switchCamera method

Future<int?> switchCamera(
  1. CameraId cameraId
)

@detail api @hiddensdk(audiosdk) @author zhangzhenyu.samuel @brief Switch to the front-facing/back-facing camera used in the internal video capture
The local client will be informed via onVideoDeviceStateChanged{@link #IRTCEngineEventHandler#onVideoDeviceStateChanged} after calling this API. @param cameraId Camera ID. Refer to CameraId{@link #CameraId} for more details. @return - 0: Success - < 0: Failure @note - Front-facing camera is the default camera. - If the internal video capturing is on, the switch is effective once you call this API. If the internal video capturing is off, the setting will be effective when capture starts.

Implementation

Future<int?> switchCamera(CameraId cameraId) async {
  $a() => ($instance as $p_a.RTCEngine)
      .switchCamera(t_CameraId.code_to_android(cameraId));
  $i() => ($instance as $p_i.ByteRTCEngine)
      .switchCamera(t_CameraId.code_to_ios(cameraId));

  if (Platform.isAndroid) {
    return $a();
  } else if (Platform.isIOS) {
    return $i();
  } else {
    throw UnsupportedError(
        'Not Support Platform ${Platform.operatingSystem}');
  }
}