Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
781 views
in Technique[技术] by (71.8m points)

youtube api - no autoplay in iframe HTML5 player on mobile (Android Chrome and Firefox)?

I've recently run into an issue when embedding a video with standard iframe embed code and adding autoplay=1 like this:

<iframe width="420" height="315" src="http://www.youtube.com/embed/Le4kjAIcj4k?rel=0&amp;autoplay=1" frameborder="0" allowfullscreen></iframe>

The results when testing:

  • autoplay works both on desktop and mobile if the Flash-version of the player is loaded (if Flash is present & no HTML5-beta participation cookie is present)
  • it works in the HTML5-version on the Desktop as well
  • but does not autoplay in the HTML5 mobile version (tested on Android 4.1.2 with both Firefox Mobile and Chrome on this page, on Android you need to make sure you don't have flash).

Is this a known issue? Any workaround?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

When you use the <iframe> Player in a browser that has Flash disabled, playback is handled via HTML5 <video> tags.

Apple explicitly prohibits autoplaying media in <video> tags in iOS Safari.

This is also the case for at least recent versions the default Android Browser or in Chrome. I'd strongly suspect that Android Firefox has the same restriction.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...