detecting the end of video using jwplayer?

javascript, jwplayer

Solution

Use onComplete(callback).

onComplete: function() {
    return alert("Im done");
}

Problem

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?

Original source