HTMLMediaElement: setMediaKeys() method

Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

The setMediaKeys() method of the HTMLMediaElement interface returns a Promise that resolves to the passed MediaKeys, which are those used to decrypt media during playback.

Syntax

js
setMediaKeys(mediaKeys)

Parameters

mediaKeys

A reference to a MediaKeys object that the HTMLMediaElement can use for decryption of media data during playback.

Return value

A Promise that resolves to the passed instance of MediaKeys.

Specifications

Specification
Encrypted Media Extensions
# dom-htmlmediaelement-setmediakeys

Browser compatibility

BCD tables only load in the browser