JSON RPC Player State?
#1
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.

Request:
Code:
"{\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}"

Response
Code:
{
  "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)

Thanks
Reply
#2
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).
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#3
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!
Reply

Logout Mark Read Team Forum Stats Members Help
JSON RPC Player State?0
This forum uses Lukasz Tkacz MyBB addons.