jab778
jab778

Reputation: 709

HTML5 videos do not play when embedded inside of a scrollable iFrame with Safari on iOS

With Safari on iOS, videos that are embedded below the fold inside of a scrollable iFrame will not begin playing when tapped. If you tap on the video multiple times, or do a long tap, the video may or may not begin playing. On the contrary, the video will play without issue as long as the video is embedded above the fold.

Until the bug is resolved, one possible work-around may be to extend the height of the iFrame and make its container scrollable. However, this is less than ideal when the content is variably sized and/or contains links to other similarly hosted pages. Can anyone recommend a better solution?

This was tested on iOS 15.4 with an iPhone 12 and iPad Pro (9.7-inch).

Upvotes: 1

Views: 878

Answers (1)

jab778
jab778

Reputation: 709

Here is a reasonable work-around for the time being:

window.addEventListener('touchstart', function(e) {
  e.preventDefault();
});

Upvotes: 1

Related Questions