question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Safari fails to load at startTime

See original GitHub issue

Hi, 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:closed
  • Created 4 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
joeyparrishcommented, Jan 15, 2020

These changes have been cherry-picked for v2.5.8.

1reaction
aveladcommented, Dec 3, 2019

I created the PR https://github.com/google/shaka-player/pull/2271 to resolve it!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Safari fails to load at startTime · Issue #2267 · shaka ... - GitHub
On Chrome it works all fine (with Dash). On Safari, it starts always at 0, even if we pass at player.load() a startTime...
Read more >
If Safari on Mac doesn't open a webpage or isn't working as ...
If Safari isn't working as you expect, one of these solutions might help. ... Open Safari again and try to load the page....
Read more >
Invalid date in safari - javascript - Stack Overflow
For me implementing a new library just because Safari cannot do it correctly is too much and a regex is overkill. Here is...
Read more >
Troubleshoot issues with Safari - Salesforce Help
To resolve, follow the steps to Clear Cache and Cookies in Safari, which can be found in the If Safari doesn't load a...
Read more >
Apple's Safari has an Outlook TokenFactoryIFrame issue (May ...
I am using outlook in a Safari browser on my Mac. ... failed to load resource: The server responded with a status of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found