Jason Schot Jason Schot - 3 months ago 36
Javascript Question

ended event videojs not working

I would like to trigger a simple event when my video is finished. I've placed this directly bellow my video tag.

<script type="text/javascript">
var myPlayer = videojs("session_video");
videojs("session_video").ready(function(){
this.addEvent("ended", function(){
alert('Here I am');
});
});
</script>


However I get: TypeError: this.addEvent is not a function and I can't find why.

You can see it live here: 78.47.121.50 (stackoverflow won't allow to make that a link)
enter code 01-01-01-2012 to bring up the video.

Any insight is much apricaited!

Kind regards,
Jason.

Answer

"addEvent" and "removeEvent" were replaced by "on" and "off"

try:

this.on("ended", function(){