B4J Library wmKODI - control KODI (formerly XBMC) from B4X [B4X][Class]

The title says it all. The API v10 info on which this class is based can be found at https://kodi.wiki/view/JSON-RPC_API/v10. Public methods:
- Initialize: Initializes the object
- Favourites_GetFavourites: Retrieve all favourites
- Favourites_PlayFavourite: Plays a favourite of type 'media' or 'window'. Does nothing for other favourite types.
- GUI_ActivateWindow: Activates the given window
- Input_Back: Goes back in GUI
- Input_ContextMenu: Shows the context menu
- Input_Down: Navigate down in GUI
- Input_Home: Goes to home window in GUI
- Input_Info: Shows the information dialog (if it is available at that time)
- Input_Left: Navigate left in GUI
- Input_Right: Navigate right in GUI
- Input_Select: Select current item in GUI
- Input_ShowOSD: Show the on-screen display for the current player (if an OSD is available for it)
- Input_ShowPlayerProcessInfo: Show player process information (if it is available) of the playing item, like video decoder, pixel format, pvr signal strength, ...
- Input_Up: Navigate up in GUI
- Arbitrary_KODI_call: Call an arbitrary KODI JSON RPC API method
- JSONRPC_Version: Retrieve the JSON-RPC protocol version. Can also be used to test the connection.
- Player_GetActivePlayers: Returns all active players
- Player_GetItem: Retrieves one or more properties of the currently played item
- Player_GetItemOneProperty: Retrieves one property of the currently played item
- Player_GetOneProperty: Retrieves the value of the given property
- Player_GetPlayers: Get a list of available players
- Player_GetProperties: Retrieves the values of the given properties
- Player_Open_File: Start playback of a single file
- Player_PlayPause: Pauses or unpauses playback
- Player_SeekPercentage: Seek through the playing item by specifying a percentage of the item's duration
- Player_SetSpeed: Set the speed of the current playback
- Player_SetSpeedBackward: Steps through the 'backward' (reverse) speed of the current playback
- Player_SetSpeedForward: Steps through the 'forward' speed of the current playback
- Player_Stop: Stops playback

B4A-specific notes:
- You may need to edit the Manifest (see example project)
- Long-clicking the buttons will show a toast message with a (very) brief description

Non-core library dependencies:
- B4J: jOkHttpUtils2, Json
- B4A: OkHttpUtils2, Json

B4A and B4J demo projects attached. I know especially for the B4A app I won't win any UI design awards but that wasn't my objective anyway :)

CHANGES:
- 2021-11-10: added public method 'Favourites_PlayFavourite'; the attachments to this here post were updated

Enjoy!

wmKODIdemo.PNG
 

Attachments

  • wmKODI.bas
    19.1 KB · Views: 111
  • wmKODIdemo_B4A.zip
    18.3 KB · Views: 110
  • wmKODIdemo_B4J.zip
    10.8 KB · Views: 101
Last edited:
Top