onpause event
Definition and usage
The onpause event occurs when audio/video is paused by the user or programmatically.
Tip:onplay Event Occurs when audio/video starts playing.
Example
Example 1
Execute JavaScript when the video is paused:
<video onpause="myFunction()">
Example 2
Execute JavaScript when the audio is paused:
<audio onpause="myFunction()">
Syntax
In HTML:
<element onpause="myScript">
In JavaScript:
object.onpause = function(){myScript};
In JavaScript, use the addEventListener() method:
object.addEventListener("pause", myScript);
Note:Internet Explorer 8 or earlier versions do not support addEventListener() method.
Technical details
Bubble: | Not supported |
---|---|
Cancelable: | Not supported |
Event type: | Event |
Supported HTML Tags: | <audio> and <video> |
DOM Version: | Level 3 Events |
Browser Support
The numbers in the table indicate the first browser version that fully supports the event.
Events | Chrome | IE | Firefox | Safari | Opera |
---|---|---|---|---|---|
onpause | Support | 9.0 | Support | Support | Support |