The MediaCapabilitiesInfo interface of the Media Capabilities API is made available when the promise returned by the MediaCapabilities.encodingInfo() or MediaCapabilities.decodingInfo() methods of the MediaCapabilities interface fulfills, providing information as to whether the media type is supported, and whether encoding or decoding such media would be smooth and power efficient.
Properties
The MediaCapabilitiesInfo interface contains three Boolean attribues:
supported: Given the properties defined in theMediaConfiguration, can the specified piece of media content be encoded (ifMediaEncodingConfigurationis set) or decode (ifMediaDecodingConfigurationis set) at all? If yes,supportedis true. Otherwise, it is false.smooth: Given the properties defined in theMediaConfiguration, will the playback of the specified piece of media be high quality? Will it be smooth? Ifsupportedistrue, and playback will be smooth,smoothis true, Otherwise, is it false.powerEfficient: Given the properties defined in theMediaConfiguration, will the playback of the specified piece of media be power efficient? Ifsupportedistrue, and playback will be power efficient,powerEfficientis true, Otherwise, is it false.
Browsers will report a supported media configuration as smooth and powerEfficient until stats on this device have been recorded. All supported audio codecs are reported to be power efficient.
Example
// MediaConfiguration to be tested
const mediaConfig = {
type : 'file',
audio : {
contentType : "audio/ogg",
channels : 2,
bitrate : 132700,
samplerate : 5200
},
};
// check support and performance
navigator.mediaCapabilities.decodingInfo(mediaConfig).then(result => { // result contains the media capabilities information
console.log('This configuration is ' +
(result.supported ? '' : 'not ') + 'supported, ' + // Can the media, as configured, be decoded by the user agent
(result.smooth ? '' : 'not ') + 'smooth, and ' + // is it smooth?
(result.powerEfficient ? '' : 'not ') + 'power efficient.') // is it power efficient?
});
Specifications
| Specification | Status | Comment |
|---|---|---|
| Media CapabilitiesThe definition of 'MediaCapabilitiesInfo' in that specification. | Draft | Initial definition |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
Chrome
Full support 66 |
Edge
Full support ≤79 |
Firefox
Full support 63 |
IE
No support No |
Opera
? |
Safari
? |
WebView Android
Full support 66 |
Chrome Android
Full support 66 |
Firefox Android
Full support 63 |
Opera Android
? |
Safari iOS
? |
Samsung Internet Android
Full support 9.0 |
| Chrome
Full support 66 |
Edge
Full support ≤79 |
Firefox
Full support 63 |
IE
No support No |
Opera
? |
Safari
? |
WebView Android
Full support 66 |
Chrome Android
Full support 66 |
Firefox Android
Full support 63 |
Opera Android
? |
Safari iOS
? |
Samsung Internet Android
Full support 9.0 | |
| Chrome
Full support 66 |
Edge
Full support ≤79 |
Firefox
Full support 63 |
IE
No support No |
Opera
? |
Safari
? |
WebView Android
Full support 66 |
Chrome Android
Full support 66 |
Firefox Android
Full support 63 |
Opera Android
? |
Safari iOS
? |
Samsung Internet Android
Full support 9.0 | |
| Chrome
Full support 66 |
Edge
Full support ≤79 |
Firefox
Full support 63 |
IE
No support No |
Opera
? |
Safari
? |
WebView Android
Full support 66 |
Chrome Android
Full support 66 |
Firefox Android
Full support 63 |
Opera Android
? |
Safari iOS
? |
Samsung Internet Android
Full support 9.0 |
Legend
- Full support
- Full support
- No support
- No support
- Compatibility unknown
- Compatibility unknown
- Experimental. Expect behavior to change in the future.'
- Experimental. Expect behavior to change in the future.
See also
MediaCapabilitiesInfo by Mozilla Contributors is licensed under CC-BY-SA 2.5.