Playing a file on a NAS via JSONRPC
#1
I am playing with XBMC and sending it JSON commands using the TCP interface. Simple commands without properties (e.g JSONRPC.Version) work fine, so I believe the TCP code is correct.

What I want to do is send XBMC a path to a file on my NAS that I want it to immediately play. The NAS is named "Tower" and has a full SMB server which works fine with things like the Dune player I send it:

{"jsonrpc":"2.0","method":"Player.Open","id":1,"params":{"item":{"file":"smb://Tower/movies/skyfall/skyfall.avi"}}}

which it accepts. I then send it a play command:

{ "jsonrpc": "2.0", "method": "Player.PlayPause", "params": { "playerid": 0 }, "id": 1}

which it rejects with an error code of -32100 which is that it did not accept the method. The issue is that there are no players active as verified by a command to get the active player Player.GetActivePlayers returning an empty result.


How do what I am trying to do? How do you set the active player?
Any help appreciated.
Reply
#2
Player.Open already starts the player for the file you passed in. The problem is that this is an asynchronous operation so even though Player.Open may return "OK" that doesn't mean that playback has actually started. Please check XBMC/Kodi's log file to see whether/why it failed.

After that you don't have to send Player.PlayPause unless you want to pause playback. And in that case the playerid for videos is 1 and not 0 (which is for music) but as you figured out yourself you can determine the playerid using Player.GetActivePlayers.
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

Logout Mark Read Team Forum Stats Members Help
Playing a file on a NAS via JSONRPC0