YouTip LogoYouTip

Event Ontimeupdate

## HTML DOM ontimeupdate Event The `ontimeupdate` event occurs when the current playback position of an audio or video file changes. This event is continuously fired during media playback as the playhead moves, and is also triggered when the playback position is explicitly changed (such as when a user seeks to a different part of the media). --- ## Key Features and Use Cases * **Real-time Tracking:** It is most commonly used alongside the `currentTime` property of the Audio/Video object to display the current playback time. * **Custom Media Players:** Essential for updating progress bars, seek sliders, and elapsed time counters in custom HTML5 media player interfaces. * **Interactive Subtitles:** Useful for synchronizing subtitles, captions, or interactive elements with specific timestamps in the media. --- ## Browser Support The numbers in the table specify the first browser version that fully supports this event. | Event | Chrome | Internet Explorer / Edge | Firefox | Safari | Opera | | :--- | :--- | :--- | :--- | :--- | :--- | | **ontimeupdate** | Yes | 9.0 | Yes | Yes | Yes | --- ## Syntax You can register this event in three ways: ### 1. In HTML ```html ``` ### 2. In JavaScript (DOM Property) ```javascript object.ontimeupdate = function() { myScript(); }; ``` ### 3. In JavaScript (Event Listener) ```javascript object.addEventListener("timeupdate", myScript); ``` *Note: The event name is `"timeupdate"` when using `addEventListener()`.* --- ## Technical Details | Property | Value | | :--- | :--- | | **Bubbles** | No | | **Cancelable** | No | | **Event Type** | Event | | **Supported HTML Tags** | `
← Event OnvolumechangeEvent Onsuspend β†’