as

Settings
Sign out
Notifications
Alexa
亚马逊应用商店
AWS
文档
Support
Contact Us
My Cases
新手入门
设计和开发
应用发布
参考
支持
感谢您的访问。此页面目前仅提供英语版本。我们正在开发中文版本。谢谢您的理解。

MediaKeys

The MediaKeys object represents a set of keys that an associated HTMLMediaElement can use for decryption of media data during playback. It also represents a CDM instance.

For more information, see https://www.w3.org/TR/encrypted-media/#mediakeys-interface

Methods

createSession()

createSession(sessionType?): MediaKeySession

Creates a new MediaKeySession object.

For more information, see https://www.w3.org/TR/encrypted-media/#dom-mediakeys-createsession.

Parameters

sessionType?

MediaKeySessionType

The type of session to create. The session type affects the behavior of the returned object.

Returns

MediaKeySession


getStatusForPolicy()

getStatusForPolicy(policy?): Promise<MediaKeyStatus>

Returns a MediaKeyStatus for a given MediaKeysPolicy.

For more information, see https://www.w3.org/TR/encrypted-media/#dom-mediakeys-getstatusforpolicy

Parameters

policy?

MediaKeysPolicy

Returns

Promise<MediaKeyStatus>


setServerCertificate()

setServerCertificate(serverCertificate): Promise<boolean>

Provides a server certificate to be used to encrypt messages to the license server.

For more information, see https://www.w3.org/TR/encrypted-media/#dom-mediakeys-setservercertificate.

Parameters

serverCertificate

ArrayBuffer

The server certificate. The contents are Key System-specific. It must not contain executable code.

Returns

Promise<boolean>

Promise Resolved when certificate is successfully set. Reject if failed.


Last updated: Oct 02, 2025