Autoplay with playsinline on Safari mobile
See original GitHub issueHello,
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:
- Created 4 years ago
- Comments:7 (2 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
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 indirectfile
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 thereadyState
to be 4 or >=3.It is perfectly valid without
playsinline
but too early with theplaysinline
attribute.So, we fixed it by detecting the
playsinline
attribute on theHTMLVideoElement
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!