C
C#16mo 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
JustiPhiOP16mo ago
when attempting to debug the recognitionResult is false with a task cancelled exception and the following stack trace:
JustiPhi
JustiPhiOP16mo ago
JustiPhi
JustiPhiOP16mo ago
when let to run i simply get the following notification:
JustiPhi
JustiPhiOP16mo ago
Accord
Accord16mo 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
JustiPhiOP16mo ago
bump
Accord
Accord16mo 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.
Want results from more Discord servers?
Add your server