hls.js icon indicating copy to clipboard operation
hls.js copied to clipboard

null fragment url

Open joshua-andrassy opened this issue 10 years ago • 3 comments

I do not know if this is an issue or not, or an issue with the playlists I'm working with...

The streams I am working with are AES encrypted and it appears that the first segment in each playlist is as such:

EXTINF:9.9683,

EXT-X-KEY:METHOD=AES-128,URI="http://www.some.url.com/crypt-0.key"

http://www.some.url.com/segment-file-640kbps-0.ts

EXTINF:9.9683,

http://www.some.url.com/segment-file-640kbps-1.ts .. .. ..

The end result is that the first fragment object features neither a url nor decryption data and ultimately some really bad playback and endless fragment looping errors (probably because that first segment features a key frame :)

Is the above a proper format for a playlist? If so, I wouldn't mind attempting to fix this and follow up with a pull request. If not, I'll simply maintain my current workaround since I am not in a position to change a large number of hls playlist files :)

Somewhat related, I did notice the following in "parseLevelPlaylist" at around line 6522 of dist/hls.js:

//it falls outside the while loop that does all the parsing
//in my use case above, since its outside the loop, it does not pop the fragment with null url
if (frag && !frag.url) {
        level.fragments.pop();
        totalduration -= frag.duration;
      }

joshua-andrassy avatar May 06 '16 22:05 joshua-andrassy

Hi @joshua-andrassy this syntax is valid as per HLS spec, but not handled properly yet. best would be to add a unit test to highlight the parsing issue, then fix playlist-loader and support this syntax. feel free to post a PR, we would be happy to support your case :-)

mangui avatar May 09 '16 09:05 mangui

cool deal, I'll definitely take a look at this.

joshua-andrassy avatar May 09 '16 13:05 joshua-andrassy

closing as PR merged

mangui avatar May 24 '16 12:05 mangui