stopVideoRecording method

Future<XFile> stopVideoRecording()

Stops the video recording and returns the file where it was saved.

Throws a CameraException if the capture failed.

Implementation

Future<XFile> stopVideoRecording() async {
  _throwIfNotInitialized("stopVideoRecording");
  if (!value.isRecordingVideo) {
    throw CameraException(
      'No video is recording',
      'stopVideoRecording was called when no video is recording.',
    );
  }
  try {
    XFile file = await CameraPlatform.instance.stopVideoRecording(_cameraId);
    value = value.copyWith(
      isRecordingVideo: false,
      recordingOrientation: Optional.absent(),
    );
    return file;
  } on PlatformException catch (e) {
    throw CameraException(e.code, e.message);
  }
}