Autoplay playsinline without muted does not work correctly on iOS 10+
Description
When loading a videojs player on iPhones with iOS 10 and up and using the autoplay and playsinline attributes, the video incorrectly attempts to begin playback. The player adds the vjs-has-started class, hides the poster and big play button and shows the loading spinner before revealing the first frame of content.
Video.js example: http://solutions.brightcove.com/marguin/autoplay-playsinline-ios10.html
HTML5 Video Element: http://solutions.brightcove.com/marguin/ima3-sdk-ios10/html5/html5-index-autoplay-playsinline.html
Ideally, the behavior should be the same as that of the HTML5 video element on iOS and not start UNLESS the muted attribute is present OR the video has no audio track.
Steps to reproduce
Explain in detail the exact steps necessary to reproduce the issue.
- Open the test page above. 2.Note that the top player with autoplay and playsinline attempts to play and stops after hiding the big play button and poster but then stops playing. 3.Note that the second player, without autoplay and playsinline behaves as expected.
Results
Expected
The player does not attempt to begin playback and the big play button and poster remain visible until the user taps the play button.
Actual
The player attempts to start playing, hides the poster, big play button, and shows the loading spinner.
Error output
No errors.
Additional Information
Please include any additional information necessary here. Including the following:
versions
videojs
5.19.2
browsers
Safari on iOS on iPhones
OSes
iOS 10 and up
plugins
are any videojs plugins being used on the page? If so, please list them below. N/A
@marguinbc iOS does have a limitation of autoplaying the video if there is volume, without user interaction. You can read more about on the following link https://webkit.org/blog/6784/new-video-policies-for-ios/
@leoafarias thank you for reply, but author is saying about another issue and it's not about limitation. I may confirm described behaviour.
I too experience this issue on iOS 10.3.1
When using autoplay and playsinline attribute, on iOS 10.3.1 it attempts to play the video but stops on the first frame on page load (hides big play button and poster)
Since iOS suggests it does not autoplay I was expecting the poster and big play button to remain until the user presses play.
So how solve these problems?
I also experienced this issue when testing the autoplay/inline capability inside the Captive Network Assistant and can confirm, that autoplay/playsinline/muted works in iOS 10.1 but fails in iOS 10.3
It is not video.js related though.
There is no way to solve the autoplay problem. However, video.js should try and know that autoplay has failed and not change its has-started state. We're going to be looking at this in the coming weeks. Hopefully, we'll have a solution before Safari 11 ships the same.
Our first PR for improving autoplay behavior is https://github.com/videojs/video.js/pull/4562
this is fixed.