当vimeo视频停止播放时发生火灾事件? [英] Fire event when vimeo video stops playing?
问题描述
目前我有一个Vimeo嵌入到叠加层中,这样我就可以在Vimeo中嵌入一个叠加层想要在视频停止后移除。希望这是有道理的!
我没有任何可用的代码,但想知道是否可以将事件侦听器添加到视频中,触发事件一旦视频完成了,你将如何去做这件事?
感谢
Ryan
自Vimeo启动新的视频播放器API 。
重要提示:务必移除 包含新脚本:?api = 1
来自iframe中的网址。这是以前在使用Froogaloop库时所需要的,不再需要。
$如果您将它放入,结束,搜索以及其他事件永远不会触发。 b $ b
< script src =https://player.vimeo.com/api/player.js>< / script>
然后使用以下示例:
$(document).ready(function(){
var iframe = $('#container iframe');
var player = new Vimeo .Player(iframe);
player.on('ended',function(){
console.log('Finished。');
});
});
I was just wondering if it was possible to fire an event once a vimeo video has finished playing?
Currently I have a Vimeo embed in an overlay, that I want to remove once the video has stopped. Hope this makes sense!
I dont really have any code that would be of use, but would like to know if you can add event listeners to the video, fire an event once the video has finished, and how you would go about doing this?
Thanks Ryan
Previous answer is now obsolete since Vimeo launching the new Video Player API.
Important: Be sure to remove the ?api=1
from the URL in your iframe. This was previously required when using the Froogaloop library and is no longer needed. If you leave it in, the 'ended', 'seeked' and other events will never fire.
Include the new script:
<script src="https://player.vimeo.com/api/player.js"></script>
And then use the following example:
$(document).ready(function(){
var iframe = $('#container iframe');
var player = new Vimeo.Player(iframe);
player.on('ended', function() {
console.log('Finished.');
});
});
这篇关于当vimeo视频停止播放时发生火灾事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!