HTML DOM Video duration property
Examples
Get the current length of the video:
var x = document.getElementById ( "myVideo") duration.;
x The output is:
12.612
try it"
Definition and Usage
duration property returns the current length of the video, in seconds.
Note: Different browsers return a different value. In the above example Internet Explorer, Firefox and Chrome browser returns "12.612." Safari Back "12.612000465393066", Opera 12 returns "12.585215419" but Opera 18 returns "12.62069."
Note: This property is read-only attribute.
Browser Support
All major browsers support duration property
Note: Internet Explorer 8 or earlier browser does not support this property.
grammar
videoObject .duration
technical details
return value: | Number that is the length of the video, in seconds. If no audio / video, return NaN (Not-a-Number). If the video stream has no predefined length, return "Inf" (unlimited). |
---|
Video Object