简体   繁体   English

Vimeo播放器按钮不会显示

[英]Vimeo Player button won't show up

I have following script in the <body> : 我在<body>有以下脚本:

<script>
(function($) {
        var buttonShowed = false;
        var vPlayer = new Vimeo.Player($('#video0 iframe'));
        vPlayer.on('timeupdate', function(time) {
            if ((time.seconds >=580) && (!buttonShowed) ) {
                buttonShowed = true;
              $('#delayed-button') .css('visibility','visible');
            }
        });

})(jQuery);
</script>

In the <head> : <head>

<script src="https://player.vimeo.com/api/player.js"></script>

The Vimeo Video got the ID video0 and the button got the ID delayed-button . Vimeo视频的ID为video0 ,按钮的ID为delayed-button

On my phone the button shows on 580 seconds but with different browsers (Chrome, Opera, Safari) on my PC the button does not show up. 在我的手机上,该按钮会显示580秒,但是在我的PC上使用不同的浏览器(Chrome,Opera,Safari)时,该按钮不会显示。

I really don't why, can you help me? 我真的不为什么,你能帮我吗?

Try using a div element instead of an iframe and it should work. 尝试使用div元素代替iframe ,它应该可以工作。 It seems that timeupdate is not working with iframe . 似乎timeupdate无法与iframe一起使用。

I've made you a working fiddle here . 我在这里给你做了个工作的小提琴。 The full code: 完整代码:

 var buttonShowed = false; var vPlayer = new Vimeo.Player($('#video0 #player')); vPlayer.on('timeupdate', function(time) { console.log(time.seconds); if ((time.seconds >= 570) && (!buttonShowed)) { buttonShowed = true; $('#delayed-button').css('visibility', 'visible'); } }); 
 #delayed-button{ visibility: hidden; } 
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src='https://player.vimeo.com/api/player.js'></script> <div id='video0'> <div data-vimeo-id="76979871" data-vimeo-autoplay="true" id="player"></div> </div> <div id='delayed-button'> button </div> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM