web api interface
InputDeviceInfo
Secure context
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 enumerateDevices() if the returned device is an audio or video input device.
Instance properties
Also inherits properties from its parent interface, MediaDeviceInfo.
Instance methods
Also inherits methods from its parent interface, MediaDeviceInfo.
getCapabilities()- : Returns a
MediaTrackCapabilitiesobject describing the primary audio or video track of a device’sMediaStream.
- : Returns a
Examples
The following example gets all media devices with 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((devices) => {
devices.forEach((device) => {
console.log(device); // an InputDeviceInfo object if the device is an input device, otherwise a MediaDeviceInfo object.
});
});
Specifications
SpecificationsStandards references are available on the canonical MDN page.
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.