Created
March 20, 2018 14:54
-
-
Save kartick14/9dfe4de53371b5b4daa005bd24810344 to your computer and use it in GitHub Desktop.
Track HTML5 Video life
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<video src="video.ogv" id="myVideo"> | |
video not supported | |
</video> | |
<script type='text/javascript'> | |
document.getElementById('myVideo').addEventListener('ended',myHandler,false); | |
function myHandler(e) { | |
// What you want to do after the event | |
} | |
</script> | |
<video id="myVideo" width="320" height="176" controls> | |
<source src="mov_bbb.mp4" type="video/mp4"> | |
<source src="mov_bbb.ogg" type="video/ogg"> | |
Your browser does not support HTML5 video. | |
</video> | |
<script> | |
var vid = document.getElementById("myVideo"); | |
vid.onended = function() { | |
alert("The video has ended"); | |
}; | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment