Easy Tutorial
❮ Prop Url Size Met Win Scrollby ❯

Video duration Property

Video Object

Example

Get the length of the current video:

var x = document.getElementById("myVideo").duration;

x output result:

12.612

Definition and Usage

The duration property returns the length of the current video in seconds.

Note: Different browsers return different values. In the above example, Internet Explorer, Firefox, and Chrome return "12.612". Safari returns "12.612000465393066", Opera 12 returns "12.585215419", but Opera 18 returns "12.62069".

Note: This property is read-only.


Browser Support

All major browsers support the duration property.

Note: Internet Explorer 8 or earlier versions do not support this property.


Syntax

Technical Details

| Return Value: | A number representing the length of the video in seconds. Returns NaN (Not-a-Number) if the audio/video is not set. Returns "Inf" (infinite) if the video stream has no predefined length. | | --- | --- |

❮ Prop Url Size Met Win Scrollby ❯