forked from adamavenir/talkto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
executable file
·76 lines (66 loc) · 2.05 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
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
69
70
71
72
73
74
75
76
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Talk to me</title>
<meta name="viewport" content="width=device-width">
<style>
body {
margin: 0;
background: black;
}
#localVideo {
position: absolute;
width: 134px;
height: 100px;
top: 10px;
left: 10px;
border-top: 1px solid rgba(255,255,255,.7);
box-shadow: rgba(0,0,0,.5) 0 0 10px;
border-radius: 3px;
}
#remoteVideos video {
margin: 0 auto;
display: inline-block;
}
#remoteVideos.videos1 video {
width: 100%;
max-width: 890px;
display: block;
}
.videos2 video {
width: 50%;
}
.videos3 video, .videos4 video {
height: 50%;
}
</style>
</head>
<body>
<section>
<video id="localVideo"></video>
<div id="remoteVideos"></div>
</section>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script src="http://simplewebrtc.com/latest.js"></script>
<script>
var videoCount;
var webrtc = new SimpleWebRTC({
localVideoEl: 'localVideo',
remoteVideosEl: 'remoteVideos',
autoRequestMedia: true
});
webrtc.on('readyToCall', function () {
webrtc.joinRoom(window.location.href);
setVideoCount();
});
var setVideoCount = function () {
videoCount = $('#remoteVideos').children().length;
$('#remoteVideos').attr('class', 'videos' + videoCount)
}
webrtc.on('video*', function() {
setVideoCount();
});
</script>
</body>
</html>