Encrypted Media Extensions
The generateRequest() method of the MediaKeySession interface returns a Promise after generating a license request based on initialization data.
Syntax
generateRequest(initDataType, initData)
Parameters
initDataTypeinitData- : Initialization data for the request, in the format specified by
initDataType. It is an instance of any of the following types:- ArrayBuffer
- DataView
- TypedArray
- : Initialization data for the request, in the format specified by
Return value
A Promise.
Exceptions
- TypeError
- : Raised if
initDataTypeis an empty string, ifinitDatais an empty array, or if the providedinitDatais not valid according to the specifiedinitDataType.
- : Raised if
NotSupportedErrorDOMException- : Raised if the Key System implementation associated with the
MediaKeySessionobject does not support the providedinitDataType, if the sanitized initialization data is empty, or if the sanitized initialization data is not supported by the content decryption module (CDM).
- : Raised if the Key System implementation associated with the
- QuotaExceededError
- : Raised if the operation fails due to a lack of resources on the user agent or CDM.
InvalidStateErrorDOMException- : Raised if the
MediaKeySessionobject is in aclosingorclosedstate, or if it has already been initialized.
- : Raised if the
Specifications
Browser compatibility
来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。
