Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML Audio/Video DOM progress Event

HTML Audio/Video DOM progress Event

HTML audio/video Tag Reference HTML Audio/Video DOM Reference

Example

Display a message while the video is downloading:

myVid=document.getElementById("video1");

myVid.onprogress=alert("Downloading video");

Try it »


Definition and Usage

The progress event occurs while the browser is downloading the specified audio/video.

While the audio/video is loading, the following events occur in order:

  1. loadstart
  2. durationchange
  3. loadedmetadata
  4. loadeddata
  5. progress
  6. canplay
  7. canplaythrough

Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the progress event.

**Note:** Internet Explorer 8 and earlier versions do not support this event.


Syntax

In HTML:

onprogress="

SomeJavaScriptCode

">

In JavaScript:

audio|video

.onprogress=

SomeJavaScriptCode

;

Using addEventListener():

audio|video

.addEventListener("progress", function()

  {

 

//SomeJavaScriptCode

  }

);

Technical Details

Supported by the following HTML tags:
Supported by the following JavaScript objects: Audio, Video

More examples

Use the onprogress attribute on HTML elements

Use addEventListener() to listen for the progress event


HTML audio/video Tag Reference HTML Audio/Video DOM Reference