Media capabilities
The MediaCapabilities interface of the Media Capabilities API provides information about the decoding abilities of the device, system and browser. The API can be used to query the browser about the decoding abilities of the device based on codecs, profile, resolution, and bitrates. The information can be used to serve optimal media streams to the user and determine if playback should be smooth and power efficient.
The information is accessed through the mediaCapabilities property of the Navigator and WorkerNavigator interface.
Browser support
| Feature | Desktop | Mobile | ||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Safari | Chrome Android | Safari iOS | |
| 66 | 79 | 63 | 13 | 66 | 13 | |
| The decodingInfo() method of the MediaCapabilities interface returns a promise that fulfils with information about how well the user agent can decode/display media with a given configuration. | 66 | 79 | 63 | 13 | 66 | 13 |
| The encodingInfo() method of the MediaCapabilities interface returns a promise that fulfills with the tested media configuration's capabilities for encoding media. This contains the three boolean properties supported, smooth, and powerefficient, which describe how compatible the device is with the type of media. | 101 | 101 | 63 | 15.4 | 101 | 15.4 |
| The mediaCapabilities read-only property of the Navigator interface references a MediaCapabilities object that can expose information about the decoding and encoding capabilities for a given media format and output capabilities. | 66 | 79 | 63 | 13 | 66 | 13 |
| The read-only mediaCapabilities property of the WorkerNavigator interface references a MediaCapabilities object that can expose information about the decoding and encoding capabilities for a given format and output capabilities (as defined by the Media Capabilities API). | 76 | 79 | 63 | 15.4 | 76 | 15.4 |
- `codecs` string can contain any subset of optional parameters (should be all or none).
- Errors if `codecs` string contains unexpected characters (should evaluate string up to character).
- `codecs` string can contain any subset of optional parameters (should be all or none).
- Errors if `codecs` string contains unexpected characters (should evaluate string up to character).
- The `webrtc` value of the `type` option is named `transmission`.
- Before Firefox 101, `decodingInfo()` ignored `codecs` parameter options for `av01` codecs (treating them as `av1`).
- `codecs` string can contain any subset of optional parameters (should be all or none).
- Errors if `codecs` string contains unexpected characters (should evaluate string up to character).
- The `webrtc` value of the `type` option is named `transmission`.
Use cases
-
Using Media capabilities
The MediaCapabilities interface of the Media Capabilities API provides information about the decoding abilities of the device, system and browser.
Cautions
- May not be supported in older browsers.
Implementation notes
- Some APIs require a secure context (HTTPS) or user activation. Check the requirements before use.