New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Speech Recognition v2 - StartListening/StopListening #1382
Conversation
74acd48
to
ce22dca
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good in general, just a friendly reminder this will be a breaking change since you're removing a feature on Windows. Also, I could see a lot of places where the CancellationToken
provided by the user is being ignored, and this isn't ideal.
src/CommunityToolkit.Maui.Core/Essentials/SpeechToText/SpeechToTextImplementation.ios.cs
Outdated
Show resolved
Hide resolved
src/CommunityToolkit.Maui.Core/Essentials/SpeechToText/SpeechToTextImplementation.shared.cs
Outdated
Show resolved
Hide resolved
src/CommunityToolkit.Maui.Core/Essentials/SpeechToText/ISpeechToText.shared.cs
Outdated
Show resolved
Hide resolved
src/CommunityToolkit.Maui.Core/Essentials/SpeechToText/SpeechToTextImplementation.macos.cs
Outdated
Show resolved
Hide resolved
…oolkit/Maui into speech-recognition-v2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Vlad!
Looks like we just need to add unit tests for the new public APIs and write the the docs.
Otherwise, the implementation looks good.
I made a couple tweaks:
- Added
event ISpeechToText.StateChanged
- Renamed
ISpeechToText.State
->ISpeechToText.CurrentState
- Renamed
ISpeechToText.StartListeningAsync
->ISpeechToText.StartListenAsync
- Renamed
ISpeechToText.StopListeningAsync
->ISpeechToText.StopListenAsync
- Renamed
OnSpeechToTextRecognitionResultCompleted
->SpeechToTextRecognitionResultCompletedEventArgs
- Renamed
OnSpeechToTextRecognitionResultUpdated
->SpeechToTextRecognitionResultUpdatedEventArgs
- Updated XML Comments for new APIs
- Updated Sample App to be more descriptive
Adding the |
Thank you @brminnick. |
…tRecognitionTaskCompletionSource` on macios
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JoonghyunCho Hey Jay!
Could you incorporate the newly added event, ISpeechToText.StateChanged
into the Tizen implementation?
We have a new method, void OnSpeechToTextStateChanged(SpeechToTextState)
, that you can call any time the SpeechToText
state changes on Tizen.
Maui/src/CommunityToolkit.Maui.Core/Essentials/SpeechToText/SpeechToTextImplementation.shared.cs
Lines 83 to 86 in 7eda8ff
void OnSpeechToTextStateChanged(SpeechToTextState speechToTextState) | |
{ | |
speechToTextStateChangedWeakEventManager.HandleEvent(this, new SpeechToTextStateChangedEventArgs(speechToTextState), nameof(StateChanged)); | |
} |
I'm not sure if Tizen has it's own event, like Windows' SpeechRecognizer.StateChanged
event, that you can subscribe to, or if you'll need to call OnSpeechToTextStateChanged()
manually, like we're doing for iOS, MacCatalyst and Windows.
Thanks @VladislavAntonyuk! I think we're super close 💯 Once Jay implements |
...it.Maui.Core/Essentials/SpeechToText/Events/SpeechToTextRecognitionResultUpdatedEventArgs.cs
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just found a couple of areas that we can improve and a question regarding an opened issue.
src/CommunityToolkit.Maui.Core/Essentials/SpeechToText/SpeechToTextImplementation.ios.cs
Show resolved
Hide resolved
src/CommunityToolkit.Maui.Core/Essentials/SpeechToText/SpeechToTextImplementation.android.cs
Outdated
Show resolved
Hide resolved
...ommunityToolkit.Maui.Core/Essentials/SpeechToText/SharedSpeechToTextImplementation.macios.cs
Outdated
Show resolved
Hide resolved
Sorry I'm late!!!!! Just added |
Not sure why it suddenly cause the vulnerability error with the SkiaSharp. Can you guess anything? |
Thank you @brminnick , @JoonghyunCho and @pictos ! |
For sure! I was just giving it a final look right now 🙌 #1398 is about to merge and then this one will be next |
Description of Change
StartListeningAsync is to start listening for speech. The method returns "immediately", it doesn't wait for the recognition result. I would not name it Background, to not confuse users, that it works like a background service and allows to spy for the user.
so flow for users:
StartListeningAsync
Subscribe for events (SpeechCompleted/PartialSpeech)
do some other stuff
Whenever I want, I can stop listening without caring for the result.
In future we can extend the API with Pause/Resume async
trying to replicate this API: https://learn.microsoft.com/en-us/uwp/api/windows.media.speechrecognition.speechcontinuousrecognitionsession.startasync?view=winrt-22621
Added new APIs :
Removed:
Offline Speech Recognition on Windows. Maybe that is my pronunciation, but the output result is much worse than with online recognition.
Linked Issues
PR Checklist
approved
(bug) orChampioned
(feature/proposal)main
at time of PRAdditional information