I'm trying to set an HTML5 video element on iOS Safari to autoplay on page load.
I know that a video can only be triggered from a user event. Here's my scenario.
I have a list of videos on /videos.html for example. That list of videos has a play button that takes the user to /videos/my-video.html
I don't want to the user to have to click 'play' again while on this URL. In my mind, they've already triggered the user event from the previous page.
Do I have any options here?
Use "autoplay" attribute to play video on page load. Add this attribute dynamically to HTML video element on the click event of play button in /videos.html. You can also use "muted" attribute to play video on mute by default.
<video width="320" height="240" autoplay muted>
<source src="movie.mp4" type="video/mp4">
</video>