javascriptwebrtcmediadevices

Instantiating MediaDeviceInfo results in 'Illegal constructor'


Is it possible to instantiate my own instance of MediaDeviceInfo? Both of these fail:

new MediaDeviceInfo();

new MediaDeviceInfo({
  deviceId: 'Brad Test',
  groupId: 'Brad Test',
  kind: 'audioinput',
  label: 'Brad Test'
});

Uncaught TypeError: Illegal constructor


Solution

  • No, there is no constructor defined on the interface: https://w3c.github.io/mediacapture-main/#device-info