Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. HTMLMediaElement
  4. setMediaKeys()

HTMLMediaElement: setMediaKeys() method

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 insecure contexts (HTTPS), in some or allsupporting browsers.

ThesetMediaKeys() method of theHTMLMediaElement interface sets theMediaKeys that will be used to decrypt media during playback.

It returns aPromise that fulfils if the new keys are successfully set, or rejects if keys cannot be set.

Syntax

js
setMediaKeys(mediaKeys)

Parameters

mediaKeys

AMediaKeys object that theHTMLMediaElement can use for decryption of media data during playback.

Return value

APromise that fulfills withundefined.

Exceptions

The returned promise may reject an error:

InvalidStateErrorDOMException

Media keys are already in the process of being attached, or the previous keys cannot be removed at the current time (for example, because the particular implementation does not allow removal during playback).

QuotaExceededError

The passed keys are already in use by another element, or the browser is unable to use it with this element for other reasons.

NotSupportedErrorDOMException

The media keys that are currently associated with the media cannot be disassociated, because this is not supported by either the CDM or the browser.

Specifications

Specification
Encrypted Media Extensions
# dom-htmlmediaelement-setmediakeys

Browser compatibility

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp