The onwaiting attribute is an event-handler attribute for <audio> and <video>. It runs when the waiting event fires — playback has stopped because of a temporary lack of data (buffering).
The event is not cancelable and does not bubble. Related: onplaying (playback resumes), onstalled (fetch not delivering), onpause (user/script pause — different meaning).
Baseline · Widely available.
Not deprecated and not experimental. Stable across modern browsers since about July 2015.
Hard to force on fast local files.
Short or cached clips rarely buffer. The live preview includes Simulate so you can study the handler without a slow network.
Syntax
HTML Syntax
syntax.html
<video|audio onwaiting="script">
script runs when playback waits for data. Preferred in apps: media.addEventListener("waiting", handler).
waiting — playback stopped for more data (show spinner).
playing — playback is moving again (hide spinner).
pause — user/script pause (not the same as buffering).
UI tip: only treat waiting as “buffering,” not every pause.
Edge Cases & Pitfalls
Most confusion mixes buffering waits with user pauses or network stalls.
pause
waiting ≠ pause
pause is a paused state. waiting means “need more data.” Do not treat every stop as a user pause.
stalled
waiting ≠ stalled
stalled is about the fetch not delivering. waiting is about playback needing data. Listen for both if you show network UI.
local
Local demos rarely wait
Cached files stay buffered. Use Simulate, DevTools throttling, or a large remote file to observe real waits.
bubble
Does not bubble
Attach the listener to the <video> / <audio> element itself.
a11y
Announce buffering to assistive tech
Update an aria-live region (or similar) when waiting/playing so screen reader users know why playback stalled.
Compatibility
Browser Support
onwaiting is an HTML media event handler for the waiting event on audio/video. It is not a Node.js, Deno, or Bun API.
✓ Baseline · Widely available
onwaiting
Widely available since about July 2015. Supported across modern browsers for HTML media elements.
98%Global support (approx.)
Google ChromeAll modern
Full support
Mozilla FirefoxAll modern
Full support
Apple SafariAll modern
Full support
Microsoft EdgeAll modern
Full support
OperaAll modern
Full support
Samsung InternetModern
Full support
Internet ExplorerLegacy support
Supported
onwaitingWidely supported
Bottom line: Safe to use for buffering UI. Prefer addEventListener; pair with playing to clear spinners.
Remember
Key Takeaways
Role: playback stopped temporarily for more media data.
vs pause: buffering wait ≠ user/script pause.
Pair: clear UI on playing when playback resumes.
Study tip: simulate the event when local files never buffer.
One line: use onwaiting for buffering UI — not for intentional pauses.
Frequently Asked Questions
It is an event-handler attribute on audio or video. When playback stops because of a temporary lack of data (buffering), the waiting event fires and the JavaScript in onwaiting runs.
pause means playback entered the paused state (user or pause()). waiting means playback stopped because more media data is needed — the element is still trying to play once data arrives.
waiting is about playback needing more data. stalled is about the fetch unexpectedly not delivering data. They can both appear during bad networks but answer different questions.
No. It is not cancelable and does not bubble. Listen on the video or audio element itself.
Short or cached files rarely run out of buffer. Real waiting needs a slow stream. Use Simulate in the live preview to practice the handler.
No. The waiting event is Baseline widely available since about July 2015. Prefer media.addEventListener("waiting", handler) in apps.