-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.html
28 lines (26 loc) · 807 Bytes
/
test.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<html>
<body>
<p id="current_text"></p>
<button id="next_element">Next Element</button>
<script>
var recognition = new webkitSpeechRecognition();
recognition.continuous = true;
recognition.onresult = function (event) {
var text = '';
for (let result of event.results) {
console.log(result);
text += result[0].transcript;
}
document.getElementById('current_text').innerHTML = text;
recognition.stop();
}
var button = document.getElementById('next_element');
button.onclick = function () {
recognition.start();
}
// button.onmouseup = function () {
// recognition.stop();
// }
</script>
</body>
</html>