forked from video-dev/hls.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index-light.html
676 lines (651 loc) · 20.1 KB
/
index-light.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
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>hls.js demo</title>
<link
rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css"
/>
<link
rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap-theme.min.css"
/>
<link rel="stylesheet" href="style.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/1.3.8/FileSaver.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.15.2/ace.js"></script>
</head>
<body>
<div class="header-container">
<header class="wrapper clearfix">
<h1>
<a target="_blank" href="https://github.com/video-dev/hls.js">
<img
src="https://cloud.githubusercontent.com/assets/616833/19739063/e10be95a-9bb9-11e6-8100-2896f8500138.png"
/>
</a>
</h1>
<h2 class="title">light demo</h2>
<h3>
<a href="../api-docs">API docs | usage guide</a>
</h3>
</header>
</div>
<div class="main-container">
<header>
<p>
Test your HLS streams in all supported browsers
(Chrome/Firefox/IE11/Edge/Safari).
</p>
<p>Advanced controls are available at the bottom of this page.</p>
<p>
<b
>This page uses hls.light.js. It does not support EME, subs or
alt-audio. Looking for the <i>complete hls.js</i> demo? Go
<a href=".">here</a>.</b
><br />
</p>
</header>
<div id="controls">
<div class="demo-controls-wrapper">
<select id="streamSelect" class="innerControls">
<option value="" selected>
Select a test-stream from drop-down menu. Or enter custom URL
below
</option>
</select>
<input id="streamURL" class="innerControls" type="text" value="" />
<label
class="innerControls"
title="Uncheck this to disable loading of streams selected from the drop-down above."
>
Enable streaming:
<input id="enableStreaming" type="checkbox" checked />
</label>
<label
class="innerControls"
title="When a media error occurs, attempt to recover playback by calling `hls.recoverMediaError()`."
>
Auto-recover media-errors:
<input id="autoRecoverError" type="checkbox" checked />
</label>
<label
class="innerControls"
title="Stop loading and playback if playback under-buffer stalls. This can help debug stall errors."
>
Stop on first stall:
<input id="stopOnStall" type="checkbox" unchecked />
</label>
<label class="innerControls">
Dump transmuxed fMP4 data:
<input id="dumpfMP4" type="checkbox" unchecked />
</label>
<label class="innerControls">
Metrics history (max limit, -1 is unlimited):
<input id="limitMetrics" style="width: 8em" type="number" />
</label>
<label class="innerControls">
HTML video element width:
<select id="videoSize" style="float: right">
<option value="240px">240px</option>
<option value="426px">426px</option>
<option value="640px">640px</option>
<option value="720px">720px</option>
<option value="854px">854px</option>
<option value="1280px">1280px</option>
<option value="1920px">1920px</option>
<option value="80%">Responsive (80%)</option>
<option value="100%">Responsive (100%)</option>
</select>
</label>
<label class="innerControls">
Current player size:
<span id="currentSize"></span>
</label>
<label class="innerControls">
Current video resolution:
<span id="currentResolution"></span>
</label>
<label class="innerControls permalink">
Permalink: <span id="StreamPermalink"></span>
</label>
</div>
<div class="config-editor-wrapper">
<div class="config-editor-container">
<div id="config-editor">Loading...</div>
</div>
<div class="config-editor-commands">
<label for="config-persistence">
Persist
<input
name="config-persistence"
id="config-persistence"
type="checkbox"
/>
</label>
<button name="config-apply" onclick="applyConfigEditorValue()">
Apply
</button>
</div>
</div>
</div>
<video
id="video"
controls
autoplay
playsinline
class="videoCentered"
style="width: 80%"
></video>
<br />
<canvas
id="bufferedCanvas"
width="720"
height="15"
class="videoCentered"
onclick="onClickBufferedRange(event);"
style="height: fit-content"
></canvas>
<br />
<br />
<label class="center">Status:</label>
<pre id="statusOut" class="center" style="white-space: pre-wrap"></pre>
<label class="center">Error:</label>
<pre id="errorOut" class="center" style="white-space: pre-wrap"></pre>
<div
class="center"
style="text-align: center; display: none"
id="toggleButtons"
>
<button
type="button"
class="btn btn-sm demo-tab-btn"
data-tab="playbackControlTab"
onclick="toggleTabClick(this);"
>
Playback
</button>
<button
type="button"
class="btn btn-sm demo-tab-btn"
data-tab="timelineTab"
onclick="toggleTabClick(this);"
>
Timeline
</button>
<button
type="button"
class="btn btn-sm demo-tab-btn"
data-tab="qualityLevelControlTab"
onclick="toggleTabClick(this);"
>
Quality-levels
</button>
<button
type="button"
class="btn btn-sm demo-tab-btn"
data-tab="audioTrackControlTab"
onclick="toggleTabClick(this);"
>
Audio-tracks
</button>
<button
type="button"
class="btn btn-sm demo-tab-btn"
data-tab="metricsDisplayTab"
onclick="toggleTabClick(this); showMetrics();"
>
Real-time metrics
</button>
<button
type="button"
class="btn btn-sm demo-tab-btn"
data-tab="statsDisplayTab"
onclick="toggleTabClick(this);"
>
Buffer & Statistics
</button>
</div>
<div
class="center demo-tab"
id="playbackControlTab"
style="display: none"
>
<br />
<center>
<p>
<span>
<button
type="button"
class="btn btn-sm btn-info"
title="video.play()"
onclick="$('#video')[0].play()"
>
Play
</button>
<button
type="button"
class="btn btn-sm btn-info"
title="video.pause()"
onclick="$('#video')[0].pause()"
>
Pause
</button>
</span>
<span>
<button
type="button"
class="btn btn-sm btn-info"
title="video.playbackRate = text input"
onclick="$('#video')[0].defaultPlaybackRate=$('#video')[0].playbackRate=$('#playback_rate').val();"
>
Playback rate
</button>
<input
type="number"
value="1"
id="playback_rate"
size="8"
style="width: 3em"
onkeydown="if(window.event.keyCode=='13'){$('#video')[0].defaultPlaybackRate=$('#video')[0].playbackRate=$('#playback_rate').val();}"
/>
</span>
<span>
<button
type="button"
class="btn btn-sm btn-info"
title="video.currentTime -= 10"
onclick="$('#video')[0].currentTime-=10"
>
- 10 s
</button>
<button
type="button"
class="btn btn-sm btn-info"
title="video.currentTime += 10"
onclick="$('#video')[0].currentTime+=10"
>
+ 10 s
</button>
</span>
<span>
<button
type="button"
class="btn btn-sm btn-info"
title="video.currentTime = text input"
onclick="$('#video')[0].currentTime=$('#seek_pos').val();"
>
Seek to
</button>
<input
type="number"
id="seek_pos"
size="8"
style="width: 7em"
onkeydown="if(window.event.keyCode=='13'){$('#video')[0].currentTime=$('#seek_pos').val();}"
/>
</span>
</p>
<p>
<span>
<button
type="button"
class="btn btn-xs btn-warning"
title="hls.startLoad()"
onclick="hls.startLoad()"
>
Start loading
</button>
<button
type="button"
class="btn btn-xs btn-warning"
title="hls.stopLoad()"
onclick="hls.stopLoad()"
>
Stop loading
</button>
</span>
<span>
<button
type="button"
class="btn btn-xs btn-warning"
title="hls.attachMedia(video)"
onclick="hls.attachMedia($('#video')[0])"
>
Attach media
</button>
<button
type="button"
class="btn btn-xs btn-warning"
title="hls.detachMedia()"
onclick="hls.detachMedia()"
>
Detach media
</button>
</span>
</p>
<p>
<span>
<button
type="button"
class="btn btn-xs btn-warning"
title="hls.recoverMediaError()"
onclick="hls.recoverMediaError()"
>
Recover media-error
</button>
<button
type="button"
class="btn btn-xs btn-warning"
title="hls.swapAudioCodec()"
onclick="hls.swapAudioCodec()"
>
Swap audio codec
</button>
</span>
</p>
<p>
<span>
<button
type="button"
class="btn btn-xs btn-default"
onclick="$('#streamSelect')[0].selectedIndex++;$('#streamSelect').change()"
>
Next video
</button>
<button
type="button"
class="btn btn-xs btn-default btn-dump"
title="Save dumped audio mp4 appends"
onclick="createfMP4('audio');"
>
Create audio-fmp4
</button>
<button
type="button"
class="btn btn-xs btn-default btn-dump"
title="Save dumped video mp4 appends"
onclick="createfMP4('video')"
>
Create video-fmp4
</button>
</span>
</p>
</center>
</div>
<div
class="center demo-tab demo-timeline-chart-container"
id="timelineTab"
style="display: none"
>
<canvas id="timeline-chart"></canvas>
</div>
<div
class="center demo-tab"
id="qualityLevelControlTab"
style="display: none"
>
<center>
<table>
<tr>
<td>
<p>Currently played level:</p>
</td>
<td>
<div id="currentLevelControl" style="display: inline"></div>
</td>
</tr>
<tr>
<td>
<p>Next level loaded:</p>
</td>
<td>
<div id="nextLevelControl" style="display: inline"></div>
</td>
</tr>
<tr>
<td>
<p>Currently loaded level:</p>
</td>
<td>
<div id="loadLevelControl" style="display: inline"></div>
</td>
</tr>
<tr>
<td>
<p>Cap-limit level (maximum):</p>
</td>
<td>
<div id="levelCappingControl" style="display: inline"></div>
</td>
</tr>
</table>
</center>
</div>
<div
class="center demo-tab"
id="audioTrackControlTab"
style="display: none"
>
<table>
<tr>
<td>Current audio-track:</td>
<td><div id="audioTrackControl" style="display: inline"></div></td>
</tr>
<tr>
<td>Language / Name:</td>
<td>
<div id="audioTrackLabel" style="display: inline">
None selected
</div>
</td>
</tr>
</table>
</div>
<div class="center demo-tab" id="metricsDisplayTab" style="display: none">
<br />
<div id="metricsButton">
<button
type="button"
class="btn btn-xs btn-info"
onclick="$('#metricsButtonWindow').toggle();$('#metricsButtonFixed').toggle();windowSliding=!windowSliding; refreshCanvas()"
>
toggle sliding/fixed window</button
><br />
<div id="metricsButtonWindow">
<button
type="button"
class="btn btn-xs btn-info"
onclick="timeRangeSetSliding(0)"
>
window ALL
</button>
<button
type="button"
class="btn btn-xs btn-info"
onclick="timeRangeSetSliding(2000)"
>
2s
</button>
<button
type="button"
class="btn btn-xs btn-info"
onclick="timeRangeSetSliding(5000)"
>
5s
</button>
<button
type="button"
class="btn btn-xs btn-info"
onclick="timeRangeSetSliding(10000)"
>
10s
</button>
<button
type="button"
class="btn btn-xs btn-info"
onclick="timeRangeSetSliding(20000)"
>
20s
</button>
<button
type="button"
class="btn btn-xs btn-info"
onclick="timeRangeSetSliding(30000)"
>
30s
</button>
<button
type="button"
class="btn btn-xs btn-info"
onclick="timeRangeSetSliding(60000)"
>
60s
</button>
<button
type="button"
class="btn btn-xs btn-info"
onclick="timeRangeSetSliding(120000)"
>
120s</button
><br />
<button
type="button"
class="btn btn-xs btn-info"
onclick="timeRangeZoomIn()"
>
Window Zoom In
</button>
<button
type="button"
class="btn btn-xs btn-info"
onclick="timeRangeZoomOut()"
>
Window Zoom Out</button
><br />
<button
type="button"
class="btn btn-xs btn-info"
onclick="timeRangeSlideLeft()"
>
<<< Window Slide
</button>
<button
type="button"
class="btn btn-xs btn-info"
onclick="timeRangeSlideRight()"
>
Window Slide >>></button
><br />
</div>
<div id="metricsButtonFixed">
<button
type="button"
class="btn btn-xs btn-info"
onclick="windowStart=$('#windowStart').val()"
>
fixed window start(ms)
</button>
<input
type="text"
id="windowStart"
defaultValue="0"
size="8"
onkeydown="if(window.event.keyCode=='13'){windowStart=$('#windowStart').val();}"
/>
<button
type="button"
class="btn btn-xs btn-info"
onclick="windowEnd=$('#windowEnd').val()"
>
fixed window end(ms)
</button>
<input
type="text"
id="windowEnd"
defaultValue="10000"
size="8"
onkeydown="if(window.event.keyCode=='13'){windowEnd=$('#windowEnd').val();}"
/><br />
</div>
<button
type="button"
class="btn btn-xs btn-success"
onclick="goToMetrics()"
style="font-size: 18px"
>
metrics link
</button>
<button
type="button"
class="btn btn-xs btn-success"
onclick="goToMetricsPermaLink()"
style="font-size: 18px"
>
metrics permalink
</button>
<button
type="button"
class="btn btn-xs btn-success"
onclick="copyMetricsToClipBoard()"
style="font-size: 18px"
>
copy metrics to clipboard
</button>
<canvas
id="bufferTimerange_c"
width="640"
height="100"
style="border: 1px solid #000000"
onmousedown="timeRangeCanvasonMouseDown(event)"
onmousemove="timeRangeCanvasonMouseMove(event)"
onmouseup="timeRangeCanvasonMouseUp(event)"
onmouseout="timeRangeCanvasonMouseOut(event);"
></canvas>
<canvas
id="bitrateTimerange_c"
width="640"
height="115"
style="border: 1px solid #000000"
></canvas>
<canvas
id="bufferWindow_c"
width="640"
height="100"
style="border: 1px solid #000000"
onmousemove="windowCanvasonMouseMove(event);"
></canvas>
<canvas
id="videoEvent_c"
width="640"
height="15"
style="border: 1px solid #000000"
></canvas>
<canvas
id="loadEvent_c"
width="640"
height="15"
style="border: 1px solid #000000"
></canvas
><br />
</div>
</div>
<div class="center demo-tab" id="statsDisplayTab" style="display: none">
<br />
<label>Buffer state:</label>
<pre id="bufferedOut"></pre>
<label>General stats:</label>
<pre id="statisticsOut"></pre>
</div>
</div>
<footer><br /><br /><br /><br /><br /><br /></footer>
<!-- Demo page required libs -->
<script src="canvas.js"></script>
<script src="metrics.js"></script>
<!-- demo build -->
<script src="../dist/hls.light.js"></script>
<script src="../dist/hls-demo.js"></script>
</body>
</html>