HTML Audio/Video DOM progress event

Example

Prompt that the video is downloading:

myVid=document.getElementById("video1");
myVid.onprogress=alert("Starting to load video");

Try it yourself

Definition and usage

A progress event occurs when the browser is downloading the specified audio/video.

The following events occur sequentially when the audio/video is loading:

Browser support

All mainstream browsers support the progress event.

Note:Internet Explorer 8 or earlier browsers do not support this event.

Syntax

In HTML:

<audio|video onprogress="SomeJavaScriptCode">

In JavaScript:

audio|video.onprogress=SomeJavaScriptCode;

Use addEventListener():

audio|video.addEventListener("progress", function()
  {
  //Some JavaScript Code
  }
);

Technical Details

The following HTML tags are supported: <audio>, <video>
The following JavaScript objects are supported: Audio, Video

More Examples

Use the progress attribute on HTML elements

Listen to progress events using addEventListener()