[英]load next page when vimeo video is finished
I would like to use a vimeo video as a intro for a website. 我想将vimeo视频用作网站的介绍。 Is there a way to load a new page after a embedded vimeo video is finished?
嵌入式vimeo视频播放完成后,是否可以加载新页面?
I tried something with jQuery but it is not really working. 我尝试使用jQuery进行某些操作,但实际上无法正常工作。
<div id="vimeo">
<iframe src="//player.vimeo.com/video/89470441?title=0&byline=0&portrait=0&color=ea5045&autoplay=1" width="960" height="540" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
</div>
<script>
$("#vimeo").on("ended", function() {
window.location.href = 'home.html';
});
</script>
Does someone have an idea how I could fix the problem? 有人知道我该如何解决该问题吗?
Try this 尝试这个
<script src="http://a.vimeocdn.com/js/froogaloop2.min.js"></script>
<div id="vimeo">
<iframe src="//player.vimeo.com/video/89470441?title=0&byline=0&portrait=0&color=ea5045&autoplay=1" width="960" height="540" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
</div>
<script>
var iframe = $('#vimeo iframe')[0],
player = $f(iframe);
// When the player is ready, add listeners for pause, finish, and playProgress
player.addEvent('ready', function() {
player.addEvent('finish', onFinish);
});
function onFinish(id) {
window.location.href = 'home.html';
}
</script>
Ref: http://developer.vimeo.com/player/js-api 参考: http : //developer.vimeo.com/player/js-api
Try taking a look at the Vimeo Javascript API: http://developer.vimeo.com/player/js-api 尝试看一下Vimeo Javascript API: http : //developer.vimeo.com/player/js-api
There is a simple JavaScript example given. 有一个简单的JavaScript示例。 If you use Froogaloop, you can place your window.location.href inside onFinish, where you see
status.text(data.seconds + 's played');
如果您使用Froogaloop,则可以将window.location.href放在onFinish内,在那里您可以看到
status.text(data.seconds + 's played');
. 。
From the simple API you can grab the movie duration in seconds along with other useful things. 通过简单的API,您可以以秒为单位获取电影时长以及其他有用的信息。
http://developer.vimeo.com/apis/simple#video-response http://developer.vimeo.com/apis/simple#video-response
From this video request URL you can post to your grab your consumables listed in the above link. 通过此视频请求URL,您可以将上面链接中列出的消耗品发布到您的手中。
http://developer.vimeo.com/apis/simple#video-request-url http://developer.vimeo.com/apis/simple#video-request-url
In any case, you can find and construct enough to get you a jquery or js countdown to redirect. 在任何情况下,您都可以找到并构造足以让您进行jquery或js倒计时的重定向。
Good luck! 祝好运!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.