This page is In Progress

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

timeupdate

Overview Table

Synchronous No
Bubbles No
Target dom/Element
Cancelable No
Default action
## Examples

The following example sets the total duration value when the video is loaded and updates the current playback position as the video plays.

function timeUpdate()
{
    document.getElementById('time').innerHTML = v1.currentTime;
}
function durationChange()
{
    document.getElementById('duration').innerHTML = v1.duration;
}
<video id="v1" controls="true" autoplay="1" src="video.aac"
    ontimeupdate="timeUpdate()" ondurationchange="durationChange()"/>
<div>Time: <span id="time">0</span> of <span id="duration">0</span> seconds.</div>

Notes

Remarks

Use the currentTime property to retrieve the current playback position. For the total length of the audio or video clip, use duration. To invoke this event, do one of the following:

  • Play the video.
  • Move the position indicator on the playback controls.

Note This event is fired approximately four times a second.

Syntax

Standards information

Event handler parameters

pEvtObj [in]
Type: ****IHTMLEventObj****

See also

Related pages

Attributions