stopVideoStreaming method

Future<void> stopVideoStreaming()

Stop streaming.

Implementation

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