-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
containers.less
436 lines (342 loc) · 11 KB
/
containers.less
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
/** @license
* Shaka Player
* Copyright 2016 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
/* All of the top-level containers into which various visible features go. */
/* A container for the entire video + controls combo. This is the auto-setup
* div which we populate. */
.shaka-video-container {
.overlay-parent();
/* Without this, the container somehow winds up being a tad taller than it
* should be (484px vs 480px). */
display: flex;
/* Set a special font for material design icons. */
.material-icons-round {
font-family: "Material Icons Round";
font-size: 24px;
}
/* Set the fonts for all other content. */
font-family: Roboto, sans-serif, TengwarTelcontar;
font-weight: normal;
-webkit-font-smoothing: antialiased;
}
/* Each browser has a different prefixed pseudo-class for fullscreened elements.
* Define the properties of a fullscreened element in a mixin, then apply to
* each of the browser-specific pseudo-classes.
* NOTE: These fullscreen pseudo-classes can't be combined with commas into a
* single delcaration. Browsers ignore the rest of the list once they hit one
* pseudo-class they don't support. */
.fullscreen-container() {
.fill-container();
background-color: black;
.shaka-text-container {
/* In fullscreen mode, the text displayer's font size should be relative to
* the either window height or width (whichever is smaller), instead of a
* fixed size. */
font-size: 4.4vmin;
}
}
.shaka-video-container:fullscreen { .fullscreen-container(); }
.shaka-video-container:-webkit-full-screen { .fullscreen-container(); }
.shaka-video-container:-moz-full-screen { .fullscreen-container(); }
.shaka-video-container:-ms-fullscreen { .fullscreen-container(); }
/* The actual video element. Sits inside .shaka-video-container and gives it a
* size in non-fullscreen mode. In fullscreen mode, the sizing relationship
* flips. CSS is just great like that. :-( */
.shaka-video {
/* At the moment, nothing special is required here.
* Note that this should NOT be an overlay-child, as its size could dictate
* the size of the container for some applications. */
}
/* A container for all controls, including the giant play button, seek bar, etc.
* Sits inside .shaka-video-container, on top of (Z axis) .shaka-video, and
* below (Y axis) .shaka-play-button-container. */
.shaka-controls-container {
.overlay-child();
.hide-when-shaka-controls-disabled();
/* Without this, the controls container overflows the video container. */
box-sizing: border-box;
/* A flex container, to make layout of children easier to reason about. */
display: flex;
/* Defines in which direction the children should flow. */
flex-direction: column;
/* Pushes the children toward the bottom of the container. */
justify-content: flex-end;
/* Centers children horizontally. */
align-items: center;
/* By default, do not allow any of our controls to shrink.
* Specific controls can use .shrinkable() to override. */
* { .unshrinkable(); }
/* Position the controls container in front of the text container, so that
* the text container doesn't interfere with the control buttons. */
z-index: 1;
&[casting="true"] {
/* Hide fullscreen button while casting. */
.shaka-fullscreen-button {
.hidden();
}
}
}
/* A container for all canvas for LCEVC decoding
* Sits inside .shaka-video-container, on top of (Z axis) .shaka-video, and
* below (Y axis) .shaka-play-button-container. */
.shaka-canvas-container {
.overlay-child();
/* Make sure pointer events can reach the video element in the case of native
* controls. */
pointer-events: none;
}
/* A container for VR
* Sits inside .shaka-video-container, on top of (Z axis) .shaka-video, and
* below (Y axis) .shaka-play-button-container. */
.shaka-vr-canvas-container {
.overlay-child();
/* Make sure pointer events can reach the video element in the case of native
* controls. */
pointer-events: none;
}
/* Container for controls positioned at the bottom of the video container:
* controls button panel and the seek bar. */
.shaka-bottom-controls {
width: @bottom-controls-width;
padding: 0;
padding-bottom: 2.5%;
/* Position the bottom panel in front of other controls (play button and
* spinner containers).
* TODO: A different layout arrangement might be a better solution for this.
* Need to experiment.
*/
z-index: 1;
}
/* This is the container for the horizontal row of controls above the seek bar.
* It sits above (Y axis) the seek bar, and below (Y axis) the giant play button
* in the middle. */
.shaka-controls-button-panel {
/* Fill the space horizontally, with no extra padding or margin. */
padding: 0;
margin: 0;
/* This is itself a flex container, with children layed out horizontally. */
display: flex;
flex-direction: row;
/* Push children to the right. */
justify-content: flex-end;
/* Center children vertically. */
align-items: center;
/* TODO: Document why. */
overflow: hidden;
min-width: 48px;
/* Make sure we don't inherit odd font sizes and styles from the environment.
* TODO: When did this happen? What forced us to do this? */
font-size: 12px;
font-weight: normal;
font-style: normal;
/* Make sure contents cannot be selected. */
.unselectable();
.show-when-controls-shown();
/* All buttons, divs, and other controls directly inside this panel should
* have these characteristics by default. */
& > * {
/* White text or button icons. */
color: white;
/* 32px tall controls. */
height: 32px;
/* Consistent alignment of buttons. */
line-height: 0.5;
/* Consistent margins (external) and padding (internal) between controls. */
.bottom-panels-elements-margin();
padding: 0 5px;
/* Transparent backgrounds, no borders, and a pointer when you mouse over
* them. */
background: transparent;
border: 0;
cursor: pointer;
}
}
/* Buttons hide certain items if they are found inside the control panel */
.shaka-controls-button-panel .shaka-overflow-menu-only {
display: none;
}
/* The container for the giant play button. Sits above (Y axis) the
* other video controls and seek bar, in the middle of the video frame, on top
* of (Z axis) the video. */
.shaka-play-button-container {
/* Take up as much space as possible, but shrink (vertically) to accomodate
* the controls at the bottom. */
margin: 0;
.fill-container();
.shrinkable();
.absolute-position();
/* Keep the play button in the middle of this container. */
display: flex;
justify-content: center;
align-items: center;
}
.shaka-statistics-container {
overflow-x: hidden;
overflow-y: auto;
min-width: 300px;
color: white;
background-color: rgba(35 35 35 / 90%);
font-size: 14px;
padding: 5px 10px;
border-radius: 2px;
position: absolute;
z-index: 2;
left: 15px;
top: 15px;
/* Fades out with the other controls. */
.show-when-controls-shown();
div {
display: flex;
justify-content: space-between;
}
span {
color: rgb(150 150 150);
}
}
.shaka-ad-statistics-container {
overflow-x: hidden;
overflow-y: auto;
min-width: 150px;
color: white;
background-color: rgba(35 35 35 / 90%);
font-size: 14px;
padding: 5px 10px;
border-radius: 2px;
position: absolute;
z-index: 2;
right: 15px;
top: 15px;
/* Fades out with the other controls. */
.show-when-controls-shown();
div {
display: flex;
justify-content: space-between;
}
span {
color: rgb(150 150 150);
}
}
.shaka-context-menu {
background-color: rgba(35 35 35 / 90%);
border-radius: 2px;
position: absolute;
z-index: 3;
button {
padding: 5px 10px;
width: 100%;
display: flex;
align-items: center;
color: white;
background: transparent;
border: 0;
cursor: pointer;
&:hover {
background-color: rgba(50 50 50 / 90%);
}
}
label {
padding: 0 20px;
align-items: flex-start;
color: white;
cursor: pointer;
}
.shaka-current-selection-span {
align-items: flex-start;
color: white;
cursor: pointer;
}
}
.shaka-scrim-container {
margin: 0;
.fill-container();
.shrinkable();
.absolute-position();
.show-when-controls-shown();
/* A black gradient at the bottom, behind the controls, but only so high. */
background: linear-gradient(to top, black 0, transparent 15%);
}
.shaka-text-container {
.absolute-position();
/* Make sure the text container doesn't steal pointer events from another
* layer, such as the ad container. There is nothing interactive in this
* layer, so this should be fine. */
pointer-events: none;
/* Place the text container on the bottom of the video container. */
bottom: 0%;
width: 100%;
min-width: 48px;
/* When the controls fade in or out, it takes 600ms. Thus, when the text
* container adjusts to the presence or absence of controls, we should wait
* briefly, so the captions don't end up appearing behind the controls.
* Instead of being a gradual animation, this is a fast animation with a
* significant delay, since the captions moving around is a little
* distracting. */
transition: bottom cubic-bezier(0.4, 0, 0.6, 1) 100ms;
transition-delay: 500ms;
/* These are defaults which are overridden by JS or cue styles. */
font-size: 20px;
line-height: 1.4; // relative to font size.
color: white;
span.shaka-text-wrapper {
display: inline;
background: none;
}
}
.shaka-controls-container[shown="true"] ~ .shaka-text-container {
/* While the controls are shown, the text container should avoid the 15%
* at the bottom of the video, to avoid overlapping with controls. */
bottom: 15%;
/* Disable the transition delay when moving the captions up, so that the
* controls don't appear over the captions. */
transition-delay: 0ms;
}
/* The buffering spinner. */
.shaka-spinner-container {
.absolute-position();
.fill-container();
.hide-when-shaka-controls-disabled();
flex-shrink: 1;
display: flex;
justify-content: center;
align-items: center;
}
@spinner-size-percentage: 15.6%;
.shaka-spinner {
/* This uses the same trickery as the big play button define
the spinner's width and height. See .shaka-play-button
for the detailed explanation. */
/* For the padding thing to work, spinner div needs to be an
overlay-parent and spinner svg - an overlay child. */
.overlay-parent();
margin: 0;
box-sizing: border-box;
padding: calc(@spinner-size-percentage / 2);
width: 0;
height: 0;
/* Add a bit of a white shadow to keep our black spinner visible
on a black background. */
filter: drop-shadow(0 0 2px rgba(255 255 255 / 50%));
}
.shaka-hidden-fast-forward-container,
.shaka-hidden-rewind-container {
height: 100%;
width: 40%;
.shrinkable();
}
.shaka-hidden-fast-forward-container {
/* Keep the fast forward button to the right of this container. */
.absolute-position();
left: 60%;
}
.shaka-hidden-rewind-container {
/* keep the rewind button to the left */
.absolute-position();
}
.shaka-video-container.no-cursor {
cursor: none !important;
* {
cursor: none !important;
}
}