feat(harmony): Implement native Web Speech API#136
Merged
Conversation
This commit is a direct implementation of the Web Speech API aimed at performance and reliability. Changes include: - Implement native Web Speech API via recognitionRef - Implement icons for microphone and stop buttons - Fix runtime errors related to speech recognition - Maintain consistent UI design, at least to a degree for internal development The implementation now uses the browser's built-in speech recognition capabilities, resulting in smaller bundle size and more direct control over the recognition process.
Luxque
reviewed
Mar 28, 2025
|
|
||
| // Initialize Web Speech API | ||
| useEffect(() => { | ||
| if ('webkitSpeechRecognition' in window || 'SpeechRecognition' in window) { |
Collaborator
There was a problem hiding this comment.
I am swapping the order of these two because you are essentially assuming that the users are more likely to have SpeechRecognition than webkitSpeechRecognition. In this assumption, 'SpeechRecognition' in window should be evaluated first, so the application can skip evaluating 'webkitSpeechRecognition' in window. I tested the code on my side after the swap, and it seems it works just fine.
Luxque
approved these changes
Mar 28, 2025
Luxque
left a comment
Collaborator
There was a problem hiding this comment.
I tested your code (including my changes) on my side, and I could understand your code clearly. I approve your changes; you may delete this branch if you want.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
(Internal Development Only, for now)
This PR is a direct implementation of the Web Speech API aimed at performance and reliability.
Changes include:
The implementation now uses the browser's built-in speech recognition capabilities, resulting in smaller bundle size and more direct control over the recognition process.
To test,
cd juke/jukeos --> npm start):