-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
45 lines (38 loc) · 1.52 KB
/
index.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<html>
<head>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script>
$(function(){
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").append(event.results[i][0].transcript);
}
}
recognition.start();
}
function stop() {
recognition.stop();
$("#output").html();
}
});
</script>
</head>
<body>
<h1>Speach to text</h1>
<input id = "bStart" type = "button" value = "Start" onclick = "start();">
<input id = "stop" type = "button" value = "Stop" onclick = "stop();">
<div id = "output"></div>
</body>
</html>