Remove bower. Fetch plyr from npm instead

This commit is contained in:
rundef 2016-02-17 10:53:53 -05:00
parent 90b87d6acf
commit bd937f6d07
7 changed files with 319 additions and 282 deletions

View file

@ -1,27 +0,0 @@
{
"name": "koel",
"authors": [
"An Phan <me@phanan.net>"
],
"moduleType": [
"es6"
],
"keywords": [
"koel",
"audio",
"streaming",
"mp3"
],
"license": "MIT",
"homepage": "http://koel.phanan.net",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"devDependencies": {
"plyr": "~1.3.6"
}
}

View file

@ -22,7 +22,7 @@ elixir(function (mix) {
.copy('resources/assets/fonts', 'public/build/fonts'); .copy('resources/assets/fonts', 'public/build/fonts');
mix.scripts([ mix.scripts([
'bower_components/plyr/dist/plyr.js', 'node_modules/plyr/dist/plyr.js',
'resources/assets/js/libs/modernizr-custom.js' 'resources/assets/js/libs/modernizr-custom.js'
], 'public/js/vendors.js', './') ], 'public/js/vendors.js', './')
.styles([ .styles([

View file

@ -35,6 +35,7 @@
"lodash": "^3.10.1", "lodash": "^3.10.1",
"mocha": "^2.3.4", "mocha": "^2.3.4",
"node-sass": "^3.4.2", "node-sass": "^3.4.2",
"plyr": "^1.5.11",
"rangeslider.js": "^2.1.1", "rangeslider.js": "^2.1.1",
"sinon": "^1.17.2", "sinon": "^1.17.2",
"vue": "^1.0.16", "vue": "^1.0.16",
@ -44,7 +45,7 @@
"vueify-insert-css": "^1.0.0" "vueify-insert-css": "^1.0.0"
}, },
"scripts": { "scripts": {
"postinstall": "bower install && cross-env NODE_ENV=production && gulp --production", "postinstall": "cross-env NODE_ENV=production && gulp --production",
"test": "mocha --compilers js:babel-register resources/assets/js/tests/**/*Test.js" "test": "mocha --compilers js:babel-register resources/assets/js/tests/**/*Test.js"
} }
} }

View file

@ -28,7 +28,7 @@
<a class="album" @click.prevent="loadAlbum(song.album)">{{ song.album.name }}</a> <a class="album" @click.prevent="loadAlbum(song.album)">{{ song.album.name }}</a>
</p> </p>
<div class="player"> <div class="player plyr">
<audio crossorigin="anonymous" controls></audio> <audio crossorigin="anonymous" controls></audio>
</div> </div>
</div> </div>
@ -501,14 +501,14 @@
left: 0; left: 0;
} }
.player-controls { .plyr__controls {
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
width: 100%; width: 100%;
} }
.player-controls-left, .player-controls-right { .plyr__controls--left, .plyr__controls--right {
display: none; display: none;
} }

View file

@ -102,7 +102,11 @@ export default {
// Add it into the "recent" list // Add it into the "recent" list
songStore.addRecent(song); songStore.addRecent(song);
this.player.source(`${sharedStore.state.cdnUrl}api/${song.id}/play?jwt-token=${ls.get('jwt-token')}`); this.player.source({
sources: [{
src: `${sharedStore.state.cdnUrl}api/${song.id}/play?jwt-token=${ls.get('jwt-token')}`
}]
});
// We'll just "restart" playing the song, which will handle notification, scrobbling etc. // We'll just "restart" playing the song, which will handle notification, scrobbling etc.
this.restart(); this.restart();

View file

@ -3,7 +3,7 @@
@import "partials/_vars.scss"; @import "partials/_vars.scss";
@import "partials/_mixins.scss"; @import "partials/_mixins.scss";
$blue: $colorHighlight; $plyr-blue: $colorHighlight;
@import "vendor/_plyr.scss"; @import "vendor/_plyr.scss";
@import "partials/_shared.scss"; @import "partials/_shared.scss";

View file

@ -7,149 +7,124 @@
// ------------------------------- // -------------------------------
// Colors // Colors
$blue: #3498DB !default; $plyr-blue: #3498DB !default;
$gray-dark: #343F4A !default; $plyr-gray-dark: #343F4A !default;
$gray: #565D64 !default; $plyr-gray: #565D64 !default;
$gray-light: #6B7D86 !default; $plyr-gray-light: #6B7D86 !default;
$gray-lighter: #CBD0D3 !default; $plyr-gray-lighter: #CBD0D3 !default;
$off-white: #313131 !default; $plyr-off-white: #313131 !default;
// Font sizes // Font sizes
$font-size-small: 14px !default; $plyr-font-size-small: 14px !default;
$font-size-base: 16px !default; $plyr-font-size-base: 16px !default;
// Captions // Captions
$font-size-captions-base: ceil($font-size-base * 1.25) !default; $plyr-font-size-captions-base: ceil($plyr-font-size-base * 1.25) !default;
$font-size-captions-medium: ceil($font-size-base * 1.5) !default; $plyr-font-size-captions-medium: ceil($plyr-font-size-base * 1.5) !default;
$font-size-captions-large: ($font-size-base * 2) !default; $plyr-font-size-captions-large: ($plyr-font-size-base * 2) !default;
// Controls // Controls
$control-spacing: 0 !default; $plyr-control-spacing: 10px !default;
$controls-bg: #fff !default; $plyr-controls-bg: #fff !default;
$control-bg-hover: $blue !default; $plyr-control-bg-hover: $plyr-blue !default;
$control-color: null !default;
$control-color-hover: null !default;
// Contrast // Contrast
@if lightness($controls-bg) >= 65% { @if lightness($plyr-controls-bg) >= 65% {
$control-color: $gray-light; $plyr-control-color: $plyr-gray-light !default;
} @else {
$control-color: $gray-lighter;
} }
@if lightness($control-bg-hover) >= 65% { @else {
$control-color-hover: $gray; $plyr-control-color: $plyr-gray-lighter !default;
} @else { }
$control-color-hover: #fff; @if lightness($plyr-control-bg-hover) >= 65% {
$plyr-control-color-hover: $plyr-gray !default;
}
@else {
$plyr-control-color-hover: #fff !default;
} }
// Tooltips // Tooltips
$tooltip-bg: $controls-bg !default; $plyr-tooltip-bg: $plyr-controls-bg !default;
$tooltip-color: $control-color !default; $plyr-tooltip-border-color: transparentize($plyr-gray-dark, .1) !default;
$tooltip-padding: $control-spacing !default; $plyr-tooltip-border-width: 1px;
$tooltip-arrow-size: 5px !default; $plyr-tooltip-shadow: 0 0 5px $plyr-tooltip-border-color, 0 0 0 $plyr-tooltip-border-width $plyr-tooltip-border-color;
$tooltip-radius: 3px !default; $plyr-tooltip-color: $plyr-control-color !default;
$plyr-tooltip-padding: $plyr-control-spacing !default;
$plyr-tooltip-arrow-size: 6px !default;
$plyr-tooltip-radius: 3px !default;
// Progress // Progress
$progress-bg: rgba(red($gray), green($gray), blue($gray), .2) !default; $plyr-progress-bg: transparentize($plyr-gray, .2) !default;
$progress-playing-bg: $blue !default; $plyr-progress-playing-bg: $plyr-blue !default;
$progress-buffered-bg: rgba(red($gray), green($gray), blue($gray), .25) !default; $plyr-progress-buffered-bg: transparentize($plyr-gray, .25) !default;
$progress-loading-size: 40px !default; $plyr-progress-loading-size: 40px !default;
$progress-loading-bg: rgba(0,0,0, .15) !default; $plyr-progress-loading-bg: transparentize(#000, .15) !default;
// Volume // Volume
$volume-track-height: 6px !default; $plyr-volume-track-height: 6px !default;
$volume-track-bg: darken($controls-bg, 10%) !default; $plyr-volume-track-bg: darken($plyr-controls-bg, 10%) !default;
$volume-thumb-height: ($volume-track-height * 2) !default; $plyr-volume-thumb-height: ($plyr-volume-track-height * 2) !default;
$volume-thumb-width: ($volume-track-height * 2) !default; $plyr-volume-thumb-width: ($plyr-volume-track-height * 2) !default;
$volume-thumb-bg: $control-color !default; $plyr-volume-thumb-bg: $plyr-control-color !default;
$volume-thumb-bg-focus: $control-bg-hover !default; $plyr-volume-thumb-bg-focus: $plyr-control-bg-hover !default;
// Breakpoints // Breakpoints
$bp-control-split: 560px !default; // When controls split into left/right $plyr-bp-control-split: 560px !default; // When controls split into left/right
$bp-captions-large: 768px !default; // When captions jump to the larger font size $plyr-bp-captions-large: 768px !default; // When captions jump to the larger font size
// Animation // Animation
// --------------------------------------- // ---------------------------------------
@keyframes plyr-progress {
@keyframes progress { to { background-position: $plyr-progress-loading-size 0; }
to { background-position: $progress-loading-size 0; }
} }
// Font smoothing // Font smoothing
@mixin font-smoothing($mode: on) @mixin font-smoothing($mode: on)
{ {
@if ($mode == 'on') { @if ($mode == 'on') {
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
} }
@else if ($mode == 'off') { @else if ($mode == 'off') {
-moz-osx-font-smoothing: auto; -moz-osx-font-smoothing: auto;
-webkit-font-smoothing: subpixel-antialiased; -webkit-font-smoothing: subpixel-antialiased;
} }
}
// Contain floats: nicolasgallagher.com/micro-clearfix-hack/
@mixin clearfix()
{
zoom: 1;
&:before,
&:after { content: ''; display: table; }
&:after { clear: both; }
}
// Tab focus styles
@mixin tab-focus()
{
outline: thin dotted #000;
outline-offset: 0;
} }
// <input type="range"> styling // <input type="range"> styling
@mixin volume-thumb() @mixin volume-thumb() {
{ height: $plyr-volume-thumb-height;
height: $volume-thumb-height; width: $plyr-volume-thumb-width;
width: $volume-thumb-width; background: $plyr-volume-thumb-bg;
background: $volume-thumb-bg;
border: 0; border: 0;
border-radius: ($volume-thumb-height / 2); border-radius: 100%;
transition: background .3s ease; transition: background .3s ease;
cursor: ew-resize; cursor: ew-resize;
} }
@mixin volume-track() @mixin volume-track() {
{ height: $plyr-volume-track-height;
height: $volume-track-height; background: $plyr-volume-track-bg;
background: $volume-track-bg;
border: 0; border: 0;
border-radius: ($volume-track-height / 2); border-radius: ($plyr-volume-track-height / 2);
} }
@mixin seek-thumb() @mixin seek-thumb() {
{
background: transparent; background: transparent;
border: 0; border: 0;
width: ($control-spacing * 2); width: 1px;
height: $control-spacing; height: $plyr-control-spacing;
} }
@mixin seek-track() @mixin seek-thumb-touch() {
{ width: ($plyr-control-spacing * 4);
transform: translateX(-50%);
}
@mixin seek-track() {
background: none; background: none;
border: 0; border: 0;
} }
// Screen reader only
// -------------------------------
.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;
}
// Styles // Styles
// ------------------------------- // -------------------------------
// Base // Base
.player { .plyr {
position: relative; position: relative;
max-width: 100%; max-width: 100%;
min-width: 290px; min-width: 290px;
@ -159,12 +134,28 @@ $bp-captions-large: 768px !default; // When captions jump to the larger
&, &,
*, *,
*::after, *::after,
*::before { *::before {
box-sizing: border-box; box-sizing: border-box;
}
// Fix 300ms delay
a, button, input, label {
touch-action: manipulation;
}
// Screen reader only
&__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 // For video
&-video-wrapper { &__video-wrapper {
position: relative; position: relative;
} }
video, video,
@ -175,10 +166,12 @@ $bp-captions-large: 768px !default; // When captions jump to the larger
} }
// For embeds // For embeds
&-video-embed { &__video-embed {
padding-bottom: 56.25%; /* 16:9 */ padding-bottom: 56.25%; /* 16:9 */
height: 0; height: 0;
overflow: hidden;
background: #000;
iframe { iframe {
position: absolute; position: absolute;
top: 0; top: 0;
@ -186,82 +179,101 @@ $bp-captions-large: 768px !default; // When captions jump to the larger
width: 100%; width: 100%;
height: 100%; height: 100%;
border: 0; 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 iframe {
pointer-events: none;
} }
} }
// Captions // Captions
&-captions { &__captions {
display: none; display: none;
position: absolute; position: absolute;
bottom: 0; bottom: 0;
left: 0; left: 0;
width: 100%; width: 100%;
padding: ($control-spacing * 2) ($control-spacing * 2) ($control-spacing * 3); padding: ($plyr-control-spacing * 2) ($plyr-control-spacing * 2) ($plyr-control-spacing * 3);
color: #fff; color: #fff;
font-size: $font-size-captions-base; font-size: $plyr-font-size-captions-base;
text-align: center; text-align: center;
@include font-smoothing(); @include font-smoothing();
span { span {
border-radius: 2px; border-radius: 2px;
padding: 3px 10px; padding: 3px 10px;
background: rgba(0,0,0, .9); background: transparentize(#000, .9);
} }
span:empty { span:empty {
display: none; display: none;
} }
@media (min-width: $bp-captions-large) { @media (min-width: $plyr-bp-captions-large) {
font-size: $font-size-captions-medium; font-size: $plyr-font-size-captions-medium;
} }
} }
&.captions-active &-captions { &--captions-active &__captions {
display: block; display: block;
} }
&.fullscreen-active &-captions { &--fullscreen-active &__captions {
font-size: $font-size-captions-large; font-size: $plyr-font-size-captions-large;
} }
// Player controls // Playback controls
&-controls { &__controls {
@include clearfix();
@include font-smoothing(); @include font-smoothing();
position: relative; position: relative;
padding: $control-spacing; padding: $plyr-control-spacing;
background: $controls-bg; background: $plyr-controls-bg;
line-height: 1; line-height: 1;
text-align: center; text-align: center;
box-shadow: 0 1px 1px rgba(red($gray-dark), green($gray-dark), blue($gray-dark), .2); box-shadow: 0 1px 1px transparentize($plyr-gray-dark, .2);
// Clear floats
&::after {
content: '';
display: table;
clear: both;
}
// Layout // Layout
&-right { &--right {
display: block; display: block;
margin: $control-spacing auto 0; margin: $plyr-control-spacing auto 0;
} }
@media (min-width: $bp-control-split) { @media (min-width: $plyr-bp-control-split) {
&-left { &--left {
float: left; float: left;
} }
&-right { &--right {
float: right; float: right;
margin-top: 0; margin-top: 0;
} }
} }
// Buttons // Buttons
button { button {
display: inline-block; display: inline-block;
vertical-align: middle; vertical-align: middle;
margin: 0 2px; margin: 0 2px;
padding: ($control-spacing / 2) $control-spacing; padding: ($plyr-control-spacing / 2) $plyr-control-spacing;
overflow: hidden; overflow: hidden;
border: 0; border: 0;
background: transparent; background: transparent;
border-radius: 3px; border-radius: 3px;
cursor: pointer; cursor: pointer;
color: $control-color; color: $plyr-control-color;
transition: background .3s ease, color .3s ease, opacity .3s ease; transition: background .3s ease, color .3s ease, opacity .3s ease;
svg { svg {
width: 18px; width: 18px;
height: 18px; height: 18px;
@ -269,116 +281,139 @@ $bp-captions-large: 768px !default; // When captions jump to the larger
fill: currentColor; fill: currentColor;
transition: fill .3s ease; transition: fill .3s ease;
} }
// Hover and tab focus // Hover and tab focus
&.tab-focus, &.tab-focus:hover,
&:hover { &:hover {
background: $control-bg-hover; background: $plyr-control-bg-hover;
color: $control-color-hover; color: $plyr-control-color-hover;
} }
// Default focus // Default focus
&:focus { &:focus {
outline: 0; outline: 0;
} }
} }
// Hide toggle icons by default // Hide toggle icons by default
.icon-exit-fullscreen, .icon--exit-fullscreen,
.icon-muted, .icon--muted,
.icon-captions-on { .icon--captions-on {
display: none; display: none;
} }
// Time display // Time display
.player-time { .plyr__time {
display: inline-block; display: inline-block;
vertical-align: middle; vertical-align: middle;
margin-left: $control-spacing; margin-left: $plyr-control-spacing;
color: $control-color; color: $plyr-control-color;
font-weight: 600; font-weight: 600;
font-size: $font-size-small; font-size: $plyr-font-size-small;
@include font-smoothing();
} }
// Media duration hidden on small screens // Media duration hidden on small screens
.player-time + .player-time { .plyr__time + .plyr__time {
display: none; display: none;
@media (min-width: $bp-control-split) { @media (min-width: $plyr-bp-control-split) {
display: inline-block; display: inline-block;
} }
// Add a slash in before // Add a slash in before
&::before { &::before {
content: '\2044'; content: '\2044';
margin-right: $control-spacing; margin-right: $plyr-control-spacing;
} }
} }
} }
// Tooltips // Tooltips
&-tooltip { &__tooltip {
visibility: hidden;
position: absolute; position: absolute;
z-index: 2; z-index: 2;
bottom: 100%; bottom: 100%;
margin-bottom: $tooltip-padding; margin-bottom: $plyr-tooltip-padding;
padding: $tooltip-padding ($tooltip-padding * 1.5); padding: $plyr-tooltip-padding ($plyr-tooltip-padding * 1.5);
opacity: 0; opacity: 0;
background: $tooltip-bg; background: $plyr-tooltip-bg;
border-radius: $tooltip-radius; box-shadow: $plyr-tooltip-shadow;
color: $tooltip-color; border-radius: $plyr-tooltip-radius;
font-size: $font-size-small; color: $plyr-tooltip-color;
font-size: $plyr-font-size-small;
line-height: 1.5; line-height: 1.5;
font-weight: 600; font-weight: 600;
transform: translate(-50%, ($tooltip-padding * 3)) scale(0); transform: translate(-50%, 10px) scale(.8);
transform-origin: 50% 100%; transform-origin: 50% 100%;
transition: transform .2s .1s ease, opacity .2s .1s ease; transition: transform .2s .1s ease, opacity .2s .1s ease, visibility .3s ease;
&::after { // Arrows
&::after,
&::before {
content: ''; content: '';
display: block;
position: absolute; position: absolute;
left: 50%;
bottom: -$tooltip-arrow-size;
margin-left: -$tooltip-arrow-size;
width: 0; width: 0;
height: 0; height: 0;
transition: inherit; top: 100%;
border-style: solid; left: 50%;
border-width: $tooltip-arrow-size $tooltip-arrow-size 0 $tooltip-arrow-size; transform: translateX(-50%);
border-color: $controls-bg transparent transparent; }
// 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-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;
} }
} }
button:hover .player-tooltip, button:hover .plyr__tooltip,
button:focus .player-tooltip { button.tab-focus:focus .plyr__tooltip,
&__tooltip--visible {
visibility: visible;
opacity: 1; opacity: 1;
transform: translate(-50%, 0) scale(1); transform: translate(-50%, 0) scale(1);
} }
button:hover .player-tooltip { button:hover .plyr__tooltip {
z-index: 3; z-index: 3;
} }
// Player progress // Common range styles
input[type='range'].tab-focus:focus {
outline: thin dotted transparentize($plyr-gray-dark, .8);
outline-offset: 3px;
}
// Playback progress
// <progress> element // <progress> element
&-progress { &__progress {
position: absolute; position: absolute;
bottom: 100%; bottom: 100%;
left: 0; left: 0;
right: 0; right: 0;
width: 100%; width: 100%;
height: 5px; height: $plyr-control-spacing;
background: $progress-bg; background: $plyr-progress-bg;
&-buffer[value], &--buffer[value],
&-played[value], &--played[value],
&-seek[type='range'] { &--seek[type='range'] {
position: absolute; position: absolute;
left: 0; left: 0;
top: 0; top: 0;
width: 100%; width: 100%;
height: 5px; height: $plyr-control-spacing;
margin: 0; margin: 0;
padding: 0; padding: 0;
vertical-align: top; vertical-align: top;
@ -388,32 +423,35 @@ $bp-captions-large: 768px !default; // When captions jump to the larger
border: none; border: none;
background: transparent; background: transparent;
} }
&-buffer[value], &--buffer[value],
&-played[value] { &--played[value] {
&::-webkit-progress-bar { &::-webkit-progress-bar {
background: transparent; background: transparent;
transition: width .2s ease;
} }
// Inherit from currentColor; // Inherit from currentColor;
&::-webkit-progress-value { &::-webkit-progress-value {
background: currentColor; background: currentColor;
transition: width .2s ease;
} }
&::-moz-progress-bar { &::-moz-progress-bar {
background: currentColor; background: currentColor;
transition: width .2s ease;
} }
} }
&-played[value] { &--played[value] {
z-index: 2; z-index: 2;
color: $progress-playing-bg; color: $plyr-progress-playing-bg;
} }
&-buffer[value] { &--buffer[value] {
color: $progress-buffered-bg; color: $plyr-progress-buffered-bg;
} }
// Seek control // Seek control
// <input[type='range']> element // <input[type='range']> element
// Specificity is for bootstrap compatibility // Specificity is for bootstrap compatibility
&-seek[type='range'] { &--seek[type='range'] {
z-index: 4; z-index: 4;
cursor: pointer; cursor: pointer;
outline: 0; outline: 0;
@ -435,7 +473,7 @@ $bp-captions-large: 768px !default; // When captions jump to the larger
-moz-appearance: none; -moz-appearance: none;
@include seek-thumb(); @include seek-thumb();
} }
// Microsoft // Microsoft
&::-ms-track { &::-ms-track {
color: transparent; color: transparent;
@ -456,58 +494,77 @@ $bp-captions-large: 768px !default; // When captions jump to the larger
border: 0; border: 0;
} }
} }
// Seek tooltip to show time
.plyr__tooltip {
left: 0;
}
}
// Touch seek wider handle
&--is-touch &--seek[type='range'] {
&::-webkit-slider-thumb {
@include seek-thumb-touch();
}
// Mozilla
&::-moz-range-thumb {
@include seek-thumb-touch();
}
// Microsoft
&::-ms-thumb {
@include seek-thumb-touch();
}
} }
// Loading state // Loading state
&.loading .player-progress-buffer { &--loading .plyr__progress--buffer {
animation: progress 1s linear infinite; animation: plyr-progress 1s linear infinite;
background-size: $progress-loading-size $progress-loading-size; background-size: $plyr-progress-loading-size $plyr-progress-loading-size;
background-repeat: repeat-x; background-repeat: repeat-x;
background-color: $progress-buffered-bg; background-color: $plyr-progress-buffered-bg;
background-image: linear-gradient( background-image: linear-gradient(
-45deg, -45deg,
$progress-loading-bg 25%, $plyr-progress-loading-bg 25%,
transparent 25%, transparent 25%,
transparent 50%, transparent 50%,
$progress-loading-bg 50%, $plyr-progress-loading-bg 50%,
$progress-loading-bg 75%, $plyr-progress-loading-bg 75%,
transparent 75%, transparent 75%,
transparent); transparent);
color: transparent; color: transparent;
} }
// States // States
&-controls [data-player='pause'], &__controls [data-plyr='pause'],
&.playing .player-controls [data-player='play'] { &--playing .plyr__controls [data-plyr='play'] {
display: none; display: none;
} }
&.playing .player-controls [data-player='pause'] { &--playing .plyr__controls [data-plyr='pause'] {
display: inline-block; display: inline-block;
} }
// Volume control // Volume control
// <input[type='range']> element // <input[type='range']> element
// Specificity is for bootstrap compatibility // Specificity is for bootstrap compatibility
&-volume[type='range'] { &__volume[type='range'] {
display: inline-block; display: inline-block;
vertical-align: middle; vertical-align: middle;
-webkit-appearance: none; -webkit-appearance: none;
-moz-appearance: none; -moz-appearance: none;
-webkit-appearance: none;
width: 100px; width: 100px;
padding: 0; margin: 0 $plyr-control-spacing 0 0;
padding: 0;
cursor: pointer; cursor: pointer;
background: transparent; background: transparent;
border: none; border: none;
outline: 0 !important;
// Webkit // Webkit
&::-webkit-slider-runnable-track { &::-webkit-slider-runnable-track {
@include volume-track(); @include volume-track();
} }
&::-webkit-slider-thumb { &::-webkit-slider-thumb {
-webkit-appearance: none; -webkit-appearance: none;
margin-top: -(($volume-thumb-height - $volume-track-height) / 2); margin-top: -(($plyr-volume-thumb-height - $plyr-volume-track-height) / 2);
@include volume-thumb(); @include volume-thumb();
} }
@ -518,13 +575,13 @@ $bp-captions-large: 768px !default; // When captions jump to the larger
&::-moz-range-thumb { &::-moz-range-thumb {
@include volume-thumb(); @include volume-thumb();
} }
// Microsoft // Microsoft
&::-ms-track { &::-ms-track {
height: $volume-track-height; height: $plyr-volume-track-height;
background: transparent; background: transparent;
border-color: transparent; border-color: transparent;
border-width: (($volume-thumb-height - $volume-track-height) / 2) 0; border-width: (($plyr-volume-thumb-height - $plyr-volume-track-height) / 2) 0;
color: transparent; color: transparent;
} }
&::-ms-fill-lower, &::-ms-fill-lower,
@ -539,13 +596,13 @@ $bp-captions-large: 768px !default; // When captions jump to the larger
outline: 0; outline: 0;
&::-webkit-slider-thumb { &::-webkit-slider-thumb {
background: $volume-thumb-bg-focus; background: $plyr-volume-thumb-bg-focus;
} }
&::-moz-range-thumb { &::-moz-range-thumb {
background: $volume-thumb-bg-focus; background: $plyr-volume-thumb-bg-focus;
} }
&::-ms-thumb { &::-ms-thumb {
background: $volume-thumb-bg-focus; background: $plyr-volume-thumb-bg-focus;
} }
} }
} }
@ -553,30 +610,30 @@ $bp-captions-large: 768px !default; // When captions jump to the larger
// Hide sound controls on iOS // Hide sound controls on iOS
// It's not supported to change volume using JavaScript: // 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 // https://developer.apple.com/library/safari/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/Device-SpecificConsiderations/Device-SpecificConsiderations.html
&.ios &-volume, &--is-ios &__volume,
&.ios [data-player='mute'], &--is-ios [data-plyr='mute'],
&-audio.ios &-controls-right { &--is-ios.plyr--audio &__controls--right {
display: none; display: none;
} }
// Center buttons so it looks less odd // Center buttons so it looks less odd
&-audio.ios &-controls-left { &--is-ios.plyr--audio &__controls--left {
float: none; float: none;
} }
// Audio specific styles // Audio specific styles
// Position the progress within the container // Position the progress within the container
&-audio .player-controls { &--audio .plyr__controls {
padding-top: ($control-spacing * 2); padding-top: ($plyr-control-spacing * 2);
} }
&-audio .player-progress { &--audio .plyr__progress {
bottom: auto; bottom: auto;
top: 0; top: 0;
background: $off-white; background: $plyr-off-white;
} }
// Full screen mode // Full screen mode
&-fullscreen, &--fullscreen,
&.fullscreen-active { &--fullscreen-active {
position: fixed; position: fixed;
top: 0; top: 0;
left: 0; left: 0;
@ -590,48 +647,50 @@ $bp-captions-large: 768px !default; // When captions jump to the larger
video { video {
height: 100%; height: 100%;
} }
.player-video-wrapper { .plyr__video-wrapper {
height: 100%; height: 100%;
width: 100%; width: 100%;
} }
.player-controls { .plyr__controls {
position: absolute; position: absolute;
bottom: 0; bottom: 0;
left: 0; left: 0;
right: 0; right: 0;
} }
}
// Hide controls when playing in full screen // Hide controls when playing in full screen
&.fullscreen-hide-controls.playing { &--fullscreen-active.plyr--fullscreen--hide-controls.plyr--playing,
.player-controls { &.plyr--fullscreen.plyr--fullscreen--hide-controls.plyr--playing {
transform: translateY(100%) translateY($control-spacing / 2); .plyr__controls {
transition: transform .3s .2s ease; transform: translateY(100%) translateY($plyr-control-spacing / 2);
} transition: transform .3s .2s ease;
&.player-hover .player-controls {
transform: translateY(0);
}
.player-captions {
bottom: ($control-spacing / 2);
transition: bottom .3s .2s ease;
}
} }
.plyr__captions {
bottom: ($plyr-control-spacing / 2);
transition: bottom .3s .2s ease;
}
&.plyr--hover .plyr__controls {
transform: translateY(0);
}
}
// Captions // Captions
.player-captions, &.plyr--fullscreen .plyr__captions,
&.fullscreen-hide-controls.playing.player-hover .player-captions { &--fullscreen-active .plyr__captions,
top: auto; &--fullscreen--hide-controls.plyr--fullscreen-active.plyr--playing.plyr--hover .plyr__captions {
bottom: 90px; top: auto;
bottom: 90px;
@media (min-width: $bp-control-split) { @media (min-width: $plyr-bp-control-split) {
bottom: 60px; bottom: 60px;
}
} }
} }
// Change icons on state change // Change icons on state change
&.fullscreen-active .icon-exit-fullscreen, &--fullscreen-active .icon--exit-fullscreen,
&.muted .player-controls .icon-muted, &--muted .plyr__controls .icon--muted,
&.captions-active .player-controls .icon-captions-on { &--captions-active .plyr__controls .icon--captions-on {
display: block; display: block;
& + svg { & + svg {
@ -640,12 +699,12 @@ $bp-captions-large: 768px !default; // When captions jump to the larger
} }
// Some options are hidden by default // Some options are hidden by default
[data-player='captions'], [data-plyr='captions'],
[data-player='fullscreen'] { [data-plyr='fullscreen'] {
display: none; display: none;
} }
&.captions-enabled [data-player='captions'], &--captions-enabled [data-plyr='captions'],
&.fullscreen-enabled [data-player='fullscreen'] { &--fullscreen-enabled [data-plyr='fullscreen'] {
display: inline-block; display: inline-block;
} }
} }