stopStreamingAudio method

Future<void> stopStreamingAudio()

Stops streaming audio data from the microphone.

Cancels the audio stream subscription, stops the audio recorder, and stops the audio player. Prints a message to the console when streaming is stopped.

Implementation

Future<void> stopStreamingAudio() async {
  await _audioSubscription?.cancel(); // Cancel the audio stream subscription
  await _record.stop(); // Stop the audio recorder
  await audioChunkPlayer.stop(); // Stop the audio player
  debugPrint('Audio streaming stopped');
}