9

I am trying to autoplay youtube videos on android, the same thing as in

How can I autoplay a video using the new embed code style for Youtube?

The following HTML works in google chrome browser, but not in the browser in android emulator.

<iframe title="YouTube video player" class="youtube-player" type="text/html" width="640" height="390" src="http://www.youtube.com/embed/xxxxxxxx?autoplay=1&vq=medium" frameborder="0"></iframe>

Can anyone shed light on this ?

4

2 回答 2

1

根据这个答案,禁用自动播放正在慢慢成为移动浏览器的标准。这样做是为了防止播放不需要的声音并节省电池。

您可能想试一试本文中的方法。

function callback () {
    document.querySelector('video').play();
}

window.addEventListener("load", callback, false);

<video poster preload="true">
    <source src="video.mp4"  type="video/mp4">
</video>
于 2013-07-30T14:14:36.610 回答
0

尝试这个。注意将 videoLink 替换为来自 YouTube 的嵌入 URL。

src=//videoLink?autoplay=1
于 2015-03-12T01:58:07.540 回答