English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Reference Manual

HTML Tag List

HTML Audio/Video DOM waiting event

The waiting event will be triggered when playback stops temporarily due to lack of data

HTML Audio/Video DOM Reference Manual

Online Example

Reminder: the video needs to buffer the next frame before it can start playing:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>HTML Audio/Video onwaiting event usage-Basic Tutorial(oldtoolbag.com)</title>
</head>
<body>
<p>Play video.</p>
<video id="myVideo" width="320" height="176" controls>
  <source src="movie.mp4" type="video/mp4">
  <source src="movie.ogg" type="video/ogg">
  Your browser does not support HTML5 video tag.
</video>
<script>
var vid = document.getElementById("myVideo");
vid.onwaiting = function() 
{
    alert("Please wait! I need to buffer the next frame");
});
</script> 
</body>
</html>
Test to see ‹/›

Definition and Usage

A waiting event occurs when the video stops playing, as it needs to buffer the next frame.
This event can also be used for <audio> elements, but it is mainly used for videos...

Browser Compatibility

IEFirefoxOperaChromeSafari

Syntax

In HTML:

<audio|video onwaiting="myScript">Try it

In JavaScript:

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

In JavaScript, use the addEventListener() method:

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

Note: Internet Explorer 8 and earlier IE versions do not support addEventListener() Methods.

Technical Details
Supported HTML Tags:<audio> and <video>
Supported JavaScript Objects:Audio, Video
HTML Audio/Video DOM Reference Manual