-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathpeerconnectionalpha.html
191 lines (172 loc) · 7.21 KB
/
peerconnectionalpha.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<title>WebRTC PeerConnection Manual Test</title>
<!-- Load the polyfill to switch-hit between Chrome and Firefox -->
<script src="adapter.js"></script>
<script src="peerconnection_manual.js"></script>
<script type="text/javascript" src="example1.js"></script>
<link rel="StyleSheet" href="stylesheet.css">
<meta charset="utf-8">
</head>
<body>
<div id="wrapper">
<div id="header" hidden>
GetUserMedia <a href="http://goo.gl/V7cZg">MediaStreamConstraints</a>:
<input type="text" id="getusermedia-constraints" wrap="soft">
Audio<input type="checkbox" id="audio" checked
onclick="updateGetUserMediaConstraints();"/>
Video<input type="checkbox" id="video" checked
onclick="updateGetUserMediaConstraints();"/>
Screen capture<input type="checkbox" id="screencapture"
onclick="updateGetUserMediaConstraints();"/>
<button class="button-green" id="re-request"
onclick="getUserMediaFromHere();">Request GetUserMedia</button><br/>
Audio source <select class="drop-down" id="audiosrc"
onchange="updateGetUserMediaConstraints();"></select>
Video source <select class="drop-down" id="videosrc"
onchange="updateGetUserMediaConstraints();"></select>
Optional min size <input type="text" id="video-width" value="1280"
size="5px" onblur="updateGetUserMediaConstraints();">
x <input type="text" id="video-height" value="720" size="5px"
onblur="updateGetUserMediaConstraints();">
<button id="get-devices" onclick="getDevices();">
Get devices</button>
Onload<input type="checkbox" id="get-devices-onload">
You can also use <a href="constraints.html">constraints.html</a>
<a href="peerconnection-help.html" target="_blank">Help</a>
<br/>
</div>
<button id="get-devices" onclick="clearCanvas();">
Clear drawing canvas</button>
<div id="container">
<div class="left">
<div style="background-color: pink">
<h2>Local Preview</h2>
<canvas id="c" width="320" height="240" style="border:2px solid #000000;"></canvas>
</div>
<div>
<div>
Size: <div id="local-view-size" class="inline-contents"></div>
<div id="local-view-stream-size" class="inline-contents">(stream
size: N/A)</div><br/>
</div>
<div>
Resize: <button onclick="updateVideoTagSize('local-view')"> To
stream size</button>
<button onclick="updateVideoTagSize('local-view', 320, 240);">
320x240</button>
<button onclick="updateVideoTagSize('local-view', 640, 480);">
640x480</button>
</div>
</div>
<h2>Send on data channel</h2>
<input type="text" id="data-channel-send" size="10" />
<button onclick="sendDataFromHere();">Send data</button><br>
<h2>Settings</h2>
Server [<a href="" onclick="showServerHelp();">?</a>]:
<input type="text" id="pc-server" size="30"
value="http://localhost:8888"/>
Peer ID: <input type="text" id="peer-id" size="10" />
<button class="button-green" id="connect" onclick="connectFromHere();">
Connect</button><br/>
PeerConnection Constraints:
CPU overuse <input type="checkbox" id="cpuoveruse-detection"
onclick="setPeerConnectionConstraints();" checked="true"/>
RTP <input type="checkbox" id="data-channel-type-rtp"
onclick="setPeerConnectionConstraints();"><br/>
<input class="width-100" type="text" id="pc-constraints" value="{}" ><br/>
PeerConnection <a href="http://goo.gl/xVi12">
createOffer MediaConstraints:</a><br/>
<input type="text" class="width-100" id="pc-createoffer-constraints"
value="{}"/><br/>
PeerConnection <a href="http://goo.gl/0TjfX">
createAnswer MediaConstraints:</a><br/>
<input type="text" class="width-100" id="pc-createanswer-constraints"
value="{}"/><br/>
Call:
<button class="button-green" onclick="negotiateCallFromHere();">Negotiate
</button>
<button class="button-red" onclick="hangUpFromHere();">Hang up</button>
<br/>
Local Stream:
<button class="button-green" onclick="addLocalStreamFromHere();">Add
</button>
<button class="button-red" onclick="removeLocalStreamFromHere();">Remove
</button>
<button class="button-red" onclick="stopLocalFromHere();">Stop</button>
<button onclick="toggleLocalVideoFromHere();">Toggle Video</button>
<button onclick="toggleLocalAudioFromHere();">Toggle Audio</button><br/>
Remote Stream:
<button onclick="toggleRemoteVideoFromHere();">Toggle Video</button>
<button onclick="toggleRemoteAudioFromHere();">Toggle Audio</button><br/>
Data Channel:
<button onclick="createDataChannelFromHere();">Create</button>
<button onclick="closeDataChannelFromHere();">Close</button>
status:
<input type="text" id="data-channel-status" size="10" value="not created"
disabled="true" /><br/>
DTMF Sender:
<button onclick="createDtmfSenderFromHere();">Create</button>
tones:
<input type="text" id="dtmf-tones" size="10" value="123,abc" />
duration(ms):
<input type="text" id="dtmf-tones-duration" size="10" value="100" />
gap(ms):
<input type="text" id="dtmf-tones-gap" size="10" value="50" />
<button onclick="insertDtmfFromHere();">Send</button><br/>
Options:
<input type="checkbox" id="force-isac" onclick="forceIsacChanged();"/>
Force iSAC in Outgoing SDP<br/>
<button onclick="clearLog();">Clear Logs</button>
</div>
<div class="right">
<div style="background-color: blue">
<h2>Remote Video</h2>
<video width="320" height="240" id="remote-view" autoplay="autoplay" style="border:2px solid #000000;">
</video><br/>
</div>
<div>
<div>
Size: <div id="remote-view-size" class="inline-contents"></div>
<div id="remote-view-stream-size" class="inline-contents">(stream size
:N/A)</div><br/>
</div>
<div>
Resize: <button onclick="updateVideoTagSize('remote-view')"> To
stream size</button>
<button onclick="updateVideoTagSize('remote-view', 320, 240);">
320x240</button>
<button onclick="updateVideoTagSize('remote-view', 640, 480);">
640x480</button>
</div>
</div>
<h2>Received on data channel</h2>
<textarea id="data-channel-receive" rows="7" cols="40" disabled="true">
</textarea>
<h2>Sent DTMF tones</h2>
<textarea id="dtmf-tones-sent" rows="7" cols="40" disabled="true">
</textarea>
</div>
<div id="footer">
<div class="left">
<h2>Messages</h2>
<pre id="messages"></pre>
</div>
<div class="right">
<h2>Debug</h2>
<pre id="debug"></pre>
</div>
</div>
</div>
</div>
</body>
<script>
function clearCanvas() {
var c = document.getElementById('c');
var context = c.getContext('2d');
context.closePath();
context.clearRect(0, 0, c.width, c.height);
}
</script>
</html>