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 > |
chevron_right
filter_none
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
Recommended Posts:
- HTML | DOM Audio pause() Method
- HTML | DOM Video pause( ) Method
- p5.js | pause() Function
- HTML | DOM onkeypress Event
- HTML | DOM onabort Event
- HTML | DOM fullscreenchange Event
- HTML | DOM onerror Event
- HTML | DOM onkeydown Event
- HTML | DOM onbeforeprint Event
- HTML | DOM onblur Event
- HTML | DOM ontoggle Event
- HTML | DOM onbeforeunload Event
- HTML | DOM onstalled Event
- HTML | DOM onfocusout Event
- HTML | DOM onfocusin Event
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : shubham_singh