changeWebcam

fun changeWebcam(deviceId: String)

This method can be used to switch to a specific camera device by its device ID.

The camera is switched in place on the existing video track, so no onStreamEnabled/onStreamDisabled events are fired on success.

Events:

  • onError — emitted only if the camera switch fails

Code Example:


var backCamera: VideoDeviceInfo? = null
for (device in VideoSDK.getVideoDevices()) {
    if (device.facingMode == FacingMode.back) {
        backCamera = device
        break
    }
}
if (backCamera != null) {
    meeting.changeWebcam(backCamera.deviceId)
}

Parameters

deviceId

(Optional) the unique identifier of the camera device to switch to. If null, toggles between front and back camera. Use getVideoDevices to enumerate available camera devices.