gpt4 book ai didi

javascript - Vimeo 播放器 JS API 在 iOS 中不起作用

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:57:40 24 4
gpt4 key购买 nike

我正在尝试使用 API 播放视频,但它只有在您单击 iOS 播放器中的播放按钮后才有效。在台式机和 Chrome for Android 中,它运行良好。

http://codepen.io/bdougherty/pen/JgDfm

$(function() {
var iframe = $('#player1')[0];
var player = $f(iframe);
var status = $('.status');

// When the player is ready, add listeners for pause, finish, and playProgress
player.addEvent('ready', function() {
status.text('ready');

player.addEvent('pause', onPause);
player.addEvent('finish', onFinish);
player.addEvent('playProgress', onPlayProgress);
});

// Call the API when a button is pressed
$('button').bind('click', function() {
player.api($(this).text().toLowerCase());
});

function onPause() {
status.text('paused');
}

function onFinish() {
status.text('finished');
}

function onPlayProgress(data) {
status.text(data.seconds + 's played');
}
});
<script src="https://f.vimeocdn.com/js/froogaloop2.min.js"></script>
<iframe id="player1" src="https://player.vimeo.com/video/76979871?api=1&player_id=player1" width="630" height="354" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>

<div>
<button>Play</button>
<button>Pause</button>
<p>Status: <span class="status">&hellip;</span></p>
</div>

是否有我可以使用的解决方法?

最佳答案

我联系了 Vimeo 支持团队。他们说 Chrome Mobile (Android) 中的行为有所不同,因为他们能够在该浏览器 (Chrome Mobile) 中使用播放器。在 iOS 中,播放由 iOS 原生媒体播放器处理。

只有当用户通过点击屏幕上的播放按钮(在 iOS 中)首先启动播放时,才能调用 Play 方法。

相关问题: Can you autoplay HTML5 videos on the iPad?

关于javascript - Vimeo 播放器 JS API 在 iOS 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35967342/

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