HTML Audio/Video DOM duration Property
HTML Audio/Video DOM Reference
Example
Get the length of the current video:
myVid=document.getElementById("video1");
alert(myVid.duration);
Try it »
Definition and Usage
The duration property returns the length of the current audio/video, in seconds.
If no audio/video is set, NaN (Not-a-Number) is returned.
Browser support





All major browsers support the duration attribute.
**Note:** Internet Explorer 8 and earlier versions do not support this property.
Syntax
audio|video
.duration
Technical Details
| Return Value: | A numeric value representing the length of the audio/video, in seconds. |
|---|
HTML Audio/Video DOM Reference