Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

detecting the end of video using jwplayer?

im using jwplayer with thier javascript api, im trying to detect when its the end of the video at the moment i have tried this:

onTime: function(event) {
          console.log(this.getDuration());
          console.log(this.getPosition());
          if (this.getPosition() === this.getDuration()) {
            return alert("Im done");
          }
        }

but this alerts twice with "im done", and obviously this is not an efficient way to detect the end of the video?

like image 299
unknown Avatar asked Jan 13 '23 15:01

unknown


1 Answers

Use onComplete(callback).

onComplete: function() {
    return alert("Im done");
}
like image 133
jgillich Avatar answered Jan 21 '23 06:01

jgillich