Last active
February 19, 2017 14:14
-
-
Save kaplanmaxe/1292b0743c42469ab7189f83f86398f0 to your computer and use it in GitHub Desktop.
JS Speech Recognition
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
| // API: https://developer.mozilla.org/en-US/docs/Web/API/Web_Speech_API | |
| const recognition = new webkitSpeechRecognition(); | |
| recognition.onresult = function(event) { | |
| for (let i = event.resultIndex; i < event.results.length; ++i) { | |
| console.log(event.results[i][0].transcript); | |
| } | |
| } | |
| recognition.start(); // Click allow when browser prompts to use your microphone | |
| recognition.stop(); // Call this when done talking. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment