Javascript DOM onloadstart Event

Introduction

Execute a JavaScript when the video is starting to load:

View in separate window

<!DOCTYPE html>
<html>
<body>

<video controls onloadstart="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 a  v a  2  s  . c  o  m

<p id="demo"></p>
<script>
function myFunction() {
  document.getElementById("demo").innerHTML = "Starting to load video";
}
</script>

</body>
</html>

The onloadstart event occurs when the browser starts looking for the specified audio/video.

This is when the loading process starts.

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



PreviousNext

Related