InputDeviceInfo

The InputDeviceInfo interface of the Media 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.

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.

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

Specifications

Specification
Media Capture and Streams
# dom-inputdeviceinfo

Browser compatibility

BCD tables only load in the browser