ondurationchange event
JavaScript is performed when the length of the video changes:
Try it out . . .
More examples are included at the bottom of this article.
Definitions and usages
The ondurationchange event is triggered when the length of the video/audio/video changes.
Note: When the video/audio/video has been loaded, the length of the video/audio (audio/video) is modified from "NaN" to the time it is being.
During the video/audio/video loading process, the events are triggered in the following order:
- onloadstart
- ondurationchange
- onloadedmetadata
- onloadeddata
- onprogress
- oncanplay
-
oncanplaythrough
Browser support
The numbers in the table support the version number of the first browser for the event.
Event | |||||
---|---|---|---|---|---|
ondurationchange | Yes | 9.0 | Yes | Yes | Yes |
Grammar
In HTML:
In JavaScript:
In JavaScript, use the addEventListener() method:
Note: The addEventListener() method is not supported in Internet Explorer 8 and earlier versions of IE.
Technical details
Whether to support bubbling: | No |
---|---|
Can I cancel: | No |
Types of events: | Event |
Supported HTML tags: | <audio>, <video> |
More instances
JavaScript is performed when audio starts loading:
Try it out . . .
The event object