timeupdate
Overview Table
Synchronous | No |
---|---|
Bubbles | No |
Target | dom/Element |
Cancelable | No |
Default action |
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
- HTML5 A vocabulary and associated APIs for HTML and XHTML, Section 4.8.9.12
Event handler parameters
- pEvtObj [in]
- Type: ****IHTMLEventObj****
See also
Related pages
- audioApiaudioApi
- audioElementaudioElement
- DocumentDocument
- sourcesource
- videoElementvideoElement
- videoApivideoApi
- WindowWindow
Reference
- currentTimecurrentTime
- durationduration
- ondurationchangeondurationchange
Attributions
Microsoft Developer Network: [Windows Internet Explorer API reference Article]