C
C#12mo ago
JustiPhi

❔ MAUI Community Toolkit Speech Recognition issue

on windows 10 I am getting a network failure with the following code:
private async Task Listen()
{
var isGranted = await SpeechToText.Default.RequestPermissions(tokenSource.Token);
if (!isGranted)
{
await Toast.Make("Permission not granted").Show(tokenSource.Token);
return;
}
var recognitionResult = await SpeechToText.Default.ListenAsync(
CultureInfo.GetCultureInfo("en-au"),
new Progress<string>(partialText =>
{
RecognitionText += partialText + " ";
}), tokenSource.Token);
if (recognitionResult.IsSuccessful)
{
RecognitionText = recognitionResult.Text;

await TextToSpeech.Default.SpeakAsync(recognitionResult.Text);
}
else
{
await Toast.Make(recognitionResult.Exception?.Message ?? "Unable to recognize speech").Show(tokenSource.Token);
}
}
private async Task Listen()
{
var isGranted = await SpeechToText.Default.RequestPermissions(tokenSource.Token);
if (!isGranted)
{
await Toast.Make("Permission not granted").Show(tokenSource.Token);
return;
}
var recognitionResult = await SpeechToText.Default.ListenAsync(
CultureInfo.GetCultureInfo("en-au"),
new Progress<string>(partialText =>
{
RecognitionText += partialText + " ";
}), tokenSource.Token);
if (recognitionResult.IsSuccessful)
{
RecognitionText = recognitionResult.Text;

await TextToSpeech.Default.SpeakAsync(recognitionResult.Text);
}
else
{
await Toast.Make(recognitionResult.Exception?.Message ?? "Unable to recognize speech").Show(tokenSource.Token);
}
}
the code appears to be working fine on windows 11 and android
7 Replies
JustiPhi
JustiPhi12mo ago
when attempting to debug the recognitionResult is false with a task cancelled exception and the following stack trace:
JustiPhi
JustiPhi12mo ago
JustiPhi
JustiPhi12mo ago
when let to run i simply get the following notification:
JustiPhi
JustiPhi12mo ago
Accord
Accord12mo ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.
JustiPhi
JustiPhi12mo ago
bump
Accord
Accord12mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.