Is there an existing issue for this?
Did you read the "Reporting a bug" section on Contributing file?
Current Behavior
iOS and Android's ListenAsync's recognitionResult callback do not behave consistently.
The SpeechToText documentation can be found here: https://learn.microsoft.com/en-us/dotnet/communitytoolkit/maui/essentials/speech-to-text?tabs=android
This document suggests that the argument to the recognitionResult (Progress) callback provides the new text that was spoken since the last callback:
var recognitionResult = await speechToText.ListenAsync(
CultureInfo.GetCultureInfo(Language),
new Progress<string>(partialText =>
{
RecognitionText += partialText + " ";
}), cancellationToken);
Our tests indicate that the callback includes the fully spoken phrase on Android but only the new words/phrase on iOS.
Expected Behavior
All platforms should behave consistently. If the docs are to be followed, then the callback should always include only the new word/phrases, rather than the entire phrase.
Steps To Reproduce
- Create a .NET project
- Add the code as shown below
- Run on iOS
- Speak
- Observe the output
- Run on Android
- Speak
- Observe the output
await SpeechToText.Default.ListenAsync(
CultureInfo.CurrentCulture,
new Progress(partialText =>
{
System.Diagnostics.Debug.WriteLine(partialText);
}), token);
iOS Output:
[0:] This
[0:] is
[0:] the
[0:] test
Android Output:
[0:]
[0:]
[0:]
[0:] this
[0:] this is
[0:] this is a
Link to public reproduction project repository
Unfortunately I do not have this, reproduced at work and do not have time to make one :(
Environment
- .NET MAUI CommunityToolkit:7.0.1
- OS: iOS 17.3 and Android 10.0
- .NET MAUI: 8.0.7
Anything else?
We are going to be updating our app to handle this method differently on iOS and Android. Fixing this could result in a breaking change for users, but I think it's worth doing to keep it consistent going forward.
Is there an existing issue for this?
Did you read the "Reporting a bug" section on Contributing file?
Current Behavior
iOS and Android's ListenAsync's
recognitionResultcallback do not behave consistently.The SpeechToText documentation can be found here: https://learn.microsoft.com/en-us/dotnet/communitytoolkit/maui/essentials/speech-to-text?tabs=android
This document suggests that the argument to the
recognitionResult(Progress) callback provides the new text that was spoken since the last callback:Our tests indicate that the callback includes the fully spoken phrase on Android but only the new words/phrase on iOS.
Expected Behavior
All platforms should behave consistently. If the docs are to be followed, then the callback should always include only the new word/phrases, rather than the entire phrase.
Steps To Reproduce
iOS Output:
Android Output:
Link to public reproduction project repository
Unfortunately I do not have this, reproduced at work and do not have time to make one :(
Environment
Anything else?
We are going to be updating our app to handle this method differently on iOS and Android. Fixing this could result in a breaking change for users, but I think it's worth doing to keep it consistent going forward.