HTTP Live Streaming (HLS) / Reloading Media Playlist Files
#1
Question 
Hi there!

I'm the developer of the SoundCloud plugin and encountered an issue regarding HLS playlists.

The SoundCloud plugin simply passes a m3u8 playlist to Kodi, which correctly plays it. But SoundCloud includes session tokens in the HLS playlist segments. These session tokens expire after 30 minutes.
Since Kodi doesn't periodically reload the m3u8 playlist, after 30 minutes the playlist segments can't be loaded anymore and the playback stops. Here is a shortened example of such a playlist:

Code:

#EXTM3U
#EXT-X-VERSION:6
#EXT-X-PLAYLIST-TYPE:VOD
#EXT-X-TARGETDURATION:10
#EXT-X-MEDIA-SEQUENCE:0
#EXTINF:1.985272,
https://cf-hls-media.sndcdn.com/media/0/...MXM5DG6EPQ
#EXTINF:2.977908,
https://cf-hls-media.sndcdn.com/media/31...MXM5DG6EPQ
#EXTINF:4.989302,
https://cf-hls-media.sndcdn.com/media/79...MXM5DG6EPQ
#EXTINF:9.978604,
https://cf-hls-media.sndcdn.com/media/15...MXM5DG6EPQ
#EXTINF:9.978604,
https://cf-hls-media.sndcdn.com/media/31...MXM5DG6EPQ
#EXTINF:7.052940,
https://cf-hls-media.sndcdn.com/media/25...MXM5DG6EPQ
#EXT-X-ENDLIST

So I took a closer look at the IETF HLS specification, which has its own section on reloading playlist files: https://tools.ietf.org/html/rfc8216#section-6.3.4
It states that

Code:

The client MUST periodically reload a Media Playlist file to learn what media is currently available,
unless it contains an EXT-X- PLAYLIST-TYPE tag with a value of VOD, or a value of EVENT and the EXT-X-ENDLIST tag is also present.

So Kodi does the right thing, since it doesn't have to reload the playlist according to the specification. The expiring SoundCloud session tokens are probably a spec violation, but I can't change that...
SoundCloud solves this issue by reloading the m3u8 playlist as soon as it encounters the first non 200 OK HTTP responses (which indicate expired session tokens).

I thought about implementing a fix in the SoundCloud plugin itself, but it feels cumbersome to track the time and trigger a replay (with an audible pause).

What do you think about this issue?
Is it worth to implement a m3u playlist reload feature? Or is there a simple way to solve this inside the plugin?
Reply
#2
Maybe this should be handled by FFmpeg itself. I think I'll open an issue there.
Reply
 
Thread Rating:
  • 0 Vote(s) - 0 Average



Logout Mark Read Team Forum Stats Members Help
HTTP Live Streaming (HLS) / Reloading Media Playlist Files00