Search code examples
htmliosvideosafari

Autoplay video HTML on Safari iOS 14.2


I have noticed that videos that I set with an autoplay mode, don't work on Iphone iOS 14.2 Before that version everything worked fine.

Does anyone know the answer and how to fix this problem? Maybe there's a way to autoplay video on Safari (iOS 14.2) again.


Solution

  • playsinline needs to be set in addition to muted and autoplay in iOS 15.

    https://css-tricks.com/what-does-playsinline-mean-in-web-video/

    From Apple's documentation:

    Video elements that include <video autoplay> play automatically when the video loads in Safari on macOS and iOS, only if those elements also include the playsinline attribute.

    By default, autoplay executes only if the video doesn’t contain an audio track, or if the video element includes the muted attribute. Video playback pauses if the element gains an audio track, becomes unmuted without user interaction, or if the video is no longer onscreen (either by CSS or due to the user scrolling the page).