HTML Audio/Video DOM durationchange Event
HTML Audio/Video DOM Reference
Example
Display a message when the video's duration changes:
myVid=document.getElementById("video1");
myVid.ondurationchange=alert("The video duration has changed");
Try it »
Definition and Usage
The durationchange event occurs when the duration data of the specified audio/video changes.
Once the audio/video is loaded, the duration changes from "NaN" to the actual duration of the audio/video.
While the audio/video is loading, the following events occur in order:
- loadstart
- durationchange
- loadedmetadata
- loadeddata
- progress
- canplay
- canplaythrough
Browser support





All major browsers support the durationchange event.
**Note:** Internet Explorer 8 and earlier versions do not support this event.
Syntax
In HTML: