2

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

viande
  • 77
  • 2
  • 10

1 Answers1

14

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.

Piotr
  • 143
  • 1
  • 8
  • Thanks Piotr, the only screenshot I got from somebody, shows that he was on Battery Save Mode (yellow battery icon). That might be the thing, thanks a lot ! – viande Jul 10 '18 at 14:34
  • Thank you so much for this. You have no idea how much time and pain you have saved me. – tensai Aug 22 '22 at 23:03