Vimeo 播放器 JS API 在 iOS 中不工作

Vimeo player JS API is not working in iOS

我正在尝试使用 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 移动版 (Android) 的行为有所不同,因为他们能够在该浏览器 (Chrome 移动版) 中使用播放器。在 iOS 中,播放由 iOS 本机媒体播放器处理。

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

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