BigVideo.js播放结束时的URL重定向 [英] BigVideo.js URL redirect at end of playback

查看:101
本文介绍了BigVideo.js播放结束时的URL重定向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用基于Video.js的BigVideo的页面上实现了背景视频

I have implemented a Background Video on a page using BigVideo which is based off Video.js

点击div时,视频会在后台播放。我不能为我的生活弄清楚如何在视频播放完成后重定向到另一个URL。这是我使用的代码:

When an div is clicked, the video plays in the background. I cannot for the life of me figure out how to redirect to another URL when the video is done playing. This is the code I am using:

链接播放视频:

<a href="vids/gem.mp4" class="home_g"></a>

结束时重定向的代码:

<script type="text/javascript">
_V_("home_g").ready(function(){
    this.addEvent("ended", function(){
        {window.location = "www.google.com"}
    });
});

。以下是完整的测试网站:测试网站

Any help would be greatly appreciated. Here is the full test site: Test Site

尝试几天后,这个工作正常,我诉诸于根据视频的时间进行重定向,如果任何人有同样的问题。如果任何人有答案使它正常工作,如果没有任何人可以简单地这样做像我一样:

After Trying for a few days to get this to work correctly, I've resorted to making a redirect based on the time of the video if anyone else has the same problem. If anyone has the answer to make it work correctly great, if not anyone else could simply do this like I did:

<script type="text/JavaScript">
   redirectTime = "107000";
   redirectURL = "index.htm";
   function timedRedirect() {
   setTimeout("location.href = redirectURL;",redirectTime);
   }
</script>

<a href="vids/gem.mp4" class="home_g" onclick="JavaScript:timedRedirect()"></a>


推荐答案

请尝试:

var BV = new $.BigVideo();

BV.init();


BV.getPlayer().on("ended", function () {
    // your code after video has finished playing
});

这篇关于BigVideo.js播放结束时的URL重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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