HTML Audio/Video DOM pauseEvents

HTML Audio/Video DOM Reference Manual

Example

Display a pop-up message when the video is paused:

var vid = document.getElementById("myVideo");
vid.onpause = function() {
alert("Video paused");
};

Try it Yourself »

This article contains more examples at the bottom.


Definition and Usage

The pause event is triggered when audio/video is paused.

Tip: playThe event is triggered when audio/video starts playing (or resumes from being paused).


Browser Support

The numbers in the table indicate the version number of the first browser that supports this event.

Events
pause Yes 9.0 Yes Yes Yes


Syntax

In HTML:

<audio|video onpause="myScript">Try it Yourself

In JavaScript:

audio|video.onpause=function(){myScript};Try it Yourself

In JavaScript, using the addEventListener() method:

audio|video.addEventListener("pause", myScript);Try it Yourself

Note:Internet Explorer 8 and earlier IE versions do not supportaddEventListener()method.


Technical Details
Supported HTML tags: <audio> and <video>
Supported JavaScript objects: Audio, Video


Examples

More Examples

Example

Display a prompt message when audio playback is paused:

var aud = document.getElementById("myAudio");
aud.onpause = function() {
alert("Audio paused");
};

Try it Yourself »


HTML Audio/Video DOM Reference Manualother extensions