Browse Source

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.
pull/80/head
David LaPalomento 12 years ago
parent
commit
83a9f86f7c
  1. 10
      src/videojs-hls.js
  2. 1
      test/videojs-hls_test.js

10
src/videojs-hls.js

@ -433,6 +433,7 @@ var
player.hls.master = {
playlists: [parser.manifest]
};
parser.manifest.uri = url;
}
// check the playlist for updates if EXT-X-ENDLIST isn't present
@ -516,8 +517,13 @@ var
return;
}
segmentUri = resolveUrl(resolveUrl(srcUrl, player.hls.media.uri || ''),
segment.uri);
// resolve the segment URL relative to the playlist
if (player.hls.media.uri === srcUrl) {
segmentUri = resolveUrl(srcUrl, segment.uri);
} else {
segmentUri = resolveUrl(resolveUrl(srcUrl, player.hls.media.uri || ''),
segment.uri);
}
// request the next segment
segmentXhr = new window.XMLHttpRequest();

1
test/videojs-hls_test.js

@ -948,7 +948,6 @@ test('merges playlist reloads', function() {
videojs.mediaSources[player.currentSrc()].trigger({
type: 'sourceopen'
});
player.hls.media.uri = 'http://example.com/manifest/missingEndlist.m3u8';
callback();
strictEqual(1, merges, 'reloaded playlist was merged');

Loading…
Cancel
Save