0

I have a video tag like so:

<video autoplay loop muted playsinline poster="/assets/images/video_poster_2.webp">
    <source src="/assets/videos/test-vid.mp4">
    <source src="/assets/videos/test-vid.webm">
</video>

The goal if for it to play automatically when the user enters the page. It works everywhere, but it doesn't autoplay on iPhones specifically.

I added the autoplay, muted and playsinline attributes, but still. Am I missing something?

Thanks in advance.

hardow2011
  • 39
  • 5
  • Does this answer your question? [HTML5 Video autoplay on iPhone](https://stackoverflow.com/questions/43570460/html5-video-autoplay-on-iphone) – SnoopFrog Jan 13 '23 at 01:50

1 Answers1

0

Here is a simple solution to auto-play the video in IOS, I've already tried and it is perfectly working on IOS, Android, also on all browsers on various platforms.

You can see the working example with code here in this Snippet:

  <video class="m-video__video js-video-video" poster="/img/showreel.jpg" autoplay loop muted playsinline>
<source src="video.mp4" type="video/mp4">
poster - an image that will be shown whilst the video is loading
autoplay - this will cause the video to autoplay as soon as it’s loaded
loop - makes the video start again when it’s finished
muted - prevents any audio from playing (a video must be muted or have no audio for it to autoplay on iOS)
playsinline - this tells iOS devices to play videos inline (so the user doesn’t have to interact with it to make it play)