stopEverything method

Future<void> stopEverything()

Stop streaming.

Implementation

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