W3cubDocs

/Web APIs

InputDeviceInfo

The InputDeviceInfo interface of the Media Capture and Streams API gives access to the capabilities of the input device that it represents.

InputDeviceInfo objects are returned by MediaDevices.enumerateDevices() if the returned device is an audio or video input device.

MediaDeviceInfo InputDeviceInfo

Instance methods

InputDeviceInfo.getCapabilities()

Returns a MediaTrackCapabilities object describing the primary audio or video track of a device's MediaStream.

Examples

The following example gets all media devices with MediaDevices.enumerateDevices(). If any of the devices are input devices then console.log(device) will print an InputDeviceInfo object to the console.

js

navigator.mediaDevices.enumerateDevices().then((devices) => {
  devices.forEach((device) => {
    console.log(device); // an InputDeviceInfo object if the device is an input device, otherwise a MediaDeviceInfo object.
  });
});

Specifications

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
InputDeviceInfo 47 79 39 No 34 11 47 47 39 34 11 5.0
getCapabilities 67 79 No No 54 17 67 67 No 48 17 9.0

© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/InputDeviceInfo