openLocalCamera method

Future<TUIActionCallback> openLocalCamera()

Implementation

Future<TUIActionCallback> openLocalCamera() async {
  var cameraPermission = await Permission.camera.request();

  if (!cameraPermission.isGranted) {
    LiveKitLogger.error('requestMicrophonePermissions:[onDenied]');
    return TUIActionCallback(code: TUIError.errPermissionDenied, message: "camera permission denied");
  }

  var result = await liveService.openLocalCamera(mediaState.isFrontCamera.value, mediaState.videoQuality.value);
  if (result.code == TUIError.success) {
    _initLivingConfig();
    mediaState.isCameraOpened.value = true;
  }
  return result;
}