// ==========================================================================
// Plyr styles
// https://github.com/selz/plyr
// ==========================================================================
// Variables
// -------------------------------
// Colors
@blue: #3498DB;
@gray-dark: #343F4A;
@gray: #565D64;
@gray-light: #6B7D86;
@gray-lighter: #CBD0D3;
@off-white: #D6DADD;
// Font sizes
@font-size-small: 14px;
@font-size-base: 16px;
// Captions
@font-size-captions-base: ceil(@font-size-base * 1.25);
@font-size-captions-medium: ceil(@font-size-base * 1.5);
@font-size-captions-large: (@font-size-base * 2);
// Controls
@control-spacing: 10px;
@controls-bg: #fff;
@control-bg-hover: @blue;
.contrast-control-color(@controls-bg);
.contrast-control-color-hover(@control-bg-hover);
// Tooltips
@tooltip-bg: @controls-bg;
@tooltip-border-color: fade(@gray-dark, 10%);
@tooltip-border-width: 1px;
@tooltip-shadow: 0 0 5px @tooltip-border-color, 0 0 0 @tooltip-border-width @tooltip-border-color;
@tooltip-color: @control-color;
@tooltip-padding: @control-spacing;
@tooltip-arrow-size: 6px;
@tooltip-radius: 3px;
// Progress
@progress-bg: fade(@gray, 20%);
@progress-playing-bg: @blue;
@progress-buffered-bg: fade(@gray, 25%);
@progress-loading-size: 40px;
@progress-loading-bg: rgba(0,0,0, .15);
// Volume
@volume-track-height: 6px;
@volume-track-bg: darken(@controls-bg, 10%);
@volume-thumb-height: (@volume-track-height * 2);
@volume-thumb-width: (@volume-track-height * 2);
@volume-thumb-bg: @control-color;
@volume-thumb-bg-focus: @control-bg-hover;
// Breakpoints
@bp-control-split: 560px; // When controls split into left/right
@bp-captions-large: 768px; // When captions jump to the larger font size
// Animation
// ---------------------------------------
@keyframes progress {
to { background-position: @progress-loading-size 0; }
}
// Mixins
// -------------------------------
// Contrast
.contrast-control-color(@color: "") when (lightness(@color) >= 65%) {
@control-color: @gray-light;
}
.contrast-control-color(@color: "") when (lightness(@color) < 65%) {
@control-color: @gray-lighter;
}
.contrast-control-color-hover(@color: "") when (lightness(@color) >= 65%) {
@control-color-hover: @gray;
}
.contrast-control-color-hover(@color: "") when (lightness(@color) < 65%) {
@control-color-hover: #fff;
}
// Font smoothing
.font-smoothing(@mode: on) when (@mode = on) {
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
}
.font-smoothing(@mode: on) when (@mode = off) {
-moz-osx-font-smoothing: auto;
-webkit-font-smoothing: subpixel-antialiased;
}
// Contain floats: nicolasgallagher.com/micro-clearfix-hack/
.clearfix() {
zoom: 1;
&:before,
&:after { content: ""; display: table; }
&:after { clear: both; }
}
// Tab focus styles
.tab-focus() {
outline: thin dotted #000;
outline-offset: 0;
}
// styling
.volume-thumb() {
height: @volume-thumb-height;
width: @volume-thumb-width;
background: @volume-thumb-bg;
border: 0;
border-radius: 100%;
transition: background .3s ease, transform .2s ease;
cursor: ew-resize;
&:hover {
transform: scale(110%);
}
&:active {
height: @volume-thumb-height + 3;
width: @volume-thumb-width + 3;
border: 2px solid @control-bg-hover;
background: #fff !important;
}
}
.volume-track() {
height: @volume-track-height;
background: @volume-track-bg;
border: 0;
border-radius: (@volume-track-height / 2);
}
.seek-thumb() {
background: transparent;
border: 0;
width: (@control-spacing * 2);
height: @control-spacing;
}
.seek-track() {
background: none;
border: 0;
}
// Styles
// -------------------------------
// Base
.plyr {
position: relative;
max-width: 100%;
min-width: 290px;
// border-box everything
// http://paulirish.com/2012/box-sizing-border-box-ftw/
&,
*,
*::after,
*::before {
box-sizing: border-box;
}
// Screen reader only elements
&__sr-only {
position: absolute !important;
clip: rect(1px, 1px, 1px, 1px);
padding: 0 !important;
border: 0 !important;
height: 1px !important;
width: 1px !important;
overflow: hidden;
}
// For video
&__video-wrapper {
position: relative;
}
video,
audio {
width: 100%;
height: auto;
vertical-align: middle;
}
// Container for embeds
&__video-embed {
padding-bottom: 56.25%; /* 16:9 */
height: 0;
overflow: hidden;
background: #000;
iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border: 0;
user-select: none;
}
// Vimeo hack
> div {
position: relative;
padding-bottom: 200%;
transform: translateY(-35.95%);
}
}
// Captions
&__captions {
display: none;
position: absolute;
bottom: 0;
left: 0;
width: 100%;
padding: (@control-spacing * 2) (@control-spacing * 2) (@control-spacing * 3);
color: #fff;
font-size: @font-size-captions-base;
text-align: center;
.font-smoothing();
span {
border-radius: 2px;
padding: 3px 10px;
background: rgba(0,0,0, .9);
}
span:empty {
display: none;
}
@media (min-width: @bp-captions-large) {
font-size: @font-size-captions-medium;
}
}
&--captions-active &__captions {
display: block;
}
&--fullscreen-active &__captions {
font-size: @font-size-captions-large;
}
// Playback controls
&__controls {
.clearfix();
.font-smoothing();
position: relative;
padding: @control-spacing;
background: @controls-bg;
line-height: 1;
text-align: center;
box-shadow: 0 1px 1px rgba(red(@gray-dark), green(@gray-dark), blue(@gray-dark), .2);
// Layout
&--right {
display: block;
margin: @control-spacing auto 0;
}
@media (min-width: @bp-control-split) {
&--left {
float: left;
}
&--right {
float: right;
margin-top: 0;
}
}
// Buttons
button {
display: inline-block;
vertical-align: middle;
margin: 0 2px;
padding: (@control-spacing / 2) @control-spacing;
overflow: hidden;
border: 0;
background: transparent;
border-radius: 3px;
cursor: pointer;
color: @control-color;
transition: background .3s ease, color .3s ease, opacity .3s ease;
svg {
width: 18px;
height: 18px;
display: block;
fill: currentColor;
transition: fill .3s ease;
}
// Hover and tab focus
&.tab-focus,
&:hover {
background: @control-bg-hover;
color: @control-color-hover;
}
// Default focus
&:focus {
outline: 0;
}
}
// Hide toggle icons by default
.icon--exit-fullscreen,
.icon--muted,
.icon--captions-on {
display: none;
}
// plyr time
.plyr__time {
display: inline-block;
vertical-align: middle;
margin-left: @control-spacing;
color: @control-color;
font-weight: 600;
font-size: @font-size-small;
.font-smoothing();
}
// Media duration hidden on small screens
.plyr__time + .plyr__time {
display: none;
@media (min-width: @bp-control-split) {
display: inline-block;
}
// Add a slash in before
&::before {
content: '\2044';
margin-right: @control-spacing;
}
}
}
// Tooltips
&__tooltip {
position: absolute;
z-index: 2;
bottom: 100%;
margin-bottom: @tooltip-padding;
padding: @tooltip-padding (@tooltip-padding * 1.5);
opacity: 0;
background: @tooltip-bg;
box-shadow: @tooltip-shadow;
border-radius: @tooltip-radius;
color: @tooltip-color;
font-size: @font-size-small;
line-height: 1.5;
font-weight: 600;
transform: translate(-50%, (@tooltip-padding * 3)) scale(.8);
transform-origin: 50% 100%;
transition: transform .2s .1s ease, opacity .2s .1s ease;
// Arrows
&::after,
&::before {
content: '';
position: absolute;
width: 0;
height: 0;
top: 100%;
left: 50%;
transform: translateX(-50%);
}
// The border triangle
&::after {
@border-arrow-size: (@tooltip-arrow-size + (@tooltip-border-width * 1));
bottom: -(@border-arrow-size + @tooltip-border-width);
border-right: @border-arrow-size solid transparent;
border-top: @border-arrow-size solid @tooltip-border-color;
border-left: @border-arrow-size solid transparent;
z-index: 1;
}
// The background triangle
&::before {
bottom: -@tooltip-arrow-size;
border-right: @tooltip-arrow-size solid transparent;
border-top: @tooltip-arrow-size solid @tooltip-bg;
border-left: @tooltip-arrow-size solid transparent;
z-index: 2;
}
}
button:hover .plyr__tooltip,
button.tab-focus:focus .plyr__tooltip {
opacity: 1;
transform: translate(-50%, 0) scale(1);
}
button:hover .plyr__tooltip {
z-index: 3;
}
// Playback progress
//