Created
June 25, 2020 15:50
-
-
Save henriquegogo/6d3d17e5283b888257ee130361102d6d to your computer and use it in GitHub Desktop.
Speech recognition and speak using native browser API
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
let recognition = new webkitSpeechRecognition(); | |
recognition.lang = 'pt-BR'; | |
recognition.onresult = ({ results }) => { | |
const transcript = results[0][0].transcript; | |
speechSynthesis.speak(new SpeechSynthesisUtterance(transcript)); | |
} | |
recognition.start(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment