HTMLMediaElement.duration

这篇翻译不完整。请帮忙从英语翻译这篇文章

HTMLMediaElement.duration 属性以秒为单位给出媒体的长度,如果没有媒体数据可用,则为零。

语法

var myDuration = audioOrVideo.duration

 如果媒体数据可用但长度未知,则此值为NaN。 如果媒体流式传输且没有预定义长度,则值为Inf。

例子

var obj = document.createElement('video');
console.log(obj.duration); // NaN

规范

规范 状态 注释
HTML Living Standard
HTMLMediaElement.duration
Living Standard No change from HTML5
HTML5
HTMLMediaElement.duration
Recommendation Initial definition.

浏览器支持

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidiOS SafariSamsung Internet
Basic supportChrome Full support YesEdge Full support YesFirefox Full support 3.5IE Full support 9Opera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support YesSamsung Internet Android ?

Legend

Full support  
Full support
Compatibility unknown  
Compatibility unknown

相关内容

文档标签和贡献者

标签: 
此页面的贡献者: terry-ice
最后编辑者: terry-ice,