The onprogress attribute handles the media progress event. It fires periodically while the browser downloads a <video> or <audio> resource.
Use it to update a “loading…” label or estimate buffered amount via media.buffered. Related readiness events: oncanplay, onloadeddata. Prefer addEventListener("progress", …).
Baseline · Widely available.
Stable across modern browsers since about July 2015. Not deprecated. Not cancelable; does not bubble.
Inline handlers discouraged.
MDN: prefer addEventListener over inline on* attributes. Study onprogress to recognize it in markup.
Syntax
HTML Syntax
syntax.html
<video onprogress="script">
script runs as download progress updates. Same idea on <audio>. Preferred: element.addEventListener("progress", handler).
canplay fires once enough data exists to begin playback.
Log makes the sequence easy to study.
Cache: a warm cache can shorten or skip some pulses.
Edge Cases & Pitfalls
Progress is about download pulses — not a guaranteed smooth percent meter.
cache
Few events when cached
From cache, progress may fire once or barely at all. Append a cache-bust query in demos if you need to see pulses.
buffered
Duration may be unknown early
Do not divide by duration until it is a finite number. Check buffered.length first.
vs ready
Not the same as canplay
progress = downloading. canplay = enough to start. Use both when building loaders.
bubble
Does not bubble
Listen on the media element itself. A parent onprogress will not see child media progress.
style
Prefer listeners
Inline on* attributes mix concerns. Use addEventListener in production code.
Compatibility
Browser Support
onprogress is a media event handler for download progress on video/audio. Prefer addEventListener in apps.
✓ Baseline · Widely available
onprogress
Widely available since about July 2015. Chrome, Firefox, Safari, Edge, and Opera support the media progress event.
97%Global support (approx.)
Google ChromeAll
Full support
Mozilla FirefoxAll
Full support
Apple SafariAll
Full support
Microsoft EdgeAll
Full support
OperaAll
Full support
Samsung InternetAll
Full support
Internet Explorer9+
Supported*
progressWidely supported
Bottom line: *Safe on modern browsers. Frequency of progress events varies with network and cache.
Remember
Key Takeaways
Role: periodic updates while media downloads.
Estimate: use buffered + duration carefully.
Target:<video> / <audio>, not parents.
Pair with:canplay for “ready to start.”
One line:onprogress tracks media download pulses — read buffered for an estimate, listen on the media element.
Frequently Asked Questions
It is an event handler for the progress event on media elements. That event fires periodically while the browser downloads a video or audio resource.
On HTMLMediaElement targets such as <video> and <audio>. Prefer element.addEventListener("progress", handler) in modern code.
Read media.buffered. When buffered.length > 0 and duration is known, buffered.end(buffered.length - 1) / duration gives an approximate loaded fraction.
No. It is not cancelable and does not bubble.
progress fires repeatedly while bytes download. canplay fires when enough data exists to start playback. They answer different questions: “how much loaded?” vs “can I start?”
Prefer addEventListener("progress", handler). MDN discourages inline HTML event handler attributes.