-
Notifications
You must be signed in to change notification settings - Fork 11
/
index.html
37 lines (30 loc) · 845 Bytes
/
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
<!doctype html>
<html>
<head>
<script src="microphone.js"></script>
</head>
<body>
<script>
var mic = new Microphone(function(){//this function is called when user allow us to access microphone.
//sample handler
mic.onSamplesAvailable = function(data,channelCount){
console.log(data);
};
//set sample rate
mic.sampleRate = 44100;
//get list of microphones available
console.log(mic.getMicrophoneList());
//get sample rate
console.log(mic.sampleRate);
//get microphone name in use
console.log(mic.name);
//starts streaming
mic.start();
//stops streaming after 1 second
setTimeout(function(){
mic.stop();
},2000);
});
</script>
</body>
</html>