Created
April 14, 2021 06:59
-
-
Save kazgoto/0a42c05250ce34d53d3f022d65136e67 to your computer and use it in GitHub Desktop.
Simple Speech API test application for 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
<html> | |
<body> | |
<textarea class="form-control" rows="5" readonly></textarea> | |
<br> | |
<button type="button" class="btn btn-primary">Recognize</button> | |
<script type="text/javascript"> | |
const recognition = new webkitSpeechRecognition(); | |
const textarea = document.querySelector('textarea'); | |
const button = document.querySelector('button'); | |
button.addEventListener('click', function () { | |
recognition.start(); | |
}); | |
recognition.onresult = function (e) { | |
console.log(e) | |
let result = e.results[0][0].transcript; | |
textarea.value = result; | |
}; | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment