开发者

jQuery - detect <video> onEnded

I have a page where I have to detect when the video has finished playing, so content can be displayed.. I'm using <video src="link" autoplay></video> for playing it and

$("video").bind("ended", function() {
            //Do stuff here...
        });

for detecting when it's done.. No idea why this isn't working.. Any help is appreciated!

[EDIT] This works when I right-click the video and click 'Show Controls' while it's playing for the first time. So strange..开发者_运维技巧

[EDIT] Code seems to be working in IE9 now, but only in IE9..


What if rather than using jQuery for the bind, you go more of a straight-JS route? Does this work for you?

$('video')[0].addEventListener('ended', function() {
    //do stuff
});


I believe you need to bind the event from the document

    $(document).bind('ended', function(e){

    });
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜