aboutsummaryrefslogtreecommitdiffstats
path: root/src/less
diff options
context:
space:
mode:
Diffstat (limited to 'src/less')
-rw-r--r--src/less/plyr.less307
-rw-r--r--src/less/variables.less13
2 files changed, 257 insertions, 63 deletions
diff --git a/src/less/plyr.less b/src/less/plyr.less
index c9e3d7c3..8e08cf40 100644
--- a/src/less/plyr.less
+++ b/src/less/plyr.less
@@ -11,6 +11,16 @@
@keyframes plyr-progress {
to { background-position: @plyr-progress-loading-size 0; }
}
+@keyframes plyr-popup {
+ from {
+ transform: translateY(10px);
+ opacity: .5;
+ }
+ to {
+ transform: translateY(0);
+ opacity: 1;
+ }
+}
// Styles
// -------------------------------
@@ -20,6 +30,7 @@
max-width: 100%;
min-width: 200px;
font-family: @plyr-font-family;
+ font-weight: 500;
direction: ltr;
& when (@plyr-border-box = true) {
@@ -40,6 +51,11 @@
}
}
+ // ARIA
+ [aria-hidden='true'] {
+ display: none;
+ }
+
// Focus
&:focus {
outline: 0;
@@ -173,6 +189,9 @@
position: relative;
background: #000;
border-radius: inherit;
+ // Require z-index to force border-radius
+ z-index: 0;
+ overflow: hidden;
}
// Container for embeds
@@ -180,11 +199,11 @@
padding-bottom: 56.25%; /* 16:9 */
height: 0;
border-radius: inherit;
-
// Require overflow and z-index to force border-radius
overflow: hidden;
z-index: 0;
+
iframe {
position: absolute;
top: 0;
@@ -225,7 +244,6 @@
color: @plyr-captions-color;
font-size: @plyr-font-size-captions-base;
text-align: center;
- font-weight: 400;
span {
border-radius: 2px;
@@ -270,50 +288,64 @@
text-align: center;
// Spacing
- > button,
+ > .plyr__control,
.plyr__progress,
- .plyr__time {
+ .plyr__time,
+ .plyr__menu {
margin-left: (@plyr-control-spacing / 2);
- &:first-child {
+ &:first-child,
+ &:first-child + [data-plyr="pause"] {
margin-left: 0;
}
}
.plyr__volume {
margin-left: (@plyr-control-spacing / 2);
}
- [data-plyr="pause"] {
- margin-left: 0;
- }
- // Buttons
- button {
- 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 .3s ease, color .3s ease, opacity .3s ease;
- color: inherit;
-
- svg {
- width: @plyr-control-icon-size;
- height: @plyr-control-icon-size;
- display: block;
- fill: currentColor;
+ @media (min-width: @plyr-bp-screen-sm) {
+ > .plyr__control,
+ .plyr__progress,
+ .plyr__time,
+ .plyr__menu {
+ margin-left: @plyr-control-spacing;
}
- // Default focus
- &:focus {
- outline: 0;
+ > .plyr__control + .plyr__control,
+ .plyr__menu + .plyr__control,
+ > .plyr__control + .plyr__menu {
+ margin-left: (@plyr-control-spacing / 2);
}
}
+}
+// Hide controls
+.plyr--hide-controls .plyr__controls {
+ opacity: 0;
+ pointer-events: none;
+}
+
+// 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 .3s ease, color .3s ease, opacity .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,
@@ -321,19 +353,11 @@
display: none;
}
- @media (min-width: @plyr-bp-screen-sm) {
- > button,
- .plyr__progress,
- .plyr__time {
- margin-left: @plyr-control-spacing;
- }
+ // Default focus
+ &:focus {
+ outline: 0;
}
}
-// Hide controls
-.plyr--hide-controls .plyr__controls {
- opacity: 0;
- pointer-events: none;
-}
// Video controls
.plyr--video .plyr__controls {
@@ -343,16 +367,17 @@
bottom: 0;
z-index: 2;
padding: (@plyr-control-spacing * 5) @plyr-control-spacing @plyr-control-spacing;
- background: linear-gradient(fade(@plyr-video-controls-bg, 0%), fade(@plyr-video-controls-bg, 50%));
+ 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: opacity .3s ease;
- button {
+ .plyr__control {
// Hover and tab focus
&.tab-focus:focus,
- &:hover {
+ &:hover,
+ &[aria-expanded='true'] {
background: @plyr-video-control-bg-hover;
color: @plyr-video-control-color-hover;
}
@@ -367,10 +392,11 @@
border: @plyr-audio-controls-border;
color: @plyr-audio-control-color;
- button {
+ .plyr__control {
// Hover and tab focus
&.tab-focus:focus,
- &:hover {
+ &:hover,
+ &[aria-expanded='true'] {
background: @plyr-audio-control-bg-hover;
color: @plyr-audio-control-color-hover;
}
@@ -400,6 +426,7 @@
height: 20px;
display: block;
fill: currentColor;
+ pointer-events: none;
}
&:focus {
@@ -427,9 +454,9 @@
}
// Change icons on state change
-.plyr--fullscreen-active .icon--exit-fullscreen,
-.plyr--muted .plyr__controls .icon--muted,
-.plyr--captions-active .plyr__controls .icon--captions-on {
+.plyr--fullscreen-active .plyr__control .icon--exit-fullscreen,
+.plyr--muted .plyr__control .icon--muted,
+.plyr--captions-active .plyr__control .icon--captions-on {
display: block;
& + svg {
@@ -439,14 +466,173 @@
// Some options are hidden by default
.plyr [data-plyr='captions'],
-.plyr [data-plyr='fullscreen'] {
+.plyr [data-plyr='fullscreen'],
+.plyr [data-plyr='pip'],
+.plyr [data-plyr='airplay'] {
display: none;
}
.plyr--captions-enabled [data-plyr='captions'],
-.plyr--fullscreen-enabled [data-plyr='fullscreen'] {
+.plyr--fullscreen-enabled [data-plyr='fullscreen'],
+.plyr--pip-enabled [data-plyr='pip'],
+.plyr--airplay-enabled [data-plyr='airplay'] {
display: inline-block;
}
+// Menus
+// --------------------------------------------------------------
+.plyr__menu {
+ position: relative;
+
+ // Hide tooltip
+ .plyr__control svg {
+ transition: transform .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: -5px;
+ margin-bottom: 10px;
+ animation: plyr-popup .2s ease;
+
+ background: @plyr-menu-bg;
+ border-radius: 4px;
+
+ white-space: nowrap;
+ text-align: left;
+ color: @plyr-menu-color;
+ font-size: @plyr-font-size-small;
+
+ > div {
+ overflow: hidden;
+ transition: height .35s cubic-bezier(.4,0,.2,1), width .35s cubic-bezier(.4,0,.2,1);
+ }
+
+ // Arrow
+ &::after {
+ content: "";
+ position: absolute;
+ top: 100%;
+ right: 15px;
+ height: 0;
+ width: 0;
+ border: 6px 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;
+ width: 100%;
+ padding: @plyr-control-padding (@plyr-control-padding * 2);
+ color: @plyr-menu-color;
+ font-weight: 600;
+ user-select: none;
+
+ &::after {
+ content: "";
+ position: absolute;
+ top: 50%;
+ transform: translateY(-50%);
+ border: 5px solid transparent;
+ }
+
+ &--forward {
+ padding-right: ceil(@plyr-control-padding * 4);
+
+ &::after {
+ right: 5px;
+ border-left-color: fade(@plyr-menu-color, 80%);
+ }
+ }
+
+ &--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: 500;
+
+ &::after {
+ left: 5px;
+ 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%);
+ }
+ }
+ }
+
+ 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: inherit;
+ margin-left: auto;
+ padding-left: ceil(@plyr-control-padding * 3.5);
+ pointer-events: none;
+ overflow: hidden;
+ font-weight: 500;
+ color: fade(@plyr-menu-color, 80%);
+
+ .plyr__badge {
+ font-weight: 600;
+ }
+ }
+
+ // When animating between menus
+ &.is-resizing {
+ overflow: hidden;
+ transition: height .35s cubic-bezier(.4,0,.2,1), width .35s cubic-bezier(.4,0,.2,1);
+ }
+ }
+}
+
+// Badge
+// --------------------------------------------------------------
+.plyr__badge {
+ padding: 2px 4px;
+ border-radius: 2px;
+ background: @plyr-menu-color;
+ color: @plyr-menu-bg;
+ font-size: 10px;
+}
+
// Tooltips
// --------------------------------------------------------------
.plyr__tooltip {
@@ -463,6 +649,7 @@
color: @plyr-tooltip-color;
font-size: @plyr-font-size-small;
+ font-weight: 500;
line-height: 1.3;
transform: translate(-50%, 10px) scale(.8);
@@ -486,18 +673,19 @@
z-index: 2;
}
}
-.plyr button:hover .plyr__tooltip,
-.plyr button.tab-focus:focus .plyr__tooltip,
+.plyr .plyr__control:hover .plyr__tooltip,
+.plyr .plyr__control.tab-focus:focus .plyr__tooltip,
.plyr__tooltip--visible {
opacity: 1;
transform: translate(-50%, 0) scale(1);
}
-.plyr button:hover .plyr__tooltip {
+.plyr .plyr__control:hover .plyr__tooltip {
z-index: 3;
}
// First tooltip
-.plyr__controls button:first-child .plyr__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(.8);
transform-origin: 0 100%;
@@ -508,7 +696,7 @@
}
// Last tooltip
-.plyr__controls button:last-child .plyr__tooltip {
+.plyr__controls > .plyr__control:last-child .plyr__tooltip {
right: 0;
transform: translate(0, 10px) scale(.8);
transform-origin: 100% 100%;
@@ -520,8 +708,9 @@
}
}
-.plyr__controls button:first-child,
-.plyr__controls button:last-child {
+.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:focus .plyr__tooltip,
.plyr__tooltip--visible {
diff --git a/src/less/variables.less b/src/less/variables.less
index 807d0854..bcc80a02 100644
--- a/src/less/variables.less
+++ b/src/less/variables.less
@@ -17,7 +17,7 @@
@plyr-font-size-base: 16px;
// Captions
-@plyr-captions-bg: fade(#000, 70%);
+@plyr-captions-bg: fade(#000, 60%);
@plyr-captions-color: #fff;
@plyr-font-size-captions-base: @plyr-font-size-base;
@plyr-font-size-captions-medium: ceil(@plyr-font-size-base * 1.5);
@@ -38,15 +38,20 @@
@plyr-audio-control-bg-hover: @plyr-color-main;
// Tooltips
-@plyr-tooltip-bg: fade(#000, 70%);
+@plyr-tooltip-bg: fade(#343f4a, 90%);
@plyr-tooltip-color: #fff;
@plyr-tooltip-padding: (@plyr-control-spacing / 2);
@plyr-tooltip-arrow-size: 4px;
@plyr-tooltip-radius: 3px;
+// Menus
+@plyr-menu-bg: @plyr-tooltip-bg;
+@plyr-menu-color: @plyr-tooltip-color;
+@plyr-menu-arrow-size: 6px;
+
// Progress
@plyr-progress-loading-size: 25px;
-@plyr-progress-loading-bg: fade(#000, 15%);
+@plyr-progress-loading-bg: fade(#343f4a, 20%);
@plyr-video-progress-bg: fade(#fff, 25%);
@plyr-video-progress-buffered-bg: @plyr-video-progress-bg;
@plyr-audio-progress-bg: fade(#C6D6DB, 66%);
@@ -58,7 +63,7 @@
@plyr-range-thumb-width: floor(@plyr-range-track-height * 2);
@plyr-range-thumb-bg: #fff;
@plyr-range-thumb-border: 2px solid transparent;
-@plyr-range-thumb-shadow: 0 1px 1px fade(@plyr-video-controls-bg, 15%), 0 0 0 1px fade(#000, 15%);
+@plyr-range-thumb-shadow: 0 1px 1px fade(@plyr-video-controls-bg, 15%), 0 0 0 1px fade(#343f4a, 20%);
@plyr-range-thumb-active-border-color: #fff;
@plyr-range-thumb-active-bg: @plyr-video-control-bg-hover;
@plyr-range-thumb-active-scale: 1.25;