MediaKeySession

这是 实验性技术
检查 浏览器兼容性表格 在生产中使用这之前。

MediaKeySession interface of the EncryptedMediaExtensions API represents a context for message exchange with a content decryption module (CDM).

特性

MediaKeySession.closed 只读
返回 Promise signaling when a MediaKeySession 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.
MediaKeySession.expiration 只读
The time after which the keys in the current session can no longer be used to decrypt media data, or NaN 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.
MediaKeySession.keyStatuses 只读
Contains a reference to a read-only MediaKeyStatusMap of the current session's keys and their statuses.
MediaKeySession.sessionId 只读
Contains a unique string generated by the CDM for the current media object and its associated keys or licenses.

事件处理程序

MediaKeySession.onkeystatuseschange
设置 EventHandler called when there has been a change in the keys in a session or their statuses.
MediaKeySession.onmessage
设置 EventHandler called when the content decryption module has generated a message for the session.

方法

MediaKeySession.close()

返回 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.

MediaKeySession.generateRequest()
返回 Promise after generating a media request based on initialization data.
MediaKeySession.load()
返回 Promise that resolves to a boolean value after loading data for a specified session object.
MediaKeySession.remove()
返回 Promise after removing any session data associated with the current object.
MediaKeySession.update()
返回 Promise after loading messages and licenses to the CDM.

范例

// TBD
					

规范

规范 状态 Comment
加密媒体扩展
The definition of 'MediaKeySession' in that specification.
Recommendation 初始定义。

浏览器兼容性

更新 GitHub 上的兼容性数据
Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
MediaKeySession
Chrome 42 Edge ≤18 Firefox Yes IE ? Opera Yes Safari ? WebView Android 43 Chrome Android 42 Firefox Android Yes Opera Android Yes Safari iOS ? Samsung Internet Android 4.0
close
Chrome 42 Edge 13 Firefox Yes IE ? Opera Yes Safari ? WebView Android 43 Chrome Android 42 Firefox Android Yes Opera Android Yes Safari iOS ? Samsung Internet Android 4.0
closed
Chrome 42 Edge 13 Firefox Yes IE ? Opera Yes Safari ? WebView Android 43 Chrome Android 42 Firefox Android Yes Opera Android Yes Safari iOS ? Samsung Internet Android 4.0
expiration
Chrome 42 Edge 13 Firefox Yes IE ? Opera Yes Safari ? WebView Android 43 Chrome Android 42 Firefox Android Yes Opera Android Yes Safari iOS ? Samsung Internet Android 4.0
generateRequest
Chrome 42 Edge 13 Firefox Yes IE ? Opera Yes Safari ? WebView Android 43 Chrome Android 42 Firefox Android Yes Opera Android Yes Safari iOS ? Samsung Internet Android 4.0
keyStatuses
Chrome 42 Edge 13 Firefox Yes IE ? Opera Yes Safari ? WebView Android 43 Chrome Android 42 Firefox Android Yes Opera Android Yes Safari iOS ? Samsung Internet Android 4.0
load
Chrome 42 Edge 13 Firefox Yes IE ? Opera Yes Safari ? WebView Android 43 Chrome Android 42 Firefox Android Yes Opera Android Yes Safari iOS ? Samsung Internet Android 4.0
onkeystatuseschange
Chrome 55 Edge ≤79 Firefox Yes IE ? Opera 42 Safari ? WebView Android 43 Chrome Android 55 Firefox Android Yes Opera Android 42 Safari iOS ? Samsung Internet Android 6.0
onmessage
Chrome 55 Edge ≤79 Firefox Yes IE ? Opera 42 Safari ? WebView Android 43 Chrome Android 55 Firefox Android Yes Opera Android 42 Safari iOS ? Samsung Internet Android 6.0
remove
Chrome 42 Edge 13 Firefox Yes IE ? Opera Yes Safari ? WebView Android 43 Chrome Android 42 Firefox Android Yes Opera Android Yes Safari iOS ? Samsung Internet Android 4.0
sessionId
Chrome 42 Edge 13 Firefox Yes IE ? Opera Yes Safari ? WebView Android 43 Chrome Android 42 Firefox Android Yes Opera Android Yes Safari iOS ? Samsung Internet Android 4.0
update
Chrome 42 Edge 13 Firefox Yes IE ? Opera Yes Safari ? WebView Android 43 Chrome Android 42 Firefox Android Yes Opera Android Yes Safari iOS ? Samsung Internet Android 4.0

图例

完整支持
完整支持
兼容性未知
兼容性未知
实验。期望将来行为有所改变。
实验。期望将来行为有所改变。