aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/htmlmediaelement/readystate
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/htmlmediaelement/readystate
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/zh-cn/web/api/htmlmediaelement/readystate')
-rw-r--r--files/zh-cn/web/api/htmlmediaelement/readystate/index.html158
1 files changed, 158 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/htmlmediaelement/readystate/index.html b/files/zh-cn/web/api/htmlmediaelement/readystate/index.html
new file mode 100644
index 0000000000..845b06d2aa
--- /dev/null
+++ b/files/zh-cn/web/api/htmlmediaelement/readystate/index.html
@@ -0,0 +1,158 @@
+---
+title: HTMLMediaElement.readyState
+slug: Web/API/HTMLMediaElement/readyState
+translation_of: Web/API/HTMLMediaElement/readyState
+---
+<div>{{APIRef("HTML DOM")}}</div>
+
+<p><strong><code>HTMLMediaElement.readyState </code></strong>属性返回音频/视频的当前就绪状态。</p>
+
+<h2 id="Syntax" name="Syntax">语法</h2>
+
+<pre class="syntaxbox">var readyState = audioOrVideo.readyState;</pre>
+
+<h3 id="返回值">返回值</h3>
+
+<p>无符号整型 An <code>unsigned short</code>.</p>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">Constant</th>
+ <th scope="col">Value</th>
+ <th scope="col">Description</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>HAVE_NOTHING</td>
+ <td>0</td>
+ <td>没有关于音频/视频是否就绪的信息</td>
+ </tr>
+ <tr>
+ <td>HAVE_METADATA</td>
+ <td>1</td>
+ <td>音频/视频已初始化</td>
+ </tr>
+ <tr>
+ <td>HAVE_CURRENT_DATA</td>
+ <td>2</td>
+ <td>数据已经可以播放(当前位置已经加载) 但没有数据能播放下一帧的内容</td>
+ </tr>
+ <tr>
+ <td>HAVE_FUTURE_DATA</td>
+ <td>3</td>
+ <td>当前及至少下一帧的数据是可用的(换句话来说至少有两帧的数据)</td>
+ </tr>
+ <tr>
+ <td>HAVE_ENOUGH_DATA</td>
+ <td>4</td>
+ <td> 可用数据足以开始播放-如果网速得到保障 那么视频可以一直播放到底</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="实例">实例</h2>
+
+<p>这个例子会监听id为example的 audio 的数据. 他会检查当前位置是否可以播放, 会的话执行播放。</p>
+
+<pre class="brush: html">&lt;audio id="example" preload="auto"&gt;
+ &lt;source src="sound.ogg" type="audio/ogg" /&gt;
+&lt;/audio&gt;
+
+</pre>
+
+<pre class="brush: js">var obj = document.getElementById('example');
+
+obj.addEventListener('loadeddata', function() {
+
+ if(obj.readyState &gt;= 2) {
+ obj.play();
+ }
+
+});
+</pre>
+
+<p> </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', "the-video-element.html#htmlmediaelement", "HTMLMediaElement.readyState")}}</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.readyState")}}</td>
+ <td>{{Spec2('HTML5 W3C')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="浏览器兼容性">浏览器兼容性</h2>
+
+<p>{{ CompatibilityTable() }}</p>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatGeckoDesktop("1.9.1")}} [1]</td>
+ <td>{{CompatIE("9")}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>Firefox OS (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<p>[1] The <code>NETWORK_LOADED</code> state was removed to align with the HTML spec in Gecko 2.0 {{geckoRelease(2)}}. </p>
+
+<h2 id="See_Also" name="See_Also">你或许还可以看看</h2>
+
+<ul>
+ <li>The interface defining it, {{domxref("HTMLMediaElement")}}.</li>
+</ul>