setCamera(cameraDeviceId)
Switches the local camera stream to the device identified by cameraDeviceId. The cameraDeviceId should match a deviceId value returned by enumerateDevices().
Because enumerateDevices() classifies cameras by their facing value ('user' or 'environment'), this method can be used to switch between front and rear cameras. Has no effect if cameraDeviceId matches the camera already in use.
This method can only be invoked while video is unmuted.
Parameters
The
deviceId of the camera to switch to. Must match a deviceId from enumerateDevices().Return value
Returns aPromise<{ device: { facingMode: DailyCameraFacingMode } | null }> with the newly active camera’s facing mode ('user' or 'environment'), or null if no device was found.