问题
On the top of this homepage, I have a video with muted, autoplay and playsinline attributes.
The video is autoplaying on desktop & mobile I've tested (Chrome, Safari, Firefox). Surprisingly, the video is not playing for lots of iPhone users, they have a PLAY button showing, requiring interaction then.
Here is my code :
<video id="vid" width="100%" height="auto" preload="auto" autoplay muted playsinline>
<source src="http://www.nevada-club.com/wp-content/uploads/2018/06/Nevada_Club.mp4" type="video/mp4" />
<source src="http://www.nevada-club.com/wp-content/uploads/2018/06/Nevada_Club.webm" type="video/webm" />
<source src="http://www.nevada-club.com/wp-content/uploads/2018/06/Nevada_Club.ogg" type="video/ogg" />
</video>
<script>
var herovide = document.getElementById('vid');
herovide.autoplay=true;
herovide.load();
</script>
Does someone knows why some people have this issue and how to fix it ? Somebody who has this issue was on iOS 11.4.
Thanks
回答1:
If iPhone is in battery save mode it will not autoplay videos. Otherwise it should play with your code.
Also i don't think you need any js to autoplay.
来源:https://stackoverflow.com/questions/51226793/video-autoplay-doesnt-work-on-all-iphone