How to Detect when an HTML5 video finishes

Here is a simple way to detect when an HTML5 video finishes. One point to note when using this method, Safari on the El Capitan verson of OS X (10.11) does not catch the ‘ended’ event. So in that case, I needed to use the ‘timeupdate’ event and then check for when this.current Time was equal to 0 again

You can add an event listener with ‘ended’ as first parameter

Like this :

<video src="video.ogv" id="myVideo">
  video not supported

<script type='text/javascript'>
    function myHandler(e) {
        // What you want to do after the event

Also remember to set loop to false, otherwise the ended event won’t be triggered

Hope this was helpful :).