Start a log
Static ReadonlyDefaultBase MediaKeySystemConfiguration used as a template when the caller does not supply Connect.MediaKeySystem.configurations. Spread first so caller-provided fields override these defaults.
StaticMEDIA_StaticSTOP_Get the current key system name, or undefined if MediaKeysEngine is not started or no key system has been successfully set up yet.
ProtectedbuildBuild the array of MediaKeySystemConfiguration that will be passed to
navigator.requestMediaKeySystemAccess() for a given key system.
keySystemConfig is a bare string (license URL) or has no configurations,
a single configuration is returned: baseConfig extended with audio/video capabilities
derived from metadata if available.keySystemConfig.configurations are provided, each is merged with metadata via
mergeConfigCapabilities; the caller's fields override baseConfig.Optionalmetadata: MetadataProtectedmergeMerge one side (audio or video) of user-provided capabilities with the capabilities derived from stream metadata.
Rules:
contentType win over metadata (explicit takes precedence).contentType (e.g. only robustness) are completed by
cross-joining them with each metadata contentType.ProtectedmetadataDerive the set of audio/video capabilities from the content-protected tracks of a
Metadata object. Each unique codecString produces one capability entry with
its contentType (e.g. video/mp4; codecs="avc1.640028"). Returns empty fields when
metadata is undefined or no track is content-protected.
Optionalmetadata: MetadataEvent unsubscription
Name of event without the 'on' prefix (ex: 'log' to 'onLog' event declared)
Event subscription
Name of event without the on prefix (ex: log to onLog event declared)
Subscriber Function
Optionaloptions: { signal?: AbortSignal }Optionalsignal?: AbortSignalOptional AbortSignal to stop this or multiple subscriptions in same time
Event subscription only one time, once time fired it's automatically unsubscribe
Name of event without the on prefix (ex: log to onLog event declared)
Subscriber Function
Optionaloptions: { signal?: AbortSignal }Optionalsignal?: AbortSignalOptional AbortSignal to stop this or multiple subscriptions in same time
Start the engine by listening to encrypted events on the video element and setting up MediaKeys when needed.
Call this when receiving the event onMetadata or before if you want to force the capabilities used in the MediaKeySystemConfiguration.
Optionalmetadata: MetadataStop the engine by releasing all resources and detaching from the video element.
Optionalerror: MediaKeysEngineErrora promise that resolves when the engine has released all resources and detached from the video element, or rejects on failure
StaticnormalizeNormalize a Connect.MediaKeyCertificate into a NormalizedMediaKeyCertificate.
A string input is treated as a URL to fetch, a Uint8Array as inline certificate bytes,
and an object is returned as-is.
StaticnormalizeNormalize a Connect.MediaKeyLicense (which may be a bare URL string) into an
object with url and headers.
MediaKeysEngine handles EME (Encrypted Media Extensions) operations for an
HTMLVideoElement. It supports the standard key systems — Widevine, PlayReady, FairPlay, and Clear Key — with multiple robustness configurations per key system, negotiated in order until one is supported by the browser.For convenience, MediaKeysEngine is integrated in Player, but it can also be used standalone — useful when you want to drive capabilities explicitly without relying on stream metadata:
Example