Safari fails to load at startTime
See original GitHub issueHi, before labeling this as a bug, I preferred to open a question issue to discuss this (maybe I’m doing something wrong?).
We are moving to using Shaka also on Safari. My situation is as follows: our player can have some cases:
- Starts at 0;
- Starts at N;
- Content ends and, on seeking back, we reload the content (due to Ads Engine, we have to detach Shaka).
- Contents stops (due to midroll) and on resume, we have to reload the content at specific position.
On Chrome it works all fine (with Dash).
On Safari, it starts always at 0, even if we pass at player.load()
a startTime
value N (any number).
To “fix” this, we had to use a “trick”, that we were using also without Shaka: MediaFragments.
I attach you what I had to do:
let streamUrlWithTime = streamSourceURL;
if (this.startTime && playbackInfo.mimeType !== "application/dash+xml") {
/**
* There was once upon a time, a duration parameter
* applied to #t=<startTime>,<duration>
* But then it has been discovered its incompatibility
* with Chrome on iOS. Therefore it was removed
* for the sake of mental sanity.
*/
streamUrlWithTime += `#t=${this.startTime}`;
}
return this.player.load(streamUrlWithTime, this.startTime, playbackInfo.mimeType).then(() => {
// after load...
});
Where streamSourceURL is just an M3U8 / HLS Url of a non-live content, and playbackInfo
is just some metadata we obtained from our content server. MimeType is application/x-mpegUrl
. We are sure that this.startTime
has a value.
I’d like to understand if this is a known problem in Safari (for Shaka), or if I’m doing something wrong.
What I saw is that, on Safari, an HLS content starts at 0 because the duration is not available yet.
If I breakpoint “slowly” after .load
, it works fine, probably because Safari is able to get the duration and then we “unlock the breakpoint”.
I’m using Shaka 2.5.6
Let me know. Thank you!
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (4 by maintainers)
Top GitHub Comments
These changes have been cherry-picked for v2.5.8.
I created the PR https://github.com/google/shaka-player/pull/2271 to resolve it!