diff options
Diffstat (limited to 'src/less/plyr.less')
-rw-r--r-- | src/less/plyr.less | 1121 |
1 files changed, 554 insertions, 567 deletions
diff --git a/src/less/plyr.less b/src/less/plyr.less index f27023bc..99df1115 100644 --- a/src/less/plyr.less +++ b/src/less/plyr.less @@ -7,12 +7,7 @@ // ------------------------------- // Colors -@plyr-blue: #3498DB; -@plyr-gray-dark: #343F4A; -@plyr-gray: #565D64; -@plyr-gray-light: #6B7D86; -@plyr-gray-lighter: #CBD0D3; -@plyr-off-white: #D6DADD; +@plyr-color-main: #63B4E1; // Font sizes @plyr-font-size-small: 14px; @@ -24,37 +19,45 @@ @plyr-font-size-captions-large: (@plyr-font-size-base * 2); // Controls +// #C6D6DB @plyr-control-spacing: 10px; -@plyr-controls-bg: #fff; -@plyr-control-bg-hover: @plyr-blue; -.contrast-control-color(@plyr-controls-bg); -.contrast-control-color-hover(@plyr-control-bg-hover); +@plyr-video-controls-bg: #000; +@plyr-video-control-color: #fff; +@plyr-video-control-color-hover: #fff; +@plyr-video-control-bg-hover: @plyr-color-main; +@plyr-audio-controls-bg: transparent; +@plyr-audio-control-color: #565D64; +@plyr-audio-control-color-hover: #fff; +@plyr-audio-control-bg-hover: @plyr-color-main; // Tooltips -@plyr-tooltip-bg: @plyr-controls-bg; -@plyr-tooltip-border-color: fade(darken(@plyr-controls-bg, 75%), 10%); -@plyr-tooltip-arrow-border-color: fade(darken(@plyr-controls-bg, 75%), 20%); +@plyr-tooltip-bg: @plyr-video-controls-bg; +@plyr-tooltip-border-color: fade(darken(@plyr-video-controls-bg, 75%), 10%); +@plyr-tooltip-arrow-border-color: fade(darken(@plyr-video-controls-bg, 75%), 20%); @plyr-tooltip-border-width: 1px; @plyr-tooltip-shadow: 0 0 5px @plyr-tooltip-border-color, 0 0 0 @plyr-tooltip-border-width @plyr-tooltip-border-color; -@plyr-tooltip-color: @plyr-control-color; -@plyr-tooltip-padding: @plyr-control-spacing; -@plyr-tooltip-arrow-size: 6px; +@plyr-tooltip-color: @plyr-video-control-color; +@plyr-tooltip-padding: (@plyr-control-spacing / 2); +@plyr-tooltip-arrow-size: 4px; @plyr-tooltip-radius: 3px; // Progress -@plyr-progress-bg: fade(@plyr-gray, 20%); -@plyr-progress-playing-bg: @plyr-blue; -@plyr-progress-buffered-bg: fade(@plyr-gray, 25%); -@plyr-progress-loading-size: 40px; +@plyr-progress-bg: fade(@plyr-video-control-color, 25%); +@plyr-progress-playing-bg: @plyr-color-main; +@plyr-progress-buffered-bg: fade(@plyr-video-control-color, 25%); +@plyr-progress-loading-size: 25px; @plyr-progress-loading-bg: fade(#000, 15%); -// Volume -@plyr-volume-track-height: 6px; -@plyr-volume-track-bg: darken(@plyr-controls-bg, 10%); -@plyr-volume-thumb-height: (@plyr-volume-track-height * 2); -@plyr-volume-thumb-width: (@plyr-volume-track-height * 2); -@plyr-volume-thumb-bg: @plyr-control-color; -@plyr-volume-thumb-bg-focus: @plyr-control-bg-hover; +// Range sliders +@range-track-height: 8px; +@range-track-bg: fade(#fff, 25%); +@range-thumb-height: floor(@range-track-height * 2); +@range-thumb-width: floor(@range-track-height * 2); +@range-thumb-bg: #fff; +@range-thumb-border: 2px solid transparent; +@range-thumb-active-border-color: #fff; +@range-thumb-active-bg: @plyr-video-control-bg-hover; +@range-thumb-shadow: 0 1px 1px fade(@plyr-video-controls-bg, 15%); // Breakpoints @plyr-bp-control-split: 560px; // When controls split into left/right @@ -68,59 +71,29 @@ // Mixins // ------------------------------- -// Contrast -.contrast-control-color(@plyr-color: "") when (lightness(@plyr-color) >= 65%) { - @plyr-control-color: @plyr-gray-light; -} -.contrast-control-color(@plyr-color: "") when (lightness(@plyr-color) < 65%) { - @plyr-control-color: @plyr-gray-lighter; -} -.contrast-control-color-hover(@plyr-color: "") when (lightness(@plyr-color) >= 65%) { - @plyr-control-color-hover: @plyr-gray; -} -.contrast-control-color-hover(@plyr-color: "") when (lightness(@plyr-color) < 65%) { - @plyr-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; -} - // <input type="range"> styling -.volume-thumb() { - height: @plyr-volume-thumb-height; - width: @plyr-volume-thumb-width; - background: @plyr-volume-thumb-bg; +.range-track() { + height: @range-track-height; + background: @range-track-bg; border: 0; - border-radius: 100%; - transition: background .3s ease; - cursor: ew-resize; + border-radius: (@range-track-height / 2); + user-select: none; } -.volume-track() { - height: @plyr-volume-track-height; - background: @plyr-volume-track-bg; - border: 0; - border-radius: (@plyr-volume-track-height / 2); -} -.seek-thumb() { - background: transparent; - border: 0; - width: 1px; - height: @plyr-control-spacing; -} -.seek-thumb-touch() { - width: (@plyr-control-spacing * 4); - transform: translateX(-50%); +.range-thumb() { + position: relative; + height: @range-thumb-height; + width: @range-thumb-width; + background: @range-thumb-bg; + border: @range-thumb-border; + border-radius: 100%; + transition: background .2s ease, border .2s ease, transform .2s ease; + box-shadow: @range-thumb-shadow; + box-sizing: border-box; } -.seek-track() { - background: none; - border: 0; +.range-thumb-active() { + background: @range-thumb-active-bg; + border-color: @range-thumb-active-border-color; + transform: scale(1.25); } // Styles @@ -146,579 +119,593 @@ touch-action: manipulation; } - // 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; - } + // Media elements video, audio { width: 100%; height: auto; vertical-align: middle; + border-radius: inherit; } - // Hide default captions - video::-webkit-media-text-track-container { - display: none; - } - - // 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; + // Range inputs + // Specificity is for bootstrap compatibility + input[type='range'] { + display: block; + height: @range-thumb-height; + width: 100%; + margin: 0; + padding: 0; + vertical-align: middle; + + appearance: none; + cursor: pointer; + border: none; + background: transparent; + + // Webkit + &::-webkit-slider-runnable-track { + .range-track(); } - - // Vimeo hack - > div { - position: relative; - padding-bottom: 200%; - transform: translateY(-35.95%); + &::-webkit-slider-thumb { + -webkit-appearance: none; + margin-top: -((@range-thumb-height - @range-track-height) / 2); + .range-thumb(); } - // To allow mouse events to be captured if full support - &.plyr iframe { - pointer-events: none; + // Mozilla + &::-moz-range-track { + .range-track(); } - } - - // Captions - &__captions { - display: none; - position: absolute; - bottom: 0; - left: 0; - width: 100%; - padding: (@plyr-control-spacing * 2) (@plyr-control-spacing * 2) (@plyr-control-spacing * 3); - color: #fff; - font-size: @plyr-font-size-captions-base; - text-align: center; - .font-smoothing(); - - span { - border-radius: 2px; - padding: 3px 10px; - background: fade(#000, 90%); + &::-moz-range-thumb { + .range-thumb(); } - span:empty { - display: none; + &::-moz-focus-outer { + border: 0; } - - @media (min-width: @plyr-bp-captions-large) { - font-size: @plyr-font-size-captions-medium; + + // Microsoft + &::-ms-track { + height: @range-track-height; + background: transparent; + border: 0; + color: transparent; } - } - &--captions-active &__captions { - display: block; - } - &--fullscreen-active &__captions { - font-size: @plyr-font-size-captions-large; - } - - // Playback controls - &__controls { - .font-smoothing(); - position: relative; - padding: @plyr-control-spacing; - background: @plyr-controls-bg; - line-height: 1; - text-align: center; - box-shadow: 0 1px 1px fade(@plyr-gray-dark, 20%); - - // Clear floats - &::after { - content: ''; - display: table; - clear: both; + &::-ms-fill-lower, + &::-ms-fill-upper { + .range-track(); } + &::-ms-thumb { + .range-thumb(); - // Layout - &--right { - display: block; - margin: @plyr-control-spacing auto 0; + // For some reason, Edge uses the -webkit margin above + margin-top: 0; } - @media (min-width: @plyr-bp-control-split) { - &--left { - float: left; - } - &--right { - float: right; - margin-top: 0; - } + + &::-ms-tooltip { + display: none; } - // Buttons - button { - display: inline-block; - vertical-align: middle; - margin: 0 2px; - padding: (@plyr-control-spacing / 2) @plyr-control-spacing; - overflow: hidden; + // Focus styles + &:focus { + outline: 0; + } + &::-moz-focus-outer { border: 0; - background: transparent; - border-radius: 3px; - cursor: pointer; - color: @plyr-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; + } + &.tab-focus:focus { + outline: 1px dotted fade(@plyr-video-control-color, 50%); + outline-offset: 3px; + } + + // Pressed styles + &:active { + &::-webkit-slider-thumb { + .range-thumb-active(); } - - // Hover and tab focus - &.tab-focus:focus, - &:hover { - background: @plyr-control-bg-hover; - color: @plyr-control-color-hover; + &::-moz-range-thumb { + .range-thumb-active(); } - // Default focus - &:focus { - outline: 0; + &::-ms-thumb { + .range-thumb-active(); } } + } +} - // Hide toggle icons by default - .icon--exit-fullscreen, - .icon--muted, - .icon--captions-on { - display: none; - } +// Screen reader only elements +.plyr__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; +} - // plyr time - .plyr__time { - display: inline-block; - vertical-align: middle; - margin-left: @plyr-control-spacing; - color: @plyr-control-color; - font-weight: 600; - font-size: @plyr-font-size-small; - } +// Video +.plyr__video-wrapper { + position: relative; + background: #000; + border-radius: inherit; +} - // Media duration hidden on small screens - .plyr__time + .plyr__time { - display: none; +// Container for embeds +.plyr__video-embed { + padding-bottom: 56.25%; /* 16:9 */ + height: 0; + overflow: hidden; + border-radius: inherit; - @media (min-width: @plyr-bp-control-split) { - display: inline-block; - } + iframe { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + border: 0; + user-select: none; + } - // Add a slash in before - &::before { - content: '\2044'; - margin-right: @plyr-control-spacing; - } - } + // 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; +} - // Tooltips - &__tooltip { - visibility: hidden; - position: absolute; - z-index: 2; - bottom: 100%; - margin-bottom: @plyr-tooltip-padding; - padding: @plyr-tooltip-padding (@plyr-tooltip-padding * 1.5); - pointer-events: none; - - opacity: 0; - background: @plyr-tooltip-bg; - box-shadow: @plyr-tooltip-shadow; - border-radius: @plyr-tooltip-radius; - color: @plyr-tooltip-color; - font-size: @plyr-font-size-small; - line-height: 1.5; - font-weight: 600; - - transform: translate(-50%, 10px) scale(.8); - transform-origin: 50% 100%; - transition: transform .2s .1s ease, opacity .2s .1s ease, visibility .3s ease; - - // Arrows - &::after, - &::before { - content: ''; - position: absolute; - width: 0; - height: 0; - top: 100%; - left: 50%; - transform: translateX(-50%); - } - // The border triangle - &::after { - @plyr-border-arrow-size: (@plyr-tooltip-arrow-size + (@plyr-tooltip-border-width * 1)); - bottom: -(@plyr-border-arrow-size + @plyr-tooltip-border-width); - border-right: @plyr-border-arrow-size solid transparent; - border-top: @plyr-border-arrow-size solid @plyr-tooltip-arrow-border-color; - border-left: @plyr-border-arrow-size solid transparent; - z-index: 1; - } - // The background triangle - &::before { - 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; - } +// 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 * 2) (@plyr-control-spacing * 2) (@plyr-control-spacing * 8); + color: #fff; + font-size: @plyr-font-size-captions-base; + text-align: center; + font-weight: 400; + + span { + border-radius: 2px; + padding: floor(@plyr-control-spacing / 3) @plyr-control-spacing; + background: fade(#000, 85%); } - button:hover .plyr__tooltip, - button.tab-focus:focus .plyr__tooltip, - &__tooltip--visible { - visibility: visible; - opacity: 1; - transform: translate(-50%, 0) scale(1); + span:empty { + display: none; } - button:hover .plyr__tooltip { - z-index: 3; + + @media (min-width: @plyr-bp-captions-large) { + font-size: @plyr-font-size-captions-medium; } +} +.plyr--captions-active .plyr__captions { + display: block; +} +.plyr--fullscreen-active .plyr__captions { + font-size: @plyr-font-size-captions-large; +} - // Common range styles - input[type='range'] { - &::-ms-tooltip { - display: none; - } - &.tab-focus:focus { - outline: 1px dotted fade(@plyr-gray-dark, 80%); - outline-offset: 3px; +// Controls +// -------------------------------------------------------------- +// Shared +.plyr__controls, +.plyr__play-large { + transition: visibility .3s ease, opacity .3s ease; +} + +// Playback controls +.plyr__controls { + display: flex; + align-items: center; + + line-height: 1; + text-align: center; + + // Spacing + > button, + .plyr__progress, + .plyr__time { + margin-left: @plyr-control-spacing; + + &:first-child { + margin-left: 0; } } + .plyr__volume[type="range"] { + margin-left: (@plyr-control-spacing / 2); + } + [data-plyr="pause"] { + margin-left: 0; + } - // Playback progress - // <progress> element - &__progress { - position: absolute; - bottom: 100%; - left: 0; - right: 0; - width: 100%; - height: @plyr-control-spacing; - background: @plyr-progress-bg; - - &--buffer[value], - &--played[value], - &--seek[type='range'] { - position: absolute; - left: 0; - top: 0; - width: 100%; - height: @plyr-control-spacing; - margin: 0; - padding: 0; - vertical-align: top; + // Buttons + button { + position: relative; + display: inline-block; + flex-shrink: 0; + vertical-align: middle; + padding: (@plyr-control-spacing / 2) @plyr-control-spacing; + border: 0; + background: transparent; + border-radius: 3px; + cursor: pointer; + transition: background .3s ease, color .3s ease, opacity .3s ease; + color: inherit; - -webkit-appearance: none; - -moz-appearance: none; - border: none; - background: transparent; + svg { + width: 18px; + height: 18px; + display: block; + fill: currentColor; } - &--buffer[value], - &--played[value] { - &::-webkit-progress-bar { - background: transparent; - transition: width .2s ease; - } - // Inherit from currentColor; - &::-webkit-progress-value { - background: currentColor; - transition: width .2s ease; - } - &::-moz-progress-bar { - background: currentColor; - transition: width .2s ease; - } + // Default focus + &:focus { + outline: 0; } - &--played[value] { - z-index: 2; - color: @plyr-progress-playing-bg; + } + + // Hide toggle icons by default + .icon--exit-fullscreen, + .icon--muted, + .icon--captions-on { + display: none; + } +} + +// Video controls +.plyr--video .plyr__controls { + position: absolute; + left: 0; + right: 0; + bottom: 0; + padding: (@plyr-control-spacing * 5) (@plyr-control-spacing * 1.5) @plyr-control-spacing; + background: linear-gradient(fade(@plyr-video-controls-bg, 0%), fade(@plyr-video-controls-bg, 50%)); + border-bottom-left-radius: inherit; + border-bottom-right-radius: inherit; + color: @plyr-video-control-color; + + button { + // Hover and tab focus + &.tab-focus:focus, + &:hover { + background: @plyr-video-control-bg-hover; + color: @plyr-video-control-color-hover; } - &--buffer[value] { - color: @plyr-progress-buffered-bg; + } +} +.plyr--audio .plyr__controls { + padding: @plyr-control-spacing; + border-radius: inherit; + background: @plyr-audio-controls-bg; + color: @plyr-audio-control-color; + + button { + // Hover and tab focus + &.tab-focus:focus, + &:hover { + background: @plyr-audio-control-bg-hover; + color: @plyr-audio-control-color-hover; } + } +} - // Seek control - // <input[type='range']> element - // Specificity is for bootstrap compatibility - &--seek[type='range'] { - z-index: 4; - cursor: pointer; - outline: 0; +// Large play button +.plyr__play-large { + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + padding: @plyr-control-spacing; + background: @plyr-video-control-bg-hover; + border: 4px solid @plyr-video-control-color; + border-radius: 100%; + color: @plyr-video-control-color; - // Webkit - &::-webkit-slider-runnable-track { - .seek-track(); - } - &::-webkit-slider-thumb { - -webkit-appearance: none; - .seek-thumb(); - } + svg { + position: relative; + left: 2px; + width: 20px; + height: 20px; + display: block; + fill: currentColor; + } - // Mozilla - &::-moz-range-track { - .seek-track(); - } - &::-moz-range-thumb { - -moz-appearance: none; - .seek-thumb(); - } + &:focus { + outline: 1px dotted fade(@plyr-video-control-color, 50%); + } +} +.plyr--audio .plyr__play-large { + display: none; +} - // Microsoft - &::-ms-track { - color: transparent; - .seek-track(); - } - &::-ms-fill-lower, - &::-ms-fill-upper { - .seek-track(); - } - &::-ms-thumb { - .seek-thumb(); - } +// 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; +} - &:focus { - outline: 0; - } - &::-moz-focus-outer { - border: 0; - } - } +// Hide controls +.plyr--hide-controls .plyr__controls, +.plyr--playing .plyr__play-large { + visibility: hidden; + opacity: 0; +} - // Seek tooltip to show time - .plyr__tooltip { - left: 0; - } - } +// 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 { + display: block; - // Touch seek wider handle - &--is-touch &--seek[type='range'] { - &::-webkit-slider-thumb { - .seek-thumb-touch(); - } - // Mozilla - &::-moz-range-thumb { - .seek-thumb-touch(); - } - // Microsoft - &::-ms-thumb { - .seek-thumb-touch(); - } + & + svg { + display: none; } +} - // Loading state - &--loading .plyr__progress--buffer { - animation: plyr-progress 1s linear infinite; - background-size: @plyr-progress-loading-size @plyr-progress-loading-size; - background-repeat: repeat-x; - background-color: @plyr-progress-buffered-bg; - background-image: linear-gradient( - -45deg, - @plyr-progress-loading-bg 25%, - transparent 25%, - transparent 50%, - @plyr-progress-loading-bg 50%, - @plyr-progress-loading-bg 75%, - transparent 75%, - transparent); - color: transparent; - } - - // States - &__controls [data-plyr='pause'], - &--playing .plyr__controls [data-plyr='play'] { - display: none; +// Some options are hidden by default +.plyr [data-plyr='captions'], +.plyr [data-plyr='fullscreen'] { + display: none; +} +.plyr--captions-enabled [data-plyr='captions'], +.plyr--fullscreen-enabled [data-plyr='fullscreen'] { + display: inline-block; +} + +// Tooltips +// -------------------------------------------------------------- +.plyr__tooltip { + visibility: hidden; + 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; + box-shadow: @plyr-tooltip-shadow; + border-radius: @plyr-tooltip-radius; + + color: @plyr-tooltip-color; + font-size: @plyr-font-size-small; + line-height: 1.3; + + transform: translate(-50%, 10px) scale(.8); + transform-origin: 50% 100%; + transition: transform .2s .1s ease, opacity .2s .1s ease, visibility .3s ease; + + // Arrows + &::before { + content: ''; + position: absolute; + width: 0; + height: 0; + left: 50%; + transform: translateX(-50%); } - &--playing .plyr__controls [data-plyr='pause'] { - display: inline-block; + // The background triangle + &::before { + 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 button:hover .plyr__tooltip, +.plyr button.tab-focus:focus .plyr__tooltip, +.plyr__tooltip--visible { + visibility: visible; + opacity: 1; + transform: translate(-50%, 0) scale(1); +} +.plyr button:hover .plyr__tooltip { + z-index: 3; +} - // Volume control - // <input[type='range']> element - // Specificity is for bootstrap compatibility - &__volume[type='range'] { - display: inline-block; - vertical-align: middle; - -webkit-appearance: none; - -moz-appearance: none; - width: 100px; - margin: 0 @plyr-control-spacing 0 0; - padding: 0; - cursor: pointer; - background: transparent; - border: none; +// Playback progress +// -------------------------------------------------------------- +// <progress> element +.plyr__progress { + position: relative; + flex: 1; + + input[type="range"] { + position: relative; + z-index: 2; - // Webkit &::-webkit-slider-runnable-track { - .volume-track(); - } - &::-webkit-slider-thumb { - -webkit-appearance: none; - margin-top: -((@plyr-volume-thumb-height - @plyr-volume-track-height) / 2); - .volume-thumb(); + background: transparent; } - - // Mozilla &::-moz-range-track { - .volume-track(); - } - &::-moz-range-thumb { - .volume-thumb(); - } - - // Microsoft - &::-ms-track { - height: @plyr-volume-track-height; background: transparent; - border-color: transparent; - border-width: ((@plyr-volume-thumb-height - @plyr-volume-track-height) / 2) 0; - color: transparent; } &::-ms-fill-lower, &::-ms-fill-upper { - .volume-track(); - } - &::-ms-thumb { - .volume-thumb(); + background: transparent; } + } - &:focus { - outline: 0; - - &::-webkit-slider-thumb { - background: @plyr-volume-thumb-bg-focus; - } - &::-moz-range-thumb { - background: @plyr-volume-thumb-bg-focus; - } - &::-ms-thumb { - background: @plyr-volume-thumb-bg-focus; - } - } + // Seek tooltip to show time + .plyr__tooltip { + left: 0; } +} - // Hide sound controls on iOS - // It's not supported to change volume using JavaScript: - // https://developer.apple.com/library/safari/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/Device-SpecificConsiderations/Device-SpecificConsiderations.html - &--is-ios &__volume, - &--is-ios [data-plyr='mute'], - &--is-ios.plyr--audio &__controls--right { - display: none; +.plyr__progress--buffer[value], +.plyr__progress--played[value] { + position: absolute; + left: 0; + top: 50%; + width: 100%; + height: @range-track-height; + margin: -(@range-track-height / 2) 0 0; + padding: 0; + vertical-align: top; + appearance: none; + border: none; + border-radius: 100px; + + &::-webkit-progress-bar { + background: transparent; } - // Center buttons so it looks less odd - &--is-ios.plyr--audio &__controls--left { - float: none; + &::-webkit-progress-value { + background: currentColor; + border-radius: 100px; + min-width: @range-track-height; } - - // Audio specific styles - // Position the progress within the container - &--audio .plyr__controls { - padding-top: (@plyr-control-spacing * 2); + &::-moz-progress-bar { + background: currentColor; + border-radius: 100px; + min-width: @range-track-height; } - &--audio .plyr__progress { - bottom: auto; - top: 0; - background: @plyr-off-white; + &::-ms-fill { + border-radius: 100px; } +} +.plyr__progress--played[value] { + z-index: 1; + color: @plyr-progress-playing-bg; + background: transparent; - // Full screen mode - &.plyr--fullscreen, - &--fullscreen-active { - position: fixed; - top: 0; - left: 0; - right: 0; - bottom: 0; - height: 100%; - width: 100%; - z-index: 10000000; - background: #000; - - video { - height: 100%; - } - .plyr__video-wrapper { - height: 100%; - width: 100%; - } - .plyr__controls { - position: absolute; - bottom: 0; - left: 0; - right: 0; - } + &::-webkit-progress-value { + min-width: @range-track-height; + border-top-right-radius: 0; + border-bottom-right-radius: 0; + } + &::-moz-progress-bar { + min-width: @range-track-height; + border-top-right-radius: 0; + border-bottom-right-radius: 0; + } + &::-ms-fill { + min-width: @range-track-height; + border-top-right-radius: 0; + border-bottom-right-radius: 0; } +} +.plyr__progress--buffer[value] { + color: @plyr-progress-buffered-bg; + background: @range-track-bg; - // Hide controls when playing in full screen - &--fullscreen-active.plyr--fullscreen--hide-controls.plyr--playing, - &.plyr--fullscreen.plyr--fullscreen--hide-controls.plyr--playing { - .plyr__controls { - transform: translateY(100%) translateY(@plyr-control-spacing / 2); - transition: transform .3s .2s ease; - } - .plyr__captions { - bottom: (@plyr-control-spacing / 2); - transition: bottom .3s .2s ease; - } - &.plyr--hover .plyr__controls { - transform: translateY(0); - } + &::-webkit-progress-value { + transition: width .2s ease; } + &::-moz-progress-bar { + transition: width .2s ease; + } + &::-ms-fill { + transition: width .2s ease; + } +} - // Captions - &.plyr--fullscreen .plyr__captions, - &--fullscreen-active .plyr__captions, - &--fullscreen--hide-controls.plyr--fullscreen-active.plyr--playing.plyr--hover .plyr__captions { - top: auto; - bottom: 90px; +// Loading state +.plyr--loading .plyr__progress--buffer { + animation: plyr-progress 1s linear infinite; + background-size: @plyr-progress-loading-size @plyr-progress-loading-size; + background-repeat: repeat-x; + background-color: @plyr-progress-buffered-bg; + background-image: linear-gradient( + -45deg, + @plyr-progress-loading-bg 25%, + transparent 25%, + transparent 50%, + @plyr-progress-loading-bg 50%, + @plyr-progress-loading-bg 75%, + transparent 75%, + transparent); + color: transparent; +} - @media (min-width: @plyr-bp-control-split) { - bottom: 60px; - } - } +// Time +// -------------------------------------------------------------- +.plyr__time { + display: inline-block; + vertical-align: middle; + font-size: @plyr-font-size-small; + line-height: .95; +} - // Change icons on state change - &--fullscreen-active .icon--exit-fullscreen, - &--muted .plyr__controls .icon--muted, - &--captions-active .plyr__controls .icon--captions-on { - display: block; +// Media duration hidden on small screens +.plyr__time + .plyr__time { + display: none; - & + svg { - display: none; - } + @media (min-width: @plyr-bp-control-split) { + display: inline-block; } - // Some options are hidden by default - [data-plyr='captions'], - [data-plyr='fullscreen'] { - display: none; + // Add a slash in before + &::before { + content: '\2044'; + margin-right: @plyr-control-spacing; } - &--captions-enabled [data-plyr='captions'], - &--fullscreen-enabled [data-plyr='fullscreen'] { - display: inline-block; +} + +// Volume +// -------------------------------------------------------------- +// <input[type='range']> element +// Specificity is for bootstrap compatibility +.plyr__volume[type='range'] { + max-width: 100px; +} + +// Hide sound controls on iOS +// It's not supported to change volume using JavaScript: +// https://developer.apple.com/library/safari/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/Device-SpecificConsiderations/Device-SpecificConsiderations.html +.plyr--is-ios .plyr__volume, +.plyr--is-ios [data-plyr='mute'], +.plyr--is-ios.plyr--audio .plyr__controls--right { + display: none; +} +// Center buttons so it looks less odd +.plyr--is-ios.plyr--audio .plyr__controls--left { + float: none; +} + +// Fullscreen +// -------------------------------------------------------------- +.plyr--fullscreen, +.plyr--fullscreen-active { + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + height: 100%; + width: 100%; + z-index: 10000000; + background: #000; + + video { + height: 100%; + } + .plyr__video-wrapper { + height: 100%; + width: 100%; + } + .plyr__controls { + position: absolute; + bottom: 0; + left: 0; + right: 0; } } |