Cleanup SASS imports
[oweals/peertube.git] / client / src / sass / player / peertube-skin.scss
1 @import '_variables';
2 @import '_mixins';
3 @import './_player-variables';
4
5 body {
6   --embedForegroundColor: #{$primary-foreground-color};
7
8   --embedBigPlayBackgroundColor: #{$primary-background-color};
9 }
10
11 @mixin big-play-button-triangle-size($triangle-size) {
12   width: $triangle-size;
13   height: $triangle-size;
14   top: calc(50% - #{$triangle-size / 2});
15   left: calc(53% - #{($triangle-size / 2)});
16 }
17
18 .video-js.vjs-peertube-skin {
19   font-size: $font-size;
20   color: var(--embedForegroundColor);
21
22   .vjs-dock-text {
23     padding-right: 10px;
24   }
25
26   .vjs-dock-description {
27     font-size: 11px;
28
29     .text::before {
30       margin-right: 4px;
31     }
32
33     .text::after {
34       margin-left: 4px;
35       transform: scale(-1, 1);
36     }
37   }
38
39   .vjs-button > .vjs-icon-placeholder::before {
40     line-height: $control-bar-height;
41   }
42
43   .vjs-volume-level::before {
44     content: ''; /* Remove Circle From Progress Bar */
45   }
46
47   .vjs-audio-button {
48     display: none;
49   }
50
51   .vjs-big-play-button {
52     outline: 0;
53     font-size: 6em;
54
55     $big-play-width: 1.2em;
56     $big-play-height: 1.2em;
57
58     border: 4px solid #fff;
59     border-radius: 100%;
60
61     left: 50%;
62     top: 50%;
63     width: $big-play-width;
64     height: $big-play-height;
65     line-height: $big-play-height;
66     margin-left: -($big-play-width / 2);
67     margin-top: -($big-play-height / 2);
68     transition: 0.4s opacity;
69
70     &::-moz-focus-inner {
71       border: 0;
72       padding: 0
73     }
74
75     .vjs-icon-placeholder::before {
76       @include big-play-button-triangle-size(45px);
77
78       content: '';
79       background-image: url('#{$assets-path}/player/images/big-play-button.svg');
80     }
81
82     &:hover {
83       opacity: 0.8;
84     }
85   }
86
87   // Small effect when we click on the play button
88   &.vjs-has-big-play-button-clicked {
89
90     .vjs-big-play-button, .vjs-poster {
91       display: block;
92       visibility: hidden;
93
94       &.vjs-big-play-button, &.vjs-big-play-button::before {
95         opacity: 0;
96         transition: visibility 0.2s, opacity 0.2s;
97       }
98
99       &.vjs-poster, &.vjs-poster::before {
100         opacity: 0;
101         transition: visibility 0.3s, opacity 0.3s;
102         transition-delay: 0.05s;
103       }
104     }
105   }
106
107   // Hide the big play button on autoplay
108   &.vjs-has-autoplay {
109     .vjs-big-play-button {
110       display: none !important;
111     }
112   }
113
114   .vjs-control-bar,
115   .vjs-big-play-button,
116   .vjs-settings-dialog {
117     background-color: var(--embedBigPlayBackgroundColor);
118   }
119
120   .vjs-poster {
121     outline: none; /* Remove Blue Outline on Click*/
122     outline: 0;
123   }
124
125   .vjs-control-bar {
126     height: $control-bar-height;
127     background: linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.6));
128     box-shadow: 0 -15px 40px 10px rgba(0, 0, 0, 0.2);
129     text-shadow: 0 0 2px rgba(0, 0, 0, 0.5);
130
131     .vjs-progress-control,
132     .vjs-play-control,
133     .vjs-playback-rate,
134     .vjs-mute-control,
135     .vjs-volume-control,
136     .vjs-resolution-control,
137     .vjs-fullscreen-control,
138     .vjs-peertube-link,
139     .vjs-theater-control,
140     .vjs-settings
141     {
142       color: var(--embedForegroundColor) !important;
143
144       opacity: $primary-foreground-opacity;
145       transition: opacity .1s;
146
147       &:hover {
148         opacity: $primary-foreground-opacity-hover;
149       }
150     }
151
152     .vjs-current-time,
153     .vjs-duration,
154     .vjs-peertube {
155       color: var(--embedForegroundColor);
156       opacity: $primary-foreground-opacity;
157     }
158
159     .vjs-progress-control {
160       position: absolute;
161       z-index: 100; // On top of the progress bar
162       bottom: 29px;
163       width: calc(100% - (2 * #{$progress-margin}));
164       margin-left: $progress-margin;
165       height: 14px;
166
167       .vjs-slider {
168         margin: 0;
169         border-radius: 0;
170         background-color: rgba(255, 255, 255, .2);
171         height: 3px;
172         transition: none;
173
174         .vjs-play-progress {
175           background: var(--embedForegroundColor);
176
177           // Not display the circle if the progress is not hovered
178           &::before {
179             opacity: 0;
180             transition: opacity 0.1s ease;
181             font-size: 14px;
182
183             top: -0.3em;
184           }
185
186           .vjs-time-tooltip {
187             display: none;
188           }
189         }
190
191         .vjs-load-progress {
192           &, & div {
193             background: rgba(255, 255, 255, .2);
194           }
195         }
196       }
197     }
198
199     .vjs-progress-control:hover .vjs-slider,
200     .vjs-progress-control .vjs-slider.vjs-sliding {
201       height: 5px;
202
203       .vjs-play-progress::before {
204         opacity: 1;
205       }
206     }
207
208
209     .vjs-play-control {
210       @include disable-outline;
211
212       cursor: pointer;
213       font-size: $font-size;
214       margin-right: 5px;
215     }
216
217     .vjs-time-control {
218       line-height: inherit;
219
220       &.vjs-current-time {
221         font-size: $font-size;
222         display: inline-block;
223         padding: 0;
224
225         .vjs-current-time-display {
226           line-height: calc(#{$control-bar-height} + 1px);
227
228           &::after {
229             content: "/";
230             margin: 0 1px 0 2px;
231           }
232         }
233       }
234
235       &.vjs-duration {
236         font-size: $font-size;
237         display: inline-block;
238         padding: 0;
239         .vjs-duration-display {
240           line-height: calc(#{$control-bar-height} + 1px);
241         }
242       }
243
244       &.vjs-remaining-time {
245         display: none;
246       }
247     }
248
249     .vjs-peertube {
250       width: 100%;
251       line-height: $control-bar-height;
252       text-align: right;
253
254       .vjs-peertube-displayed {
255         display: block;
256       }
257
258       .vjs-peertube-hidden {
259         display: none;
260       }
261
262       .download-speed-number, .upload-speed-number, .peers-number, .http-fallback {
263         font-weight: $font-semibold;
264       }
265
266       .download-speed-text, .upload-speed-text, .peers-text, .http-fallback {
267         margin-right: 15px;
268       }
269
270       .icon {
271         display: inline-block;
272         width: 15px;
273         height: 15px;
274         background-size: contain;
275         vertical-align: middle;
276         background-repeat: no-repeat;
277         margin-right: 6px;
278         position: relative;
279         top: -1px;
280
281         &.icon-download {
282           background-image: url('#{$assets-path}/player/images/arrow-down.svg');
283         }
284
285         &.icon-upload {
286           background-image: url('#{$assets-path}/player/images/arrow-up.svg');
287         }
288       }
289     }
290
291     .vjs-playback-rate {
292       font-size: 10px;
293       width: 37px !important;
294
295       .vjs-playback-rate-value {
296         font-size: 13px;
297         line-height: $control-bar-height;
298       }
299
300       .vjs-menu .vjs-menu-content {
301         width: 37px !important;
302       }
303     }
304
305     .vjs-mute-control {
306       @include disable-outline;
307
308       line-height: $control-bar-height;
309       padding: 0;
310       width: 30px;
311
312       .vjs-icon-placeholder {
313         display: inline-block;
314         width: 22px;
315         height: 22px;
316         vertical-align: middle;
317         background: url('#{$assets-path}/player/images/volume.svg') no-repeat;
318         background-size: contain;
319
320         &::before {
321           content: '';
322         }
323       }
324
325       &.vjs-vol-0 .vjs-icon-placeholder {
326         background: url('#{$assets-path}/player/images/volume-mute.svg') no-repeat;
327         background-size: contain;
328       }
329     }
330
331     .vjs-volume-control {
332       width: 30px;
333       margin: 0 5px 0 0;
334     }
335
336     .vjs-volume-bar {
337       background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAcCAQAAACw95UnAAAAMElEQVRIx2NgoBL4n4YKGUYNHkEG4zJg1OCRYDCpBowaPJwMppbLRg0eNXjUYBLEAXWNUA6QNm1lAAAAAElFTkSuQmCC) no-repeat;
338       background-size: 22px 14px;
339       height: 100%;
340       width: 100%;
341       max-width: 22px;
342       max-height: 14px;
343       margin: 7px 4px;
344       border-radius: 0;
345       top: 3px;
346
347       .vjs-volume-level {
348         background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAcAQAAAAAyhWABAAAAAnRSTlMAAHaTzTgAAAAZSURBVHgBYwAB/g9EUv+JokCqiaT+U4MCAPKPS7WUUOc1AAAAAElFTkSuQmCC) no-repeat;
349         background-size: 22px 14px;
350         max-width: 22px;
351         max-height: 14px;
352         height: 100%;
353       }
354
355       &:focus {
356         text-shadow: none;
357         box-shadow: none;
358       }
359     }
360
361     .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active,
362     .vjs-volume-panel.vjs-volume-panel-horizontal:active,
363     .vjs-volume-panel.vjs-volume-panel-horizontal:focus,
364     .vjs-volume-panel.vjs-volume-panel-horizontal:hover {
365       width: 6em;
366       transition-property: none;
367     }
368
369     .vjs-volume-panel .vjs-mute-control:hover ~ .vjs-volume-control.vjs-volume-horizontal {
370       width: 3em;
371       height: auto;
372     }
373
374     .vjs-volume-panel .vjs-mute-control:hover ~ .vjs-volume-control {
375       transition-property: none;
376     }
377
378     .vjs-volume-panel {
379       .vjs-mute-control {
380         width: 2em;
381         z-index: 1;
382         padding: 0;
383       }
384
385       .vjs-volume-control {
386         display: inline-block;
387         position: relative;
388         left: 5px;
389         opacity: 1;
390         width: 3em;
391         height: auto;
392       }
393     }
394
395     .vjs-peertube-link {
396       @include disable-outline;
397       @include disable-default-a-behaviour;
398
399       text-decoration: none;
400       line-height: $control-bar-height;
401       font-weight: $font-semibold;
402       padding: 0 5px;
403     }
404
405     .vjs-theater-control {
406       @include disable-outline;
407
408       width: 37px;
409       margin-right: 1px;
410       cursor: pointer;
411
412       .vjs-icon-placeholder {
413         transition: transform 0.2s ease;
414         display: inline-block;
415         width: 22px;
416         height: 22px;
417         vertical-align: middle;
418         background: url('#{$assets-path}/player/images/theater.svg') no-repeat;
419         background-size: contain;
420
421         &::before {
422           content: '';
423         }
424       }
425     }
426
427     .vjs-fullscreen-control {
428       @include disable-outline;
429
430       width: 37px;
431       margin-right: 11px;
432
433       .vjs-icon-placeholder {
434         display: inline-block;
435         width: 22px;
436         height: 22px;
437         vertical-align: middle;
438         background: url('#{$assets-path}/player/images/fullscreen.svg') no-repeat;
439         background-size: contain;
440
441         &::before {
442           content: '';
443         }
444       }
445     }
446
447     .vjs-menu-button-popup {
448       font-weight: $font-semibold;
449       width: 50px;
450
451       .vjs-resolution-button {
452         @include disable-outline;
453       }
454
455       .vjs-menu {
456         top: 20px;
457         left: 0;
458
459         .vjs-menu-content {
460           width: 50px;
461           bottom: 20px;
462         }
463
464         li {
465           text-transform: none;
466           font-size: 13px;
467         }
468       }
469     }
470   }
471
472   @media screen and (max-width: 750px) {
473     .vjs-theater-control {
474       display: none;
475     }
476
477     .vjs-dock-text {
478       font-size: 16px;
479     }
480
481     .vjs-dock-description {
482       font-size: 9px;
483     }
484
485     .vjs-big-play-button {
486       font-size: 5em;
487       border-width: 3px;
488
489       .vjs-icon-placeholder::before {
490         @include big-play-button-triangle-size(32px);
491       }
492     }
493   }
494
495   @media screen and (max-width: 570px) {
496     .vjs-dock-text {
497       font-size: 14px;
498     }
499
500     .vjs-big-play-button {
501       font-size: 4.5em;
502       border-width: 2.5px;
503
504       .vjs-icon-placeholder::before {
505         @include big-play-button-triangle-size(27px);
506       }
507     }
508
509     .vjs-peertube {
510       padding: 0 !important;
511
512       .vjs-peertube-displayed {
513         display: none !important;
514       }
515     }
516   }
517
518   @media screen and (max-width: 300px) {
519     .vjs-dock-text {
520       font-size: 13px;
521     }
522
523     .vjs-big-play-button {
524       font-size: 3em;
525       border-width: 2px;
526
527       .vjs-icon-placeholder::before {
528         @include big-play-button-triangle-size(20px);
529       }
530     }
531
532     .vjs-volume-control {
533       display: none !important;
534     }
535
536     .vjs-peertube-link {
537       padding: 0 !important;
538     }
539
540     .vjs-settings {
541       width: 33px;
542     }
543   }
544
545   // Theater mode is enabled
546   &.vjs-theater-enabled {
547     .vjs-theater-control {
548       width: 30px;
549
550       .vjs-icon-placeholder {
551         transform: scale(0.8);
552       }
553     }
554   }
555
556   // On fullscreen, hide theater control
557   &.vjs-fullscreen {
558     .vjs-theater-control {
559       display: none;
560     }
561   }
562 }
563
564 // Play/pause animations
565 .vjs-has-started .vjs-play-control {
566   &.vjs-playing {
567     animation: remove-pause-button 0.25s ease;
568   }
569
570   &.vjs-paused {
571     animation: add-play-button 0.25s ease;
572   }
573
574   @keyframes remove-pause-button {
575     0% {
576       transform: rotate(90deg);
577     }
578     100% {
579       transform: rotate(0deg);
580     }
581   }
582
583   @keyframes add-play-button {
584     0% {
585       transform: rotate(-90deg);
586     }
587     100% {
588       transform: rotate(0deg);
589     }
590   }
591 }
592
593 // Error display disabled
594 .vjs-error:not(.vjs-error-display-enabled) {
595   .vjs-error-display {
596     display: none;
597   }
598
599   .vjs-loading-spinner {
600     display: block;
601   }
602 }
603
604 // Error display enabled
605 .vjs-error.vjs-error-display-enabled {
606   .vjs-error-display {
607     display: block;
608   }
609 }