This feature is well established and works across many devices and browser versions. It’s been available across browsers since April 2022.
Note: This feature is available in Web Workers.
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.
encodingInfo(configuration)
configurationAn object with a property type and either a video or audio property containing a configuration of the appropriate type:
typeThe type of media being tested. This takes one of two values:
recordRepresents a configuration for recording of media, e.g., using MediaRecorder.
webrtcRepresents a configuration meant to be transmitted over electronic means (e.g., using RTCPeerConnection). Note: Firefox uses transmission for this type, and webrtc does not work.
transmission Non-standard The synonym of webrtc to be used in Firefox.
videoConfiguration object for a video media source. This has the following properties:
contentTypeString containing a valid video MIME type, and (optionally) a codecs parameter.
widthThe width of the video.
heightThe height of the video.
bitrateThe number of bits used to encode one second of the video file.
framerateThe number of frames making up one second of video playback.
audioConfiguration object for an audio media source. This has the following properties:
contentTypeString containing a valid audio MIME type, and (optionally) a codecs parameter.
channelsThe number of channels used by the audio track.
bitrateThe number of bits used to encode one second of the audio file.
samplerateThe number of audio samples making up one second of the audio file.
A Promise fulfilling with an object containing three Boolean attributes:
supportedtrue if the media content can be encoded at all. Otherwise, it is false.
smoothtrue if playback of the media will be smooth (of high quality). Otherwise it is false.
powerEfficienttrue if playback of the media will be power efficient. Otherwise, it is 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.
TypeErrorThrown if the configuration passed to the encodingInfo() method is invalid, which may be for any of the following reasons:
contentType is not a valid codec MIME type,configuration elements.// Create media configuration to be tested
const mediaConfig = {
type: "record", // or 'transmission'
video: {
contentType: "video/webm;codecs=vp8.0", // valid content type
width: 1920, // width of the video
height: 1080, // height of the video
bitrate: 120000, // number of bits used to encode 1s of video
framerate: 48, // number of frames making up that 1s.
},
};
// check support and performance
navigator.mediaCapabilities.encodingInfo(mediaConfig).then((result) => {
console.log(
`This configuration is ${result.supported ? "" : "not "}supported,`,
);
console.log(`${result.smooth ? "" : "not "}smooth, and`);
console.log(`${result.powerEfficient ? "" : "not "}power efficient.`);
});
| Specification |
|---|
| Media Capabilities> # dom-mediacapabilities-encodinginfo> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
encodingInfo |
101 | 101 | 63Thewebrtc value of the type option is named transmission. |
87 | 15.4 | 101 | 63Thewebrtc value of the type option is named transmission. |
70 | 15.4 | 19.0 | 101 | 15.4 |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/MediaCapabilities/encodingInfo