Execute a JavaScript when an audio is ready to start after having been paused: - Javascript DOM Event

Javascript examples for DOM Event:onplaying

Description

Execute a JavaScript when an audio is ready to start after having been paused:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<audio controls onplaying="myFunction()">
  <source src="your.ogg" type="audio/ogg">
  <source src="your.mp3" type="audio/mpeg">
  Your browser does not support the audio element.
</audio>//  w w w  .  j a  va 2s .c  o m

<script>
function myFunction() {
    console.log("The audio is now playing");
}
</script>

</body>
</html>

Related Tutorials