我正在尝试添加一个视频到我的网站,以便当视频完成时,它重定向到我的网站上的另一个页面。我看过一些论坛,但在我的情况下,没有一个论坛能做到我所需要的。这是我正在尝试重定向的视频的嵌入代码...
<iframe src="//ihigh.volarvideo.com/sheldonclarkcardinals/broadcast/embed/95383?w=640&autoplay=1" frameborder="0" width="640" height="360" scrolling="no"></iframe>提前感谢!
发布于 2015-01-08 13:02:12
您可以使用jquery setTimeout,但问题是,如果视频暂停,就会出现问题。
<iframe src="//www.youtube.com/embed/_OBlgSz8sSM" frameborder="0" width="640" height="360" scrolling="no"></iframe>
setTimeout(function(){
window.location = "http://www.stackoverflow.com";
},56000); // This is equal to the lenght of the video发布于 2015-01-08 13:05:41
Volar有一个javascript API,你可以在其中监听事件。在iframe中添加ID:
<iframe id="my-video" src="//ihigh.volarvideo.com/sheldonclarkcardinals/broadcast/embed/95383?w=640&autoplay=1" frameborder="0" width="640" height="360" scrolling="no"></iframe>然后在页面中包含volarvideo.js并调用:
var i = document.getElementById('my-video');
var v = new Volarvideo();
v.on('onComplete', function() {
window.location.href = "<desired url>";
}
v.connect(i);
v.play();https://stackoverflow.com/questions/27833091
复制相似问题