i am trying to replicate the chatgpt voice mode functionality and i need to have the connection opened all the time. I have tried using https://pub.dev/packages/deepgram_speech_to_text for this but if i open up the listen stream in an action, i dont know how to close it from another action. Please can someone help me?
Deepgram integration for speech to speech
Integrations
This is how the implementation is from the documentation
// 1. you want the stream to manage itself automatically
Stream<DeepgramSttResult> stream = deepgram.transcribeFromLiveAudioStream(micStream, queryParams:streamParams);
// 2. you want to manage the stream manually
DeepgramLiveTranscriber transcriber = deepgram.createLiveTranscriber(micStream, queryParams:streamParams);
transcriber.stream.listen((res) {
print(res.transcript);
});
transcriber.start();
// you can pause and resume the transcription (stop sending audio data to the server)
transcriber.pause();
// ...
transcriber.resume();
// then close the stream when you're done, you can call start() again if you want to restart a transcription
transcriber.close();
No
1