Video.js: Callback for when a video has ended?

Created on 21 Jan 2014  路  10Comments  路  Source: videojs/video.js

Hello again

Is there a callback for when a video has ended (has reached the end)? And how can I change to another video when that has happened? Dynamically I mean.

Thanks!

Most helpful comment

You can do this by listening for the ended event.

var video = videojs('awesome_video').ready(function(){
  var player = this;

  player.on('ended', function() {
    alert('video is done!');
  });
});

All 10 comments

You can do this by listening for the ended event.

var video = videojs('awesome_video').ready(function(){
  var player = this;

  player.on('ended', function() {
    alert('video is done!');
  });
});

That's easy. Thanks. But should be documented!

Where can I find the full list of available events? Thanks.

It's work fine,Thank you very much! If Html5 video have loop attribute or options loop is true ,It's will not working.

I am also looking for full list of existing events.

The HTML5 media events are going to cover just about every event Video.js will fire.

Nice

Not work on my site Tubeplayer

exactly what i was looking for. docs for the event trigger are not super clear

I have solved this problem by using timeupdate event

player.on('timeupdate', function(){
      if(player.currentTime() == player.duration()){
          console.log('video is ended');
      }
});
Was this page helpful?
0 / 5 - 0 ratings

Related issues

askaliuk picture askaliuk  路  3Comments

shivamg705 picture shivamg705  路  4Comments

kitsunde picture kitsunde  路  4Comments

zhulduz picture zhulduz  路  3Comments

cshah123 picture cshah123  路  4Comments