start method

Future<void> start()

Implementation

Future<void> start() async {
  if (!(value.isInitialized ?? false) || _isDisposed) {
    throw AudioStreamingException(
      'Uninitialized AudioController',
      'startAudioStreaming was called on uninitialized AudioController',
    );
  }
  if (value.isRecording ?? false) {
    throw AudioStreamingException(
      'A audio streaming is already started.',
      'startAudioStreaming was called when a recording is already started.',
    );
  }

  try {
    await channel.start();
    value = value.copyWith(isRecording: true);
  } on PlatformException catch (e) {
    throw AudioStreamingException(e.code, e.message);
  }
}