aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/timeranges/start/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/zh-cn/web/api/timeranges/start/index.html')
-rw-r--r--files/zh-cn/web/api/timeranges/start/index.html72
1 files changed, 72 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/timeranges/start/index.html b/files/zh-cn/web/api/timeranges/start/index.html
new file mode 100644
index 0000000000..48f53a9a02
--- /dev/null
+++ b/files/zh-cn/web/api/timeranges/start/index.html
@@ -0,0 +1,72 @@
+---
+title: TimeRanges.start()
+slug: Web/API/TimeRanges/start
+translation_of: Web/API/TimeRanges/start
+---
+<p>{{APIRef("DOM")}}</p>
+
+<p>{{gecko_minversion_header("2.0")}}</p>
+
+<p>返回指定时间范围的开始偏移量。</p>
+
+<h2 id="语法">语法</h2>
+
+<pre class="syntaxbox"><em>startTime</em> = TimeRanges.start(index)
+</pre>
+
+<h3 id="参数">参数</h3>
+
+<ul>
+ <li><code>index</code> 想要检索的时间范围的索引值。</li>
+</ul>
+
+<h3 id="异常">异常</h3>
+
+<dl>
+ <dt>INDEX_SIZE_ERR</dt>
+ <dd>如果不存在指定索引值的时间范围,抛出 <code>DOMException</code> 异常。</dd>
+</dl>
+
+<h2 id="示例">示例</h2>
+
+<p>假定页面中存在一个ID为“myVideo”的 video 元素:</p>
+
+<pre class="brush: js">var v = document.getElementById("myVideo");
+
+var buf = v.buffered;
+
+var numRanges = buf.length;
+
+if (buf.length == 1) {
+ // only one range
+ if (buf.start(0) == 0 &amp;&amp; buf.end(0) == v.duration) {
+ // The one range starts at the beginning and ends at
+ // the end of the video, so the whole thing is loaded
+ }
+}
+</pre>
+
+<p>这个例子演示了如何通过 <code>TimeRanges</code> 来判断 video 是否已经完全加载。</p>
+
+<h2 id="规范">规范</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName("HTML WHATWG", "#dom-timeranges-start", "TimeRanges.start()")}}</td>
+ <td>{{Spec2("HTML WHATWG")}}</td>
+ <td>Initial definition</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="浏览器兼容性">浏览器兼容性</h2>
+
+
+
+<p>{{Compat("api.TimeRanges.start")}}</p>