stopVideoRecording method

Future<void> stopVideoRecording()

Stop recording.

Implementation

Future<void> stopVideoRecording() async {
  if (!value.isInitialized || _isDisposed) {
    throw CameraException(
      'Uninitialized CameraController',
      'stopVideoRecording was called on uninitialized CameraController',
    );
  }
  if (!value.isRecordingVideo) {
    throw CameraException(
      'No video is recording',
      'stopVideoRecording was called when no video is recording.',
    );
  }
  try {
    value =
        value.copyWith(isRecordingVideo: false, isStreamingVideoRtmp: false);
    await _channel.invokeMethod<void>(
      'stopRecordingOrStreaming',
      <String, dynamic>{'textureId': _textureId},
    );
  } on PlatformException catch (e) {
    throw CameraException(e.code, e.message ?? 'Unknown exception');
  }
}