stopHighSpeedRecording method

Future<RecordingResult> stopHighSpeedRecording()

Stops a slow-motion recording started with startHighSpeedRecording and restores the normal preview session. Returns the file path and metadata.

Implementation

Future<RecordingResult> stopHighSpeedRecording() async {
  _requireInitialized();
  final RecordingResult result;
  try {
    result = await _native.stopHighSpeedRecording(_textureId!);
  } catch (e) {
    _isRecording = false;
    _isRecordingPaused = false;
    notifyListeners();
    if (e is CameraException) rethrow;
    throw RecorderException(
      'recorder/finalize-failed',
      'Failed to finalise high-speed recording: $e',
      cause: e,
    );
  }
  _isRecording = false;
  _isRecordingPaused = false;
  notifyListeners();
  if (result.reason == RecordingFinishedReason.failed) {
    throw const RecorderException(
      'recorder/finalize-failed',
      'High-speed recording could not be finalised; the truncated file was discarded.',
    );
  }
  return result;
}