此頁面由社群從英文翻譯而來。了解更多並加入 MDN Web Docs 社群。
加密媒體擴充 API
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2019年3月.
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
加密媒體擴充 API(Encrypted Media Extensions API)提供用以控制受數位版權管理(DRM)機制保護的影音內容播放的介面。
可以透過 Navigator.requestMediaKeySystemAccess() 存取此 API。
介面
MediaEncryptedEvent-
表示當
HTMLMediaElement偵測到初始化資料時觸發的特定encrypted事件。 MediaKeyMessageEvent-
包含當內容解密模組(CDM)為會話產生訊息時的內容與相關資料。
MediaKeys-
表示一組能讓關聯的
HTMLMediaElement在播放時解密媒體資料的金鑰。 MediaKeySession-
表示與內容解密模組(CDM)交換訊息的上下文。
MediaKeyStatusMap-
提供金鑰 ID 與金鑰狀態之間的唯讀對應表。
MediaKeySystemAccess-
提供可用於解密或內容保護的金鑰系統存取權限。
擴充其他介面
加密媒體擴充 API 會擴充以下 API,並加上這些功能。
HTMLMediaElement
HTMLMediaElement.mediaKeysRead only-
提供一個
MediaKeys物件,代表這個元素在播放時可以用來解密媒體資料的金鑰集合。 HTMLMediaElement.setMediaKeys()-
設定
MediaKeys,讓這個元素在播放時能夠解密媒體內容。 encrypted事件-
當媒體內含的初始化資料被偵測到時,會在
HTMLMediaElement上觸發這個事件,表示該媒體已加密。
Navigator
-
回傳一個
Promise,兌現後會獲得MediaKeySystemAccess物件。這個物件可用來存取特定的媒體金鑰系統,接著就能建立金鑰來解密媒體串流。
規範
| Specification |
|---|
| Encrypted Media Extensions> # navigator-extension-requestmediakeysystemaccess> |
瀏覽器相容性
Enable JavaScript to view this browser compatibility table.