stopVideoRecording method
Implementation
Future<UCapturedVideo?> stopVideoRecording() async {
final int? id = _sessionId;
if (id == null || !value.isRecording) return null;
_recordingTicker?.cancel();
try {
final Map<Object?, Object?>? raw = await UCameraChannel.invokeMap("stopRecording", <String, Object?>{"sessionId": id});
_recordingStartedAt = null;
_recordedBeforePause = Duration.zero;
_emit(value.copyWith(state: UCameraState.ready, recordingDuration: Duration.zero, recordingBytes: 0));
return raw == null ? null : UCapturedVideo.fromMap(raw);
} on UCameraException catch (error) {
_emit(value.copyWith(state: UCameraState.ready));
_fail(error);
return null;
} catch (error) {
_emit(value.copyWith(state: UCameraState.ready));
_fail(UCameraException(code: UCameraErrorCode.unknown, message: "$error"));
return null;
}
}