YouTip LogoYouTip

Prop Video Duration

# HTML DOM Video duration property [![Image 8: Video Object Reference](#) Video Object](#) ## Example Get the length of the current video: ```javascript var x = document.getElementById("myVideo").duration; The output of _x_ is: 12.612 [Try it yourself Β»](#) * * * ## Definition and Usage The duration property returns the length of the current video, in seconds. **Note:** Different browsers return different values. In the example above, 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 ![Image 9: Internet Explorer](#)![Image 10: Firefox](#)![Image 11: Opera](#)![Image 12: Google Chrome](#)![Image 13: Safari](#) The duration property is supported by all major browsers. **Note:** Internet Explorer 8 or earlier versions do not support this property. * * * ## Syntax _videoObject_.duration ## Technical Details | Return Value: | A number representing the length of the video, in seconds. If the audio/video is not set, it returns NaN (Not-a-Number). If the video stream has no predefined length, it returns "Inf" (Infinity). | | --- | * * Video Object](#)
← Prop Video DurationProp Video Defaultplaybackrate β†’