How to play video file
#1
I am simply trying to play a video file using:

Code:
{"jsonrpc":"2.0", "method":"Player.Open","params":{ "playerid": 1, "item":{"file":"C:\video\1.avi"}}}

I get a response:

Code:
{"error":{"code":-32700,"message":"Parse error."},"id":null,"jsonrpc":"2.0"}

I cant figure out what I am doing wrong. The path for the file is correct.
Reply
#2
Try double slashes in the path:
Code:
"C:\\video\\1.avi"

jonib
XBMC2, EventGhost plugin. Image
Reply
#3
(2014-01-07, 18:20)jonib Wrote: Try double slashes in the path:
Code:
"C:\\video\\1.avi"

jonib

still getting the same error response
Reply
#4
You are missing the "id" of the API transaction.

For example:
Code:
{"jsonrpc":"2.0","method":"Player.Open","params":{"item":{"playlistid":1,"position":0}},"id":1}
I am an expert at acting like an expert ---- WC Fields.

XBMC Web Control Interface - https://github.com/mthiels/webinterface.xrc
Reply
#5
(2014-01-07, 20:26)Kabooga Wrote: You are missing the "id" of the API transaction.

For example:
Code:
{"jsonrpc":"2.0","method":"Player.Open","params":{"item":{"playlistid":1,"position":0}},"id":1}

This is what I have now and its still getting the same error:

Code:
{"jsonrpc":"2.0","method":"Player.Open","params":{"item":{"file": "C:\\video\\1.avi"}},"id":1}

I dont have a playlist and not sure what would happen but I tried your json:

Code:
{"jsonrpc":"2.0","method":"Player.Open","params":{"item":{"playlistid":1,"position":0}},"id":1}

and I got a response

Code:
{"id":1,"jsonrpc":"2.0","result":"OK"}

But I cant seem to get it working with a path that I specify for whatever video I want to play...
Reply
#6
I tried this API command and it did start a video (note: This was on a Windows machine).

Code:
"{\"jsonrpc\":\"2.0\",\"method\":\"Player.Open\",\"params\":{\"item\":{\"file\": \"C:/Users/XXXXX/Videos/Movies/Up.m4v\"}},\"id\":1}"

You may want to search through the JSON-RPC forum to see the proper way to encode the file path. I did see one or two mentions of it by doing a quick search for "Player.Open"
I am an expert at acting like an expert ---- WC Fields.

XBMC Web Control Interface - https://github.com/mthiels/webinterface.xrc
Reply
#7
(2014-01-07, 21:26)Kabooga Wrote: I tried this API command and it did start a video (note: This was on a Windows machine).

Code:
"{\"jsonrpc\":\"2.0\",\"method\":\"Player.Open\",\"params\":{\"item\":{\"file\": \"C:/Users/XXXXX/Videos/Movies/Up.m4v\"}},\"id\":1}"

You may want to search through the JSON-RPC forum to see the proper way to encode the file path. I did see one or two mentions of it by doing a quick search for "Player.Open"

I just used this and it worked! Thanks so much! I had to use forward slashes instead for the file path.
Reply
#8
Escaped backward slashes also work but depending on the programming language you use you need to escape the escaped backward slashes. In C it would be
Code:
C:\\\\foo\\\\bar
because C interprets a backslash as an escape character so it needs to be escaped with another one and as JSON-RPC also interprets a backslash as an escape character, it needs to be escaped again.
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
How to play video file1