forked from milani/microphone.js
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
41 lines (41 loc) · 1.12 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
<!doctype html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script src="microphone.js"></script>
</head>
<body>
<div id="microphone"></div>
<script>
$(document).ready(function(){
$('#microphone').on('error', function(event, message){
console.error(message);
});
var options = {
buffer_size : 400,
vad: {
level: 10,
timeout: 2000
}
};
var microphone = new $.microphone('#microphone', options);
$('#microphone').on('ready', function(event){
console.log('ready');
setTimeout(function(){
microphone.stop();
}, 10000);
microphone.start();
});
$('#microphone').on('data', function(event, data){
console.log(data);
});
$('#microphone').on('activity', function(event, activity){
console.log(activity);
});
$('#microphone').on('vad', function(event, vad){
console.log(vad);
});
});
</script>
</body>
</html>