Track the media playlist URI when inferring a master playlist
When a media playlist was loaded directly, the URI wasn't being set on the implicit master playlist created by the plugin. That meant that playlist reloads weren't being correctly associated with the old playlist version and merges weren't happening. Now, live media playlists loaded directly should be updated properly after being refreshed and segment URLs are resolved directly against the media playlists when the master playlist is only inferred.
Showing
2 changed files
with
6 additions
and
1 deletions
... | @@ -433,6 +433,7 @@ var | ... | @@ -433,6 +433,7 @@ var |
433 | player.hls.master = { | 433 | player.hls.master = { |
434 | playlists: [parser.manifest] | 434 | playlists: [parser.manifest] |
435 | }; | 435 | }; |
436 | parser.manifest.uri = url; | ||
436 | } | 437 | } |
437 | 438 | ||
438 | // check the playlist for updates if EXT-X-ENDLIST isn't present | 439 | // check the playlist for updates if EXT-X-ENDLIST isn't present |
... | @@ -516,8 +517,13 @@ var | ... | @@ -516,8 +517,13 @@ var |
516 | return; | 517 | return; |
517 | } | 518 | } |
518 | 519 | ||
520 | // resolve the segment URL relative to the playlist | ||
521 | if (player.hls.media.uri === srcUrl) { | ||
522 | segmentUri = resolveUrl(srcUrl, segment.uri); | ||
523 | } else { | ||
519 | segmentUri = resolveUrl(resolveUrl(srcUrl, player.hls.media.uri || ''), | 524 | segmentUri = resolveUrl(resolveUrl(srcUrl, player.hls.media.uri || ''), |
520 | segment.uri); | 525 | segment.uri); |
526 | } | ||
521 | 527 | ||
522 | // request the next segment | 528 | // request the next segment |
523 | segmentXhr = new window.XMLHttpRequest(); | 529 | segmentXhr = new window.XMLHttpRequest(); | ... | ... |
... | @@ -948,7 +948,6 @@ test('merges playlist reloads', function() { | ... | @@ -948,7 +948,6 @@ test('merges playlist reloads', function() { |
948 | videojs.mediaSources[player.currentSrc()].trigger({ | 948 | videojs.mediaSources[player.currentSrc()].trigger({ |
949 | type: 'sourceopen' | 949 | type: 'sourceopen' |
950 | }); | 950 | }); |
951 | player.hls.media.uri = 'http://example.com/manifest/missingEndlist.m3u8'; | ||
952 | 951 | ||
953 | callback(); | 952 | callback(); |
954 | strictEqual(1, merges, 'reloaded playlist was merged'); | 953 | strictEqual(1, merges, 'reloaded playlist was merged'); | ... | ... |
-
Please register or sign in to post a comment