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