// ==========================================================================
// Plyr styles
// https://github.com/sampotts/plyr
// TODO: break into smaller files and look at use of BEM classnames
// ==========================================================================
@import 'variables';
@import 'mixins';
// Animation
// ---------------------------------------
@keyframes plyr-progress {
to {
background-position: @plyr-progress-loading-size 0;
}
}
@keyframes plyr-popup {
from {
transform: translateY(10px);
opacity: 0.5;
}
to {
transform: translateY(0);
opacity: 1;
}
}
// Styles
// -------------------------------
// Base
.plyr {
position: relative;
max-width: 100%;
min-width: 200px;
overflow: hidden;
font-family: @plyr-font-family;
font-weight: @plyr-font-weight-normal;
direction: ltr;
text-shadow: none;
& when(@plyr-border-box = true) {
// border-box everything
// http://paulirish.com/2012/box-sizing-border-box-ftw/
&,
*,
*::after,
*::before {
box-sizing: border-box;
}
}
& when(@plyr-touch-action = true) {
// Fix 300ms delay
a,
button,
input,
label {
touch-action: manipulation;
}
}
// ARIA
[aria-hidden='true'] {
display: none;
}
// Focus
&:focus {
outline: 0;
}
// Media elements
video,
audio {
width: 100%;
height: auto;
vertical-align: middle;
border-radius: inherit;
}
// Range inputs
// Specificity is for bootstrap compatibility
input[type='range'] {
display: block;
height: (@plyr-range-thumb-height * @plyr-range-thumb-active-scale);
width: 100%;
margin: 0;
padding: 0;
cursor: pointer;
border: none;
background: transparent;
// Used in JS to populate lower fill for WebKit
color: @plyr-range-selected-bg;
// WebKit
-webkit-appearance: none;
&::-webkit-slider-runnable-track {
.plyr-range-track();
}
&::-webkit-slider-thumb {
-webkit-appearance: none;
margin-top: -((@plyr-range-thumb-height - @plyr-range-track-height) / 2);
.plyr-range-thumb();
}
// Mozilla
&::-moz-range-track {
.plyr-range-track();
}
&::-moz-range-thumb {
.plyr-range-thumb();
}
&::-moz-range-progress {
height: @plyr-range-track-height;
background: currentColor;
border-radius: (@plyr-range-track-height / 2);
}
// Microsoft
&::-ms-track {
height: @plyr-range-track-height;
background: transparent;
border: 0;
color: transparent;
}
&::-ms-fill-upper {
.plyr-range-track();
}
&::-ms-fill-lower {
.plyr-range-track();
background: currentColor;
}
&::-ms-thumb {
.plyr-range-thumb();
// For some reason, Edge uses the -webkit margin above
margin-top: 0;
}
&::-ms-tooltip {
display: none;
}
// Focus styles
&:focus {
outline: 0;
}
&::-moz-focus-outer {
border: 0;
}
&.tab-focus {
outline-offset: 3px;
}
// Pressed styles
&:active {
&::-webkit-slider-thumb {
.plyr-range-thumb-active();
}
&::-moz-range-thumb {
.plyr-range-thumb-active();
}
&::-ms-thumb {
.plyr-range-thumb-active();
}
}
}
}
// Video range inputs
.plyr--video input[type='range'] {
&::-webkit-slider-runnable-track {
background: @plyr-video-range-track-bg;
}
&::-moz-range-track {
background: @plyr-video-range-track-bg;
}
&::-ms-track {
background: @plyr-video-range-track-bg;
}
&.tab-focus {
outline: 1px dotted fade(@plyr-video-control-color, 50%);
}
}
// Audio range inputs
.plyr--audio input[type='range'] {
&::-webkit-slider-runnable-track {
background: @plyr-audio-range-track-bg;
}
&::-moz-range-track {
background: @plyr-audio-range-track-bg;
}
&::-ms-track {
background: @plyr-audio-range-track-bg;
}
&.tab-focus {
outline: 1px dotted fade(@plyr-audio-control-color, 50%);
}
}
// Screen reader only elements
.plyr__sr-only {
clip: rect(1px, 1px, 1px, 1px);
overflow: hidden;
// !important is not always needed
& when(@plyr-sr-only-important = true) {
position: absolute !important;
padding: 0 !important;
border: 0 !important;
height: 1px !important;
width: 1px !important;
}
& when(@plyr-sr-only-important = false) {
position: absolute;
padding: 0;
border: 0;
height: 1px;
width: 1px;
}
}
// Video
.plyr__video-wrapper {
position: relative;
background: #000;
border-radius: inherit;
// Require z-index to force border-radius
z-index: 0;
overflow: hidden;
}
// Container for embeds
.plyr__video-embed {
padding-bottom: 56.25%; /* 16:9 */
height: 0;
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%);
}
}
// To allow mouse events to be captured if full support
.plyr .plyr__video-embed iframe {
pointer-events: none;
}
// Captions
// --------------------------------------------------------------
// Hide default captions
.plyr video::-webkit-media-text-track-container {
display: none;
}
.plyr__captions {
display: none;
position: absolute;
bottom: 0;
left: 0;
width: 100%;
padding: @plyr-control-spacing;
transform: translateY(-(@plyr-control-spacing * 4));
transition: transform 0.3s ease;
color: @plyr-captions-color;
font-size: @plyr-font-size-captions-small;
text-align: center;
span {
border-radius: 2px;
padding: 0.2em 0.5em;
background: @plyr-captions-bg;
box-decoration-break: clone;
line-height: 170%;
white-space: pre-wrap;
// Firefox adds a
when using getCueAsHTML()
div {
display: inline;
}
}
span:empty {
display: none;
}
@media (min-width: @plyr-bp-screen-sm) {
padding: (@plyr-control-spacing * 2);
font-size: @plyr-font-size-captions-base;
}
@media (min-width: @plyr-bp-screen-md) {
font-size: @plyr-font-size-captions-medium;
}
}
.plyr--captions-active .plyr__captions {
display: block;
}
.plyr--hide-controls .plyr__captions {
transform: translateY(-(@plyr-control-spacing * 1.5));
}
// Controls
// --------------------------------------------------------------
// Hide native controls
.plyr ::-webkit-media-controls {
display: none;
}
// Playback controls
.plyr__controls {
display: flex;
align-items: center;
text-align: center;
// Spacing
> .plyr__control,
.plyr__progress,
.plyr__time,
.plyr__menu {
margin-left: (@plyr-control-spacing / 2);
&:first-child,
&:first-child + [data-plyr='pause'] {
margin-left: 0;
}
}
.plyr__volume {
margin-left: (@plyr-control-spacing / 2);
}
@media (min-width: @plyr-bp-screen-sm) {
> .plyr__control,
.plyr__progress,
.plyr__time,
.plyr__menu {
margin-left: @plyr-control-spacing;
}
> .plyr__control + .plyr__control,
.plyr__menu + .plyr__control,
> .plyr__control + .plyr__menu {
margin-left: (@plyr-control-spacing / 2);
}
}
}
// Buttons
.plyr__control {
position: relative;
display: inline-block;
flex-shrink: 0;
overflow: visible; // IE11
vertical-align: middle;
padding: @plyr-control-padding;
border: 0;
background: transparent;
border-radius: 3px;
cursor: pointer;
transition: background 0.3s ease, color 0.3s ease, opacity 0.3s ease;
color: inherit;
svg {
width: @plyr-control-icon-size;
height: @plyr-control-icon-size;
display: block;
fill: currentColor;
pointer-events: none;
}
// Hide toggle icons by default
.icon--exit-fullscreen,
.icon--muted,
.icon--captions-on {
display: none;
}
// Default focus
&:focus {
outline: 0;
}
}
// Video controls
.plyr--video .plyr__controls {
position: absolute;
left: 0;
right: 0;
bottom: 0;
z-index: 2;
padding: (@plyr-control-spacing * 3.5) (@plyr-control-spacing + 2) @plyr-control-spacing;
background: linear-gradient(fade(@plyr-video-controls-bg, 0%), fade(@plyr-video-controls-bg, 70%));
border-bottom-left-radius: inherit;
border-bottom-right-radius: inherit;
color: @plyr-video-control-color;
transition: all 0.4s ease-in-out;
.plyr__control {
svg {
filter: drop-shadow(0 1px 1px fade(#000, 15%));
}
// Hover and tab focus
&.tab-focus,
&:hover,
&[aria-expanded='true'] {
background: @plyr-video-control-bg-hover;
color: @plyr-video-control-color-hover;
}
}
}
// Hide controls
.plyr--video.plyr--hide-controls .plyr__controls {
opacity: 0;
transform: translateY(100%);
pointer-events: none;
}
// Audio controls
.plyr--audio .plyr__controls {
padding: @plyr-control-spacing;
border-radius: inherit;
background: @plyr-audio-controls-bg;
border: @plyr-audio-controls-border;
color: @plyr-audio-control-color;
.plyr__control {
// Hover and tab focus
&.tab-focus,
&:hover,
&[aria-expanded='true'] {
background: @plyr-audio-control-bg-hover;
color: @plyr-audio-control-color-hover;
}
}
}
// Large play button (video only)
.plyr__play-large {
display: none;
position: absolute;
z-index: 1;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
padding: ceil(@plyr-control-spacing * 1.25);
background: fade(@plyr-video-control-bg-hover, 80%);
border: 3px solid currentColor;
border-radius: 100%;
box-shadow: 0 1px 1px fade(#000, 15%);
color: @plyr-video-control-color;
transition: all 0.3s ease;
svg {
position: relative;
left: 2px;
width: 20px;
height: 20px;
display: block;
fill: currentColor;
pointer-events: none;
}
&:hover,
&:focus {
background: @plyr-video-control-bg-hover;
}
&:focus {
outline: 1px dotted fade(@plyr-video-control-color, 50%);
}
}
.plyr .plyr__play-large {
display: inline-block;
}
.plyr--audio .plyr__play-large {
display: none;
}
.plyr--playing .plyr__play-large {
opacity: 0;
visibility: hidden;
}
// States
.plyr__controls [data-plyr='pause'],
.plyr--playing .plyr__controls [data-plyr='play'] {
display: none;
}
.plyr--playing .plyr__controls [data-plyr='pause'] {
display: inline-block;
}
// Change icons on state change
.plyr--muted .plyr__control .icon--muted,
.plyr--captions-active .plyr__control .icon--captions-on {
display: block;
& + svg {
display: none;
}
}
// Some options are hidden by default
.plyr [data-plyr='captions'],
.plyr [data-plyr='pip'],
.plyr [data-plyr='airplay'],
.plyr [data-plyr='fullscreen'] {
display: none;
}
.plyr--captions-enabled [data-plyr='captions'],
.plyr--pip-supported [data-plyr='pip'],
.plyr--airplay-supported [data-plyr='airplay'],
.plyr--fullscreen-enabled [data-plyr='fullscreen'] {
display: inline-block;
}
// Menus
// --------------------------------------------------------------
.plyr__menu {
position: relative;
// Hide tooltip
.plyr__control svg {
transition: transform 0.3s ease;
}
.plyr__control[aria-expanded='true'] {
svg {
transform: rotate(45deg);
}
.plyr__tooltip {
display: none;
}
}
// The actual menu container
&__container {
position: absolute;
z-index: 1;
bottom: 100%;
right: -3px;
margin-bottom: 10px;
animation: plyr-popup 0.2s ease;
background: @plyr-menu-bg;
border-radius: 4px;
box-shadow: 0 1px 2px fade(#000, 20%);
white-space: nowrap;
text-align: left;
color: @plyr-menu-color;
font-size: @plyr-font-size-small;
> div {
overflow: hidden;
transition: height 0.35s cubic-bezier(0.4, 0, 0.2, 1), width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
// Arrow
&::after {
content: '';
position: absolute;
top: 100%;
right: 15px;
height: 0;
width: 0;
border: 4px solid transparent;
border-top-color: @plyr-menu-bg;
}
ul {
margin: 0;
padding: @plyr-control-padding;
list-style: none;
overflow: hidden;
}
// Options
.plyr__control {
display: flex;
align-items: center;
width: 100%;
padding: ceil(@plyr-control-padding / 2) (@plyr-control-padding * 2);
color: @plyr-menu-color;
font-weight: @plyr-font-weight-bold;
user-select: none;
&::after {
content: '';
position: absolute;
top: 50%;
transform: translateY(-50%);
border: 4px solid transparent;
transition: border-color 0.2s ease;
}
&--forward {
padding-right: ceil(@plyr-control-padding * 4);
&::after {
right: 5px;
border-left-color: fade(@plyr-menu-color, 80%);
}
&.tab-focus::after,
&:hover::after {
border-left-color: currentColor;
}
}
&--back {
position: relative;
@horizontal-padding: (@plyr-control-padding * 2);
width: ~'calc(100% - @{horizontal-padding})';
margin: @plyr-control-padding;
margin-bottom: floor(@plyr-control-padding / 2);
padding-left: ceil(@plyr-control-padding * 4);
font-weight: @plyr-font-weight-normal;
&::after {
left: @plyr-control-padding;
border-right-color: fade(@plyr-menu-color, 80%);
}
&::before {
content: '';
position: absolute;
top: 100%;
left: 0;
right: 0;
height: 1px;
overflow: hidden;
margin-top: ceil(@plyr-control-padding / 2);
background: fade(#000, 15%);
box-shadow: 0 1px 0 fade(#fff, 10%);
}
&.tab-focus::after,
&:hover::after {
border-right-color: currentColor;
}
}
}
label.plyr__control {
padding-left: ceil(@plyr-control-padding * 2.5);
input[type='radio'] {
position: relative;
left: -@plyr-control-padding;
}
}
// Option value
.plyr__menu__value {
display: flex;
align-items: center;
margin-left: auto;
padding-left: ceil(@plyr-control-padding * 3.5);
pointer-events: none;
overflow: hidden;
font-weight: @plyr-font-weight-normal;
.plyr__badge {
font-weight: @plyr-font-weight-bold;
}
}
}
}
// Badge
// --------------------------------------------------------------
.plyr__badge {
padding: 1px 4px;
border-radius: 2px;
background: @plyr-menu-color;
color: @plyr-menu-bg;
font-size: 10px;
}
// Tooltips
// --------------------------------------------------------------
.plyr__tooltip {
position: absolute;
z-index: 2;
bottom: 100%;
margin-bottom: (@plyr-tooltip-padding * 2);
padding: @plyr-tooltip-padding (@plyr-tooltip-padding * 1.5);
pointer-events: none;
opacity: 0;
background: @plyr-tooltip-bg;
border-radius: @plyr-tooltip-radius;
box-shadow: 0 1px 2px fade(#000, 10%);
color: @plyr-tooltip-color;
font-size: @plyr-font-size-small;
font-weight: @plyr-font-weight-normal;
line-height: 1.3;
transform: translate(-50%, 10px) scale(0.8);
transform-origin: 50% 100%;
transition: transform 0.2s 0.1s ease, opacity 0.2s 0.1s ease;
&::before {
// Arrows
content: '';
position: absolute;
width: 0;
height: 0;
left: 50%;
transform: translateX(-50%);
// The background triangle
bottom: -@plyr-tooltip-arrow-size;
border-right: @plyr-tooltip-arrow-size solid transparent;
border-top: @plyr-tooltip-arrow-size solid @plyr-tooltip-bg;
border-left: @plyr-tooltip-arrow-size solid transparent;
z-index: 2;
}
}
.plyr .plyr__control:hover .plyr__tooltip,
.plyr .plyr__control.tab-focus .plyr__tooltip,
.plyr__tooltip--visible {
opacity: 1;
transform: translate(-50%, 0) scale(1);
}
.plyr .plyr__control:hover .plyr__tooltip {
z-index: 3;
}
// First tooltip
.plyr__controls > .plyr__control:first-child .plyr__tooltip,
.plyr__controls > .plyr__control:first-child + .plyr__control .plyr__tooltip {
left: 0;
transform: translate(0, 10px) scale(0.8);
transform-origin: 0 100%;
&::before {
left: (@plyr-control-icon-size / 2) + @plyr-control-padding;
}
}
// Last tooltip
.plyr__controls > .plyr__control:last-child .plyr__tooltip {
right: 0;
transform: translate(0, 10px) scale(0.8);
transform-origin: 100% 100%;
&::before {
left: auto;
right: (@plyr-control-icon-size / 2) + @plyr-control-padding;
transform: translateX(50%);
}
}
.plyr__controls > .plyr__control:first-child,
.plyr__controls > .plyr__control:first-child + .plyr__control,
.plyr__controls > .plyr__control:last-child {
&:hover .plyr__tooltip,
&.tab-focus .plyr__tooltip,
.plyr__tooltip--visible {
transform: translate(0, 0) scale(1);
}
}
// Playback progress
// --------------------------------------------------------------
//