<!DOCTYPE html>
<html>
<body>

<p>This example demonstrates how to assign an "onplaying" event to an audio element.</p>

<p>Play, pause and then play the audio again.</p>

<audio controls onplaying="myFunction()">
  <source src="horse.ogg" type="audio/ogg">
  <source src="horse.mp3" type="audio/mpeg">
  Your browser does not support the audio element.
</audio>

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

</body>
</html>