diff --git a/bower.json b/bower.json index 537b614b..eaaf3a85 100644 --- a/bower.json +++ b/bower.json @@ -17,7 +17,7 @@ "dist/plyr.js", "dist/sprite.svg", "src/less/plyr.less", - "src/sass/plyr.scss", + "src/scss/plyr.scss", "src/js/plyr.js" ], "ignore": [ diff --git a/bundles.json b/bundles.json index c123e5b0..a2d35eae 100644 --- a/bundles.json +++ b/bundles.json @@ -3,8 +3,8 @@ "less": { "plyr.css": ["src/less/plyr.less"] }, - "sass": { - "plyr.css": ["src/sass/plyr.sass"] + "scss": { + "plyr.css": ["src/scss/plyr.scss"] }, "js": { "plyr.js": ["src/js/plyr.js"] diff --git a/changelog.md b/changelog.md index c3c6c931..cd6337e5 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,19 @@ # Changelog +## v1.6.0 +- New, cleaner, UI: + - Controls are now overlaid, maintaining the video's ratio and making sizing easier + - A large play button can now be overlaid over videos + - Default number of control buttons reduced + - New play, pause, rewind and fast forward icons + - Flexbox all the things! +- Tidied up the LESS (and SCSS) as part of the above, variables and mixins in seprate files amking customization and upgrades easier +- Toggle mute bug fix; if a player was muted previously and the user refreshed, unmuting would have meant volume was still zero (effectively muted), now the config default value is used. Not ideal but good for now +- New `iconUrl` option allowing specifying a same origin SVG sprite location. Loading this way means you don't need the AJAX sprite loading JavaScript +- `click` option renamed to `clickToPlay` to make it a bit more self explanatory. Unfortunately cross origin SVG sprites is not supported in any browser yet :-( +- `hideControls` is now a global option, rather than being exclusive to fullscreen. Controls are now hidden after 2 seconds of no mouse movement. Controls are always shown when media is paused or stopped. This is defaulted to true. +- `sass` folder in `src` renamed from to `scss` + ## v1.5.21 - Bug fix for embeds: `play` not being defined (fixes #185 and #186) diff --git a/controls.md b/controls.md index dc95cdb9..a74bdcf8 100644 --- a/controls.md +++ b/controls.md @@ -46,65 +46,64 @@ This is an example `html` option with all controls. ```javascript var controls = ["
", - "
", + "", + "", + "", + "", + "", + "", "", "", - "", + "", "", "0% buffered", "", "00:00", - "
", - "", - "", - "", - "", - "", - "", - "", - "Current time", - "00:00", - "", - "", - "Duration", - "00:00", - "", "", - "", - "", + "", + "Current time", + "00:00", + "", + "", + "Duration", + "00:00", + "", + "", + "", "", - "", - "", - "", + "", + "", "", -"
"].join("\n"); + "", + "", +""].join(""); // Setup the player plyr.setup('.js-player', { diff --git a/dist/plyr.css b/dist/plyr.css index 1ec9061f..bb5b712c 100644 --- a/dist/plyr.css +++ b/dist/plyr.css @@ -1 +1 @@ -.plyr--playing .plyr__play-large,.plyr__tooltip{visibility:hidden;opacity:0}.plyr .plyr__video-embed iframe,.plyr__tooltip{pointer-events:none}@-webkit-keyframes plyr-progress{to{background-position:25px 0}}@keyframes plyr-progress{to{background-position:25px 0}}.plyr{position:relative;max-width:100%;min-width:200px;font-family:Avenir,"Avenir Next","Helvetica Neue","Segoe UI",Helvetica,Arial,sans-serif}.plyr,.plyr *,.plyr ::after,.plyr ::before{box-sizing:border-box}.plyr a,.plyr button,.plyr input,.plyr label{-ms-touch-action:manipulation;touch-action:manipulation}.plyr audio,.plyr video{width:100%;height:auto;vertical-align:middle;border-radius:inherit}.plyr input[type=range]{display:block;height:20px;width:100%;margin:0;padding:0;vertical-align:middle;-webkit-appearance:none;-moz-appearance:none;appearance:none;cursor:pointer;border:none;background:0 0}.plyr input[type=range]::-webkit-slider-runnable-track{height:8px;background:0 0;border:0;border-radius:4px;-webkit-user-select:none;user-select:none}.plyr input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;margin-top:-4px;position:relative;height:16px;width:16px;background:#fff;border:2px solid transparent;border-radius:100%;transition:background .2s ease,border .2s ease,-webkit-transform .2s ease;transition:background .2s ease,border .2s ease,transform .2s ease;transition:background .2s ease,border .2s ease,transform .2s ease,-webkit-transform .2s ease;box-shadow:0 1px 1px rgba(0,0,0,.15),0 0 0 1px rgba(0,0,0,.15);box-sizing:border-box}.plyr input[type=range]::-moz-range-track{height:8px;background:0 0;border:0;border-radius:4px;-moz-user-select:none;user-select:none}.plyr input[type=range]::-moz-range-thumb{position:relative;height:16px;width:16px;background:#fff;border:2px solid transparent;border-radius:100%;transition:background .2s ease,border .2s ease,-webkit-transform .2s ease;transition:background .2s ease,border .2s ease,transform .2s ease;transition:background .2s ease,border .2s ease,transform .2s ease,-webkit-transform .2s ease;box-shadow:0 1px 1px rgba(0,0,0,.15),0 0 0 1px rgba(0,0,0,.15);box-sizing:border-box}.plyr input[type=range]::-ms-track{height:8px;background:0 0;border:0;color:transparent}.plyr input[type=range]::-ms-fill-upper{height:8px;background:0 0;border:0;border-radius:4px;-ms-user-select:none;user-select:none}.plyr input[type=range]::-ms-fill-lower{height:8px;border:0;border-radius:4px;-ms-user-select:none;user-select:none;background:#3498db}.plyr input[type=range]::-ms-thumb{position:relative;height:16px;width:16px;background:#fff;border:2px solid transparent;border-radius:100%;transition:background .2s ease,border .2s ease,-webkit-transform .2s ease;transition:background .2s ease,border .2s ease,transform .2s ease;transition:background .2s ease,border .2s ease,transform .2s ease,-webkit-transform .2s ease;box-shadow:0 1px 1px rgba(0,0,0,.15),0 0 0 1px rgba(0,0,0,.15);box-sizing:border-box;margin-top:0}.plyr input[type=range]::-ms-tooltip{display:none}.plyr input[type=range]:focus{outline:0}.plyr input[type=range]::-moz-focus-outer{border:0}.plyr input[type=range].tab-focus:focus{outline-offset:3px}.plyr input[type=range]:active::-webkit-slider-thumb{background:#3498db;border-color:#fff;-webkit-transform:scale(1.25);transform:scale(1.25)}.plyr input[type=range]:active::-moz-range-thumb{background:#3498db;border-color:#fff;transform:scale(1.25)}.plyr input[type=range]:active::-ms-thumb{background:#3498db;border-color:#fff;transform:scale(1.25)}.plyr--video input[type=range].tab-focus:focus{outline:rgba(255,255,255,.5) dotted 1px}.plyr--audio input[type=range].tab-focus:focus{outline:rgba(86,93,100,.5) dotted 1px}.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__video-wrapper{position:relative;background:#000;border-radius:inherit;-webkit-mask-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAA5JREFUeNpiYGBgAAgwAAAEAAGbA+oJAAAAAElFTkSuQmCC)}.plyr__video-embed{padding-bottom:56.25%;height:0;overflow:hidden;border-radius:inherit}.plyr__video-embed iframe{position:absolute;top:0;left:0;width:100%;height:100%;border:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.plyr__video-embed>div{position:relative;padding-bottom:200%;-webkit-transform:translateY(-35.95%);transform:translateY(-35.95%)}.plyr video::-webkit-media-text-track-container{display:none}.plyr__captions{display:none;position:absolute;bottom:0;left:0;width:100%;padding:20px 20px 80px;color:#fff;font-size:20px;text-align:center;font-weight:400;-webkit-font-smoothing:subpixel-antialiased}.plyr__captions span{border-radius:2px;padding:3px 10px;background:rgba(0,0,0,.85)}.plyr__captions span:empty{display:none}@media (min-width:768px){.plyr__captions{font-size:24px}}.plyr--captions-active .plyr__captions{display:block}.plyr--fullscreen-active .plyr__captions{font-size:32px}.plyr__time,.plyr__tooltip{font-size:14px;-webkit-font-smoothing:subpixel-antialiased}.plyr__controls{display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-ms-flex-align:center;align-items:center;line-height:1;text-align:center;transition:opacity .3s ease}.plyr__controls .plyr__progress,.plyr__controls .plyr__time,.plyr__controls>button{margin-left:5px}.plyr__controls .plyr__progress:first-child,.plyr__controls .plyr__time:first-child,.plyr__controls>button:first-child{margin-left:0}.plyr__controls .plyr__volume{margin-left:5px}.plyr__controls [data-plyr=pause]{margin-left:0}.plyr__controls button{position:relative;display:inline-block;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;vertical-align:middle;padding:5px;border:0;background:0 0;border-radius:3px;cursor:pointer;transition:background .3s ease,color .3s ease,opacity .3s ease;color:inherit}.plyr__controls button svg{width:18px;height:18px;display:block;fill:currentColor}.plyr__controls button:focus{outline:0}.plyr__controls .icon--captions-on,.plyr__controls .icon--exit-fullscreen,.plyr__controls .icon--muted{display:none}@media (min-width:480px){.plyr__controls .plyr__progress,.plyr__controls .plyr__time,.plyr__controls>button{margin-left:10px}.plyr__controls button{padding:5px 10px}}.plyr--hide-controls .plyr__controls{opacity:0}.plyr--video .plyr__controls{position:absolute;left:0;right:0;bottom:0;padding:50px 10px 10px;background:linear-gradient(rgba(0,0,0,0),rgba(0,0,0,.5));border-bottom-left-radius:inherit;border-bottom-right-radius:inherit;color:#fff}.plyr--video .plyr__controls button.tab-focus:focus,.plyr--video .plyr__controls button:hover{background:#3498db;color:#fff}@media (min-width:480px){.plyr--video .plyr__controls{padding-left:15px;padding-right:15px}}.plyr--audio .plyr__controls{padding:10px;border-radius:inherit;background:#fff;border:1px solid #dbe3e8;box-shadow:0 1px 1px rgba(0,0,0,.05);color:#565D64}.plyr--audio .plyr__controls button.tab-focus:focus,.plyr--audio .plyr__controls button:hover,.plyr__play-large{background:#3498db;color:#fff}.plyr__play-large{position:absolute;top:50%;left:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);padding:10px;border:4px solid currentColor;border-radius:100%;box-shadow:0 1px 1px rgba(0,0,0,.15);transition:opacity .3s ease,visibility .3s ease}.plyr__play-large svg{position:relative;left:2px;width:20px;height:20px;display:block;fill:currentColor}.plyr--audio .plyr__play-large,.plyr--playing .plyr__controls [data-plyr=play],.plyr__controls [data-plyr=pause]{display:none}.plyr__play-large:focus{outline:rgba(255,255,255,.5) dotted 1px}.plyr--playing .plyr__controls [data-plyr=pause]{display:inline-block}.plyr--captions-active .plyr__controls .icon--captions-on,.plyr--fullscreen-active .icon--exit-fullscreen,.plyr--muted .plyr__controls .icon--muted{display:block}.plyr [data-plyr=captions],.plyr [data-plyr=fullscreen],.plyr--captions-active .plyr__controls .icon--captions-on+svg,.plyr--fullscreen-active .icon--exit-fullscreen+svg,.plyr--muted .plyr__controls .icon--muted+svg{display:none}.plyr--captions-enabled [data-plyr=captions],.plyr--fullscreen-enabled [data-plyr=fullscreen]{display:inline-block}.plyr__tooltip{position:absolute;z-index:2;bottom:100%;margin-bottom:10px;padding:5px 7.5px;background:#000;box-shadow:0 0 5px rgba(0,0,0,.1),0 0 0 1px rgba(0,0,0,.1);border-radius:3px;color:#fff;line-height:1.3;-webkit-transform:translate(-50%,10px) scale(.8);transform:translate(-50%,10px) scale(.8);-webkit-transform-origin:50% 100%;transform-origin:50% 100%;transition:opacity .2s .1s ease,visibility .3s ease,-webkit-transform .2s .1s ease;transition:transform .2s .1s ease,opacity .2s .1s ease,visibility .3s ease;transition:transform .2s .1s ease,opacity .2s .1s ease,visibility .3s ease,-webkit-transform .2s .1s ease}.plyr__tooltip::before{content:'';position:absolute;width:0;height:0;left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%);bottom:-4px;border-right:4px solid transparent;border-top:4px solid #000;border-left:4px solid transparent;z-index:2}.plyr button.tab-focus:focus .plyr__tooltip,.plyr button:hover .plyr__tooltip,.plyr__tooltip--visible{visibility:visible;opacity:1;-webkit-transform:translate(-50%,0) scale(1);transform:translate(-50%,0) scale(1)}.plyr button:hover .plyr__tooltip{z-index:3}.plyr__progress{position:relative;-webkit-flex:1;-ms-flex:1;flex:1}.plyr__progress input[type=range]{position:relative;z-index:2}.plyr__progress input[type=range]::-webkit-slider-runnable-track{background:0 0}.plyr__progress input[type=range]::-moz-range-track{background:0 0}.plyr__progress input[type=range]::-ms-fill-upper{background:0 0}.plyr__progress .plyr__tooltip{left:0}.plyr__progress--buffer[value],.plyr__progress--played[value],.plyr__volume--display[value]{position:absolute;left:0;top:50%;width:100%;height:8px;margin:-4px 0 0;padding:0;vertical-align:top;-webkit-appearance:none;-moz-appearance:none;appearance:none;border:none;border-radius:100px}.plyr__progress--buffer[value]::-webkit-progress-bar,.plyr__progress--played[value]::-webkit-progress-bar,.plyr__volume--display[value]::-webkit-progress-bar{background:0 0}.plyr__progress--buffer[value]::-webkit-progress-value,.plyr__progress--played[value]::-webkit-progress-value,.plyr__volume--display[value]::-webkit-progress-value{background:currentColor;border-radius:100px;min-width:8px}.plyr__progress--buffer[value]::-moz-progress-bar,.plyr__progress--played[value]::-moz-progress-bar,.plyr__volume--display[value]::-moz-progress-bar{background:currentColor;border-radius:100px;min-width:8px}.plyr__progress--buffer[value]::-ms-fill,.plyr__progress--played[value]::-ms-fill,.plyr__volume--display[value]::-ms-fill{border-radius:100px}.plyr__progress--played[value],.plyr__volume--display[value]{z-index:1;color:#3498db;background:0 0;transition:none}.plyr__progress--played[value]::-webkit-progress-value,.plyr__volume--display[value]::-webkit-progress-value{min-width:8px;max-width:99%;border-top-right-radius:0;border-bottom-right-radius:0}.plyr__progress--played[value]::-moz-progress-bar,.plyr__volume--display[value]::-moz-progress-bar{min-width:8px;max-width:99%;border-top-right-radius:0;border-bottom-right-radius:0}.plyr__progress--played[value]::-ms-fill,.plyr__volume--display[value]::-ms-fill{display:none}.plyr__progress--buffer[value]::-webkit-progress-value{transition:width .2s ease}.plyr__progress--buffer[value]::-moz-progress-bar{transition:width .2s ease}.plyr__progress--buffer[value]::-ms-fill{transition:width .2s ease}.plyr--video .plyr__progress--buffer[value],.plyr--video .plyr__volume--display[value]{background:rgba(255,255,255,.25)}.plyr--video .plyr__progress--buffer[value]{color:rgba(255,255,255,.25)}.plyr--audio .plyr__progress--buffer[value],.plyr--audio .plyr__volume--display[value]{background:rgba(198,214,219,.66)}.plyr--audio .plyr__progress--buffer[value]{color:rgba(198,214,219,.66)}.plyr--loading .plyr__progress--buffer{-webkit-animation:plyr-progress 1s linear infinite;animation:plyr-progress 1s linear infinite;background-size:25px 25px;background-repeat:repeat-x;background-image:linear-gradient(-45deg,rgba(0,0,0,.15) 25%,transparent 25%,transparent 50%,rgba(0,0,0,.15) 50%,rgba(0,0,0,.15) 75%,transparent 75%,transparent);color:transparent}.plyr--video.plyr--loading .plyr__progress--buffer{background-color:rgba(255,255,255,.25)}.plyr--audio.plyr--loading .plyr__progress--buffer{background-color:rgba(198,214,219,.66)}.plyr__time{display:inline-block;vertical-align:middle;line-height:.95}.plyr .plyr__volume{display:none;position:relative}.plyr .plyr__volume input[type=range]{position:relative;z-index:2}@media (min-width:480px){.plyr .plyr__volume{display:block;max-width:60px}}@media (min-width:768px){.plyr .plyr__volume{max-width:100px}}.plyr--is-ios .plyr__volume,.plyr--is-ios [data-plyr=mute]{display:none!important}.plyr--fullscreen,.plyr--fullscreen-active{position:fixed;top:0;left:0;right:0;bottom:0;height:100%;width:100%;z-index:10000000;background:#000;border-radius:0}.plyr--fullscreen video,.plyr--fullscreen-active video{height:100%}.plyr--fullscreen .plyr__video-wrapper,.plyr--fullscreen-active .plyr__video-wrapper{height:100%;width:100%}.plyr--fullscreen .plyr__controls,.plyr--fullscreen-active .plyr__controls{position:absolute;bottom:0;left:0;right:0} \ No newline at end of file +.plyr--playing .plyr__play-large,.plyr__tooltip{visibility:hidden;opacity:0}.plyr .plyr__video-embed iframe,.plyr__tooltip{pointer-events:none}@-webkit-keyframes plyr-progress{to{background-position:25px 0}}@keyframes plyr-progress{to{background-position:25px 0}}.plyr{position:relative;max-width:100%;min-width:200px;font-family:Avenir,"Avenir Next","Helvetica Neue","Segoe UI",Helvetica,Arial,sans-serif}.plyr,.plyr *,.plyr ::after,.plyr ::before{box-sizing:border-box}.plyr a,.plyr button,.plyr input,.plyr label{-ms-touch-action:manipulation;touch-action:manipulation}.plyr audio,.plyr video{width:100%;height:auto;vertical-align:middle;border-radius:inherit}.plyr input[type=range]{display:block;height:20px;width:100%;margin:0;padding:0;vertical-align:middle;-webkit-appearance:none;-moz-appearance:none;appearance:none;cursor:pointer;border:none;background:0 0}.plyr input[type=range]::-webkit-slider-runnable-track{height:8px;background:0 0;border:0;border-radius:4px;-webkit-user-select:none;user-select:none}.plyr input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;margin-top:-4px;position:relative;height:16px;width:16px;background:#fff;border:2px solid transparent;border-radius:100%;transition:background .2s ease,border .2s ease,-webkit-transform .2s ease;transition:background .2s ease,border .2s ease,transform .2s ease;transition:background .2s ease,border .2s ease,transform .2s ease,-webkit-transform .2s ease;box-shadow:0 1px 1px rgba(0,0,0,.15),0 0 0 1px rgba(0,0,0,.15);box-sizing:border-box}.plyr input[type=range]::-moz-range-track{height:8px;background:0 0;border:0;border-radius:4px;-moz-user-select:none;user-select:none}.plyr input[type=range]::-moz-range-thumb{position:relative;height:16px;width:16px;background:#fff;border:2px solid transparent;border-radius:100%;transition:background .2s ease,border .2s ease,-webkit-transform .2s ease;transition:background .2s ease,border .2s ease,transform .2s ease;transition:background .2s ease,border .2s ease,transform .2s ease,-webkit-transform .2s ease;box-shadow:0 1px 1px rgba(0,0,0,.15),0 0 0 1px rgba(0,0,0,.15);box-sizing:border-box}.plyr input[type=range]::-ms-track{height:8px;background:0 0;border:0;color:transparent}.plyr input[type=range]::-ms-fill-upper{height:8px;background:0 0;border:0;border-radius:4px;-ms-user-select:none;user-select:none}.plyr input[type=range]::-ms-fill-lower{height:8px;border:0;border-radius:4px;-ms-user-select:none;user-select:none;background:#3498db}.plyr input[type=range]::-ms-thumb{position:relative;height:16px;width:16px;background:#fff;border:2px solid transparent;border-radius:100%;transition:background .2s ease,border .2s ease,-webkit-transform .2s ease;transition:background .2s ease,border .2s ease,transform .2s ease;transition:background .2s ease,border .2s ease,transform .2s ease,-webkit-transform .2s ease;box-shadow:0 1px 1px rgba(0,0,0,.15),0 0 0 1px rgba(0,0,0,.15);box-sizing:border-box;margin-top:0}.plyr input[type=range]::-ms-tooltip{display:none}.plyr input[type=range]:focus{outline:0}.plyr input[type=range]::-moz-focus-outer{border:0}.plyr input[type=range].tab-focus:focus{outline-offset:3px}.plyr input[type=range]:active::-webkit-slider-thumb{background:#3498db;border-color:#fff;-webkit-transform:scale(1.25);transform:scale(1.25)}.plyr input[type=range]:active::-moz-range-thumb{background:#3498db;border-color:#fff;transform:scale(1.25)}.plyr input[type=range]:active::-ms-thumb{background:#3498db;border-color:#fff;transform:scale(1.25)}.plyr--video input[type=range].tab-focus:focus{outline:rgba(255,255,255,.5) dotted 1px}.plyr--audio input[type=range].tab-focus:focus{outline:rgba(86,93,100,.5) dotted 1px}.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__video-wrapper{position:relative;background:#000;border-radius:inherit;-webkit-mask-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAA5JREFUeNpiYGBgAAgwAAAEAAGbA+oJAAAAAElFTkSuQmCC)}.plyr__video-embed{padding-bottom:56.25%;height:0;overflow:hidden;border-radius:inherit}.plyr__video-embed iframe{position:absolute;top:0;left:0;width:100%;height:100%;border:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.plyr__video-embed>div{position:relative;padding-bottom:200%;-webkit-transform:translateY(-35.95%);transform:translateY(-35.95%)}.plyr video::-webkit-media-text-track-container{display:none}.plyr__captions{display:none;position:absolute;bottom:0;left:0;width:100%;padding:20px 20px 80px;color:#fff;font-size:20px;text-align:center;font-weight:400;-webkit-font-smoothing:subpixel-antialiased}.plyr__captions span{border-radius:2px;padding:3px 10px;background:rgba(0,0,0,.85)}.plyr__captions span:empty{display:none}@media (min-width:768px){.plyr__captions{font-size:24px}}.plyr--captions-active .plyr__captions{display:block}.plyr--fullscreen-active .plyr__captions{font-size:32px}.plyr__time,.plyr__tooltip{font-size:14px;-webkit-font-smoothing:subpixel-antialiased}.plyr__controls{display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-ms-flex-align:center;align-items:center;line-height:1;text-align:center;transition:opacity .3s ease}.plyr__controls .plyr__progress,.plyr__controls .plyr__time,.plyr__controls>button{margin-left:5px}.plyr__controls .plyr__progress:first-child,.plyr__controls .plyr__time:first-child,.plyr__controls>button:first-child{margin-left:0}.plyr__controls .plyr__volume{margin-left:5px}.plyr__controls [data-plyr=pause]{margin-left:0}.plyr__controls button{position:relative;display:inline-block;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;vertical-align:middle;padding:5px;border:0;background:0 0;border-radius:3px;cursor:pointer;transition:background .3s ease,color .3s ease,opacity .3s ease;color:inherit}.plyr__controls button svg{width:18px;height:18px;display:block;fill:currentColor}.plyr__controls button:focus{outline:0}.plyr__controls .icon--captions-on,.plyr__controls .icon--exit-fullscreen,.plyr__controls .icon--muted{display:none}@media (min-width:480px){.plyr__controls .plyr__progress,.plyr__controls .plyr__time,.plyr__controls>button{margin-left:10px}.plyr__controls button{padding:5px 10px}}.plyr--hide-controls .plyr__controls{opacity:0}.plyr--video .plyr__controls{position:absolute;left:0;right:0;bottom:0;padding:50px 10px 10px;background:linear-gradient(rgba(0,0,0,0),rgba(0,0,0,.5));border-bottom-left-radius:inherit;border-bottom-right-radius:inherit;color:#fff}.plyr--video .plyr__controls button.tab-focus:focus,.plyr--video .plyr__controls button:hover{background:#3498db;color:#fff}@media (min-width:480px){.plyr--video .plyr__controls{padding-left:15px;padding-right:15px}}.plyr--audio .plyr__controls{padding:10px;border-radius:inherit;background:#fff;border:1px solid #dbe3e8;box-shadow:0 1px 1px rgba(0,0,0,.05);color:#565D64}.plyr--audio .plyr__controls button.tab-focus:focus,.plyr--audio .plyr__controls button:hover,.plyr__play-large{background:#3498db;color:#fff}.plyr__play-large{position:absolute;top:50%;left:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);padding:10px;border:4px solid currentColor;border-radius:100%;box-shadow:0 1px 1px rgba(0,0,0,.15);transition:opacity .3s ease,visibility .3s ease}.plyr__play-large svg{position:relative;left:2px;width:20px;height:20px;display:block;fill:currentColor}.plyr--audio .plyr__play-large,.plyr--playing .plyr__controls [data-plyr=play],.plyr__controls [data-plyr=pause]{display:none}.plyr__play-large:focus{outline:rgba(255,255,255,.5) dotted 1px}.plyr--playing .plyr__controls [data-plyr=pause]{display:inline-block}.plyr--captions-active .plyr__controls .icon--captions-on,.plyr--fullscreen-active .icon--exit-fullscreen,.plyr--muted .plyr__controls .icon--muted{display:block}.plyr [data-plyr=captions],.plyr [data-plyr=fullscreen],.plyr--captions-active .plyr__controls .icon--captions-on+svg,.plyr--fullscreen-active .icon--exit-fullscreen+svg,.plyr--muted .plyr__controls .icon--muted+svg{display:none}.plyr--captions-enabled [data-plyr=captions],.plyr--fullscreen-enabled [data-plyr=fullscreen]{display:inline-block}.plyr__tooltip{position:absolute;z-index:2;bottom:100%;margin-bottom:10px;padding:5px 7.5px;background:#000;box-shadow:0 0 5px rgba(0,0,0,.1),0 0 0 1px rgba(0,0,0,.1);border-radius:3px;color:#fff;line-height:1.3;-webkit-transform:translate(-50%,10px) scale(.8);transform:translate(-50%,10px) scale(.8);-webkit-transform-origin:50% 100%;transform-origin:50% 100%;transition:opacity .2s .1s ease,visibility .3s ease,-webkit-transform .2s .1s ease;transition:transform .2s .1s ease,opacity .2s .1s ease,visibility .3s ease;transition:transform .2s .1s ease,opacity .2s .1s ease,visibility .3s ease,-webkit-transform .2s .1s ease}.plyr__tooltip::before{content:'';position:absolute;width:0;height:0;left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%);bottom:-4px;border-right:4px solid transparent;border-top:4px solid #000;border-left:4px solid transparent;z-index:2}.plyr button.tab-focus:focus .plyr__tooltip,.plyr button:hover .plyr__tooltip,.plyr__tooltip--visible{visibility:visible;opacity:1;-webkit-transform:translate(-50%,0) scale(1);transform:translate(-50%,0) scale(1)}.plyr button:hover .plyr__tooltip{z-index:3}.plyr__progress{position:relative;-webkit-flex:1;-ms-flex:1;flex:1}.plyr__progress input[type=range]{position:relative;z-index:2}.plyr__progress input[type=range]::-webkit-slider-runnable-track{background:0 0}.plyr__progress input[type=range]::-moz-range-track{background:0 0}.plyr__progress input[type=range]::-ms-fill-upper{background:0 0}.plyr__progress .plyr__tooltip{left:0}.plyr__progress--buffer[value],.plyr__progress--played[value],.plyr__volume--display[value]{position:absolute;left:0;top:50%;width:100%;height:8px;margin:-4px 0 0;padding:0;vertical-align:top;-webkit-appearance:none;-moz-appearance:none;appearance:none;border:none;border-radius:100px}.plyr__progress--buffer[value]::-webkit-progress-bar,.plyr__progress--played[value]::-webkit-progress-bar,.plyr__volume--display[value]::-webkit-progress-bar{background:0 0}.plyr__progress--buffer[value]::-webkit-progress-value,.plyr__progress--played[value]::-webkit-progress-value,.plyr__volume--display[value]::-webkit-progress-value{background:currentColor;border-radius:100px;min-width:8px}.plyr__progress--buffer[value]::-moz-progress-bar,.plyr__progress--played[value]::-moz-progress-bar,.plyr__volume--display[value]::-moz-progress-bar{background:currentColor;border-radius:100px;min-width:8px}.plyr__progress--buffer[value]::-ms-fill,.plyr__progress--played[value]::-ms-fill,.plyr__volume--display[value]::-ms-fill{border-radius:100px}.plyr__progress--played[value],.plyr__volume--display[value]{z-index:1;color:#3498db;background:0 0;transition:none}.plyr__progress--played[value]::-webkit-progress-value,.plyr__volume--display[value]::-webkit-progress-value{min-width:8px;max-width:99%;border-top-right-radius:0;border-bottom-right-radius:0}.plyr__progress--played[value]::-moz-progress-bar,.plyr__volume--display[value]::-moz-progress-bar{min-width:8px;max-width:99%;border-top-right-radius:0;border-bottom-right-radius:0}.plyr__progress--played[value]::-ms-fill,.plyr__volume--display[value]::-ms-fill{display:none}.plyr__progress--buffer[value]::-webkit-progress-value{transition:width .2s ease}.plyr__progress--buffer[value]::-moz-progress-bar{transition:width .2s ease}.plyr__progress--buffer[value]::-ms-fill{transition:width .2s ease}.plyr--video .plyr__progress--buffer[value],.plyr--video .plyr__volume--display[value]{background:rgba(255,255,255,.25)}.plyr--video .plyr__progress--buffer[value]{color:rgba(255,255,255,.25)}.plyr--audio .plyr__progress--buffer[value],.plyr--audio .plyr__volume--display[value]{background:rgba(198,214,219,.66)}.plyr--audio .plyr__progress--buffer[value]{color:rgba(198,214,219,.66)}.plyr--loading .plyr__progress--buffer{-webkit-animation:plyr-progress 1s linear infinite;animation:plyr-progress 1s linear infinite;background-size:25px 25px;background-repeat:repeat-x;background-image:linear-gradient(-45deg,rgba(0,0,0,.15) 25%,transparent 25%,transparent 50%,rgba(0,0,0,.15) 50%,rgba(0,0,0,.15) 75%,transparent 75%,transparent);color:transparent}.plyr--video.plyr--loading .plyr__progress--buffer{background-color:rgba(255,255,255,.25)}.plyr--audio.plyr--loading .plyr__progress--buffer{background-color:rgba(198,214,219,.66)}.plyr__time{display:inline-block;vertical-align:middle;line-height:.95}.plyr__time+.plyr__time{display:none}@media (min-width:768px){.plyr__time+.plyr__time{display:inline-block}}.plyr__time+.plyr__time::before{content:'\2044';margin-right:10px}.plyr .plyr__volume{display:none;position:relative}.plyr .plyr__volume input[type=range]{position:relative;z-index:2}@media (min-width:480px){.plyr .plyr__volume{display:block;max-width:60px}}@media (min-width:768px){.plyr .plyr__volume{max-width:100px}}.plyr--is-ios .plyr__volume,.plyr--is-ios [data-plyr=mute]{display:none!important}.plyr--fullscreen,.plyr--fullscreen-active{position:fixed;top:0;left:0;right:0;bottom:0;height:100%;width:100%;z-index:10000000;background:#000;border-radius:0}.plyr--fullscreen video,.plyr--fullscreen-active video{height:100%}.plyr--fullscreen .plyr__video-wrapper,.plyr--fullscreen-active .plyr__video-wrapper{height:100%;width:100%}.plyr--fullscreen .plyr__controls,.plyr--fullscreen-active .plyr__controls{position:absolute;bottom:0;left:0;right:0} \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index a73ed738..238ab798 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -30,7 +30,7 @@ paths = { // Source paths src: { less: path.join(root, "src/less/**/*"), - sass: path.join(root, "src/sass/**/*"), + scss: path.join(root, "src/scss/**/*"), js: path.join(root, "src/js/**/*"), sprite: path.join(root, "src/sprite/*.svg") }, @@ -55,7 +55,7 @@ paths = { // Task arrays tasks = { less: [], - sass: [], + scss: [], js: [], sprite: [] }, @@ -110,15 +110,15 @@ var build = { })(key); } }, - sass: function(files, bundle) { + scss: function(files, bundle) { for (var key in files) { (function (key) { - var name = "sass-" + key; - tasks.sass.push(name); + var name = "scss-" + key; + tasks.scss.push(name); gulp.task(name, function () { return gulp - .src(bundles[bundle].sass[key]) + .src(bundles[bundle].scss[key]) .pipe(sass()) .on("error", gutil.log) .pipe(concat(key)) @@ -152,7 +152,7 @@ var build = { // Plyr core files build.js(bundles.plyr.js, "plyr"); build.less(bundles.plyr.less, "plyr"); -build.sass(bundles.plyr.sass, "plyr"); +build.scss(bundles.plyr.scss, "plyr"); build.sprite("plyr"); // Docs files @@ -165,9 +165,9 @@ gulp.task("js", function(){ run(tasks.js); }); -// Build SASS (for testing, default is LESS) -gulp.task("sass", function(){ - run(tasks.sass); +// Build SCSS (for testing, default is LESS) +gulp.task("scss", function(){ + run(tasks.scss); }); // Watch for file changes diff --git a/package.json b/package.json index 84c63370..09fdfc2d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "plyr", - "version": "1.5.21", + "version": "1.6.0", "description": "A simple, accessible and customizable HTML5, YouTube and Vimeo media player", "homepage": "http://plyr.io", "main": "src/js/plyr.js", diff --git a/readme.md b/readme.md index 60191e30..1f7d250c 100644 --- a/readme.md +++ b/readme.md @@ -80,7 +80,7 @@ If you want to use our CDN, you can use the following: You can also access the `sprite.svg` file at `https://cdn.plyr.io/1.5.21/sprite.svg`. ### CSS & Styling -If you want to use the default css, add the `plyr.css` file from `/dist` into your head, or even better use `plyr.less` or `plyr.sass` file included in `/src` in your build to save a request. +If you want to use the default css, add the `plyr.css` file from `/dist` into your head, or even better use `plyr.less` or `plyr.scss` file included in `/src` in your build to save a request. ```html @@ -89,7 +89,18 @@ If you want to use the default css, add the `plyr.css` file from `/dist` into yo The default setup uses the BEM methodology with `plyr` as the block, e.g. `.plyr__controls`. You can change the class hooks in the options. Check out the source for more on this. ### SVG -The SVG sprite for the controls icons is loaded in by AJAX to help with performance. This is best added before the closing ``, before any other scripts. +The SVG sprite for the controls icons can be loaded two ways: +- By passing the path to the sprite as the `iconUrl` option; or +- Using AJAX, injecting the sprite into a hidden div. + +#### Using the `iconUrl` option +This method requires the SVG sprite to be hosted on the *same domain* as your page hosting the player. Currently no browser supports cross origin SVG sprites due to XSS issues. Fingers crossed this will come soon though. An example value for this option would be: +``` +/path/to/sprite.svg +``` + +#### Using AJAX +Using AJAX means you can load the sprite from a different origin. Avoiding the issues above. This is an example script to load an SVG sprite best added before the closing ``, before any other scripts. ```html ``` @@ -207,6 +218,9 @@ Passing just the options object: plyr.setup(options); ``` +#### RangeTouch +Some touch browsers (particularly Mobile Safari on iOS) seem to have issues with `` elements whereby touching the track to set the value doesn't work and sliding the thumb can be tricky. To combat this, I've created [RangeTouch](https://rangetouch.com) which I'd recommend including in your solution. It's a tiny script with a nice benefit for users on touch devices. + #### Options Options must be passed as an object to the `setup()` method as above or as JSON in `data-plyr` attribute on each of your target elements (e.g. data-plyr='{ title: "testing" }') - note the single quotes encapsulating the JSON. @@ -251,6 +265,12 @@ Options must be passed as an object to the `setup()` method as above or as JSON icon Specify the id prefix for the icons used in the default controls (e.g. "icon-play" would be "icon"). This is to prevent clashes if you're using your own SVG defs file but with the default controls. Most people can ignore this option. + + iconUrl + String + null + Specify a relative path to the SVG sprite, hosted on the *same domain* as the page the player is hosted on. Using this menthod means no requirement for the AJAX sprite loading script. See the SVG section for more info. + debug Boolean @@ -276,10 +296,16 @@ Options must be passed as an object to the `setup()` method as above or as JSON A number, between 1 and 10, representing the initial volume of the player. - click + clickToPlay Boolean true - Click (or tap) will toggle pause/play of a <video>. + Click (or tap) of the video container will toggle pause/play. + + + hideControls + Boolean + true + Hide video controls automatically after 2s of no mouse or focus movement, on control element blur (tab out), on playback start or entering fullscreen. As soon as the mouse is moved, a control element is focused or playback is paused, the controls reappear instantly. tooltips @@ -366,12 +392,6 @@ Options must be passed as an object to the `setup()` method as above or as JSON true Enable a full viewport view for older browsers. - - hideControls - Boolean - true - Hide the controls when fullscreen is active and the video is playing, after 1s. The controls reappear on hover of the progress bar (mouse), focusing a child control or pausing the video (by tap/click of video if `click` is `true`). - allowAudio Boolean diff --git a/src/less/plyr.less b/src/less/plyr.less index 3d203e98..7133816f 100644 --- a/src/less/plyr.less +++ b/src/less/plyr.less @@ -613,6 +613,20 @@ line-height: .95; -webkit-font-smoothing: subpixel-antialiased; } +// Media duration hidden on small screens +.plyr__time + .plyr__time { + display: none; + + @media (min-width: @plyr-bp-screen-md) { + display: inline-block; + } + + // Add a slash in before + &::before { + content: '\2044'; + margin-right: @plyr-control-spacing; + } +} // Volume // -------------------------------------------------------------- diff --git a/src/less/variables.less b/src/less/variables.less index 0b1c8541..ea5c6b8e 100644 --- a/src/less/variables.less +++ b/src/less/variables.less @@ -4,7 +4,7 @@ // ========================================================================== // Colors -@plyr-color-main: #3498db; //#02BD9B; +@plyr-color-main: #3498db; // Font sizes @plyr-font-size-small: 14px; diff --git a/src/sass/plyr.scss b/src/sass/plyr.scss deleted file mode 100644 index 8de9af6e..00000000 --- a/src/sass/plyr.scss +++ /dev/null @@ -1,719 +0,0 @@ -// ========================================================================== -// Plyr styles -// https://github.com/selz/plyr -// ========================================================================== - -// Variables -// ------------------------------- - -// Colors -$plyr-blue: #3498DB !default; -$plyr-gray-dark: #343F4A !default; -$plyr-gray: #565D64 !default; -$plyr-gray-light: #6B7D86 !default; -$plyr-gray-lighter: #CBD0D3 !default; -$plyr-off-white: #D6DADD !default; - -// Font sizes -$plyr-font-size-small: 14px !default; -$plyr-font-size-base: 16px !default; - -// Captions -$plyr-font-size-captions-base: ceil($plyr-font-size-base * 1.25) !default; -$plyr-font-size-captions-medium: ceil($plyr-font-size-base * 1.5) !default; -$plyr-font-size-captions-large: ($plyr-font-size-base * 2) !default; - -// Controls -$plyr-control-spacing: 10px !default; -$plyr-controls-bg: #fff !default; -$plyr-control-bg-hover: $plyr-blue !default; - -// Contrast -@if lightness($plyr-controls-bg) >= 65% { - $plyr-control-color: $plyr-gray-light !default; -} -@else { - $plyr-control-color: $plyr-gray-lighter !default; -} -@if lightness($plyr-control-bg-hover) >= 65% { - $plyr-control-color-hover: $plyr-gray !default; -} -@else { - $plyr-control-color-hover: #fff !default; -} - -// Tooltips -$plyr-tooltip-bg: $plyr-controls-bg !default; -$plyr-tooltip-border-color: transparentize(darken($plyr-controls-bg, 75%), .9) !default; -$plyr-tooltip-arrow-border-color: transparentize(darken($plyr-controls-bg, 75%), .8) !default; - -$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 !default; -$plyr-tooltip-padding: $plyr-control-spacing !default; -$plyr-tooltip-arrow-size: 6px !default; -$plyr-tooltip-radius: 3px !default; - -// Progress -$plyr-progress-bg: transparentize($plyr-gray, .8) !default; -$plyr-progress-playing-bg: $plyr-blue !default; -$plyr-progress-buffered-bg: transparentize($plyr-gray, .75) !default; -$plyr-progress-loading-size: 40px !default; -$plyr-progress-loading-bg: transparentize(#000, .85) !default; - -// Volume -$plyr-volume-track-height: 6px !default; -$plyr-volume-track-bg: darken($plyr-controls-bg, 10%) !default; -$plyr-volume-thumb-height: ($plyr-volume-track-height * 2) !default; -$plyr-volume-thumb-width: ($plyr-volume-track-height * 2) !default; -$plyr-volume-thumb-bg: $plyr-control-color !default; -$plyr-volume-thumb-bg-focus: $plyr-control-bg-hover !default; - -// Breakpoints -$plyr-bp-control-split: 560px !default; // When controls split into left/right -$plyr-bp-captions-large: 768px !default; // When captions jump to the larger font size - -// Animation -// --------------------------------------- -@keyframes plyr-progress { - to { background-position: $plyr-progress-loading-size 0; } -} - -// Font smoothing -@mixin font-smoothing($mode: on) -{ - @if ($mode == 'on') { - -moz-osx-font-smoothing: grayscale; - -webkit-font-smoothing: antialiased; - } - @else if ($mode == 'off') { - -moz-osx-font-smoothing: auto; - -webkit-font-smoothing: subpixel-antialiased; - } -} - -// styling -@mixin volume-thumb() { - height: $plyr-volume-thumb-height; - width: $plyr-volume-thumb-width; - background: $plyr-volume-thumb-bg; - border: 0; - border-radius: 100%; - transition: background .3s ease; - cursor: ew-resize; -} -@mixin volume-track() { - height: $plyr-volume-track-height; - background: $plyr-volume-track-bg; - border: 0; - border-radius: ($plyr-volume-track-height / 2); -} -@mixin seek-thumb() { - background: transparent; - border: 0; - width: 1px; - height: $plyr-control-spacing; -} -@mixin seek-thumb-touch() { - width: ($plyr-control-spacing * 4); - transform: translateX(-50%); -} -@mixin seek-track() { - background: none; - border: 0; -} - -// Styles -// ------------------------------- -// Base -.plyr { - position: relative; - max-width: 100%; - min-width: 290px; - font-family: Avenir, "Avenir Next", "Helvetica Neue", "Segoe UI", Helvetica, Arial, sans-serif; - - // border-box everything - // http://paulirish.com/2012/box-sizing-border-box-ftw/ - &, - *, - *::after, - *::before { - 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 - &__video-wrapper { - position: relative; - } - video, - audio { - width: 100%; - height: auto; - vertical-align: middle; - } - - // Hide default captions - video::-webkit-media-text-track-container { - display: none; - } - - // 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%); - } - - // To allow mouse events to be captured if full support - &.plyr iframe { - pointer-events: none; - } - } - - // 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; - @include font-smoothing(); - - span { - border-radius: 2px; - padding: 3px 10px; - background: transparentize(#000, .1); - } - span:empty { - display: none; - } - - @media (min-width: $plyr-bp-captions-large) { - font-size: $plyr-font-size-captions-medium; - } - } - &--captions-active &__captions { - display: block; - } - &--fullscreen-active &__captions { - font-size: $plyr-font-size-captions-large; - } - - // Playback controls - &__controls { - @include font-smoothing(); - position: relative; - padding: $plyr-control-spacing; - background: $plyr-controls-bg; - line-height: 1; - text-align: center; - box-shadow: 0 1px 1px transparentize($plyr-gray-dark, .8); - - // Clear floats - &::after { - content: ''; - display: table; - clear: both; - } - - // Layout - &--right { - display: block; - margin: $plyr-control-spacing auto 0; - } - @media (min-width: $plyr-bp-control-split) { - &--left { - float: left; - } - &--right { - float: right; - margin-top: 0; - } - } - - // Buttons - button { - display: inline-block; - vertical-align: middle; - margin: 0 2px; - padding: ($plyr-control-spacing / 2) $plyr-control-spacing; - overflow: hidden; - 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; - } - - // Hover and tab focus - &.tab-focus:hover, - &:hover { - background: $plyr-control-bg-hover; - color: $plyr-control-color-hover; - } - // Default focus - &:focus { - outline: 0; - } - } - - // Hide toggle icons by default - .icon--exit-fullscreen, - .icon--muted, - .icon--captions-on { - display: none; - } - - // Time display - .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; - } - - // Media duration hidden on small screens - .plyr__time + .plyr__time { - display: none; - - @media (min-width: $plyr-bp-control-split) { - display: inline-block; - } - - // Add a slash in before - &::before { - content: '\2044'; - margin-right: $plyr-control-spacing; - } - } - } - - // 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; - } - } - button:hover .plyr__tooltip, - button.tab-focus:focus .plyr__tooltip, - &__tooltip--visible { - visibility: visible; - opacity: 1; - transform: translate(-50%, 0) scale(1); - } - button:hover .plyr__tooltip { - z-index: 3; - } - - // Common range styles - input[type='range'].tab-focus:focus { - outline: thin dotted transparentize($plyr-gray-dark, .8); - outline-offset: 3px; - } - - // Playback 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; - - -webkit-appearance: none; - -moz-appearance: none; - border: none; - background: transparent; - } - &--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; - } - } - &--played[value] { - z-index: 2; - color: $plyr-progress-playing-bg; - } - &--buffer[value] { - color: $plyr-progress-buffered-bg; - } - - // Seek control - // element - // Specificity is for bootstrap compatibility - &--seek[type='range'] { - z-index: 4; - cursor: pointer; - outline: 0; - - // Webkit - &::-webkit-slider-runnable-track { - @include seek-track(); - } - &::-webkit-slider-thumb { - -webkit-appearance: none; - @include seek-thumb(); - } - - // Mozilla - &::-moz-range-track { - @include seek-track(); - } - &::-moz-range-thumb { - -moz-appearance: none; - @include seek-thumb(); - } - - // Microsoft - &::-ms-track { - color: transparent; - @include seek-track(); - } - &::-ms-fill-lower, - &::-ms-fill-upper { - @include seek-track(); - } - &::-ms-thumb { - @include seek-thumb(); - } - - &:focus { - outline: 0; - } - &::-moz-focus-outer { - 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 .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; - } - &--playing .plyr__controls [data-plyr='pause'] { - display: inline-block; - } - - // Volume control - // 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; - - // Webkit - &::-webkit-slider-runnable-track { - @include volume-track(); - } - &::-webkit-slider-thumb { - -webkit-appearance: none; - margin-top: -(($plyr-volume-thumb-height - $plyr-volume-track-height) / 2); - @include volume-thumb(); - } - - // Mozilla - &::-moz-range-track { - @include volume-track(); - } - &::-moz-range-thumb { - @include 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 { - @include volume-track(); - } - &::-ms-thumb { - @include volume-thumb(); - } - - &: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; - } - } - } - - // 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; - } - // Center buttons so it looks less odd - &--is-ios.plyr--audio &__controls--left { - float: none; - } - - // Audio specific styles - // Position the progress within the container - &--audio .plyr__controls { - padding-top: ($plyr-control-spacing * 2); - } - &--audio .plyr__progress { - bottom: auto; - top: 0; - background: $plyr-off-white; - } - - // Full screen mode - &--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; - } - } - - // 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); - } - } - - // 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; - - @media (min-width: $plyr-bp-control-split) { - bottom: 60px; - } - } - - // Change icons on state change - &--fullscreen-active .icon--exit-fullscreen, - &--muted .plyr__controls .icon--muted, - &--captions-active .plyr__controls .icon--captions-on { - display: block; - - & + svg { - display: none; - } - } - - // Some options are hidden by default - [data-plyr='captions'], - [data-plyr='fullscreen'] { - display: none; - } - &--captions-enabled [data-plyr='captions'], - &--fullscreen-enabled [data-plyr='fullscreen'] { - display: inline-block; - } -} diff --git a/src/scss/mixins.scss b/src/scss/mixins.scss new file mode 100644 index 00000000..b4bfca6a --- /dev/null +++ b/src/scss/mixins.scss @@ -0,0 +1,29 @@ +// ========================================================================== +// Plyr mixins +// https://github.com/selz/plyr +// ========================================================================== + +// styling +@mixin plyr-range-track() { + height: $plyr-range-track-height; + background: transparent; + border: 0; + border-radius: ($plyr-range-track-height / 2); + user-select: none; +} +@mixin plyr-range-thumb() { + position: relative; + height: $plyr-range-thumb-height; + width: $plyr-range-thumb-width; + background: $plyr-range-thumb-bg; + border: $plyr-range-thumb-border; + border-radius: 100%; + transition: background .2s ease, border .2s ease, transform .2s ease; + box-shadow: $plyr-range-thumb-shadow; + box-sizing: border-box; +} +@mixin plyr-range-thumb-active() { + background: $plyr-range-thumb-active-bg; + border-color: $plyr-range-thumb-active-border-color; + transform: scale($plyr-range-thumb-active-scale); +} \ No newline at end of file diff --git a/src/scss/plyr.scss b/src/scss/plyr.scss new file mode 100644 index 00000000..d7976b39 --- /dev/null +++ b/src/scss/plyr.scss @@ -0,0 +1,686 @@ +// ========================================================================== +// Plyr styles +// https://github.com/selz/plyr +// ========================================================================== + +@import "variables"; +@import "mixins"; + +// Animation +// --------------------------------------- +@keyframes plyr-progress { + to { background-position: $plyr-progress-loading-size 0; } +} + +// Styles +// ------------------------------- +// Base +.plyr { + position: relative; + max-width: 100%; + min-width: 200px; + font-family: Avenir, "Avenir Next", "Helvetica Neue", "Segoe UI", Helvetica, Arial, sans-serif; + + // border-box everything + // http://paulirish.com/2012/box-sizing-border-box-ftw/ + &, + *, + *::after, + *::before { + box-sizing: border-box; + } + + // Fix 300ms delay + a, button, input, label { + touch-action: manipulation; + } + + // 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; + vertical-align: middle; + + appearance: none; + cursor: pointer; + border: none; + background: transparent; + + // WebKit + &::-webkit-slider-runnable-track { + @include plyr-range-track(); + } + &::-webkit-slider-thumb { + -webkit-appearance: none; + margin-top: -(($plyr-range-thumb-height - $plyr-range-track-height) / 2); + @include plyr-range-thumb(); + } + + // Mozilla + &::-moz-range-track { + @include plyr-range-track(); + } + &::-moz-range-thumb { + @include plyr-range-thumb(); + } + &::-moz-focus-outer { + border: 0; + } + + // Microsoft + &::-ms-track { + height: $plyr-range-track-height; + background: transparent; + border: 0; + color: transparent; + } + &::-ms-fill-upper { + @include plyr-range-track(); + } + &::-ms-fill-lower { + @include plyr-range-track(); + background: $plyr-range-selected-bg; + } + &::-ms-thumb { + @include 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:focus { + outline-offset: 3px; + } + + // Pressed styles + &:active { + &::-webkit-slider-thumb { + @include plyr-range-thumb-active(); + } + &::-moz-range-thumb { + @include plyr-range-thumb-active(); + } + &::-ms-thumb { + @include plyr-range-thumb-active(); + } + } + } +} + +// Video range inputs +.plyr--video input[type='range'].tab-focus:focus { + outline: 1px dotted transparentize($plyr-video-control-color, .5); +} + +// Audio range inputs +.plyr--audio input[type='range'].tab-focus:focus { + outline: 1px dotted transparentize($plyr-audio-control-color, .5); +} + +// 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; +} + +// Video +.plyr__video-wrapper { + position: relative; + background: #000; + border-radius: inherit; + + // Cleaner radius, also forces iframe radius + -webkit-mask-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAA5JREFUeNpiYGBgAAgwAAAEAAGbA+oJAAAAAElFTkSuQmCC); +} + +// Container for embeds +.plyr__video-embed { + padding-bottom: 56.25%; /* 16:9 */ + height: 0; + overflow: hidden; + border-radius: inherit; + + 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 * 2) ($plyr-control-spacing * 2) ($plyr-control-spacing * 8); + color: #fff; + font-size: $plyr-font-size-captions-base; + text-align: center; + font-weight: 400; + -webkit-font-smoothing: subpixel-antialiased; + + span { + border-radius: 2px; + padding: floor($plyr-control-spacing / 3) $plyr-control-spacing; + background: transparentize(#000, .15); + } + span:empty { + display: none; + } + + @media (min-width: $plyr-bp-screen-md) { + 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; +} + +// Controls +// -------------------------------------------------------------- +// Playback controls +.plyr__controls { + display: flex; + align-items: center; + + line-height: 1; + text-align: center; + + transition: opacity .3s ease; + + // Spacing + > button, + .plyr__progress, + .plyr__time { + margin-left: ($plyr-control-spacing / 2); + + &:first-child { + 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; + vertical-align: middle; + padding: ($plyr-control-spacing / 2); + border: 0; + background: transparent; + border-radius: 3px; + cursor: pointer; + transition: background .3s ease, color .3s ease, opacity .3s ease; + color: inherit; + + svg { + width: 18px; + height: 18px; + display: block; + fill: currentColor; + } + + // Default focus + &:focus { + outline: 0; + } + } + + // Hide toggle icons by default + .icon--exit-fullscreen, + .icon--muted, + .icon--captions-on { + display: none; + } + + @media (min-width: $plyr-bp-screen-sm) { + > button, + .plyr__progress, + .plyr__time { + margin-left: $plyr-control-spacing; + } + button { + padding: ($plyr-control-spacing / 2) $plyr-control-spacing; + } + } +} +// Hide controls +.plyr--hide-controls .plyr__controls { + opacity: 0; +} + +// Video controls +.plyr--video .plyr__controls { + position: absolute; + left: 0; + right: 0; + bottom: 0; + padding: ($plyr-control-spacing * 5) $plyr-control-spacing $plyr-control-spacing; + background: linear-gradient(transparentize($plyr-video-controls-bg, 1), transparentize($plyr-video-controls-bg, .5)); + 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; + } + } + + @media (min-width: $plyr-bp-screen-sm) { + padding-left: ($plyr-control-spacing * 1.5); + padding-right: ($plyr-control-spacing * 1.5); + } +} + +// Audio controls +.plyr--audio .plyr__controls { + padding: $plyr-control-spacing; + border-radius: inherit; + background: $plyr-audio-controls-bg; + border: $plyr-audio-controls-border; + box-shadow: $plyr-audio-controls-box-shadow; + 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; + } + } +} + +// Large play button (video only) +.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 currentColor; + border-radius: 100%; + box-shadow: 0 1px 1px transparentize($plyr-video-controls-bg, .85); + color: $plyr-video-control-color; + transition: opacity .3s ease, visibility .3s ease; + + svg { + position: relative; + left: 2px; + width: 20px; + height: 20px; + display: block; + fill: currentColor; + } + + &:focus { + outline: 1px dotted transparentize($plyr-video-control-color, .5); + } +} +.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--fullscreen-active .icon--exit-fullscreen, +.plyr--muted .plyr__controls .icon--muted, +.plyr--captions-active .plyr__controls .icon--captions-on { + display: block; + + & + svg { + 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; + -webkit-font-smoothing: subpixel-antialiased; + + 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%); + } + // 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; +} + +// Playback progress +// -------------------------------------------------------------- +// element +.plyr__progress { + position: relative; + flex: 1; + + input[type="range"] { + position: relative; + z-index: 2; + + &::-webkit-slider-runnable-track { + background: transparent; + } + &::-moz-range-track { + background: transparent; + } + &::-ms-fill-upper { + background: transparent; + } + } + + // Seek tooltip to show time + .plyr__tooltip { + left: 0; + } +} + +.plyr__progress--buffer[value], +.plyr__progress--played[value], +.plyr__volume--display[value] { + position: absolute; + left: 0; + top: 50%; + width: 100%; + height: $plyr-range-track-height; + margin: -($plyr-range-track-height / 2) 0 0; + padding: 0; + vertical-align: top; + appearance: none; + border: none; + border-radius: 100px; + + &::-webkit-progress-bar { + background: transparent; + } + &::-webkit-progress-value { + background: currentColor; + border-radius: 100px; + min-width: $plyr-range-track-height; + } + &::-moz-progress-bar { + background: currentColor; + border-radius: 100px; + min-width: $plyr-range-track-height; + } + &::-ms-fill { + border-radius: 100px; + } +} +.plyr__progress--played[value], +.plyr__volume--display[value] { + z-index: 1; + color: $plyr-range-selected-bg; + background: transparent; + transition: none; + + &::-webkit-progress-value { + min-width: $plyr-range-track-height; + max-width: 99%; + border-top-right-radius: 0; + border-bottom-right-radius: 0; + } + &::-moz-progress-bar { + min-width: $plyr-range-track-height; + max-width: 99%; + border-top-right-radius: 0; + border-bottom-right-radius: 0; + } + &::-ms-fill { + display: none; + } +} +.plyr__progress--buffer[value] { + &::-webkit-progress-value { + transition: width .2s ease; + } + &::-moz-progress-bar { + transition: width .2s ease; + } + &::-ms-fill { + transition: width .2s ease; + } +} +.plyr--video .plyr__progress--buffer[value], +.plyr--video .plyr__volume--display[value] { + background: $plyr-video-range-track-bg; +} +.plyr--video .plyr__progress--buffer[value] { + color: $plyr-video-progress-buffered-bg; +} +.plyr--audio .plyr__progress--buffer[value], +.plyr--audio .plyr__volume--display[value] { + background: $plyr-audio-range-track-bg; +} +.plyr--audio .plyr__progress--buffer[value] { + color: $plyr-audio-progress-buffered-bg; +} + +// 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-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; +} +.plyr--video.plyr--loading .plyr__progress--buffer { + background-color: $plyr-video-progress-buffered-bg; +} +.plyr--audio.plyr--loading .plyr__progress--buffer { + background-color: $plyr-audio-progress-buffered-bg; +} + +// Time +// -------------------------------------------------------------- +.plyr__time { + display: inline-block; + vertical-align: middle; + font-size: $plyr-font-size-small; + line-height: .95; + -webkit-font-smoothing: subpixel-antialiased; +} +// Media duration hidden on small screens +.plyr__time + .plyr__time { + display: none; + + @media (min-width: $plyr-bp-screen-md) { + display: inline-block; + } + + // Add a slash in before + &::before { + content: '\2044'; + margin-right: $plyr-control-spacing; + } +} + +// Volume +// -------------------------------------------------------------- +.plyr .plyr__volume { + display: none; + position: relative; + + input[type="range"] { + position: relative; + z-index: 2; + } + @media (min-width: $plyr-bp-screen-sm) { + display: block; + max-width: 60px; + } + @media (min-width: $plyr-bp-screen-md) { + 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'] { + display: none !important; +} + +// 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; + border-radius: 0; + + video { + height: 100%; + } + .plyr__video-wrapper { + height: 100%; + width: 100%; + } + .plyr__controls { + position: absolute; + bottom: 0; + left: 0; + right: 0; + } +} diff --git a/src/scss/variables.scss b/src/scss/variables.scss new file mode 100644 index 00000000..baf47e25 --- /dev/null +++ b/src/scss/variables.scss @@ -0,0 +1,67 @@ +// ========================================================================== +// Plyr variables +// https://github.com/selz/plyr +// https://robots.thoughtbot.com/sass-default +// ========================================================================== + +// Colors +$plyr-color-main: #3498db !default; + +// Font sizes +$plyr-font-size-small: 14px !default; +$plyr-font-size-base: 16px !default; + +// Captions +$plyr-font-size-captions-base: ceil($plyr-font-size-base * 1.25) !default; +$plyr-font-size-captions-medium: ceil($plyr-font-size-base * 1.5) !default; +$plyr-font-size-captions-large: ($plyr-font-size-base * 2) !default; + +// Controls +$plyr-control-spacing: 10px !default; +$plyr-video-controls-bg: #000 !default; +$plyr-video-control-color: #fff !default; +$plyr-video-control-color-hover: #fff !default; +$plyr-video-control-bg-hover: $plyr-color-main !default; +$plyr-audio-controls-bg: #fff !default; +$plyr-audio-controls-border: 1px solid #dbe3e8 !default; +$plyr-audio-controls-box-shadow: 0 1px 1px transparentize(#000, .95) !default; +$plyr-audio-control-color: #565D64 !default; +$plyr-audio-control-color-hover: #fff !default; +$plyr-audio-control-bg-hover: $plyr-color-main; + +// Tooltips +$plyr-tooltip-bg: $plyr-video-controls-bg !default; +$plyr-tooltip-border-color: transparentize(darken($plyr-video-controls-bg, 75%), .9) !default; +$plyr-tooltip-arrow-border-color: transparentize(darken($plyr-video-controls-bg, 75%), .8) !default; +$plyr-tooltip-border-width: 1px !default; +$plyr-tooltip-shadow: 0 0 5px $plyr-tooltip-border-color, 0 0 0 $plyr-tooltip-border-width $plyr-tooltip-border-color !default; +$plyr-tooltip-color: $plyr-video-control-color !default; +$plyr-tooltip-padding: ($plyr-control-spacing / 2) !default; +$plyr-tooltip-arrow-size: 4px !default; +$plyr-tooltip-radius: 3px !default; + +// Progress +$plyr-progress-loading-size: 25px !default; +$plyr-progress-loading-bg: transparentize(#000, .85) !default; +$plyr-video-progress-bg: transparentize(#fff, .75) !default; +$plyr-video-progress-buffered-bg: $plyr-video-progress-bg !default; +$plyr-audio-progress-bg: transparentize(#C6D6DB, .33) !default; +$plyr-audio-progress-buffered-bg: $plyr-audio-progress-bg !default; + +// Range sliders +$plyr-range-track-height: 8px !default; +$plyr-range-thumb-height: floor($plyr-range-track-height * 2) !default; +$plyr-range-thumb-width: floor($plyr-range-track-height * 2) !default; +$plyr-range-thumb-bg: #fff !default; +$plyr-range-thumb-border: 2px solid transparent !default; +$plyr-range-thumb-shadow: 0 1px 1px transparentize($plyr-video-controls-bg, .85), 0 0 0 1px transparentize(#000, .85) !default; +$plyr-range-thumb-active-border-color: #fff !default; +$plyr-range-thumb-active-bg: $plyr-video-control-bg-hover !default; +$plyr-range-thumb-active-scale: 1.25 !default; +$plyr-video-range-track-bg: $plyr-video-progress-buffered-bg !default; +$plyr-audio-range-track-bg: $plyr-audio-progress-buffered-bg !default; +$plyr-range-selected-bg: $plyr-color-main !default; + +// Breakpoints +$plyr-bp-screen-sm: 480px !default; +$plyr-bp-screen-md: 768px !default; \ No newline at end of file