Class: Controller

Controller(ip, port)

Kodi Controller allows Playing, Pausing and more

Constructor

new Controller(ip, port)

Parameters:
Name Type Default Description
ip string localhost The IP address that Kodi is on
port number 8080 The port that Kodi is configured for (Default is 8080)
Source:

Methods

contextMenu(callback)

Brings up the context menu
Parameters:
Name Type Description
callback function The callback function called with the params (err, data)
Source:

fastForward(callback, speed)

Fast forwards
Parameters:
Name Type Default Description
callback function The callback function called with err, callback
speed number 2 The speed to fast forward with speed has to be in [2, 4, 8, 16, 32]
Source:

getActivePlayerID(callback)

Gets the ID of the active player from Kodi
Parameters:
Name Type Description
callback function The callback function called with the params (err, data) with data being the ID
Source:

getVolume(callback)

Gets the current players volume
Parameters:
Name Type Description
callback function The callback function called with the params (err, data) with data being the volume
Source:

goBack(callback)

Goes back in the menu
Parameters:
Name Type Description
callback function The callback function called with the params (err, data)
Source:

goDown(callback)

Navigates down in the menu
Parameters:
Name Type Description
callback function The callback function called with the params (err, data)
Source:

goHome(callback)

Goes to Kodi home menu
Parameters:
Name Type Description
callback function The callback function called with the params (err, data)
Source:

goLeft(callback)

Navigates left in the menu
Parameters:
Name Type Description
callback function The callback function called with the params (err, data)
Source:

goNext(callback)

Skips to next media
Parameters:
Name Type Description
callback function The callback function called with err, callback
Source:

goPrevious(callback)

Goes to start or previous media
Parameters:
Name Type Description
callback function The callback function called with err, callback
Source:

goRight(callback)

Navigates right in the menu
Parameters:
Name Type Description
callback function The callback function called with the params (err, data)
Source:

goUp(callback)

Navigates up in the menu
Parameters:
Name Type Description
callback function The callback function called with the params (err, data)
Source:

pause(callback)

Pauses Kodi
Parameters:
Name Type Description
callback function The callback function called with err, callback
Source:

pingKodi(address) → {Promise}

Pings an address to check if it is responding and running Kodi.
Parameters:
Name Type Description
address string Address to ping
Source:
Returns:
Promise which resolves with eithe true or false depending on if the ping succeeded or failed.
Type
Promise

play(callback)

Plays Kodi
Parameters:
Name Type Description
callback function The callback function called with err, callback
Source:

playPause(callback)

Plays Kodi if paused and pauses if playing
Parameters:
Name Type Description
callback function The callback function called with err, callback
Source:

quit(callback)

Quits the application
Parameters:
Name Type Description
callback function The callback function called with the params (err, data) with data being the volume
Source:

rewind(callback, speed)

Rewinds
Parameters:
Name Type Default Description
callback function The callback function called with err, callback
speed number 2 The speed to rewind by speed has to be in [2, 4, 8, 16, 32]
Source:

scanForKodis(callback, port)

Searches the network for Kodi's on the supplied port
Parameters:
Name Type Default Description
callback function The callback function called with the params (err, data) with data being a list of ip's and port
port number 8080 The port that Kodi is configured for (Default is 8080)
Source:

select(callback)

Selects the current menu item
Parameters:
Name Type Description
callback function The callback function called with the params (err, data)
Source:

sendRequest(method, params, callback?)

Sends a request to Kodi with body as the body of the request, handles errors as needed
Parameters:
Name Type Description
method string The method we are calling
params Object The parameters for the method
callback? function Function called when request is finished with arguments of string (err), string (body)
Source:

setVolume(callback, volume)

Sets the volume
Parameters:
Name Type Description
callback function The callback function called with the params (err, data) with data being the volume
volume int The volume to set the player to
Source:

showInfo(callback)

Shows info on the current video playing
Parameters:
Name Type Description
callback function The callback function called with the params (err, data) with data being the volume
Source:

stop(callback)

Stops kodi
Parameters:
Name Type Description
callback function The callback function called with err, callback
Source:

toggleFullscreen(callback)

Toggles fullscreen
Parameters:
Name Type Description
callback function The callback function called with the params (err, data) with data being the volume
Source:

toggleMute(callback)

Toggles mute
Parameters:
Name Type Description
callback function The callback function called with the params (err, data) with data being the volume
Source:

volumeDown(callback, volumeChangeBy)

Decreases the volume
Parameters:
Name Type Default Description
callback function The callback function called with err, callback
volumeChangeBy number 5 How much to decrease the volume by
Source:

volumeUp(callback, volumeChangeBy)

Increases the volume
Parameters:
Name Type Default Description
callback function The callback function called with err, callback
volumeChangeBy number 5 How much to increase the volume by
Source: