Skip to content

Instantly share code, notes, and snippets.

@szolotykh
Created January 22, 2015 23:17
Show Gist options
  • Save szolotykh/e57476ff257bf1ae01b0 to your computer and use it in GitHub Desktop.
Save szolotykh/e57476ff257bf1ae01b0 to your computer and use it in GitHub Desktop.
HTML5 Speech to text example
<html>
<head>
<script>
var recognition = new webkitSpeechRecognition();
recognition.continuous = true;
//recognition.interimResults = true;
function start(){
recognition.onresult = function(event) {
console.log(event);
var output = document.getElementById("output");
output.innerHTML = "";
for(var i=0; i<event.results.length; i++){
output.innerHTML = output.innerHTML + event.results[i][0].transcript;
}
}
recognition.start();
}
</script>
</head>
<body>
<h1>Speach to text</h1>
<input id = "bStart" type = "button" value = "Start" onclick = "start();"></input>
<div id = "output"></div>
</body>
</html>
@girng
Copy link

girng commented May 6, 2022

it's broken, jim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment