MediaCapabilities Class

Tells whether the user agent can decode or encode media with a configuration (https://w3c.github.io/media-capabilities/, navigator.mediaCapabilities). The library validates the configurations as the specification requires, and the backends of the browsing context answer the support:

Without a backend, nothing is supported. There is no performance model: a supported configuration is smooth, and not power efficient (the library cannot tell whether a backend uses hardware codecs). A colorGamut or a transferFunction must match the color space of a VP9 or AV1 codec string (BT.709 when the string does not give it), and a video with HDR metadata is not supported (the rendering is in sRGB). A configuration with a key system is checked by Encrypted Media Extensions (Clear Key): a supported one gets a MediaKeySystemAccess.

public sealed class MediaCapabilities

Methods

NameDescription
DecodingInfo(MediaDecodingConfiguration)Returns whether the user agent can decode media with a configuration (https://w3c.github.io/media-capabilities/#dom-mediacapabilities-decodinginfo).
EncodingInfo(MediaEncodingConfiguration)Returns whether the user agent can encode media with a configuration (https://w3c.github.io/media-capabilities/#dom-mediacapabilities-encodinginfo).

DecodingInfo(MediaDecodingConfiguration)

MediaCapabilities.cs

Returns whether the user agent can decode media with a configuration (https://w3c.github.io/media-capabilities/#dom-mediacapabilities-decodinginfo).

Parameters

configuration MediaDecodingConfiguration
The configuration.

Returns

Task<MediaCapabilitiesDecodingInfo> A task that completes with the support, or fails with a TypeErrorException for an invalid configuration, or a DomException for a key system in a worker (InvalidStateError) or in a context that is not secure (SecurityError).

See also

EncodingInfo(MediaEncodingConfiguration)

MediaCapabilities.cs

Returns whether the user agent can encode media with a configuration (https://w3c.github.io/media-capabilities/#dom-mediacapabilities-encodinginfo).

Parameters

configuration MediaEncodingConfiguration
The configuration.

Returns

Task<MediaCapabilitiesEncodingInfo> A task that completes with the support, or fails with a TypeErrorException for an invalid configuration.

See also