HTML Audio/Video DOM playingEvents

HTML Audio/Video DOM Reference Manual

Example

Popup message when playing video:

var vid = document.getElementById("myVideo");
vid.onplaying = function() {
    alert("The video is now playing");
};

Try it Yourself »

This article contains more examples at the bottom.


Definition and Usage

The playing event is fired when the audio/video is ready after having been paused or stopped due to buffering.


Browser Support

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

Events
playing Yes 9.0 Yes Yes Yes


Syntax

In HTML:

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

In JavaScript:

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

In JavaScript, using the addEventListener() method:

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

Note:Internet Explorer 8 and earlier IE versions are not supportedaddEventListener()method.


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


Examples

More Examples

Example

Popup message when playing audio:

var aud = document.getElementById("myAudio");
aud.onplaying = function() {
    alert("The audio is now playing");
};

Try it Yourself »


HTML Audio/Video DOM Reference Manualother extensions