-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathexample.html
59 lines (56 loc) · 1.86 KB
/
example.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="speech.js"></script>
<style>
body {
font-family: 'Helvetica Neue', Arial, sans-serif;
}
#text {
font-size: 80px;
letter-spacing: -3px;
text-align: center;
margin: 0;
position: absolute;
width: 100%;
top: 40%;
}
p {
font-weight: bold;
text-align: center;
font-size: 13px;
color: #999;
}
</style>
</head>
<body>
<h1 id="text">Please allow access to mic.</h1>
<p>Speech.js demo by Evan You</p>
<a href="https://github.com/yyx990803/Speech.js"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png" alt="Fork me on GitHub"></a>
<script type="text/javascript">
var text = document.getElementById('text')
var speech = new Speech({
debugging: true,
continuous: true,
interimResults: true,
autoRestart: true
})
speech
.on('start', function () {
text.innerHTML = 'Come on, talk to me.'
})
.on('end', function () {
text.innerHTML = 'Stopped listening.'
})
.on('interimResult', function (msg) {
text.innerHTML = msg
})
.on('finalResult', function (msg) {
text.innerHTML = msg
})
.start()
</script>
</body>
</html>