Latest web development tutorials

ondurationchange event

Event Object Reference Event objects

Examples

JavaScript is executed when a change in the length of the video:

<Video ondurationchange = "myFunction ()">

try it"

Bottom of this article contains more examples.


Definition and Usage

ondurationchange event video / audio (audio / video) Duration trigger change.

Note: When the video / audio (audio / video) has been loaded, the video / audio (audio / video) the length of time from the "NaN" is modified to the length of time.

In the video / audio (audio / video) loading process, triggering the sequence of events is as follows:

  1. onloadstart
  2. ondurationchange
  3. onloadedmetadata
  4. onloadeddata
  5. onprogress
  6. oncanplay
  7. oncanplaythrough

Browser Support

Figures in the table represent the first browser to support this version of events.

event
ondurationchange Yes 9.0 Yes Yes Yes


grammar

In HTML:

<Elementondurationchange = "myScript"> try

In JavaScript:

object .ondurationchange = function () {myScript }; try

JavaScript, use the addEventListener () method:

object .addEventListener ( "durationchange", myScript ); try

Note: Internet Explorer 8 and earlier versions of IE do not support addEventListener () method.


technical details
Whether to support the bubble: No
It can be canceled: No
Event Type: Event
Supported HTML tags: <Audio>, <video>


Examples

More examples

Examples

Executed when the audio starts loading JavaScript:

<Audio ondurationchange = "myFunction ()">

try it"


Event Object Reference Event objects