private async Task stopSpeechRecognition() { isFeeding = false; while (!bufferQueue.IsEmpty) { await Task.Delay(90); } var transcription = client.FinishStream(stream); await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { result.Text = transcription; }); }
/// <summary> /// Stops the recording and sets the transcription of the closed stream. /// </summary> /// <returns>A Task to await.</returns> public async Task StopRecordingAsync() { try { mAudioCapture.Stop(); while (!_bufferQueue.IsEmpty && StreamingIsBusy) { await Task.Delay(90); } Transcription = mSttClient.FinishStream(mSttStream); } catch (Exception e) { Console.WriteLine(e.Message); } }