<audio onended="myFunction()"> - Javascript DOM Event

Javascript examples for DOM Event:onended

Description

The onended event occurs when the audio/video has reached the end.

Summary

Bubbles No
Cancelable No
Supported HTML tags: <audio> and <video>

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<audio controls onended="myFunction()">
  <source src="your.ogg" type="audio/ogg">
  <source src="your.mp3" type="audio/mpeg">
  Your browser does not support the audio element.
</audio>//from  www  . jav a  2s. c om

<script>
function myFunction() {
    console.log("The video has ended");
}
</script>

</body>
</html>

Related Tutorials