< HTML Audio/Video DOM Reference
Example
Alert that the video is playing:
var vid = document.getElementById("myVideo");
vid.onplaying = function()
{
alert("The video is now playing");
};
Try it Yourself »
More "Try it Yourself" examples below.
Definition and Usage
The playing event occurs when the audio/video is playing after having been paused or stopped for buffering.
Browser Support
The numbers in the table specify the first browser version that fully supports the event.
Event | |||||
---|---|---|---|---|---|
playing | Yes | 9.0 | Yes | Yes | Yes |
Syntax
In HTML:
<audio|video onplaying="myScript">Try it
In JavaScript:
audio|video.onplaying=function(){myScript};Try it
In JavaScript, using the addEventListener() method:
audio|video.addEventListener("playing", myScript);Try it
Note: The addEventListener() method is not supported in Internet Explorer 8 and earlier versions.
Technical Details
Supported HTML tags: | <audio> and <video> |
---|---|
Supported JavaScript objects: | Audio, Video |
More Examples
Example
Alert that the audio is playing:
var aud = document.getElementById("myAudio");
aud.onplaying = function()
{
alert("The audio is now playing");
};
Try it Yourself »