endVideo method
Returns the recording, or starts one if capture is idle.
Implementation
Future<void> endVideo() async {
if (_closed || _capturing || filter == XAssetKind.image) return;
if (!recording) {
await takeVideo();
return;
}
_capturing = true;
_safeNotify();
try {
final file = await session.useController(
(controller) => controller.stopVideoRecording(),
);
if (!_closed && file != null) pop(VideoMedia(file: io.File(file.path)));
} catch (error, stack) {
_captureError(error, stack);
} finally {
_capturing = false;
_photo = filter != XAssetKind.video;
_safeNotify();
}
}