Kodi Community Forum

Full Version: JSON RPC Player State?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi All,

Finally got around to updating to Eden and have a play with the new JSON RPC stuff. I've had a read through Montellese's very useful thread on the changes made and note the following.

Quote:Replaced Player.State, Player.GetTime and Player.GetPercentage with Player.GetProperties

But making a JSON RPC request to Player.GetProperties with State properties returns an error message.

"{\r\n  \"jsonrpc\": \"2.0\",\r\n  \"method\": \"Player.GetProperties\",\r\n  \"params\": {\r\n    \"properties\": [\r\n      \"state\"\r\n    ],\r\n    \"playerid\": 1\r\n  },\r\n  \"id\": 1\r\n}"

  "error": {
    "code": -32602,
    "data": {
      "method": "Player.GetProperties",
      "stack": {
        "message": "array element at index 0 does not match",
        "name": "properties",
        "property": {
          "message": "Received value does not match any of the defined enum values",
          "name": "Player.Property.Name",
          "type": "string"
        "type": "array"
    "message": "Invalid params."
  "id": 1,
  "jsonrpc": "2.0"

So, is there anywhere now I can find out the state of the player (Paused/Playing)

What makes you think that there is a "state" property? Before that change Player.State returned things like playing, paused etc so these had to be integrated into Player.GetProperty. The wiki page on the JSON-RPC API is pretty complete so looking at JSON-RPC_API/v4#Player.Property.Name (wiki) shows you a list of available properties and "state" is not among them. To determine whether a player is playing or paused you can use the "speed" property. If it equals 0 the player is paused otherwise it's playing (maybe rewinding or fast-forwarding depending on the value).
Ahah, thank you Montellese. I just assumed that since GetProperties took percentage and time as properties it might also take state based on your other comments in that thread Smile I did wonder if state was missed out of the API docs, and I couldn't see an obvious other place to get player paused/playing so thank you again for pointing me in the right direction. Much Appreciated!