Horje

How to Run "myFunction" when the video is finished

Video Example. Play the video: This example demonstrates how to use the "onended" attribute on a VIDEO element.
index.html
Example: HTML
<video id="myVideo" width="320" height="176" controls onended="myFunction()">
  <source src="https://www.sample-videos.com/video321/mp4/240/big_buck_bunny_240p_10mb.mp4" type="video/mp4">
  <source src="https://www.sample-videos.com/video321/mp4/240/big_buck_bunny_240p_10mb.mp4" type="video/ogg">
  Your browser does not support HTML5 video.
</video>

<p>Play the video:</p>

<script>
function myFunction() {
  alert("Thank you for watching");
}
</script>





Type:
html
Category:
Web Tutorial
Sub Category:
HTML Attribute
Uploaded by:
Admin