Javascript DOM onwaiting Event via addEventListener() method

Introduction

In JavaScript, using the addEventListener() method:

object.addEventListener("waiting",
       myScript);

This example uses the addEventListener() method to attach a "waiting" event to a video element.

View in separate window

<!DOCTYPE html>
<html>
<body>
<p>Play the video.</p>

<video controls id="myVideo">
  <source src="video.mp4" type="video/mp4">
  <source src="video.ogg" type="video/ogg">
  Your browser does not support HTML5 video.
</video>//from   ww  w.j a v  a 2s  . com

<p id="demo"></p>
<script>
document.getElementById("myVideo").addEventListener("waiting", myFunction);

function myFunction() {
  document.getElementById("demo").innerHTML = "Wait! I need to buffer the next frame";
}
</script>

</body>
</html>
Bubbles: No
Cancelable: No
Event type: Event
Supported HTML tags: <audio>, <video>



PreviousNext

Related