大网数据广告活动
Web 标准与前端开发

MediaKeySession: generateRequest() method

· 52CE 我爱测

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

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

  • initDataType
    • : A string that specifies the format of the initData parameter. This must be one of the following values:
      • "cenc": The initData parameter uses the "cenc" format.
      • "keyids": The initData parameter uses the "keyids" format.
      • "webm": The initData parameter uses the "webm" format.
  • initData
    • : Initialization data for the request, in the format specified by initDataType. It is an instance of any of the following types:
      • ArrayBuffer
      • DataView
      • TypedArray

Return value

A Promise.

Exceptions

  • TypeError
    • : Raised 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).
  • QuotaExceededError
    • : Raised 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.

Specifications

Browser compatibility

来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
MDN Web Docs / Mozilla 贡献者
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 2.5

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。