This feature is not Baseline because it does not work in some of the most widely-used browsers.
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
The getCapabilities() method of the InputDeviceInfo interface returns a MediaTrackCapabilities object describing the primary audio or video track of the device's MediaStream.
getCapabilities()
None.
A MediaTrackCapabilities object which specifies the value or range of values which are supported for each of the user agent's supported constrainable properties. It is required to return identical information as returned by calling getCapabilities() on the first MediaStreamTrack of the same kind as this device (video or audio) in the MediaStream returned by getUserMedia({ deviceId: deviceInfo.deviceId }). See MediaStreamTrack.getCapabilities() for a list of commonly supported properties and their types.
Note: If the user has not granted permission to access the input device an empty object will be returned.
In the following example we ask for permission to access audio and video devices with mediaDevices.getUserMedia(), as to use getCapabilities() we need permission to access the devices.
If device is an InputDeviceInfo object, then getCapabilities() will return an object with members representing its capabilities. A video stream will not include auto properties such as noiseSuppression, for example.
// Get permission to access audio or video devices
navigator.mediaDevices
.getUserMedia({ audio: true, video: true })
// Enumerate media devices
.then(() => navigator.mediaDevices.enumerateDevices())
.then((devices) => {
devices.forEach((device) => {
if (typeof device.getCapabilities === "function") {
console.log("Capabilities:", device.getCapabilities()); // A MediaTrackCapabilities object.
} else {
console.log("Device does not support getCapabilities:", device);
}
});
})
.catch((mediaError) => {
console.error("Error accessing media devices:", mediaError);
});
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
getCapabilities |
67 | 79 | No | 54 | 17 | 67 | No | 48 | 17 | 9.0 | 67 | 17 |
MediaStreamTrack.getCapabilities(), which also return a MediaTrackCapabilities object.
© 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/InputDeviceInfo/getCapabilities