HTML Audio / Video DOM playing event
HTML Audio / Video DOM Reference
Examples
A message appears when the video:
var vid = document.getElementById ( "myVideo");
vid.onplaying = function () {
alert ( "The video is now playing");
};
vid.onplaying = function () {
alert ( "The video is now playing");
};
try it"
Bottom of this article contains more examples.
Definition and Usage
When the trigger is ready playing event in the audio / video (audio / video) due to buffering suspended or stopped.
Browser Support
Figures in the table represent the first browser to support this version of events.
event | |||||
---|---|---|---|---|---|
playing | Yes | 9.0 | Yes | Yes | Yes |
grammar
In HTML:
<Audio | video onplaying = "myScript "> try
In JavaScript:
audio | video .onplaying = function () {myScript}; try
JavaScript, use the addEventListener () method:
audio | video .addEventListener ( "playing" , 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
A message appears when Audio playback:
var aud = document.getElementById ( "myAudio");
aud.onplaying = function () {
alert ( "The audio is now playing");
};
aud.onplaying = function () {
alert ( "The audio is now playing");
};
try it"
HTML Audio / Video DOM Reference