JSON RPC Player State?

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
UndisclosedP Offline
Junior Member
Posts: 26
Joined: Dec 2006
Reputation: 0
Post: #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
(This post was last modified: 2012-03-29 14:45 by UndisclosedP.)
find quote
Montellese Offline
Team Kodi Developer
Posts: 3,921
Joined: Jan 2009
Reputation: 36
Location: Switzerland
Post: #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 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 XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

[Image: badge.gif]
find quote
UndisclosedP Offline
Junior Member
Posts: 26
Joined: Dec 2006
Reputation: 0
Post: #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!
find quote