EN
Ce contenu n’est pas disponible dans votre langue. Voici la version anglaise.

durationchange | ondurationchange event

Occurs when the duration attribute is updated.

HTML5 A vocabulary and associated APIs for HTML and XHTML, Section 4.8.9.12Internet Explorer 9

Syntax

HTML Attribute <element ondurationchange = "handler(event)">
Event Property object.ondurationchange = handler;
addEventListener Method object.addEventListener("durationchange", handler, useCapture)

Event information

SynchronousNo
BubblesNo
CancelableNo

Event handler parameters

handler [in]

Type: function

Event handler object.

Standards information

Remarks

Use the duration property to determine the new duration of the clip.

This event occurs immediately after onloadstart and before onloadedmetadata.

To invoke this event, do one of the following:

  • Load a media resource.

Examples

The following example reads the total duration 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>

See also

audio
audio
document
source
video element
video object
window
Reference
onloadedmetadata
ontimeupdate

 

 

Afficher:
© 2014 Microsoft. Tous droits réservés.