HTML Audio/Video DOM waitingEvents
HTML Audio/Video DOM Reference Manual
Example
A prompt message pops up when the video needs to buffer the next frame before it starts playing:
var vid = document.getElementById("myVideo");
vid.onwaiting = function() {
alert("Wait! I need to buffer the next frame");
};
vid.onwaiting = function() {
alert("Wait! I need to buffer the next frame");
};
Try it Yourself »
Definition and Usage
The waiting event fires when the video stops because it needs to buffer the next frame.
This event can be used on the <audio> element, but is usually used in video.
Browser Support
The numbers in the table specify the first browser version that supports the event.
| Events | |||||
|---|---|---|---|---|---|
| waiting | Yes | 9.0 | Yes | Yes | Yes |
Syntax
In HTML:
<audio|video onwaiting="myScript">Try it Yourself
In JavaScript:
audio|video.onwaiting=function(){myScript};Try it Yourself
In JavaScript, using the addEventListener() method:
audio|video.addEventListener("waiting", 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 |
HTML Audio/Video DOM Reference Manualother extensions