Javascript DOM onwaiting Event via HTML Tag onwaiting function

Introduction

In JavaScript:

object.onwaiting = function(){
       myScript};

This example uses the HTML DOM to assign an "onwaiting" 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>/* w  w w.j  a v a2  s  .  c o m*/

<p id="demo"></p>
<script>
document.getElementById("myVideo").onwaiting = function() {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