As of Chrome for Android 53, video autoplay is now allowed as long as the video is muted. I have found a scenario where autoplay will not work with video.js even if the video is muted.
Example:
https://jsfiddle.net/0u0x42ed/2/
Explain in detail the exact steps necessary to reproduce the issue.
The expected result is that the video plays.
The video does not play
Failed to execute 'play' on 'HTMLMediaElement': API can only be initiated by a user gesture.
This is not a problem on iOS and it is also not a problem when setting the source through HTML, see:
https://jsfiddle.net/0u0x42ed/6/
Even though there is an alternative way to achieve autoplay without the error, this is not an approach that works when you are serving a DASH video, given that programmatically setting the src is the only way that currently works with DASH as of videojs 5.10+, see:
https://github.com/videojs/video.js/issues/3428
5.19.1
Chrome for Android 56
Android
This might be related to #3131
Yeah, it is definitely related to that issue.
Calling play() is not the same thing as autoplay. You will want to set the autoplay attribute on your <video> element or pass autoplay: true in Video.js options. The video will play in either case, as you can see in these JSBins:
autoplay attribute: https://jsbin.com/zezupi/edit?html,js,outputautoplay: true option: https://jsbin.com/nobapo/edit?html,js,outputEDIT: You will still see a console message because, at multiple points with autoplay on, Video.js will call play() internally. However, it shouldn't break anything.
@coryc5 I am not sure if this helps, but by calling the src before the ready it seems to do the trick.
https://jsfiddle.net/fyde0fp8/
You need to set 2 attributes for the video tag.
autoplay and muted
This made it work for me.
We have improved autoplay/muted support in the player greatly in the latest versions of v5 and v6. Though, v6 has some other extra fixes.
Most helpful comment
You need to set 2 attributes for the video tag.
autoplay and muted
This made it work for me.