-
Notifications
You must be signed in to change notification settings - Fork 0
/
speech_and_audiotrack.html
68 lines (56 loc) · 1.62 KB
/
speech_and_audiotrack.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
60
61
62
63
64
65
66
67
68
<html>
<head></head>
<body>
<script>
navigator.mediaDevices.getUserMedia({audio: true}).then((stream) => {
SpeechRecognition = webkitSpeechRecognition || SpeechRecognition;
const recognition = new SpeechRecognition();
recognition.lang = 'ja-JP';
recognition.continuous = true;
recognition.interimResults = true;
recognition.onaudiostart = (e) => {
console.log('onaudiostart');
console.log(e);
}
recognition.onaudioend = (e) => {
console.log('onaudioend');
console.log(e);
}
recognition.onerror = () => {
console.log('onerror');
console.log(e);
}
recognition.onnomatch = (e) => {
console.log(onnomatch);
console.log(e);
}
recognition.onsoundstart = (e) => {
console.log('onsoundstart');
console.log(e);
}
recognition.onsoundend = (e) => {
console.log('onsoundend');
console.log(e);
}
recognition.onspeechstart = (e) => {
console.log('onspeechstart');
console.log(e);
}
recognition.onspeechend = (e) => {
console.log('onspeechend');
console.log(e);
}
recognition.onstart = (e) => {
console.log('onstart')
console.log(e);
}
recognition.onresult = (event) => {
console.log(event.results);
}
recognition.start(stream.getAudioTracks()[0]);
}).catch(e => {
console.log(e);
})
</script>
</body>
</html>