Encrypted Media Extensions API

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since March 2019.

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

The Encrypted Media Extensions API provides interfaces for controlling the playback of content which is subject to a digital restrictions management scheme.

Access to this API is provided through Navigator.requestMediaKeySystemAccess().

Interfaces

MediaEncryptedEvent

Represents a specific encrypted event thrown when a HTMLMediaElement encounters some initialization data.

MediaKeyMessageEvent

Contains the content and related data when the content decryption module (CDM) generates a message for the session.

MediaKeys

Represents a set of keys that an associated HTMLMediaElement can use for decryption of media data during playback.

MediaKeySession

Represents a context for message exchange with a content decryption module (CDM).

MediaKeyStatusMap

A read-only map of media key statuses by key IDs.

MediaKeySystemAccess

Provides access to a key system for decryption and/or a content protection provider.

Extensions to other interfaces

The Encrypted Media Extensions API extends the following APIs, adding the listed features.

HTMLMediaElement

HTMLMediaElement.mediaKeys Read only

Provides a MediaKeys object that represents the set of keys that the element can use for decryption of media data during playback.

HTMLMediaElement.setMediaKeys()

Sets the MediaKeys that will be used to decrypt media during playback.

encrypted event

Event that is fired on a HTMLMediaElement when initialization data is encountered in the media, indicating that it is encrypted.

Returns a Promise that fulfils to a MediaKeySystemAccess object that can be used to access a particular media key system, which can in turn be used to create keys for decrypting a media stream.

Specifications

Specification
Encrypted Media Extensions
# navigator-extension-requestmediakeysystemaccess

Browser compatibility

desktop mobile server
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Node.js
requestMediaKeySystemAccess
Chrome – Full support
Chrome 42 (Release date: 2015-04-14)
footnote
footnote The spec requires that the passed supportedConfigurations option contain at least one of audioCapabilities or videoCapabilities, and that said parameters include a codec string.
footnote The function does not exist in insecure contexts. This was not enforced until Chrome 58.
Edge – Full support
Edge 13 (Release date: 2015-11-12)
footnote Full support
Firefox – Full support
Firefox 38 (Release date: 2015-05-12)
footnote
footnote Starting in Firefox 55, if neither audioCapabilities nor videoCapabilities is specified in supportedConfigurations, a warning is output to the web console.
footnote In addition, starting in Firefox 55, if in supportedConfigurations, either audioCapabilities's or videoCapabilities's contentType value doesn't specify a "codecs" substring to define allowed codecs within the media wrapper, a warning is output to the web console. See note below table for example and correction.
footnote In the future, if neither audioCapabilities nor videoCapabilities is specified in the supportedConfigurations, a NotSupported exception will be thrown.
Opera – Full support
Opera 29 (Release date: 2015-04-28)
footnote
footnote The spec requires that the passed supportedConfigurations option contain at least one of audioCapabilities or videoCapabilities, and that said parameters include a codec string.
footnote The function does not exist in insecure contexts. This was not enforced until Opera 45.
Safari – Full support
Safari 12.1 (Release date: 2019-03-25)
footnote Full support
Chrome Android – Full support
Chrome Android 42 (Release date: 2015-04-15)
footnote
footnote The spec requires that the passed supportedConfigurations option contain at least one of audioCapabilities or videoCapabilities, and that said parameters include a codec string.
footnote The function does not exist in insecure contexts. This was not enforced until Chrome Android 58.
Firefox for Android – Full support
Firefox for Android 38 (Release date: 2015-05-12)
footnote
footnote Starting in Firefox for Android 55, if neither audioCapabilities nor videoCapabilities is specified in supportedConfigurations, a warning is output to the web console.
footnote In addition, starting in Firefox for Android 55, if in supportedConfigurations, either audioCapabilities's or videoCapabilities's contentType value doesn't specify a "codecs" substring to define allowed codecs within the media wrapper, a warning is output to the web console. See note below table for example and correction.
footnote In the future, if neither audioCapabilities nor videoCapabilities is specified in the supportedConfigurations, a NotSupported exception will be thrown.
Opera Android – Full support
Opera Android 29 (Release date: 2015-04-28)
footnote
footnote The spec requires that the passed supportedConfigurations option contain at least one of audioCapabilities or videoCapabilities, and that said parameters include a codec string.
footnote The function does not exist in insecure contexts. This was not enforced until Opera 45.
Safari on iOS – Full support
Safari on iOS 12.2 (Release date: 2019-03-25)
footnote Full support
Samsung Internet – Full support
Samsung Internet 4 (Release date: 2016-03-11)
footnote
footnote The spec requires that the passed supportedConfigurations option contain at least one of audioCapabilities or videoCapabilities, and that said parameters include a codec string.
footnote The function does not exist in insecure contexts. This was not enforced until Samsung Internet 7.0.
WebView Android – Full support
WebView Android 43 (Release date: 2015-05-27)
footnote
footnote The spec requires that the passed supportedConfigurations option contain at least one of audioCapabilities or videoCapabilities, and that said parameters include a codec string.
footnote The function does not exist in insecure contexts. This was not enforced until version 58.
WebView on iOS – Full support
WebView on iOS 12.2 (Release date: 2019-03-25)
footnote Full support
Node.js – No support
Node.js
footnote No support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
See implementation notes.