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.

onReady not called on iOS Safari

See original GitHub issue

I am loading an .mp4 file from AWS. On OSX Safari it is working fine, no problems, but on iOS the onReady function is never called. This happens both on v0.25.3, and the latest (v1.2.1) so it’s not a recent bug. I did not find any info about this in the “Mobile considerations” section, however.

Is this a known issue? Are there any workarounds?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:15 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
GianlucaGuarinicommented, Mar 20, 2018

I hope my patch could help anyone landing here:

componentDidMount() {
   // on iOS we need to force the load event
   // to get the onReady event firing properly
   // where of course this.refs.video is so rendered: <ReactPlayer ref='video'>
   const videoElement = this.refs.video.getInternalPlayer()
   videoElement.load()
}
1reaction
rijkcommented, Feb 28, 2018

Yup, this seems to be the problem. In my case, this created a serious usability issue, as I display a loading spinner overlay until I get the onReady. So when I never get this, the user can never interact with the video 😃

I worked around it now by checking the user agent for iOS, and disabling the page’s loading state manually in that case.

If we can’t do anything to fix this, I do think it would be a good idea to add this to the documentation, under onReady or at least the mobile considerations.

PS: The problem was not related to the order of the calls — at least not for me. So, personally, I see no need to apply a fix there.

Read more comments on GitHub >

github_iconTop Results From Across the Web

onReady not called on iOS Safari · Issue #340 - GitHub
I am loading an .mp4 file from AWS. On OSX Safari it is working fine, no problems, but on iOS the onReady function...
Read more >
$(document).ready not firing on iOS - Stack Overflow
I've found the problem: Somewhere in my code, i had a function with a predetermined value, and only Safari thrown an error.
Read more >
jquery not working on iphone - Qualtrics Community
Hello, I am adding this code to remove the blank option for the drop down list.
Read more >
Document: DOMContentLoaded event - Web APIs | MDN
The DOMContentLoaded event fires when the initial HTML document has been completely loaded and parsed, without waiting for stylesheets, images, ...
Read more >
Fixing Safari's back button browser cache issue with vanilla JS
Fixing Safari's back button browser cache issue with vanilla JS. Safari has a weird “quirk.” If you navigate from one page to another...
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