diff --git a/src/components/VapMp4Player.vue b/src/components/VapMp4Player.vue index 1f493c2..1bf2c1b 100644 --- a/src/components/VapMp4Player.vue +++ b/src/components/VapMp4Player.vue @@ -101,6 +101,17 @@ function enforceVideoPlaybackAttributes(video, shouldMute) { return } + // Keep the video in the DOM and renderable for iOS autoplay policy checks. + // WebKit may still require a user gesture for videos with `display:none`. + video.style.display = 'block' + video.style.position = 'fixed' + video.style.left = '-9999px' + video.style.top = '0' + video.style.width = '1px' + video.style.height = '1px' + video.style.opacity = '0' + video.style.pointerEvents = 'none' + video.playsInline = true video.setAttribute('playsinline', '') video.setAttribute('webkit-playsinline', '')