HTML | Audio/Video DOM pause Event
The HTML Audio/Video DOM pause Event occurs when the Audio has been paused by the user or it will be automatically paused or stop.
Syntax:
- This syntax is used in HTML
<audio|video onpause="myScript">
- This Syntax is used in JavaScript:
audio|video.onpause=function(){myScript}; - In JavaScript, We also using the addEventListener() method:
audio|video.addEventListener("pause", myScript);
Example:
<!DOCTYPE html><html> <head> <title> HTML Audio/Video DOM pause Event </title></head> <body> <h1> GeeksForGeeks </h1> <h1 style="color:green"> HTML Audio DOM pause Event </h1> <audio id="geeks" controls> <source src="beep.mp3" type="audio/mp3"> </audio> <script> var aud = document.getElementById("geeks"); aud.onpause = function() { alert("Audio is paused now"); }; </script></body> </html> |
Output:
Before:
After:
Supported Browsers: The browsers supported by Audio/Video DOM pause Event are listed below:
- Google Chrome
- Internet Explorer 9.0
- Firefox
- Apple Safari
- Opera
Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML course.


