aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/htmlmediaelement/networkstate
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/networkstate
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/networkstate')
-rw-r--r--files/zh-cn/web/api/htmlmediaelement/networkstate/index.html161
1 files changed, 161 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/htmlmediaelement/networkstate/index.html b/files/zh-cn/web/api/htmlmediaelement/networkstate/index.html
new file mode 100644
index 0000000000..09164c8b35
--- /dev/null
+++ b/files/zh-cn/web/api/htmlmediaelement/networkstate/index.html
@@ -0,0 +1,161 @@
+---
+title: HTMLMediaElement.networkState
+slug: Web/API/HTMLMediaElement/networkState
+tags:
+ - API
+ - HTML DOM
+ - Web
+ - 只读
+ - 属性
+translation_of: Web/API/HTMLMediaElement/networkState
+---
+<div>{{APIRef("HTML DOM")}}</div>
+
+<p><span class="seoSummary"> <strong><code>HTMLMediaElement.networkState</code></strong> 属性表示在网络上获取媒体的当前状态。</span></p>
+
+<h2 id="Syntax" name="Syntax">语法</h2>
+
+<pre class="syntaxbox">var networkState = audioOrVideo.networkState;</pre>
+
+<h3 id="取值">取值</h3>
+
+<p>一个 <code>unsigned short</code>。可能的值包括:</p>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">常量</th>
+ <th scope="col"> 值 </th>
+ <th scope="col">描述</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td><code>NETWORK_EMPTY</code></td>
+ <td>0</td>
+ <td>还没有数据。并且 <code>readyState</code> 的值是 <code>HAVE_NOTHING</code>。</td>
+ </tr>
+ <tr>
+ <td><code>NETWORK_IDLE</code></td>
+ <td>1</td>
+ <td>HTMLMediaElement 是有效的并且已经选择了一个资源,,但是还没有使用网络。</td>
+ </tr>
+ <tr>
+ <td><code>NETWORK_LOADING</code></td>
+ <td>2</td>
+ <td>浏览器正在下载 HTMLMediaElement 数据。</td>
+ </tr>
+ <tr>
+ <td><code>NETWORK_NO_SOURCE</code></td>
+ <td>3</td>
+ <td>没有找到 HTMLMediaElement src。</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="例子">例子</h2>
+
+<p>这个例子监听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('playing', function() {
+
+ if (obj.networkState === 2) {
+ // Still loading...
+ }
+
+});
+</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.networkState")}}</td>
+ <td>{{Spec2('HTML WHATWG')}}</td>
+ <td>未对 {{SpecName('HTML5 W3C')}} 更改</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('HTML5 W3C', "embedded-content-0.html#htmlmediaelement", "HTMLMediaElement.networkState")}}</td>
+ <td>{{Spec2('HTML5 W3C')}}</td>
+ <td>初始定义。</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>Edge</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>{{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>Edge</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>{{CompatVersionUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<p>[1]  <code>NETWORK_LOADED</code> 已被移除以与Gecko 2.0的HTML规范一致。{{geckoRelease(2)}}. </p>
+
+<h2 id="See_Also" name="See_Also">另见</h2>
+
+<ul>
+ <li>定义它的接口, {{domxref("HTMLMediaElement")}}.</li>
+</ul>