stopRecording method
Implementation
Future<void> stopRecording({
OnVideoCallback? onVideo,
OnVideoFailedCallback? onVideoFailed,
}) async {
var currentCapture = cameraContext.mediaCaptureController.value;
if (currentCapture == null) {
return;
}
final result = await CamerawesomePlugin.stopRecordingVideo();
if (result) {
_mediaCapture = MediaCapture.success(
captureRequest: currentCapture.captureRequest,
);
onVideo?.call(currentCapture.captureRequest);
} else {
_mediaCapture = MediaCapture.failure(
captureRequest: currentCapture.captureRequest,
);
onVideoFailed?.call(Exception("Error while stop recording"));
}
await CamerawesomePlugin.setCaptureMode(CaptureMode.video);
cameraContext.changeState(VideoCameraState.from(cameraContext));
}