Javascript DOM onloadeddata Event

Introduction

Execute a JavaScript when data for the current frame is available for <video>.

View in separate window

<!DOCTYPE html>
<html>
<body>

<video controls onloadeddata="myFunction()">
  <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  av a 2 s.  c  om

<p id="demo"></p>
<script>
function myFunction() {
  document.getElementById("demo").innerHTML = "Browser has loaded the current frame";
}
</script>

</body>
</html>

The onloadeddata event occurs when data for the current frame is loaded, but not enough to play next frame.

Bubbles: No
Cancelable: No
Event type: Event
Supported HTML tags: <audio> and <video>



PreviousNext

Related