ended event videojs not working
"addEvent" and "removeEvent" were replaced by "on" and "off"
try:
this.on("ended", function(){
The ended event will not fire if end user intentionally seek the video to end keeping video as paused. I was able to get it work as:
<script type="text/javascript">
var player = videojs('my_video', {}, function() {});
player.ready(function(){
var duration_time = Math.floor(this.duration());
this.on('timeupdate', function() {
var current_time = Math.floor(this.currentTime());
if ( current_time > 0 && ( current_time == duration_time ) ){
$('#continue_button').removeAttr("disabled");
}
});
});
</script>
For those who still have problems with ended events in some browsers you can resort to this fix:
player.ready(function() {
var myPlayer = this;
playerInstance.on("timeupdate", function(event) { //chrome fix
if (event.currentTarget.currentTime == event.currentTarget.duration) {
console.log('video ended');
}
});
});