#17914 closed Bugs (Fixed)

JSON video playback fails when stream URL has parameters

Reported by: DaveBlake Owned by: Montellese
Priority: 4 - Normal
Component: Web Server / Web Interface / Web API / JSON-RPC Version: 18.0 "Leia" Alpha1
Severity: Normal Keywords: JSON, video stream playback
Cc: Blocked By:
Blocking: Platform: All


A regression in v18 when using JSON Player.Open command to playback video streams from URLs that have parameters.

The first time this is done the video plays, however subsequently playback does not start if you try to do it again.

As example, using a test video located on a google drive, try posting this (sorry this has such a long option string, but it shows the issue):

{"id":0,"jsonrpc":"2.0","method":"Player.Open","params":{"item":{"file":"https://r2---sn-h5q7rn7s.c.drive.google.com/videoplayback?id=b7006e4d9e0f1f96&itag=22&source=webdrive&requiressl=yes&mm=30&mn=sn-h5q7rn7s&ms=nxu&mv=m&pl=16&sc=yes&ttl=transient&ei=d54aW8msD8mr-wXXv5zoCg&susc=dr&driveid=0BwxFVkl63-lERkJRU003ZTd2VEk&app=texmex&mime=video/mp4&lmt=1450741832071385&mt=1528471107&ip=,ipbits,expire,id,itag,source,requiressl,mm,mn,ms,mv,pl,sc,ttl,ei,susc,driveid,app,mime,lmt,cp&signature=905A4F0CD14231FEECDDD9222F9692A82D20FF6B.53E6BCE011D31ED75506EB104C603BB44FA71884&key=ck2&cpn=btIbR6hgKf7_dAlP&c=WEB_EMBEDDED_PLAYER&cver=20180607|Cookie=CONSENT=YES+PT.en+V8; SID=NQb0S2d11mp51bZaA0z42Y2DwFRpAhnLEr0_YJsZBQDiCs7oiywh09cihOrccRBmfnpT4g.; HSID=AhN6RY03UflT-VuEO; SSID=A-9jFXdwqzFJUQsqC; APISID=yTc7aZZmqmy7dX0l/A9ZjWsUXKZtXmzY1j; SAPISID=-3dOR9OK7fUomErH/AeIL3TZBXcae0vk5u; DRIVE_STREAM=sPO4JBwCW2o; 1P_JAR=2018-6-8-15; NID=131=t_GVxSbwdd7oJtSmuNFnUAUI7c3FACecweCA4kwTHUDkaHOG-6PR714RNO_CQ8uGBF7Y9Yt_SHDEb8j925tGIsnkv5_fSdtdw7btQ24Ut5TenxJdwsbnvhJJ07qKopVo4MX_g2UVy6MmFEix3YynDIQEN7weuH4j62Dpxjm6ZoLYOvydU17bRxZG5nOV-C38-NBhiowANrJcJ9mZU3DftT-ZzPgzdFrKWP2hY22ovVpadh7_kORz1aL6i-eXEaj07BHtha6I9pod6udsfX1JMgUMvwxudWKfrijwq6E5SWfg80386NXKr4LYL8dQ7mDmN3nvS-jRZ5JEh11Fx7_cAF0jkRsftW4wBdrRRLXpTf3ZVRhpyV5JzsY; SIDCC=AEfoLeYUnXnxWpLpucS9sRQpTZSeQovxUIIlOiKCWwFefi_US2tHm6QuUbEiRfuyjxjJS62C2g"}}}

Note that Player.Open commands now need to be sent using POST (not HTTP). Of course Kodi needs to be configured to accept remotre access too.

This behaviour was introduced by https://github.com/xbmc/xbmc/pull/12962. Prior to that change on playback the full URL + parameters was stored in the video database (for playback history data), but now only the URL is stored and parameters stripped.

It is the stored path that is used by the player, not the actual path passed in by the JSON call. Hence when a stream with parameters in it's URL has been played once, it can not be played again because the options have been stripped and the path invalid

How to Fix: I don't believe that the best solution is to revert to storing the URL + options in the way we did before. The parameters could vary, using previously stored values could fail. Nor would it be right to stop storing playback history for those streams.

It makes most sense to me for the player to always use the actual URL JSON passes rather than the stripped URL stored the the database. It does this on the initial playback so that value must be avaailable to the player. However I don't know how to achieve that, perhaps @FernetMenta could take a look?

Thanks @engen92 and @peak3d for helping me research this issue, which I initially thought was CURL related. CURL is fine, just the player using a stripped URL rather than the actual one

Change History (7)

comment:1 Changed at 2018-06-15T18:02:39+01:00 by peak3d

wget command (user / password / port must be corrected

wget --user ??? --password ??? http://localhost:8080/jsonrpc --header="Content-Type: application/json" --post-data='{"jsonrpc":"2.0","method":"Player.Open","params":{"item":{"file":"https://r2---sn-h5q7rn7s.c.drive.google.com/videoplayback?id=b7006e4d9e0f1f96&itag=59&source=webdrive&requiressl=yes&mm=30&mn=sn-h5q7rn7s&ms=nxu&mv=u&pl=22&sc=yes&ttl=transient&ei=8BkkW4SjCornuQXJ-7zIAQ&susc=dr&driveid=0BwxFVkl63-lERkJRU003ZTd2VEk&app=texmex&mime=video/mp4&lmt=1450741833474484&mt=1529091893&ip=,ipbits,expire,id,itag,source,requiressl,mm,mn,ms,mv,pl,sc,ttl,ei,susc,driveid,app,mime,lmt,cp&signature=9AE6FD32A23EDD5A1E505804C763E218786445D8.095567B8B35866E445BDBCD2D93BA1960C126868&key=ck2&cpn=oPyGHiJiBFbN6A8Z&c=WEB_EMBEDDED_PLAYER&cver=20180614|Cookie=CONSENT=YES+PT.en+V8; SID=PAbXc0h1sV-OTp2b7gSZG_jB6hko3sAKYXYLH4cRaf9KkxIhQbh-OnMLvoOrUOvnhUG1bg.; HSID=AXjo3BrkjCeJFyLfD; SSID=AXFv335LIqPqEeZtg; APISID=kwoWRNT-ZB8R0ygl/Aj1BUKAc5RbIi02gG; SAPISID=QYXBOtg2seQITcG_/AMyvA5bxl-fnQXK2Z; DRIVE_STREAM=kG48hVIJfkg; 1P_JAR=2018-6-15-19; NID=132=mi0g3SAmxd1p1WxL-oMe_xhwwKdA0V8FD4pXIr9AeLzCtblAL5L3UdqXmRILnvBjge6-k_2dhMtTsJMAVhQeMuTXSJgGjFGyFva6o-mGKTE1CO9E6LoSywfMzvoHQite0z8kFLyN7b_wBtQwBs7NcjBpHx0tWJ6xzJPJXPNkdr8N5VVPMszuzTeVqemxzq2Af68hOPIjSBb8p0-__Iaidj0YquXCuz5dOVXXSjDGic4J2jgjEHY; SIDCC=AEfoLeYCFNZmaOptaSvs37SWY9zooZFjMIti4pUlzq8T-kFGvAkYH5sQjYBAHceTzw2wMRCTfkk"}},"id":0}'
Last edited at 2018-06-15T21:11:53+01:00 by peak3d (previous) (diff)

comment:2 Changed at 2018-06-16T08:14:42+01:00 by DaveBlake

Unfortuneately keeping a working test URL with options is a chanllenge as validity seems to keep lapsing. Looking for a more stable example

comment:3 Changed at 2018-06-16T09:11:03+01:00 by DaveBlake

It is possible to see how the player is not always passing url parameteres to the backend by adding them to a url that does not need them and then checking the debug log. With fake parameters the stream will play every time, but obviously playback would fail when the parameters were real and necessary.

Test with curl command like this:

curl --header "Content-Type: application/json" --request POST --data 
http://user:[email protected]:8080/jsonrpc

Video will play, note "test=1" appears everywhere in the log. Now play again with a different parameter (so easy to serach for in log)

curl --header "Content-Type: application/json" --request POST --data 
http://user:[email protected]:8080/jsonrpc

This example will play as parameters are fake, however note that "test=2" does not appear in log, this time only FergusonOnKwayzarShow1Gankino.mpg is passed.

I think that the player should be using the URL passed by JSON every time, but currently ater the first playback the player uses what is stored in the video db

comment:4 Changed at 2018-06-17T07:36:44+01:00 by FernetMenta

fix: https://github.com/xbmc/xbmc/pull/14068

The issue not not at all related to player. The problem is that JSON-RPC does magic to the passed parameters. You wouln't not expect this by an interface.

comment:5 Changed at 2018-06-17T07:37:54+01:00 by FernetMenta

  • Component changed from Video playback (inc. audio in video and codecs) to Web Server / Web Interface / Web API / JSON-RPC
  • Owner changed from FernetMenta to Montellese

comment:6 Changed at 2018-08-04T11:51:20+01:00 by Rechi

  • Resolution set to Fixed
  • Status changed from new to closed

comment:7 Changed at 2018-08-08T20:32:09+01:00 by Martijn

  • Milestone changed from 18.0 "L*****" to 18.0 "Leia"

Milestone renamed

Note: See TracTickets for help on using tickets.