setInputDevicesAsync()
setInputDevicesAsync({ audioDeviceId, videoDeviceId, audioSource, videoSource })
Switch to using a specific local audio device, video device, or both.
Accepts an argument representing the device either as an ID that matches an ID returned by enumerateDevices
(audioDeviceId
or videoDeviceId
), or as a raw MediaStreamTrack object (audioSource
or videoSource
).
Returns a Promise which resolves with an object containing device info:
Note: If a given device has not been specified and has not yet been acquired, or if you have provided a custom track in lieue of the device, the corresponding object will be empty ({}).
This method is a wrapper around updateInputSettings()
providing an easy way to switch devices without modifying other constraints. As such, an 'input-settings-updated'
event will be emitted if the device switch is successful and getInputSettings()
will reflect the new device settings.