-
Notifications
You must be signed in to change notification settings - Fork 144
/
Copy pathindex.html
461 lines (447 loc) · 29.6 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
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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
<!DOCTYPE html>
<html lang="en">
<head>
<title>KVS WebRTC Test Page</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<link rel="stylesheet" href="loader.css">
<link rel="stylesheet" href="./app.css">
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.bundle.min.js"></script>
<script src="aws-sdk-all-2.1646.0.js"></script>
<script src="https://unpkg.com/@ungap/url-search-params"></script>
<script src="https://webrtc.github.io/adapter/adapter-latest.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/chart.umd.min.js"></script>
<script src="https://www.gstatic.com/charts/loader.js"></script>
<link rel="icon" type="image/png" href="favicon.ico">
</head>
<body>
<div class="container mt-3">
<h1>KVS WebRTC Test Page</h1>
<p>This is the KVS Signaling Channel WebRTC test page. Use this page to connect to a signaling channel as either the MASTER or as a VIEWER.</p>
<div class="row loader"></div>
<div id="main" class="d-none">
<form id="form" onsubmit="return false">
<h4>KVS Endpoint</h4>
<div class="form-group has-validation" style="position: relative;">
<label for="region">Region</label>
<input type="text" class="form-control valid" id="region" placeholder="Region" value="us-west-2" autocomplete="off" required>
<datalist id="regionList"></datalist>
<div id="region-invalid-feedback" class="invalid-feedback"></div>
</div>
<h4>AWS Credentials</h4>
<div class="form-group">
<label for="accessKeyId">Access Key ID</label>
<input type="text" class="form-control" id="accessKeyId" placeholder="Access key id" required>
</div>
<div class="form-group">
<label for="secretAccessKey">Secret Access Key</label>
<input type="password" class="form-control" id="secretAccessKey" placeholder="Secret access key" required>
</div>
<div class="form-group">
<label for="sessionToken">Session Token <small>(optional)</small></label>
<input type="password" class="form-control" id="sessionToken" placeholder="Session token">
</div>
<h4>Signaling Channel</h4>
<div>
<label for="channelName">Channel Name</label>
<div class="form-group input-group">
<input type="text" class="form-control" id="channelName" placeholder="Channel" required>
<div class="input-group-append">
<button id="create-channel-button" type="submit" class="btn btn-primary" title="Create a signaling channel with this name.">Create Channel</button>
</div>
</div>
</div>
<div class="form-group">
<label for="clientId">Client Id <small>(optional)</small></label>
<span data-delay="{ "hide": 1500 }" data-position="auto" tabindex="0" class="text-info" data-toggle="tooltip" data-html="true" title="
<p>Only used in <code>viewer</code> mode. A unique identifier for the client. If left empty, a random client id will be generated.</p>
<a href="https://docs.aws.amazon.com/kinesisvideostreams-webrtc-dg/latest/devguide/kvswebrtc-websocket-apis-1.html">Additional information</a>
"><sup>ⓘ</sup></span>
<input type="text" class="form-control" id="clientId" placeholder="Client id">
</div>
<h4>Tracks</h4>
<p><small>Control which media types are transmitted to the remote client. For WebRTC Ingestion and Storage master, both audio and video must be sent, and viewers cannot not send video and optional audio.</small></p>
<div class="form-group">
<div class="form-check-inline">
<input class="form-check-input" type="checkbox" id="sendVideo" value="video" checked>
<label for="sendVideo" class="form-check-label">Send Video</label>
</div>
<div class="form-check-inline">
<input class="form-check-input" type="checkbox" id="sendAudio" value="audio">
<label for="sendAudio" class="form-check-label">Send Audio</label>
</div>
<div class="form-check-inline">
<input class="form-check-input" type="checkbox" id="openDataChannel" value="datachannel">
<label for="openDataChannel" class="form-check-label">Open DataChannel</label>
<span data-delay="{ "hide": 1500 }" data-position="auto" tabindex="0" class="text-info ml-1" data-toggle="tooltip" data-html="true" title="
<p>Open a channel which can be used for bidirectional peer-to-peer transfers of data, hence the name.</p>
<a href="https://www.w3.org/TR/webrtc/#rtcdatachannel">Additional information</a>
"><sup>ⓘ</sup></span>
</div>
</div>
<details id="webrtc-ingestion-and-storage-group"><summary class="h4">WebRTC Ingestion and Storage</summary>
<div>
<p><small>Configure which stream to ingest and store media to. Call update media storage configuration with an empty Stream name to disable this feature.</small></p>
<div class="form-group input-group">
<input type="text" class="form-control" id="streamName" placeholder="Stream name">
<div class="input-group-append">
<button id="create-stream-button" type="submit" class="btn btn-primary ml-1 mr-1" title="Create a Kinesis Video Stream with this name." data-toggle="modal" data-target="#create-stream-modal">Create Stream</button>
</div>
<div class="input-group-append">
<button id="update-media-storage-configuration-button" type="submit" class="btn btn-primary" title="Ingest and Store media to a specific Kinesis Video Stream.">Update Media Storage Configuration</button>
</div>
</div>
<div class="form-group">
<button id="describe-media-storage-configuration-button" class="btn btn-primary">Describe Media Storage Configuration</button>
</div>
<div class="form-group">
<button id="listStorageChannels" class="btn btn-primary">List All Media Storage Channels</button>
<p><small>List storage channels outputs the ARNs of all signaling channels configured for storage and their associated stream's ARN.</small></p>
</div>
<div class="form-group form-check-inline">
<input class="form-check-input" type="checkbox" id="ingest-media">
<label for="ingest-media" class="form-check-label">Automatically determine ingestion mode</label>
<span data-delay="{ "hide": 1500 }" data-position="auto" tabindex="0" class="text-info ml-1" data-toggle="tooltip" data-html="true" title="
<p>If WebRTC Ingestion and Storage is configured, after connecting to Kinesis Video Signaling, this sample application will invoke the JoinStorageSession API to have the Kinesis video producing device join the WebRTC session as a viewer.</p>
<a href="https://docs.aws.amazon.com/kinesisvideostreams/latest/dg/API_webrtc_JoinStorageSession.html">Additional information</a>
"><sup>ⓘ</sup></span>
</div>
<div id="manual-ingestion-mode-button-override" class="form-group form-check-inline">
<label for="show-join-storage-session-button" class="form-check-label mr-2">Manual override:</label>
<div id="manual-join-button-group" class="btn-group" role="group" aria-label="ingestion manual mode">
<button id="ingest-media-manual-on" class="btn btn-secondary">ON</button>
<button id="ingest-media-manual-off" class="btn btn-primary" data-selected="true">OFF</button>
</div>
</div>
<br />
<div id="show-join-storage-session-manually">
<div class="form-group form-check-inline">
<input class="form-check-input" type="checkbox" id="show-join-storage-session-button">
<label for="show-join-storage-session-button" class="form-check-label">Show button to manually call JoinStorageSession API.</label>
<span data-delay="{ "hide": 1500 }" data-position="auto" tabindex="0" class="text-info ml-1" data-toggle="tooltip" data-html="true" title="
<p>If enabled, this application won't automatically invoke this API after connecting to Signaling. You will need to invoke this API manually.</p>
"><sup>ⓘ</sup></span>
</div>
<div class="form-group form-check-inline">
<input class="form-check-input" type="checkbox" id="show-join-storage-session-as-viewer-button">
<label for="show-join-storage-session-as-viewer-button" class="form-check-label">Show button to manually call JoinStorageSessionAsViewer API.</label>
<span data-delay="{ "hide": 1500 }" data-position="auto" tabindex="0" class="text-info ml-1" data-toggle="tooltip" data-html="true" title="
<p>If enabled, this application won't automatically invoke this API after connecting to Signaling. You will need to invoke this API manually.</p>
"><sup>ⓘ</sup></span>
</div>
</div>
</div>
</details>
<h4>Video Resolution</h4>
<p><small>Set the desired video resolution and aspect ratio.</small></p>
<div class="form-group">
<div class="form-check">
<input class="form-check-input" type="radio" name="resolution" id="widescreen" value="option1" checked>
<label class="form-check-label" for="widescreen">1280x720 <small>(16:9 widescreen)</small></label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="resolution" id="fullscreen" value="option2">
<label class="form-check-label" for="fullscreen">640x480 <small>(4:3 fullscreen)</small></label>
</div>
</div>
<h4>NAT Traversal</h4>
<p><small>Control settings for ICE candidate generation.</small>
<span data-delay="{ "hide": 1500 }" data-position="auto" tabindex="0" class="text-info" data-toggle="tooltip" data-html="true" title="
<p>Determines the types of <code>ICE candidates</code> that are generated.<br/><br/>STUN/TURN = host, server reflexive, and relay<br/>STUN only = server reflexive<br/>TURN only = relay<br/>Disabled = host</p>
<a href="https://docs.aws.amazon.com/kinesisvideostreams-webrtc-dg/latest/devguide/kvswebrtc-how-it-works.html#how-kvswebrtc-works">Additional information</a>
"><sup>ⓘ</sup></span></p>
<div class="form-group">
<div class="form-check">
<input class="form-check-input" type="radio" name="natTraversal" id="natTraversalEnabled" value="option2" checked>
<label class="form-check-label" for="natTraversalEnabled">STUN/TURN</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="natTraversal" id="forceTURN" value="option3">
<label class="form-check-label" for="forceTURN">TURN Only <small>(force cloud relay)</small></label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="natTraversal" id="forceSTUN" value="option4">
<label class="form-check-label" for="forceSTUN">STUN Only</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="natTraversal" id="natTraversalDisabled" value="option1">
<label class="form-check-label" for="natTraversalDisabled">Disabled</label>
</div>
</div>
<div class="form-group">
<div class="form-check-inline">
<input class="form-check-input" type="checkbox" id="useTrickleICE" value="useTrickleICE" checked>
<label for="useTrickleICE" class="form-check-label">Use trickle ICE</label>
<span data-delay="{ "hide": 1500 }" data-position="auto" tabindex="0" class="text-info ml-1" data-toggle="tooltip" data-html="true" title="
<p>ICE candidates are exchanged incrementally as soon as they become available (and simultaneously with the gathering of other candidates). Supported by browsers, but not by Alexa devices.</p>
<a href="https://datatracker.ietf.org/doc/html/rfc8829#sec.ice-candidate-trickling">Additional information</a>
"><sup>ⓘ</sup></span>
</div>
</div>
<h4>Amazon KVS WebRTC DQP</h4>
<div class="form-group">
<div class="form-check-inline">
<input class="form-check-input" type="checkbox" id="enableDQPmetrics" value="enableDQPmetrics">
<label for="enableDQPmetrics" class="form-check-label">Enable KVS WebRTC DQP Test and Metrics <small>(Viewer only)</small></label>
<span data-delay="{ "hide": 1500 }" data-position="auto" tabindex="0" class="text-info ml-1" data-toggle="tooltip" data-html="true" title="
<p>Enables the test and metrics for the Amazon KVS WebRTC Device Qualification Program.</p>
<a href="https://aws.amazon.com/partners/programs/dqp/">Additional information</a>
"><sup>ⓘ</sup></span>
</div>
</div>
<h4>Amazon KVS WebRTC Profiling Timeline chart</h4>
<div class="form-group">
<div class="form-check-inline">
<input class="form-check-input" type="checkbox" id="enableProfileTimeline" value="enableProfileTimeline">
<label for="enableProfileTimeline" class="form-check-label">Enable C SDK master and JS viewer profile timeline<small>(Master + Viewer)</small></label>
<span data-delay="{ "hide": 1500 }" data-position="auto" tabindex="0" class="text-info ml-1" data-toggle="tooltip" data-html="true" title="
<p>Enables the test and metrics for the Amazon KVS WebRTC by sending the master-side metrics to the viewer via datachannel and display a timeline chart.</p>
<a href="https://github.com/awslabs/amazon-kinesis-video-streams-webrtc-sdk-js/tree/develop?tab=readme-ov-file#metrics">Additional information</a>
"><sup>ⓘ</sup></span>
</div>
</div>
<details><summary class="h4">Advanced</summary>
<p><small>Filter settings for which ICE candidates are sent to and received from the peer.</small></p>
<div class="container">
<div class="row">
<div class="col-sm">
<div class="form-check">
<input class="form-check-input" type="checkbox" id="send-relay" checked />
<label for="send-relay" class="form-check-label">Send <code>relay</code> candidates to peer</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="accept-relay" checked />
<label for="accept-relay" class="form-check-label">Accept <code>relay</code> candidates from peer</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="send-srflx" checked />
<label for="send-srflx" class="form-check-label">Send <code>srflx</code> candidates to peer</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="accept-srflx" checked />
<label for="accept-srflx" class="form-check-label">Accept <code>srflx</code> candidates from peer</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="send-host" checked />
<label for="send-host" class="form-check-label">Send <code>host</code> candidates to peer</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="accept-host" checked />
<label for="accept-host" class="form-check-label">Accept <code>host</code> candidates from peer</label>
</div>
</div>
<div class="col-sm">
<div class="form-check">
<input class="form-check-input" type="checkbox" id="send-prflx" checked />
<label for="send-prflx" class="form-check-label">Send <code>prflx</code> candidates to peer</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="accept-prflx" checked />
<label for="accept-prflx" class="form-check-label">Accept <code>prflx</code> candidates from peer</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="send-tcp" checked />
<label for="send-tcp" class="form-check-label">Send <code>tcp</code> candidates to peer</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="accept-tcp" checked />
<label for="accept-tcp" class="form-check-label">Accept <code>tcp</code> candidates from peer</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="send-udp" checked />
<label for="send-udp" class="form-check-label">Send <code>udp</code> candidates to peer</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="accept-udp" checked />
<label for="accept-udp" class="form-check-label">Accept <code>udp</code> candidates from peer</label>
</div>
</div>
</div>
</div>
<p class="mt-3"><small>Logging</small></p>
<div class="container">
<div class="row">
<div class="col-sm">
<div class="form-check">
<input class="form-check-input" type="checkbox" id="log-aws-sdk-calls" onclick="configureAwsSdkLogs()"/>
<label for="log-aws-sdk-calls" class="form-check-label">Log AWS SDK for JavaScript calls</label>
</div>
</div>
</div>
</div>
<p class="mt-3"><small>Endpoint Override</small></p>
<div class="form-group">
<input type="text" class="form-control" id="endpoint" placeholder="Endpoint">
</div>
</details>
<hr>
<div>
<button id="master-button" type="submit" class="btn btn-primary">Start Master</button>
<button id="viewer-button" type="submit" class="btn btn-primary">Start Viewer</button>
</div>
</form>
<div class="modal fade" id="create-stream-modal" tabindex="-1" role="dialog" aria-labelledby="create-stream-modal-label" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="create-stream-modal-label">Create a Kinesis Video Stream</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<form>
<div class="form-group">
<label for="create-stream-modal-stream-input" class="col-form-label">Stream Name:</label>
<input type="text" class="form-control" id="create-stream-modal-stream-input">
</div>
<div class="form-group">
<label for="create-stream-modal-retention-input" class="col-form-label">Data retention (hours):</label>
<input class="form-control" id="create-stream-modal-retention-input" type="number" value="48"/>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary" id="create-stream-modal-create-stream-button" data-dismiss="modal">Create Stream</button>
</div>
</div>
</div>
</div>
<div id="master" class="d-none">
<h2 id="master-heading">Master</h2>
<div class="row">
<div class="col">
<h5 id="master-section-heading">Master Section</h5>
<div class="video-container"><video class="local-view" autoplay playsinline controls muted></video></div>
</div>
<div id="viewer-view-holder" class="col remote">
<h5 id="master-viewer-heading">Viewer Return Channel</h5>
<div id="empty-video-placeholder" class="video-container"><video class="remote-view" autoplay playsinline controls></video></div>
</div>
</div>
<div class="row datachannel">
<div class="col">
<div class="form-group">
<textarea id="master-data-channel-input" type="text" class="form-control local-message" placeholder="DataChannel message to send to all viewers"> </textarea>
</div>
</div>
<div class="col remote">
<div class="card bg-light mb-3">
<pre class="remote-message card-body text-monospace preserve-whitespace"></pre>
</div>
</div>
</div>
<div>
<span class="send-message datachannel">
<button id="send-message" type="button" class="btn btn-primary">Send DataChannel Message</button>
</span>
<button id="stop-master-button" type="button" class="btn btn-danger">Stop Master</button>
<button id="join-storage-session-button" type="button" class="btn btn-primary d-none">Join Storage Session</button>
<button id="join-storage-session-as-viewer-button" type="button" class="btn btn-primary d-none">Join Storage Session As Viewer</button>
</div>
</div>
<div id="viewer" class="d-none">
<h2>Viewer</h2>
<div class="row">
<div class="col">
<h5>Return Channel</h5>
<div class="video-container"><video class="local-view" autoplay playsinline controls muted></video></div>
</div>
<div class="col">
<h5>From Master</h5>
<div class="video-container"><video class="remote-view" autoplay playsinline controls></video></div>
</div>
</div>
<div class="row datachannel">
<div class="col">
<div class="form-group">
<textarea type="text" class="form-control local-message" placeholder="DataChannel message to send to MASTER"> </textarea>
</div>
</div>
<div class="col">
<div class="card bg-light mb-3">
<pre class="remote-message card-body text-monospace preserve-whitespace"></pre>
</div>
</div>
</div>
<div>
<span class="send-message datachannel d-none">
<button type="button" class="btn btn-primary">Send DataChannel Message</button>
</span>
<button id="stop-viewer-button" type="button" class="btn btn-danger">Stop Viewer</button>
</div>
</div>
<div>
<div id="dqpmetrics" class="d-none">
<h3 id="dqpmetrics-header">DQP Test Metrics (from Master)</h3>
<div class="row">
<div class="col">
<div class="card bg-light mb-3">
<div id="dqp-test"></div>
</div>
</div>
<div class="col">
<div class="card bg-light mb-3">
<canvas id="metricsChart" style="width:100%"; height="400px"></canvas>
</div>
</div>
</div>
<h3 id="live-stats-header">Live Stats (from Master)</h3>
<div class="card bg-light mb-3">
<div id="webrtc-live-stats"></div>
</div>
</div>
<div id="timeline-profiling" class="d-none" style="padding-top:20px;">
<div class="row">
<div class="col">
<h4 id="timeline-profiling-header"></h4>
<div id="timeline-chart" style="width:100%;height:0px">
</div>
</div>
</div>
</div>
</div>
<h3 id="logs-header">Logs</h3>
<div class="card bg-light mb-3">
<div style="display: flex; justify-content: space-between;">
<div id="tabs">
<button id="debug-button" class="btn btn-light" onClick="logLevelSelected(event)" data-level="DEBUG">DEBUG</button>
<button id="info-button" class="btn btn-primary" onClick="logLevelSelected(event)" data-level="INFO">INFO</button>
<button id="warn-button" class="btn btn-light" onClick="logLevelSelected(event)" data-level="WARN">WARN</button>
<button id="error-button" class="btn btn-light" onClick="logLevelSelected(event)" data-level="ERROR">ERROR</button>
</div>
<div class="d-inline-flex">
<button id="more-logs" class="btn btn-light" title="Show more logs">+</button>
<button id="less-logs" class="btn btn-light" title="Show less logs">-</button>
<button id="clear-logs" class="btn btn-light">Clear Logs</button>
<div>
<button id="copy-logs" class="btn btn-light" title="Copy logs">
<span id="copy-tooltip" aria-live="assertive" class="text-info" role="tooltip" data-position="auto" title="Copied logs to clipboard!">📋</span>
</button>
</div>
</div>
</div>
<pre id="logs" class="card-body text-monospace preserve-whitespace"></pre>
</div>
</div>
</div>
<div id="test"></div>
<script src="../kvs-webrtc.js"></script>
<script src="./channelHelper.js"></script>
<script src="./mediaHelper.js"></script>
<script src="./answerer.js"></script>
<script src="./master.js"></script>
<script src="./viewer.js"></script>
<script src="./createSignalingChannel.js"></script>
<script src="./listStorageChannels.js"></script>
<script src="./updateMediaStorageConfiguration.js"></script>
<script src="./describeMediaStorageConfiguration.js"></script>
<script src="./createStream.js"></script>
<script src="./joinStorageSession.js"></script>
<script src="./joinStorageSessionAsViewer.js"></script>
<script src="./app.js"></script>
</body>
</html>