forked from ehsan/chromium-audio-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplaythrough.html
33 lines (27 loc) · 838 Bytes
/
playthrough.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
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<script>
function error() {
alert('Stream generation failed.');
}
function getUserMedia(dictionary, callback) {
try {
navigator.webkitGetUserMedia(dictionary, callback, error);
} catch (e) {
alert('webkitGetUserMedia threw exception :' + e);
}
}
function gotStream(stream) {
var context = new AudioContext();
// Create an AudioNode from the stream.
var mediaStreamSource = context.createMediaStreamSource(stream);
// Connect it to the destination.
mediaStreamSource.connect(context.destination);
}
getUserMedia({audio:true}, gotStream);
</script>
</body>
</html>