Created
November 14, 2019 16:06
-
-
Save Gkiokan/4c1b2e36f8fe6d4473bc819e03b38a2b to your computer and use it in GitHub Desktop.
WebKit Speech Recognition, playground with Google Chrome
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
var recognition = new webkitSpeechRecognition(); | |
recognition.lang = 'de'; //Sprache auf Deutsch festlegen | |
recognition.continuous = true; | |
recognition.interimResults = true; | |
//recognition.onstart = function() { recognizing = true; }; | |
//recognition.onerror = function(event) { console.log(event.error); }; | |
//recognition.onend = function() { recognizing = false; }; | |
recognition.onresult = function (event) { | |
if (event.results.length > 0) { | |
console.log(event.results[Object.keys(event.results).length-1][0].transcript); //erstes Ergebnis ausgeben | |
} | |
}; | |
recognition.start(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment