HTML Audio / Video DOM pause event
HTML Audio / Video DOM Reference
Examples
When the video is paused message pops up:
var vid = document.getElementById ( "myVideo");
vid.onpause = function () {
alert ( "pause video playback");
};
vid.onpause = function () {
alert ( "pause video playback");
};
try it"
Bottom of this article contains more examples.
Definition and Usage
When the pause trigger event in the audio / video (audio / video) Pause.
Tip: Play event in the audio / video (audio / video) to start playback trigger (or cancel pause).
Browser Support
Figures in the table represent the first browser to support this version of events.
event | |||||
---|---|---|---|---|---|
pause | Yes | 9.0 | Yes | Yes | Yes |
grammar
In HTML:
<Audio | video onpause = "myScript "> try
In JavaScript:
audio | video .onpause = function () {myScript}; try
JavaScript, use the addEventListener () method:
audio | video .addEventListener ( "pause" , myScript); try
Note: Internet Explorer 8 and earlier versions of IE do not support addEventListener () method.
technical details
Supported HTML tags: | <Audio> and <video> |
---|---|
Supported JavaScript Objects: | Audio, Video |
More examples
Examples
When audio playback is paused message pops up:
var aud = document.getElementById ( "myAudio");
aud.onpause = function () {
alert ( "Audio playback pause");
};
aud.onpause = function () {
alert ( "Audio playback pause");
};
try it"
HTML Audio / Video DOM Reference