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.

Autoplay with playsinline on Safari mobile

See original GitHub issue

Hello,

We experience a problem with autoplay on safari mobile, with playsinline attribute set to true on the video element. The player stops on an AbortError, which seem to occur when the browser is blocking the autoplay due to the auto play policy, but before we receive the MEDIA_ERR_BLOCKED_AUTOPLAY.

It has worked before, but seems to have stopped to work when #650 was merged, so somehow related to that - but I haven’t been able to understand in more detail what is happening.

Any ideas?

Thanks for the good work!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
PaulRossetcommented, Mar 18, 2020

Hello Matthias,

I was able to reproduce the problem you encountered thanks to your minimal repository on Safari mobile (IOS 13.3.1).

As you mention, the problem was introduced in the 3.17.1 version.

We are currently investigating it. Thanks.

1reaction
PaulRossetcommented, Mar 24, 2020

Hello Matthias,

I just wanted to announce to you the recent news related to this issue.

The good news is that we found the original problem and we have fixed it.

The problem was coming from the logic of how we determined the LOADED event/state in directfile mode.
The logic on Safari Mobile is different depending on the playsinline attribute, but we weren’t aware of it.
So if we were on SafariMobile or in directfile mode, we weren’t waiting for the readyState to be 4 or >=3.
It is perfectly valid without playsinline but too early with the playsinline attribute.

So, we fixed it by detecting the playsinline attribute on the HTMLVideoElement to be able to react in consequence.

The fix will be available in the next release.

Thank you again for your help and your good catch!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Delivering Video Content for Safari - Apple Developer
Enable Video Autoplay. Video elements that include <video autoplay> play automatically when the video loads in Safari on macOS and iOS, only if...
Read more >
HTML5 Video autoplay on iPhone - ios - Stack Overflow
I tried all the code options "playsinline autoplay loop muted". The problem was the video I received was in the wrong mp4 codec....
Read more >
Playsinline/autoplay iOS Safari Testing - CodePen
After iOS 10. <video> elements will be allowed to autoplay without a user gesture if their source media contains no audio tracks.
Read more >
Best Practices: How to Play Content in Line in Mobile Browsers
Allowing mobile video ads to play in-line is a simple change that can help ... Playsinline can also unlock the autoplay functionality on...
Read more >
Autoplay does not work on iPhone - WordPress.org
It seems that Safari needs some extra care: “To be able to play inline, webkit requires you to pass playsinline attribute to allow...
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