HTML Audio / Video DOM duration property
HTML Audio / Video DOM Reference
Examples
Get the current length of the video:
myVid=document.getElementById("video1");
alert(myVid.duration);
alert(myVid.duration);
try it"
Definition and Usage
duration property returns the current length of the audio / video in seconds.
If no audio / video, return NaN (Not-a-Number).
Browser Support
All major browsers support duration property.
Note: 8 and earlier versions of Internet Explorer does not support this property.
grammar
audio|video .duration
technical details
返回值: | 数字值,表示音频/视频的长度,以秒计。 |
---|
HTML Audio / Video DOM Reference