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:

getCurrentWindow(callback)

Gets the active window the user is using
Parameters:
Name Type Description
callback function The callback function called with the params (err, data) (see https://kodi.wiki/view/JSON-RPC_API/v8#GUI.Property.Value)
Source:

getProperties(properties, callback)

Retrieves the values of the given properites
Parameters:
Name Type Description
properties Array Array of properies to retrieve (see https://kodi.wiki/view/JSON-RPC_API/v8#GUI.Property.Name)
callback function The callback function called with the params (err, data)
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:

inputAction(action, callback)

Execute a specific action
Parameters:
Name Type Description
action string Action to be executed (see https://kodi.wiki/view/JSON-RPC_API/v8#Input.Action)
callback function The callback function called with the params (err, data)
Source:

inputContextMenu(callback)

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

inputHome(callback)

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

inputInfo(callback)

Shows the information dialog
Parameters:
Name Type Description
callback function The callback function called with the params (err, data)
Source:

inputSelect(callback)

Select an item in GUI
Parameters:
Name Type Description
callback function The callback function called with the params (err, data)
Source:

inputSendText(text, callback)

Sends generic (unicode) text to be inserted into a text box in the GUI
Parameters:
Name Type Description
text string Text to be sent
callback function The callback function called with the params (err, data)
Source:

inputShowCodec(callback)

Show codec information of the playing item
Parameters:
Name Type Description
callback function The callback function called with the params (err, data)
Source:

inputShowOSD(callback)

Shows the on-screen display for the current player
Parameters:
Name Type Description
callback function The callback function called with the params (err, data)
Source:

inputShowPlayerProcessInfo(callback)

Show player process information of the playing item, like video decoder, pixel format, pvr signal strength, ...
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:

repeatAll(callback)

Repeat All
Parameters:
Name Type Description
callback function The callback function called with the params (err, data)
Source:

repeatOff(callback)

Repeat Off
Parameters:
Name Type Description
callback function The callback function called with the params (err, data)
Source:

repeatOne(callback)

Repeat One
Parameters:
Name Type Description
callback function The callback function called with the params (err, data)
Source:

restart(callback)

Restart
Parameters:
Name Type Description
callback function The callback function called with the params (err, data)
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:

shutdown(callback)

Shutdown
Parameters:
Name Type Description
callback function The callback function called with the params (err, data)
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: