diff options
Diffstat (limited to 'files/zh-cn/web/api/mediakeysession')
-rw-r--r-- | files/zh-cn/web/api/mediakeysession/index.html | 161 | ||||
-rw-r--r-- | files/zh-cn/web/api/mediakeysession/load/index.html | 100 |
2 files changed, 261 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/mediakeysession/index.html b/files/zh-cn/web/api/mediakeysession/index.html new file mode 100644 index 0000000000..2896b7eb8b --- /dev/null +++ b/files/zh-cn/web/api/mediakeysession/index.html @@ -0,0 +1,161 @@ +--- +title: MediaKeySession +slug: Web/API/MediaKeySession +tags: + - API + - Audio + - EncryptedMediaExtensions + - Interface + - Media + - MediaKeySession + - NeedsExample + - NeedsTranslation + - Reference + - TopicStub + - Video +translation_of: Web/API/MediaKeySession +--- +<p>{{APIRef("EncryptedMediaExtensions")}}{{SeeCompatTable}}</p> + +<p>The <code><strong>MediaKeySession</strong></code> interface of the <a href="/en-US/docs/Web/API/EncryptedMediaExtensions_API">EncryptedMediaExtensions API</a> represents a context for message exchange with a content decryption module (CDM).</p> + +<h2 id="Properties">Properties</h2> + +<dl> + <dt>{{domxref("MediaKeySession.closed")}} {{readonlyInline}}</dt> + <dd>Returns a {{jsxref("Promise")}} signaling when a <code>MediaKeySession</code> closes. This promise can only be fulfilled and is never rejected. Closing a session means that licenses and keys associated with it are no longer valid for decrypting media data. </dd> + <dt>{{domxref("MediaKeySession.expiration")}} {{readonlyInline}}</dt> + <dd>The time after which the keys in the current session can no longer be used to decrypt media data, or <code>NaN</code> if no such time exists. This value is determined by the CDM and measured in milliseconds since January 1, 1970, UTC. This value may change during a session lifetime, such as when an action triggers the start of a window.</dd> + <dt>{{domxref("MediaKeySession.keyStatuses")}} {{readonlyInline}}</dt> + <dd>Contains a reference to a read-only {{domxref("MediaKeyStatusMap")}} of the current session's keys and their statuses.</dd> + <dt>{{domxref("MediaKeySession.sessionId")}} {{readonlyInline}}</dt> + <dd>Contains a unique string generated by the CDM for the current media object and its associated keys or licenses.</dd> +</dl> + +<h3 id="Event_handlers">Event handlers</h3> + +<dl> + <dt>{{domxref("MediaKeySession.onkeystatuseschange")}}</dt> + <dd>Sets the {{domxref('EventHandler')}} called when there has been a change in the keys in a session or their statuses.</dd> + <dt>{{domxref("MediaKeySession.onmessage")}}</dt> + <dd>Sets the {{domxref('EventHandler')}} called when the content decryption module has generated a message for the session.</dd> +</dl> + +<h2 id="Methods">Methods</h2> + +<dl> + <dt>{{domxref("MediaKeySession.close()")}}</dt> + <dd> + <p class="p1">Returns a {{jsxref("Promise")}} after notifying the current media session is no longer needed and that the CDM should release any resources associated with this object and close it.</p> + </dd> + <dt>{{domxref("MediaKeySession.generateRequest()")}}</dt> + <dd>Returns a {{jsxref("Promise")}} after generating a media request based on initialization data.</dd> + <dt>{{domxref("MediaKeySession.load()")}}</dt> + <dd>Returns a {{jsxref("Promise")}} that resolves to a boolean value after loading data for a specified session object. </dd> + <dt>{{domxref("MediaKeySession.remove()")}}</dt> + <dd>Returns a {{jsxref("Promise")}} after removing any session data associated with the current object.</dd> + <dt>{{domxref("MediaKeySession.update()")}}</dt> + <dd>Returns a {{jsxref("Promise")}} after loading messages and licenses to the CDM.</dd> +</dl> + +<h2 id="Examples">Examples</h2> + +<pre class="brush: js">// TBD</pre> + +<h2 id="Specifications">Specifications</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('EME', '#mediakeysession-interface', 'MediaKeySession')}}</td> + <td>{{Spec2('EME')}}</td> + <td>Initial definition.</td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility">Browser compatibility</h2> + +<div>{{CompatibilityTable}}</div> + +<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 (WebKit)</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatChrome(42.0)}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatUnknown}}</td> + </tr> + <tr> + <td><code>onkeystatuseschange</code> and <code>onmessage</code></td> + <td>{{CompatChrome(55.0)}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatOpera(42)}}</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>Android Webview</th> + <th>Edge</th> + <th>Firefox Mobile (Gecko)</th> + <th>Firefox OS</th> + <th>IE Mobile</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> + <th>Chrome for Android</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatNo}}</td> + <td>{{CompatChrome(43.0)}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatChrome(42.0)}}</td> + </tr> + <tr> + <td><code>onkeystatuseschange</code> and <code>onmessage</code></td> + <td>{{CompatNo}}</td> + <td>{{CompatChrome(55.0)}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatOperaMobile(42)}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatChrome(55.0)}}</td> + </tr> + </tbody> +</table> +</div> diff --git a/files/zh-cn/web/api/mediakeysession/load/index.html b/files/zh-cn/web/api/mediakeysession/load/index.html new file mode 100644 index 0000000000..a0e7d234f8 --- /dev/null +++ b/files/zh-cn/web/api/mediakeysession/load/index.html @@ -0,0 +1,100 @@ +--- +title: load() +slug: Web/API/MediaKeySession/load +translation_of: Web/API/MediaKeySession/load +--- +<div><font><font>{{APIRef("EncryptedMediaExtensions")}} {{SeeCompatTable}}</font></font></div> + +<p><font><font>该</font></font><code>MediaKeySession.load()</code><font><font>方法返回一个{{jsxref("Promise")}},它在加载指定的会话对象的数据后解析为一个布尔值。</font></font></p> + +<h2 id="句法"><font><font>句法</font></font></h2> + +<pre class="syntaxbox"><var><font><font>mediaKeySession .load(</font></font></var><var><font><font>sessionId)</font></font></var><font><var><font>.then(</font></var><font>function(</font></font><var><font><font>booleanValue</font></font></var><font><font>){...});</font></font></pre> + +<h3 id="参数"><font><font>参数</font></font></h3> + +<dl> + <dt><font><font>的sessionId</font></font></dt> + <dd><font><font>由当前媒体对象及其相关键或许可证的内容解析模块生成的唯一字符串。</font></font></dd> +</dl> + +<h3 id="返回值"><font><font>返回值</font></font></h3> + +<p><font><font>一个{{jsxref("Promise")}}解析为一个布尔值,指示加载是成功还是失败。</font></font></p> + +<h2 id="产品规格"><font><font>产品规格</font></font></h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col"><font><font>规范</font></font></th> + <th scope="col"><font><font>状态</font></font></th> + <th scope="col"><font><font>评论</font></font></th> + </tr> + <tr> + <td><font><font>{{SpecName('EME','#widl-MediaKeySession-load-Promise-boolean - DOMString-sessionId','load()')}}</font></font></td> + <td><font><font>{{Spec2('EME')}}</font></font></td> + <td><font><font>初始定义</font></font></td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容"><font><font>浏览器兼容</font></font></h2> + +<div><font><font>{{CompatibilityTable}}</font></font></div> + +<div id="compat-desktop"> +<table class="compat-table"> + <tbody> + <tr> + <th><font><font>特征</font></font></th> + <th><font><font>铬</font></font></th> + <th><font><font>边缘</font></font></th> + <th><font><font>Firefox(Gecko)</font></font></th> + <th><font><font>IE浏览器</font></font></th> + <th><font><font>歌剧</font></font></th> + <th><font><font>Safari(WebKit)</font></font></th> + </tr> + <tr> + <td><font><font>基本支持</font></font></td> + <td><font><font>{{CompatChrome(42.0)}}</font></font></td> + <td><font><font>{{CompatVersionUnknown}}</font></font></td> + <td><font><font>{{CompatUnknown}}</font></font></td> + <td><font><font>{{CompatUnknown}}</font></font></td> + <td><font><font>{{CompatUnknown}}</font></font></td> + <td><font><font>{{CompatUnknown}}</font></font></td> + </tr> + </tbody> +</table> +</div> + +<div id="compat-mobile"> +<table class="compat-table"> + <tbody> + <tr> + <th><font><font>特征</font></font></th> + <th><font><font>Android的</font></font></th> + <th><font><font>Android Webview</font></font></th> + <th><font><font>边缘</font></font></th> + <th><font><font>Firefox Mobile(Gecko)</font></font></th> + <th><font><font>Firefox操作系统</font></font></th> + <th><font><font>IE Mobile</font></font></th> + <th><font><font>歌剧手机</font></font></th> + <th><font><font>Safari手机</font></font></th> + <th><font><font>适用于Android的Chrome</font></font></th> + </tr> + <tr> + <td><font><font>基本支持</font></font></td> + <td><font><font>{{CompatNo}}</font></font></td> + <td><font><font>{{CompatChrome(43.0)}}</font></font></td> + <td><font><font>{{CompatVersionUnknown}}</font></font></td> + <td><font><font>{{CompatUnknown}}</font></font></td> + <td><font><font>{{CompatUnknown}}</font></font></td> + <td><font><font>{{CompatUnknown}}</font></font></td> + <td><font><font>{{CompatUnknown}}</font></font></td> + <td><font><font>{{CompatUnknown}}</font></font></td> + <td><font><font>{{CompatChrome(42.0)}}</font></font></td> + </tr> + </tbody> +</table> +</div> |