Skip to content

Instantly share code, notes, and snippets.

@Gkiokan
Created November 14, 2019 16:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Gkiokan/4c1b2e36f8fe6d4473bc819e03b38a2b to your computer and use it in GitHub Desktop.
Save Gkiokan/4c1b2e36f8fe6d4473bc819e03b38a2b to your computer and use it in GitHub Desktop.
WebKit Speech Recognition, playground with Google Chrome
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