switchCamera method

  1. @override
Future<void> switchCamera()
override

Implementation

@override
Future<void> switchCamera() async {
  if (_localStream == null) throw Exception('Stream is not initialized');

  final List<MediaStreamTrack> videoTracks = _localStream!.getVideoTracks();

  if (videoTracks.isEmpty) return;

  await Helper.switchCamera(videoTracks.first);

  _mParticipant?.switchCamera();

  _socketEmiter.setCameraType(_mParticipant?.cameraType ?? CameraType.front);

  _notify(CallbackEvents.shouldBeUpdateState);
}