setCameraTorch method
@detail api @author zhangzhenyu.samuel @brief 打开/关闭当前使用的摄像头(前置/后置)的闪光灯 @param torchState 闪光灯状态。参考 TorchState{@link #TorchState} @return - 0: 成功。 - < 0: 失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明。 @note - 必须已调用 startVideoCapture{@link #RTCEngine#startVideoCapture} 使用 SDK 内部采集模块进行视频采集时,才能设置闪光灯。 - 设置结果在调用 stopVideoCapture{@link #RTCEngine#stopVideoCapture} 关闭内部采集后失效。
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}');
}
}