Vimeo播放器JS API在iOS中不起作用 [英] Vimeo player JS API is not working in iOS

查看:158
本文介绍了Vimeo播放器JS API在iOS中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm trying to use the API to play a video, but it only works after you click the play button in the player in iOS. In desktop and Chrome for Android, it is working fine.

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>

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

Is there a workaround that I can use?

推荐答案

我联系了Vimeo支持团队。他们表示,Chrome Mobile(Android)的行为有所不同,因为他们可以在该浏览器(Chrome Mobile)中使用播放器。在iOS中,播放由iOS本地媒体播放器处理。

I contacted the Vimeo support team. They said behavior differs in Chrome Mobile (Android) because they're able to use the Player in that browser (Chrome Mobile). In iOS, playback is handled by the iOS native media player.

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

They Play method can only be called if the user initiates playback first by tapping the play button onscreen (in iOS).

相关问题:
你可以在iPad上自动播放HTML5视频吗?

这篇关于Vimeo播放器JS API在iOS中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆