gpt4 book ai didi

javascript - 即使通过用户输入启动,Youtube Javascript API 也不允许在移动设备上进行播放控制

转载 作者:行者123 更新时间:2023-11-28 05:43:21 25 4
gpt4 key购买 nike

在下面的 fiddle 中,有 YouTube 播放器的外部控件。它们在桌面浏览器上运行良好,但在移动浏览器中播放按钮无法开始播放视频。

https://jsfiddle.net/wittjosiah/oLxv6ep2/

根据苹果开发者库:

In Safari on iOS (for all devices, including iPad), where the user may be on a cellular network and be charged per data unit, preload and autoplay are disabled. No data is loaded until the user initiates it. This means the JavaScript play() and load() methods are also inactive until the user initiates playback, unless the play() or load() method is triggered by user action. In other words, a user-initiated Play button works, but an onLoad="play()" event does not.

但是,在这种情况下,play() 方法是由用户触发的,但仍然无法在 iPhone 模拟器和我的 iPhone 6S 上启动播放。 p>

我错过了什么吗?这不起作用有什么原因吗? YouTube 的移动网站通过用户操作启动播放,因此它必须是可能的。如有任何帮助,我们将不胜感激。

最佳答案

YT.Player does not guarantee playVideo() 适用于所有移动环境。

关于javascript - 即使通过用户输入启动,Youtube Javascript API 也不允许在移动设备上进行播放控制,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38745562/

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