-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathclient.html
49 lines (40 loc) · 1.59 KB
/
client.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
<html>
<head>
<title>Web Looper</title>
<link href="lib/bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
<link type="text/css" rel="stylesheet" href="style/main.css"/>
</head>
<body>
<h1>Web Looper (client)</h1>
<h5>Client of the first loop recorder made entirely with the <a href="http://www.w3.org/TR/webaudio/">WebAudio API</a></h5>
<h5>Insert the room's id, click "Connect" and enjoy!</h5>
<h5>Room's ID: </h5><input type="text" id="connid"/>
<div>
<input type="button" value="Connect" id="connectBtn">
</div>
<div>
<video id="playback" controls="controls" autoplay="autoplay" height="50px" width="300px"/>
</div>
<script src="http://cdn.peerjs.com/0.3/peer.min.js"></script>
<script>
var peer = new Peer({key: 'bwipa5argudf5hfr', debug: 4});
var context = new webkitAudioContext();
var receiver;
var call;
connectBtn.addEventListener('click', function(){
navigator.webkitGetUserMedia({ audio: true, video: true}, function(mediaStream){
call = peer.call(connid.value, mediaStream);
call.on('stream', function(remoteStream){
receiver = context.createMediaStreamSource(remoteStream);
receiver.connect(context.destination);
playback.src = URL.createObjectURL(remoteStream);
});
},
function() {
alert("Error: could not access getUserMedia");
}
);
});
</script>
</body>
</html>