-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HLS: Incorrect composition of full URLs to media_N.m3u8 #1664
Comments
Confirmed. Thanks for the report! We're working on it. |
I have a working fix locally, but I still need to clean things up, update the tests, and write new tests. |
After a great deal of refactor and clean up (which I think we should keep), I have discovered that this bug can only be triggered if the URI loaded for the master playlist is a relative path: player.load('media/master.m3u8'); The fix for that could be a single line in the HLS parser: shaka.hls.HlsParser.prototype.start = function(uri, playerInterface) {
goog.asserts.assert(this.config_, 'Must call configure() before start()!');
this.playerInterface_ = playerInterface;
this.manifestUri_ = uri;
return this.requestManifest_(uri).then(function(response) {
// vvvvv
this.manifestUri_ = response.uri; // ADD THIS LINE
// ^^^^^
return this.parseManifest_(response.data, uri).then(function() {
this.setUpdateTimer_(this.updatePeriod_);
return this.manifest_;
}.bind(this));
}.bind(this));
}; In your case, Even though I now know that we could "fix" it with that one line, there are many unclear assumptions about relative vs absolute URIs in the HLS parser, and some TODOs about how we handle redirects (poorly). So I think the larger cleanup is worthwhile. |
Also document the usage of each Set/Map to make changes easier to understand. Issue #1664 Change-Id: I4e951c642bca13b7b3ead9b478bf530cfadbabf3
Thanks for the fix! |
Happy to help! |
Also document the usage of each Set/Map to make changes easier to understand. Issue #1664 Backported to v2.4.x Change-Id: I4e951c642bca13b7b3ead9b478bf530cfadbabf3
This fixes issues with the interpretation of URIs in HLS and makes their usage and meaning consistent and clear. - Name URI variables as either absolute, final (post-redirect), or verbatim (exactly as they appear in the playlist) - Identify media playlists by their verbatim URI when testing for equality or duplication - When a master playlist is redirected, interpret media playlists as relative to the redirected location - When a media playlist is redirected, request updates from the redirected location - When updating a media playlist, resolve media segment URIs as relative to the latest redirected media playlist URI - Resolve absolute segment URIs when parsing the playlist text, rather than waiting until we intepret and build the manifest - Remove some incidental bind() calls, which exposed compiler errors - Avoid refactoring long parameter lists - Avoid refactoring for async/await - Clean up redirection tests, which were brittle and did not verify what they seemed to - Use relative segment URIs for all segments in tests - Use media playlist URIs within master playlists in tests - Add a regression test specifically for #1664 Closes #1664 Backported to v2.4.x Change-Id: I45f946790c7d669637c231ae93920a09c18c4222
Fix cherry-picked for v2.4.6. |
Have you read the FAQ and checked for duplicate open issues?:
Yes.
What version of Shaka Player are you using?:
Reproduces on 2.5.0-beta2 and 2.4.5.
Can you reproduce the issue with our latest release version?:
Yes.
Can you reproduce the issue with the latest code from
master
?:I didn't try.
Are you using the demo app or your own custom app?:
Custom app.
If custom app, can you reproduce the issue using our demo app?:
I can't try as the stream is not accessible publicly.
What browser and OS are you using?:
Kubuntu 18.10, Chrome 70.0.3538.102, Firefox 63.0.
What are the manifest and license server URIs?:
No license server. The manifest and the test page are attached.
What did you do?
Suppose, the test page is located at https://my.server.com/dash/index-shaka.html. The page contains a relative path to the manifest "media/master.m3u8". The media manifests are also located in the "media" subdirectory, i.e. "media/media_0.m3u8", "media/media_1.m3u8", etc. master.m3u8 contains only media manifest file names with no path, i.e. media_0.m3u8, media_1.m3u8, etc.
What actually happened?
When I open the test page, Shaka-Player attempts to load media manifests at https://my.server.com/dash/media/media/media_0.m3u8. Notice the duplicate "media" in the URL. As a result, media manifests are not found, the server returns 404.
What did you expect to happen?
The player should correctly compose the absolute URLs to the media manifests. Given that the page is located at https://my.server.com/dash/index-shaka.html, the absolute URL to the master manifest would be https://my.server.com/dash/media/master.m3u8. Since media manifests are referenced relative to the master manifest, the correct absolute URLs should be https://my.server.com/dash/media/media_0.m3u8, etc.
I've attached the test page and manifests in the directory layout described above.
dash.tar.gz
The text was updated successfully, but these errors were encountered: