setVideoInputDevice method

Future<void> setVideoInputDevice(
  1. MediaDevice device
)

Set video input device.

Implementation

Future<void> setVideoInputDevice(MediaDevice device) async {
  final track = localParticipant?.videoTracks.firstOrNull?.track;
  if (track == null) return;
  if (selectedVideoInputDeviceId != device.deviceId) {
    await track.switchCamera(device.deviceId);
    Hardware.instance.selectedVideoInput = device;
  }
  engine.roomOptions = engine.roomOptions.copyWith(
    defaultCameraCaptureOptions:
        roomOptions.defaultCameraCaptureOptions.copyWith(
      deviceId: device.deviceId,
    ),
  );
}