English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Reference Manual

HTML Tag Reference

HTML Audio/Video DOM progress event

The progress event is triggered periodically when the browser loads resources.

 HTML Audio/Video DOM Reference Manual

Online Example

Hint: The video is downloading:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>HTML Audio/Using the video onprogress event-Basic Tutorial(oldtoolbag.com)</title>
</head>
<body>
<video id="video1" controls="controls">
  <source src="movie.mp4" type="video/mp4">
  <source src="movie.ogg" type="video/ogg">
  Your browser does not support HTML5 video tag.
</video>
<script>
myVid=document.getElementById("video1");
myVid.onprogress=alert("Downloading video");
</script> 
</body>
</html>
Test to see ‹/›

Definition and Usage

When the browser is downloading the specified audio/video, a progress event will occur.
In the audio/The following events occur in the order listed during the video loading process:

Browser Compatibility

IEFirefoxOperaChromeSafari

All major browsers support the progress event.

Note:Internet Explorer 8 and earlier versions 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()
  {
  //SomeJavaScriptCode
  }
);

Technical Details

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

More Examples

Use the onprogress attribute on HTML elements

Use addEventListener() to listen to the progress event

 HTML Audio/Video DOM Reference Manual