redirecting the page after a video plays using an html5 video player

拥有回忆 提交于 2019-12-29 08:16:30

问题


I am making a video reel (a portfolio) website, using wordpress as my backend, and the videojs html5 video player with each video in a different post. I want the videos to play successively, so that when one video finishes it redirects to the "next post".

I'm having trouble seeing if there are any DOM calls that fire after the video plays. Basically I want to fire the redirect as soon as the video plays.

Can someone point me in the right direction?

Thanks!


回答1:


It looks like there is an ended event that you can hook up to.




回答2:


you need to call a function on ended... or the relocation just there...

That's it.




回答3:


Ended up using the following code:

$(document).ready(function(){
    var sStr = "<?php echo get_permalink(get_adjacent_post(true,'',true)); ?>";
    $(".video-js").bind('ended', function(){
                window.location = sStr;
    });
});


来源:https://stackoverflow.com/questions/5208561/redirecting-the-page-after-a-video-plays-using-an-html5-video-player

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!