gpt4 book ai didi

html - 在 android 中自动播放 youtube 视频

转载 作者:太空狗 更新时间:2023-10-29 13:32:15 27 4
gpt4 key购买 nike

我正在尝试在 android 上自动播放 youtube 视频,与在中一样

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

以下 HTML 在 google chrome 浏览器中有效,但在 android 模拟器中的浏览器中无效。

<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>

任何人都可以阐明这一点吗?

最佳答案

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

您可能想提供来自 this article 的方法一枪。

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

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

<video poster preload="true">
<source src="video.mp4" type="video/mp4">
</video>

关于html - 在 android 中自动播放 youtube 视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3896943/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com