1
<video autobuffer controls autoplay>
  <source id="mp4" src="../vid/coolvideo.mp4" type="video/mp4">
</video>

Is there anyway to autoplay a .mp4 video file on page load for iPhone and Android Smart Mobile Devices. The above works great in the browser, but struggles hard on smart mobile. Is there any other HTML5 or even If I must JS solutions for iPhone (without loading a bloated third-party resource, ideally). Plain javaScript or plain jQuery, HTML5 solutions ideal.

Dr Upvote
  • 8,023
  • 24
  • 91
  • 204
  • what do you mean, "struggles hard"? The video's "big" and mobile devices can't handle it? – Marc B Aug 31 '16 at 21:40
  • 1
    Possible duplicate of [Can you autoplay HTML5 videos on the iPad?](http://stackoverflow.com/questions/12496144/can-you-autoplay-html5-videos-on-the-ipad) – zero298 Aug 31 '16 at 21:41
  • I seriously hope not. Any site that automatically plays video on my mobile device will be immediately black-listed. – Reinstate Monica Cellio Aug 31 '16 at 21:50

2 Answers2

3

It works only if you add muted and playsinline attributes

<video autoplay playsinline muted loop>
    <source src="cover.mp4" type="video/mp4">
    Your browser does not support HTML5 video.
</video>
chickens
  • 19,976
  • 6
  • 58
  • 55
  • I added "playsinline" and works perfectly well for me on Chrome on iphone. without "playsinline" Chrome on iphone didn't play the video automatically, and forced full-screen when clicking the play button. – minjunkim7767 Feb 03 '22 at 21:35
1

Check this link

which says:"autoplay is disabled to prevent unsolicited cellular download"

Pranjal
  • 1,088
  • 1
  • 7
  • 18