aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/htmlmediaelement/duration/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/zh-cn/web/api/htmlmediaelement/duration/index.html')
-rw-r--r--files/zh-cn/web/api/htmlmediaelement/duration/index.html61
1 files changed, 61 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/htmlmediaelement/duration/index.html b/files/zh-cn/web/api/htmlmediaelement/duration/index.html
new file mode 100644
index 0000000000..575e8be90c
--- /dev/null
+++ b/files/zh-cn/web/api/htmlmediaelement/duration/index.html
@@ -0,0 +1,61 @@
+---
+title: HTMLMediaElement.duration
+slug: Web/API/HTMLMediaElement/duration
+tags:
+ - API
+ - HTML
+ - Video
+ - Web
+translation_of: Web/API/HTMLMediaElement/duration
+---
+<div>{{APIRef("HTML DOM")}}</div>
+
+<p><strong><code>HTMLMediaElement.duration</code></strong> 属性以秒为单位给出媒体的长度,如果没有媒体数据可用,则为零。</p>
+
+<h2 id="Syntax" name="Syntax">语法</h2>
+
+<pre class="brush: js">var <em>myDuration</em> = <em>audioOrVideo</em>.duration</pre>
+
+<h3 id="值">值</h3>
+
+<p> 如果媒体数据可用但长度未知,则此值为NaN。 如果媒体流式传输且没有预定义长度,则值为Inf。</p>
+
+<h2 id="例子">例子</h2>
+
+<pre class="brush: js">var obj = document.createElement('video');
+console.log(obj.duration); // NaN
+</pre>
+
+<h2 id="规范">规范</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">规范</th>
+ <th scope="col">状态</th>
+ <th scope="col">注释</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('HTML WHATWG', "the-video-element.html#htmlmediaelement", "HTMLMediaElement.duration")}}</td>
+ <td>{{Spec2('HTML WHATWG')}}</td>
+ <td>No change from {{SpecName('HTML5 W3C')}}</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('HTML5 W3C', "embedded-content-0.html#htmlmediaelement", "HTMLMediaElement.duration")}}</td>
+ <td>{{Spec2('HTML5 W3C')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="浏览器支持">浏览器支持</h2>
+
+<div class="hidden">此页面上的兼容性表格由结构化数据生成。 如果您想为数据做出贡献,请查看<a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> 并向我们发送拉取请求。</div>
+
+<p>{{Compat("api.HTMLMediaElement.duration")}}</p>
+
+<h2 id="See_Also" name="See_Also">相关内容</h2>
+
+<ul>
+ <li>定义它的接口, {{domxref("HTMLMediaElement")}}.</li>
+</ul>