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
|
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
:root {
--player-bg-color: #000;
--player-control-icon-fill: #fff;
--player-control-item-half-width: clamp(calc(16px / 2), calc(10vmax / 2), calc(32px / 2));
--player-control-item-height: clamp(16px, 10vmax, 32px);
--close-btn-fill-color: #000;
--controls-bottom-distance: 15px;
--controls-bottom-upper-height: 30px;
--scrubber-vertical-margin: 7px;
--resize-margin: 5px;
background-color: var(--player-bg-color);
overflow: hidden;
}
button::-moz-focus-inner {
border: 0;
}
body {
margin: 0;
}
body:fullscreen {
-moz-window-dragging: no-drag;
}
.player-holder {
display: flex;
flex-direction: column;
height: 100vh;
overflow: hidden;
}
browser {
flex: 1;
}
#controls {
height: calc(100% - 2 * var(--resize-margin));
left: 0;
position: absolute;
top: 0;
width: calc(100% - 2 * var(--resize-margin));
margin: var(--resize-margin);
-moz-window-dragging: drag;
}
#controls button {
appearance: none;
border: 0;
z-index: 1;
}
#controls button:focus-visible,
#controls input:focus-visible,
.switch > input:focus-visible + .slider {
outline: 3px solid #0060DF;
box-shadow: 1px 2px 5px #000;
}
/* Styling for background gradient.
* Opacity changes are handled separately under .control-item.
*/
#controls-bottom-gradient {
background: linear-gradient(0deg, #000000 -13.24%, rgba(0, 0, 0, 0) 90.44%);
position: absolute;
height: calc(var(--controls-bottom-distance) + 2 * var(--resize-margin) + var(--player-control-item-height) + var(--controls-bottom-upper-height) + var(--scrubber-vertical-margin));
bottom: 0;
width: 100vw;
margin: 0 calc(-1 * var(--resize-margin)) calc(-1 * var(--resize-margin)) calc(-1 * var(--resize-margin));
pointer-events: none;
-moz-window-dragging: drag;
}
#controls-bottom {
position: absolute;
bottom: var(--controls-bottom-distance);
width: 100%;
}
.controls-bottom-lower {
display: grid;
grid-template-columns: repeat(3, 1fr);
margin: 0 24px;
}
.start-controls {
display: grid;
justify-self: start;
}
.center-controls {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-template-areas: "seekbackward playpause seekforward";
justify-self: center;
gap: 8px;
}
.end-controls {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-template-areas: "audio closedcaption fullscreen";
justify-self: end;
gap: 8px;
}
.control-item {
-moz-window-dragging: no-drag;
transition: opacity 160ms linear, fill-opacity 160ms linear;
opacity: 0;
cursor: pointer;
}
.control-button {
background-color: transparent;
border-radius: 4px;
/**
* Make the button dimensions a square proportional to one
* dimension of the window - in this case, the width dimension,
* since we suspect most videos are wider than they are tall.
*/
height: var(--player-control-item-height);
width: 10vmax;
max-width: 32px;
min-width: 16px;
-moz-context-properties: fill, fill-opacity;
fill: var(--player-control-icon-fill);
background-position: center;
background-size: 60%;
background-repeat: no-repeat;
}
.control-button:hover:enabled {
background-color: rgba(255, 255, 255, .25);
}
#controls:is([keying], [showing]) .control-button:disabled,
/* Only change opacity on hover events for non-fullscreen mode.
* Fullscreen mode uses the `showing` attribute instead. */
body:not(:fullscreen) #controls:hover .control-button:disabled {
/* Set `fill-opacity` to the desired opacity in addition to full `opacity`
* to allow having the button's tooltip in full opacity even if the button is disabled. */
fill-opacity: 0.4;
opacity: 1 !important;
}
.control-item:focus-visible::after,
.control-item:hover::after {
content: attr(tooltip);
display: inline-block;
width: max-content;
position: relative;
padding: .4em .5em;
background: #000000;
color: #ffffff;
border-radius: 4px;
pointer-events: none;
}
/* Since #controls is set to LTR, button tooltips would normally appear
* as LTR also for RTL locales. To fix this, set the .control-item's ::after
* to RTL based on the root directionality.
* Because of that, don't set logical properties for the next set of rules. */
:root:dir(rtl) .control-item::after {
direction: rtl;
}
/* Set the tooltip position for different playback controls */
.tooltip-under-controls:focus-visible::after,
.tooltip-under-controls:hover::after {
bottom: -3em;
}
#close:focus-visible::after,
#close:hover::after,
#unpip[mac="true"]:focus-visible::after,
#unpip[mac="true"]:hover::after {
float: right;
transform: translateX(1em);
}
#unpip:focus-visible::after,
#unpip:hover::after,
#close[mac="true"]:focus-visible::after,
#close[mac="true"]:hover::after {
float: left;
transform: translateX(-1em);
}
.tooltip-over-controls:focus-visible::after,
.tooltip-over-controls:hover::after {
bottom: 3em;
}
.inline-end-tooltip:focus-visible::after,
.inline-end-tooltip:hover::after {
float: right;
right: -1em;
}
.inline-start-tooltip:focus-visible::after,
.inline-start-tooltip:hover::after {
float: left;
left: -1em;
}
.center-tooltip:focus-visible::after,
.center-tooltip:hover::after {
right: 0.8em;
translate: calc(-50% + var(--player-control-item-half-width));
}
/* Since the unpip button icon is reversed for RTL locales,
* re-position the tooltip so that the tooltip remains in the original placement */
:root:dir(rtl) #unpip:focus-visible::after,
:root:dir(rtl) #unpip:hover::after {
float: right;
}
:root:dir(rtl) #unpip[mac="true"]:focus-visible::after,
:root:dir(rtl) #unpip[mac="true"]:hover::after {
float: left;
}
/* Since the unpip icon is reversed for RTL locales,
* flip its tooltip back */
:root:dir(rtl) #unpip:focus-visible::after,
:root:dir(rtl) #unpip:hover::after {
scale: -1 1;
}
/* Set opacity for buttons and scrubber when controls are visible on the pip window and are not hovered over.
* For fullscreen mode, only apply opacity if there is a showing attribute. */
body:not(:fullscreen) #controls:hover .control-item:not(:hover),
body:fullscreen #controls[showing]:hover .control-item:not(:hover),
#controls[donthide] .control-item {
opacity: 0.8;
}
#controls[keying] .control-item,
#controls[showing] .control-item,
#controls:hover .control-item:hover {
opacity: 1;
}
/* Background gradient is the only control item with a fixed opacity value. */
#controls[keying] .control-item#controls-bottom-gradient,
#controls[showing] .control-item#controls-bottom-gradient,
#controls:hover .control-item#controls-bottom-gradient:hover
#controls[donthide] .control-item#controls-bottom-gradient {
opacity: 0.8;
}
/* For readability, timestamp should maintain full opacity when visible */
body:not(:fullscreen) #controls:hover #timestamp,
body:fullscreen #controls[showing]:hover {
opacity: 1;
}
#close,
#unpip {
background-color: rgba(255, 255, 255, .8);
position: absolute;
fill: var(--close-btn-fill-color);
}
#close:is(:hover, :focus-visible),
#unpip:is(:hover, :focus-visible) {
background-color: rgba(255, 255, 255, .9);
}
#close {
background-image: url("chrome://global/skin/icons/close.svg");
right: 10px;
top: 10px;
}
#close[mac="true"] {
right: auto;
left: 10px;
}
#unpip {
background-image: url("chrome://global/skin/media/picture-in-picture-closed.svg");
left: 10px;
top: 10px;
}
#unpip[mac="true"] {
right: 10px;
left: auto;
}
#playpause {
grid-area: playpause;
}
#audio {
grid-area: audio;
}
#fullscreen {
grid-area: fullscreen;
}
#controls.playing #playpause {
background-image: url("chrome://global/skin/media/pause-fill.svg");
}
#controls:not(.playing) #playpause {
background-image: url("chrome://global/skin/media/play-fill.svg");
}
#controls.muted #audio {
background-image: url("chrome://global/skin/media/audio-muted.svg");
}
#controls:not(.muted) #audio {
background-image: url("chrome://global/skin/media/audio.svg");
}
body:fullscreen #fullscreen {
background-image: url("chrome://global/skin/media/picture-in-picture-exit-fullscreen-button.svg");
background-size: auto;
}
body:not(:fullscreen) #fullscreen {
background-image: url("chrome://global/skin/media/picture-in-picture-enter-fullscreen-button.svg");
background-size: auto;
}
#seekBackward {
background-image: url("chrome://global/skin/media/picture-in-picture-seekBackward-button.svg");
background-size: auto;
grid-area: seekbackward;
}
#seekForward {
background-image: url("chrome://global/skin/media/picture-in-picture-seekForward-button.svg");
background-size: auto;
grid-area: seekforward;
}
:root:dir(rtl) #unpip {
transform: scaleX(-1);
}
#closed-caption {
background-image: url("chrome://global/skin/media/closed-caption-settings-button.svg");
color: white;
grid-area: closedcaption;
}
.box {
-moz-window-dragging: no-drag;
background-color: #2B2A33;
text-align: start;
font-size: 1em;
width: 186px;
padding: 0 8px;
margin: 0;
border-radius: 8px;
}
:root:dir(rtl) .box {
direction: rtl;
}
.a11y-only {
visibility: hidden;
position: absolute;
}
.hide {
display: none;
}
.bold {
font-weight: 590;
}
.box > input[type="radio"]{
background-color: red;
fill: currentColor;
}
.box label:not(.switch) {
color: white;
font-family: sans-serif;
}
#subtitles-toggle-label {
width: fit-content;
padding: 8px;
}
.panel {
position: absolute;
bottom: 40px;
user-select: none;
right: 24px;
}
.panel-fieldset {
border: none;
margin-top: 8px;
padding-inline-start: 0;
}
.panel-legend {
font-family: sans-serif;
color: white;
margin-top: 8px;
padding-inline-start: 0;
}
.arrow {
border: 10px solid transparent;
border-top-color: #2B2A33;
width: 0;
height: 0;
inset-inline-start: 136px;
position: relative;
}
.grey-line {
width: 100%;
height: 1px;
background: #8F8F9D;
}
.font-size-selection {
margin-inline-start: 8px;
padding-inline-start: 8px;
}
.font-size-selection-radio {
display: flex;
width: fit-content;
cursor: pointer;
padding-block: 8px;
}
.font-size-selection-radio label {
cursor: pointer;
}
.font-size-selection-radio > input[type="radio"] {
appearance: none;
width: 16px;
height: 16px;
border: 1px solid #8f8f9d;
border-radius: 50%;
margin: 0;
margin-inline-end: 6px;
}
.font-size-selection-radio > input[type="radio"]:checked {
border: 4px solid #00ddff;
}
.subtitle-grid {
display: grid;
grid-template-rows: auto;
grid-template-columns: auto 46px;
padding: 8px;
}
.switch {
position: relative;
display: inline-block;
width: 32px;
height: 16px;
grid-column: 2;
margin: 8px;
cursor: pointer;
}
.switch input {
opacity: 0;
width: 0;
height: 0;
}
.slider {
position: absolute;
inset: 0;
transition: transform 250ms;
border-radius: 13px;
background-color: #55545f;
}
.slider::before {
position: absolute;
content: '';
height: 12px;
width: 12px;
inset-inline-start: 2px;
bottom: 2px;
background-color: #2B2A33;
transition: transform 250ms;
border-radius: 50%;
}
input:checked + .slider {
background-color: #00ddff;
}
input:checked + .slider::before {
transform: translateX(16px);
}
:root:dir(rtl) input:checked + .slider::before {
transform: translateX(-16px);
}
.font-size-overlay {
opacity: 0.4;
pointer-events: none;
}
.controls-bottom-upper {
width: calc(100% - 38px);
height: var(--controls-bottom-upper-height);
margin: 0 19px;
display: grid;
}
.scrubber-no-drag {
-moz-window-dragging: no-drag;
height: 16px;
margin: var(--scrubber-vertical-margin) 0;
display: grid;
justify-items: center;
align-items: center;
width: 100%;
}
#scrubber {
width: 100%;
background-color: transparent;
padding: 6px;
}
#scrubber::-moz-range-thumb {
border-radius: 14px;
background-color: #BFBFC9;
position: relative;
width: 8px;
height: 8px;
border: 3px solid #FFFFFF;
bottom: 24px;
padding: 0;
}
#scrubber::-moz-range-track {
background-color: #969696;
}
#scrubber::-moz-range-progress {
background-color: #FFFFFF;
}
#scrubber,
#scrubber::-moz-range-track,
#scrubber::-moz-range-progress {
height: 4px;
border-radius: 10px;
}
#timestamp {
align-self: center;
color: #FFFFFF;
cursor: default;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Ubuntu", "Helvetica Neue", sans-serif;
font-size: 0.9em;
user-select: none;
width: 16ch;
grid-area: timestamp;
}
#timestamp::after {
background: unset;
content: unset;
}
@media (height <= 325px), (width <= 475px) {
#closed-caption {
display: none;
}
.end-controls {
grid-template-columns: repeat(2, 1fr);
grid-template-areas: "audio fullscreen";
}
}
@media (width <= 440px) {
#timestamp {
display: none;
}
}
@media (width <= 350px) {
#fullscreen {
display: none;
}
.end-controls {
grid-template-columns: repeat(1, 1fr);
grid-template-areas: "audio";
}
}
@media (height <= 200px) {
.scrubber-no-drag {
display: none;
}
}
@media (width <= 300px) {
.scrubber-no-drag,
#seekForward,
#seekBackward,
.start-controls {
display: none;
}
.controls-bottom-lower {
grid-template-columns: repeat(2, 1fr);
}
.center-controls {
grid-template-columns: repeat(1, 1fr);
grid-template-areas: "playpause";
}
.end-controls {
justify-self: center;
}
}
|