html5 autoplay video in Mobile device

You wont be able to achieve this in iOS without hacks. From the official Apple WebKit documentation:

Starting in iOS 10, WebKit relaxes its inline and autoplay policies to
make these presentations possible, but still keeps in mind sites’
bandwidth and users’ batteries.

By default, WebKit will have the following policies:

  • video elements will be allowed to autoplay without a user gesture if their source media contains no audio tracks.
  • video muted elements will also be allowed to autoplay without a user gesture. If a element gains an audio track or becomes un-muted without a user gesture, playback will pause.

https://webkit.org/blog/6784/new-video-policies-for-ios/

As for Mobile Chrome (Android):

Muted autoplay for video is supported by Chrome for Android as of
version 53. Playback will start automatically for a video element once
it comes into view if both autoplay and muted are set, and playback of
muted videos can be initiated progamatically with play(). Previously,
playback on mobile had to be initiated by a user gesture, regardless
of the muted state.

https://developers.google.com/web/updates/2016/07/autoplay

Leave a Comment