The ontimeupdate attribute is an event-handler attribute for <audio> and <video>. It runs JavaScript when the timeupdate event fires — the media’s currentTime has been updated.
The event is not cancelable and does not bubble. It fires often (roughly 4–66 Hz, depending on system load) while time advances during play or seek. Use it for clocks and progress UIs. Contrast with onseeked (one-shot seek done) and ondurationchange (total length changed).
Baseline · Widely available.
Not deprecated and not experimental. The timeupdate event is stable across modern browsers since about July 2015.
Prefer addEventListener in apps.
Inline ontimeupdate is fine for learning. Production code usually uses media.addEventListener("timeupdate", handler). Keep the handler cheap — it can run many times per second.
Syntax
HTML Syntax
syntax.html
<video|audio ontimeupdate="script">
script is JavaScript that runs when timeupdate fires. Equivalent JS: media.ontimeupdate = handler or media.addEventListener("timeupdate", handler).
Values
Attribute Values
The attribute value is always a script. Common patterns:
Most issues come from heavy work inside a high-frequency handler, or reading duration too early.
frequency
Fires many times per second
About 4–66 Hz. Avoid heavy DOM work, network, or canvas redraws every tick — throttle if needed.
vs seeked
Not a one-shot seek event
seeked means “jump finished.” timeupdate means “time value changed again” during play or seek.
duration
duration may be NaN at first
Wait for metadata (durationchange / loaded metadata) before dividing for percent.
bubble
Does not bubble
Listen on the audio/video element itself. Parent listeners will not see a bubbling timeupdate.
property
.ontimeupdate = replaces listeners
Assigning the IDL property overwrites a previous assignment. Prefer addEventListener for multiple handlers.
Compatibility
Browser Support
ontimeupdate is an HTML event-handler attribute for media elements in the browser. It is not a Node.js, Deno, or Bun API.
✓ Baseline · Widely available
ontimeupdate
Widely available since about July 2015. Chrome, Firefox, Safari, Edge, and Opera support the timeupdate event on audio and video.
97%Global support (approx.)
Google Chrome3+
Full support
Mozilla Firefox3.5+
Full support
Apple Safari3.1+
Full support
Microsoft Edge12+
Full support
Opera10.5+
Full support
Samsung InternetModern · Full
Full support
Internet Explorer9+
Supported
ontimeupdateWidely supported
Bottom line: Safe to use for media clocks and progress. Prefer addEventListener in production, and keep handlers lightweight because of the high event rate.
Remember
Key Takeaways
Role: run script when currentTime is updated.
Use for: clocks, captions sync cues, progress meters.
Rate: frequent (≈4–66 Hz) — keep handlers light.
Seek done: use onseeked, not only ontimeupdate.
One line:ontimeupdate means “playback time changed again” — ideal for live clocks and progress, with a light handler.
Frequently Asked Questions
It is an event-handler attribute on audio or video. When the currentTime value is updated during playback (or seeking), the timeupdate event fires and the script runs — often used for custom clocks and progress bars.
The HTML audio and video elements. Put the handler on the media element itself.
About 4 to 66 times per second, depending on system load. User agents vary the rate so UI work stays comfortable. Keep handlers light.
ontimeupdate fires repeatedly as currentTime changes. onseeked fires once when a seek operation finishes. Use seeked for “jump done,” timeupdate for ongoing progress.
Both work. For learning, ontimeupdate in HTML is fine. In production code, prefer media.addEventListener("timeupdate", handler).
No. The timeupdate event and ontimeupdate handler are standard HTML media features and Baseline widely available since about July 2015.