<!DOCTYPE html> <html> <body> <p>Play and pause the audio file.</p> <audio id="myAudio" controls onpause="myFunction()"> <source src="https://file-examples.com/wp-content/storage/2017/11/file_example_MP3_700KB.mp3" type="audio/ogg"> <source src="https://file-examples.com/wp-content/storage/2017/11/file_example_MP3_700KB.mp3" type="audio/mpeg"> Your browser does not support the audio element. </audio> <script> function myFunction() { alert("The audio file has been paused"); } </script> <p>This example demonstrates how to use the "onpause" attribute on an AUDIO element.</p> </body> </html>