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 generateRequest() method of the MediaKeySession interface returns a Promise after generating a license request based on initialization data.
generateRequest(initDataType, initData)
initDataTypeA string that specifies the format of the initData parameter. This must be one of the following values:
initDataInitialization data for the request, in the format specified by initDataType. It is an instance of any of the following types:
A Promise.
TypeErrorRaised if initDataType is an empty string, if initData is an empty array, or if the provided initData is not valid according to the specified initDataType.
NotSupportedError DOMException
Raised if the Key System implementation associated with the MediaKeySession object does not support the provided initDataType, if the sanitized initialization data is empty, or if the sanitized initialization data is not supported by the content decryption module (CDM).
QuotaExceededErrorRaised if the operation fails due to a lack of resources on the user agent or CDM.
InvalidStateError DOMException
Raised if the MediaKeySession object is in a closing or closed state, or if it has already been initialized.
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
generateRequest |
42 | 13 | 38 | 29 | 12.1 | 42 | 38 | 29 | 12.2 | 4.0 | 43 | 12.2 |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/MediaKeySession/generateRequest