setCameraTorch method

Future<int?> setCameraTorch(
  1. TorchState torchState
)

@detail api @author zhangzhenyu.samuel @brief Turn on/off the flash state of the currently used camera (front/postcondition) @param torchState Flash state. Refer to TorchState{@link #TorchState} @return - 0: Success. - < 0: Failure. See ReturnStatus{@link #ReturnStatus} for more details. @note - The flash can only be set if you have called startVideoCapture{@link #RTCEngine#startVideoCapture} for video capture using the SDK internal capture module. - The setting result fails after calling stopVideoCapture{@link #RTCEngine#stopVideoCapture} to turn off internal collection.

Implementation

Future<int?> setCameraTorch(TorchState torchState) async {
  $a() => ($instance as $p_a.RTCEngine)
      .setCameraTorch(t_TorchState.code_to_android(torchState));
  $i() => ($instance as $p_i.ByteRTCEngine)
      .setCameraTorch(t_TorchState.code_to_ios(torchState));

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