<!DOCTYPE html> <html> <body> <script> function myFunction() { alert('The audio is now playing'); } </script> <p>Press play on the audio.</p> <audio controls onplaying="myFunction()"> <source src="https://download.samplelib.com/mp4/sample-5s.mp4" type="audio/ogg"> <source src="https://download.samplelib.com/mp4/sample-5s.mp4" type="audio/mpeg"> Your browser does not support the audio element. </audio> </body> </html>