MediaKeySession

The MediaKeySession interface of the Encrypted Media Extensions API represents a context for message exchange with a content decryption module (CDM). Available only in secure contexts.

MDN Reference

Properties

Link copied to clipboard

The closed read-only property of the MediaKeySession interface returns a Promise signaling when a MediaKeySession closes.

Link copied to clipboard

The expiration read-only property of the MediaKeySession interface returns 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.

Link copied to clipboard

The keyStatuses read-only property of the MediaKeySession interface returns a reference to a read-only MediaKeyStatusMap of the current session's keys and their statuses.

Link copied to clipboard

The sessionId read-only property of the MediaKeySession interface contains a unique string generated by the content decryption module (CDM) for the current media object and its associated keys or licenses.

Functions

Link copied to clipboard
suspend fun close()

The close() method of the MediaKeySession interface notifies that the current media session is no longer needed, and that the content decryption module should release any resources associated with this object and close it.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
suspend fun generateRequest(initDataType: String, initData: BufferSource)

The generateRequest() method of the MediaKeySession interface returns a Promise after generating a license request based on initialization data.

Link copied to clipboard
fun generateRequestAsync(initDataType: String, initData: BufferSource): Promise<Void>
Link copied to clipboard
suspend fun load(sessionId: String): Boolean

The load() method of the MediaKeySession interface returns a Promise that resolves to a boolean value after loading data for a specified session object.

Link copied to clipboard
fun loadAsync(sessionId: String): Promise<JsBoolean>
Link copied to clipboard
suspend fun remove()

The remove() method of the MediaKeySession interface returns a Promise after removing any session data associated with the current object.

Link copied to clipboard
Link copied to clipboard
suspend fun update(response: BufferSource)

The update() method of the MediaKeySession interface loads messages and licenses to the CDM, and then returns a Promise.

Link copied to clipboard
Link copied to clipboard