diff options
-rw-r--r-- | bower.json | 62 | ||||
-rw-r--r-- | bundles.json | 46 | ||||
-rw-r--r-- | changelog.md | 45 | ||||
-rw-r--r-- | controls.md | 18 | ||||
-rw-r--r-- | dist/plyr.css | 2 | ||||
-rw-r--r-- | dist/plyr.js | 2 | ||||
-rw-r--r-- | docs/dist/docs.css | 2 | ||||
-rw-r--r-- | docs/dist/docs.js | 2 | ||||
-rw-r--r-- | docs/dist/templates.js | 2 | ||||
-rw-r--r-- | docs/error.html | 28 | ||||
-rw-r--r-- | docs/index.html | 152 | ||||
-rw-r--r-- | docs/src/js/docs.js | 13 | ||||
-rw-r--r-- | docs/src/less/docs.less | 170 | ||||
-rw-r--r-- | docs/src/less/lib/fontface.less | 24 | ||||
-rw-r--r-- | docs/src/less/lib/mixins.less | 32 | ||||
-rw-r--r-- | docs/src/templates/controls.html | 118 | ||||
-rw-r--r-- | gulpfile.js | 356 | ||||
-rw-r--r-- | package.json | 3 | ||||
-rw-r--r-- | readme.md | 88 | ||||
-rw-r--r-- | src/js/plyr.js | 874 | ||||
-rw-r--r-- | src/js/plyr.youtube.js | 32 | ||||
-rw-r--r-- | src/less/plyr.less | 1072 | ||||
-rw-r--r-- | src/sass/plyr.scss | 1075 |
23 files changed, 2428 insertions, 1790 deletions
@@ -1,33 +1,33 @@ { - "name": "plyr", - "description": "A simple HTML5 media player using custom controls", - "homepage": "http://plyr.io", - "keywords": [ - "Audio", - "Video", - "HTML5 Audio", - "HTml5 Video" - ], - "authors": [ - "Sam Potts <me@sampotts.me>" - ], - "dependencies": {}, - "main": [ - "dist/plyr.css", - "dist/plyr.js", - "dist/sprite.svg", - "src/less/plyr.less", - "src/sass/plyr.sass", - "src/js/plyr.js" - ], - "ignore": [ - "node_modules", - "bower_components", - ".gitignore" - ], - "repository": { - "type": "git", - "url": "git://github.com/selz/plyr.git" - }, - "license": "MIT" + "name": "plyr", + "description": "A simple HTML5 media player using custom controls", + "homepage": "http://plyr.io", + "keywords": [ + "Audio", + "Video", + "HTML5 Audio", + "HTml5 Video" + ], + "authors": [ + "Sam Potts <me@sampotts.me>" + ], + "dependencies": {}, + "main": [ + "dist/plyr.css", + "dist/plyr.js", + "dist/sprite.svg", + "src/less/plyr.less", + "src/sass/plyr.sass", + "src/js/plyr.js" + ], + "ignore": [ + "node_modules", + "bower_components", + ".gitignore" + ], + "repository": { + "type": "git", + "url": "git://github.com/selz/plyr.git" + }, + "license": "MIT" }
\ No newline at end of file diff --git a/bundles.json b/bundles.json index 1f9733a4..0595c557 100644 --- a/bundles.json +++ b/bundles.json @@ -1,25 +1,25 @@ { - "plyr": { - "less": { - "plyr.css": ["src/less/plyr.less"] - }, - "sass": { - "plyr.css": ["src/less/plyr.sass"] - }, - "js": { - "plyr.js": ["src/js/plyr.js"] - } - }, - "docs": { - "less": { - "docs.css": ["docs/src/less/docs.less"] - }, - "js": { - "docs.js": [ - "docs/src/js/lib/hogan-3.0.2.mustache.js", - "docs/dist/templates.js", - "docs/src/js/docs.js" - ] - } - } + "plyr": { + "less": { + "plyr.css": ["src/less/plyr.less"] + }, + "sass": { + "plyr.css": ["src/less/plyr.sass"] + }, + "js": { + "plyr.js": ["src/js/plyr.js"] + } + }, + "docs": { + "less": { + "docs.css": ["docs/src/less/docs.less"] + }, + "js": { + "docs.js": [ + "docs/src/js/lib/hogan-3.0.2.mustache.js", + "docs/dist/templates.js", + "docs/src/js/docs.js" + ] + } + } }
\ No newline at end of file diff --git a/changelog.md b/changelog.md index fbe0479b..f81bf982 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,50 @@ # Changelog +## v1.1.5 +- Fix for incorrect `isFullscreen()` return value in Mozilla (Fixes #38) + +## v1.1.4 +- Minor bug fixes + +## v1.1.3 +- Fixes for random id used in controls with multiple instances and one call to setup +- Audio player UI improvements + +## v1.1.2 +- Added an onSetup callback option +- Added fullscreen API methods `toggleFullscreen()` (must be user iniated), and `isFullscreen()` + +## v1.1.1 +- Fix for unsupported browser handling +- Fix for config.controls having no effect + +## v1.1.0 +- Added config option to set which controls are shown (if using the default controls html) and better handling of missing controls + +## v1.0.31 +- Display duration on `metadataloaded` + +## v1.0.30 +- Fixed bug with media longer than 60 minutes (Fixes #69) + +## v1.0.29 +- Added option to hide controls on fullscreen (default `true`) while palying, after 1s. Pause, mouse hover on progress, or focus on a child control re-shows the controls. On touch a tap of the video (which plays/pauses the video by default) is required. (Fixes #47) +- Fixed a bug with caption toggle in 1.0.28 + +## v1.0.28 +- Added API support for browsers that don't have full plyr support (pretty much <=IE9 and `<video>` on iPhone/iPod) + +## v1.0.27 +- Keyboard accessibility improvements (Fixes #66) + +## v1.0.26 +- Fixes for SASS (cheers @brunowego) +- Indentation reset to 4 spaces + +## v1.0.25 +- Fixes for iOS volume controls (hidden) +- Classnames for left/right controls changed + ## v1.0.24 - Added tooltip option to display labels as tooltips (Fixes #50) diff --git a/controls.md b/controls.md index c8f04f71..510da2de 100644 --- a/controls.md +++ b/controls.md @@ -2,7 +2,7 @@ This is the markup that is rendered for the Plyr controls. You can use the default controls or provide a customized version of markup based on your needs. -The demo Plyr setup uses a Hogan template. This purely to allow for localization at a later date. Check out `controls.html` in `/src/templates` to get an idea of how the default html is structured. Alternatively check out the `plyr.js` source. +The demo Plyr setup uses a Hogan template. This purely to allow for localization at a later date. Check out `controls.html` in `/src/templates` to get an idea of how the default html is structured. ## Requirements @@ -13,11 +13,11 @@ You need to add several placeholders to your html template that are replaced whe - `{id}` - the dynamically generated ID for the player (for form controls) - `{seektime}` - the seek time specified in options for fast forward and rewind -Currently all buttons and inputs need to be present for Plyr to work but later we'll make it more dynamic so if you omit a button or input, it'll still work. +You can include only the controls you need when specifying custom html. -## Default +## Example -This is the default `html` option from `plyr.js`. +This is an example `html` option with all controls. ```javascript ["<div class='player-controls'>", @@ -31,7 +31,7 @@ This is the default `html` option from `plyr.js`. "<span>0</span>% buffered", "</progress>", "</div>", - "<span class='player-controls-playback'>", + "<span class='player-controls-left'>", "<button type='button' data-player='restart'>", "<svg><use xlink:href='#icon-restart'></use></svg>", "<span class='sr-only'>Restart</span>", @@ -53,11 +53,15 @@ This is the default `html` option from `plyr.js`. "<span class='sr-only'>Forward {seektime} secs</span>", "</button>", "<span class='player-time'>", - "<span class='sr-only'>Time</span>", + "<span class='sr-only'>Current time</span>", + "<span class='player-current-time'>00:00</span>", + "</span>", + "<span class='player-time'>", + "<span class='sr-only'>Duration</span>", "<span class='player-duration'>00:00</span>", "</span>", "</span>", - "<span class='player-controls-sound'>", + "<span class='player-controls-right'>", "<input class='inverted sr-only' id='mute{id}' type='checkbox' data-player='mute'>", "<label id='mute{id}' for='mute{id}'>", "<svg class='icon-muted'><use xlink:href='#icon-muted'></use></svg>", diff --git a/dist/plyr.css b/dist/plyr.css index a75c95ca..185e3311 100644 --- a/dist/plyr.css +++ b/dist/plyr.css @@ -1 +1 @@ -.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}@-webkit-keyframes progress{to{background-position:40px 0}}@keyframes progress{to{background-position:40px 0}}.player{position:relative;max-width:100%;min-width:290px}.player,.player *,.player ::after,.player ::before{box-sizing:border-box}.player-video-wrapper{position:relative}.player video{width:100%;height:auto;vertical-align:middle}.player-captions{display:none;position:absolute;bottom:0;left:0;width:100%;padding:20px;min-height:2.5em;color:#fff;font-size:16px;font-weight:600;text-shadow:-1px -1px 0 #565d64,1px -1px 0 #565d64,-1px 1px 0 #565d64,1px 1px 0 #565d64;text-align:center;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}@media (min-width:768px){.player-captions{font-size:24px}}.player.captions-active .player-captions{display:block}.player-controls{zoom:1;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;position:relative;padding:20px 10px 10px;background:#343f4a;line-height:1;text-align:center}.player-controls:after,.player-controls:before{content:"";display:table}.player-controls:after{clear:both}.player-controls-sound{display:block;margin:10px auto 0}@media (min-width:560px){.player-controls-playback{float:left}.player-controls-sound{float:right;margin-top:0}}.player-controls button,.player-controls input+label{display:inline-block;vertical-align:middle;margin:0 2px;padding:5px 10px;transition:background .3s ease;border-radius:3px;cursor:pointer}.player-controls button svg,.player-controls input+label svg{width:18px;height:18px;display:block;fill:currentColor;transition:fill .3s ease}.player-controls .inverted:checked+label,.player-controls input+label{color:#565d64}.player-controls .inverted+label,.player-controls button,.player-controls input:checked+label{color:#cbd0d3}.player-controls button{border:0;background:0 0;overflow:hidden}.player-controls [type=checkbox]+label:hover,.player-controls [type=checkbox]:focus+label,.player-controls button:focus,.player-controls button:hover{background:#3498db;color:#fff}.player-controls button:focus,.player-controls input:focus+label{outline:0}.player-controls .icon-captions-on,.player-controls .icon-exit-fullscreen,.player-controls .icon-muted{display:none}.player-controls .player-time{display:inline-block;vertical-align:middle;margin-left:10px;color:#cbd0d3;font-weight:600;font-size:14px;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.player-tooltip{visibility:hidden;position:absolute;z-index:2;bottom:100%;margin-bottom:10px;padding:10px 15px;opacity:0;background:#343f4a;border-radius:3px;color:#fff;font-size:14px;line-height:1.5;font-weight:600;-webkit-transform:translate(-50%,30px);transform:translate(-50%,30px);transition:-webkit-transform .2s .2s ease,opacity .2s .2s ease;transition:transform .2s .2s ease,opacity .2s .2s ease}.player-tooltip::after{content:"";display:block;position:absolute;left:50%;bottom:-5px;margin-left:-5px;width:0;height:0;transition:inherit;border-style:solid;border-width:5px 5px 0;border-color:#343f4a transparent transparent}.player button:focus .player-tooltip,.player button:hover .player-tooltip,.player input:focus+label .player-tooltip,.player label:hover .player-tooltip{visibility:visible;opacity:1;-webkit-transform:translate(-50%,0);transform:translate(-50%,0)}.player button:hover .player-tooltip,.player label:hover .player-tooltip{z-index:3}.player-progress{position:absolute;top:0;left:0;right:0;width:100%;height:10px;background:#6e777f}.player-progress-buffer[value],.player-progress-played[value],.player-progress-seek[type=range]{position:absolute;left:0;top:0;width:100%;height:10px;margin:0;padding:0;vertical-align:top;-webkit-appearance:none;-moz-appearance:none;border:none;background:0 0}.player-progress-buffer[value]::-webkit-progress-bar,.player-progress-played[value]::-webkit-progress-bar{background:0 0}.player-progress-buffer[value]::-webkit-progress-value,.player-progress-played[value]::-webkit-progress-value{background:currentColor}.player-progress-buffer[value]::-moz-progress-bar,.player-progress-played[value]::-moz-progress-bar{background:currentColor}.player-progress-played[value]{z-index:2;color:#3498db}.player-progress-buffer[value]{color:#565d64}.player-progress-seek[type=range]{z-index:4;cursor:pointer;outline:0}.player-progress-seek[type=range]::-webkit-slider-runnable-track{background:0 0;border:0}.player-progress-seek[type=range]::-webkit-slider-thumb{-webkit-appearance:none;background:0 0;border:0;width:20px;height:10px}.player-progress-seek[type=range]::-moz-range-track{background:0 0;border:0}.player-progress-seek[type=range]::-moz-range-thumb{-moz-appearance:none;background:0 0;border:0;width:20px;height:10px}.player-progress-seek[type=range]::-ms-track{color:transparent;background:0 0;border:0}.player-progress-seek[type=range]::-ms-fill-lower,.player-progress-seek[type=range]::-ms-fill-upper{background:0 0;border:0}.player-progress-seek[type=range]::-ms-thumb{background:0 0;border:0;width:20px;height:10px}.player-progress-seek[type=range]:focus{outline:0}.player-progress-seek[type=range]::-moz-focus-outer{border:0}.player.loading .player-progress-buffer{-webkit-animation:progress 1s linear infinite;animation:progress 1s linear infinite;background-size:40px 40px;background-repeat:repeat-x;background-color:#565d64;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}.player-controls [data-player=pause],.player.playing .player-controls [data-player=play]{display:none}.player.playing .player-controls [data-player=pause]{display:inline-block}.player-volume[type=range]{display:inline-block;vertical-align:middle;-webkit-appearance:none;-moz-appearance:none;width:100px;margin:0 10px 0 0;padding:0;cursor:pointer;background:0 0}.player-volume[type=range]::-webkit-slider-runnable-track{height:6px;background:#565d64;border:0;border-radius:3px}.player-volume[type=range]::-webkit-slider-thumb{-webkit-appearance:none;margin-top:-3px;height:12px;width:12px;background:#cbd0d3;border:0;border-radius:6px;transition:background .3s ease;cursor:ew-resize}.player-volume[type=range]::-moz-range-track{height:6px;background:#565d64;border:0;border-radius:3px}.player-volume[type=range]::-moz-range-thumb{height:12px;width:12px;background:#cbd0d3;border:0;border-radius:6px;transition:background .3s ease;cursor:ew-resize}.player-volume[type=range]::-ms-track{height:6px;background:0 0;border-color:transparent;border-width:3px 0;color:transparent}.player-volume[type=range]::-ms-fill-lower,.player-volume[type=range]::-ms-fill-upper{height:6px;background:#565d64;border:0;border-radius:3px}.player-volume[type=range]::-ms-thumb{height:12px;width:12px;background:#cbd0d3;border:0;border-radius:6px;transition:background .3s ease;cursor:ew-resize}.player-volume[type=range]:focus{outline:0}.player-volume[type=range]:focus::-webkit-slider-thumb{background:#3498db}.player-volume[type=range]:focus::-moz-range-thumb{background:#3498db}.player-volume[type=range]:focus::-ms-thumb{background:#3498db}.player-fullscreen,.player.fullscreen-active{position:fixed;top:0;left:0;right:0;bottom:0;height:100%;width:100%;z-index:10000000;background:#000}.player-fullscreen .player-video-wrapper,.player.fullscreen-active .player-video-wrapper{height:100%;width:100%}.player-fullscreen .player-video-wrapper video,.player.fullscreen-active .player-video-wrapper video{height:100%}.player-fullscreen .player-video-wrapper .player-captions,.player.fullscreen-active .player-video-wrapper .player-captions{top:auto;bottom:90px}@media (min-width:560px) and (max-width:767px){.player-fullscreen .player-video-wrapper .player-captions,.player.fullscreen-active .player-video-wrapper .player-captions{bottom:60px}}@media (min-width:768px){.player-fullscreen .player-video-wrapper .player-captions,.player.fullscreen-active .player-video-wrapper .player-captions{bottom:80px}}.player-fullscreen .player-controls,.player.fullscreen-active .player-controls{position:absolute;bottom:0;left:0;right:0}.player.captions-active .player-controls .icon-captions-on,.player.fullscreen-active .icon-exit-fullscreen,.player.muted .player-controls .icon-muted{display:block}.player [data-player=captions],.player [data-player=captions]+label,.player [data-player=fullscreen],.player [data-player=fullscreen]+label,.player.captions-active .player-controls .icon-captions-on+svg,.player.fullscreen-active .icon-exit-fullscreen+svg,.player.muted .player-controls .icon-muted+svg{display:none}.player.captions-enabled [data-player=captions],.player.captions-enabled [data-player=captions]+label,.player.fullscreen-enabled [data-player=fullscreen],.player.fullscreen-enabled [data-player=fullscreen]+label{display:inline-block}.player-fullscreen [data-player=fullscreen],.player-fullscreen [data-player=fullscreen]+label{display:none!important}
\ No newline at end of file +.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}@-webkit-keyframes progress{to{background-position:40px 0}}@keyframes progress{to{background-position:40px 0}}.player{position:relative;max-width:100%;min-width:290px}.player,.player *,.player ::after,.player ::before{box-sizing:border-box}.player-video-wrapper{position:relative}.player video{width:100%;height:auto;vertical-align:middle}.player-video-embed{padding-bottom:56.25%;height:0}.player-video-embed iframe{position:absolute;top:0;left:0;width:100%;height:100%;border:0}.player-captions{display:none;position:absolute;bottom:0;left:0;width:100%;padding:20px;min-height:2.5em;color:#fff;font-size:16px;font-weight:600;text-shadow:-1px -1px 0 #565d64,1px -1px 0 #565d64,-1px 1px 0 #565d64,1px 1px 0 #565d64;text-align:center;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}@media (min-width:768px){.player-captions{font-size:24px}}.player.captions-active .player-captions{display:block}.player-controls{zoom:1;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;position:relative;padding:10px;background:#343f4a;line-height:1;text-align:center}.player-controls:after,.player-controls:before{content:"";display:table}.player-controls:after{clear:both}.player-controls-right{display:block;margin:10px auto 0}@media (min-width:560px){.player-controls-left{float:left}.player-controls-right{float:right;margin-top:0}}.player-controls button,.player-controls input+label{display:inline-block;vertical-align:middle;margin:0 2px;padding:5px 10px;transition:background .3s ease;border-radius:3px;cursor:pointer}.player-controls button svg,.player-controls input+label svg{width:18px;height:18px;display:block;fill:currentColor;transition:fill .3s ease}.player-controls .inverted:checked+label,.player-controls input+label{color:#565d64}.player-controls .inverted+label,.player-controls button,.player-controls input:checked+label{color:#cbd0d3}.player-controls button{border:0;background:0 0;overflow:hidden}.player-controls [type=checkbox]+label:hover,.player-controls [type=checkbox]:focus+label,.player-controls button:focus,.player-controls button:hover{background:#3498db;color:#fff}.player-controls button:focus,.player-controls input:focus+label{outline:0}.player-controls .icon-captions-on,.player-controls .icon-exit-fullscreen,.player-controls .icon-muted{display:none}.player-controls .player-time{display:inline-block;vertical-align:middle;margin-left:10px;color:#cbd0d3;font-weight:600;font-size:14px;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.player-controls .player-time+.player-time{display:none}@media (min-width:560px){.player-controls .player-time+.player-time{display:inline-block}}.player-controls .player-time+.player-time::before{content:"\2044";margin-right:10px;color:#78858d}.player-tooltip{visibility:hidden;position:absolute;z-index:2;bottom:100%;margin-bottom:10px;padding:10px 15px;opacity:0;background:#343f4a;border-radius:3px;color:#fff;font-size:14px;line-height:1.5;font-weight:600;-webkit-transform:translate(-50%,30px);transform:translate(-50%,30px);transition:-webkit-transform .2s .2s ease,opacity .2s .2s ease;transition:transform .2s .2s ease,opacity .2s .2s ease}.player-tooltip::after{content:"";display:block;position:absolute;left:50%;bottom:-5px;margin-left:-5px;width:0;height:0;transition:inherit;border-style:solid;border-width:5px 5px 0;border-color:#343f4a transparent transparent}.player button:focus .player-tooltip,.player button:hover .player-tooltip,.player input:focus+label .player-tooltip,.player label:hover .player-tooltip{visibility:visible;opacity:1;-webkit-transform:translate(-50%,0);transform:translate(-50%,0)}.player button:hover .player-tooltip,.player label:hover .player-tooltip{z-index:3}.player-progress{position:absolute;bottom:100%;left:0;right:0;width:100%;height:10px;background:rgba(86,93,100,.2)}.player-progress-buffer[value],.player-progress-played[value],.player-progress-seek[type=range]{position:absolute;left:0;top:0;width:100%;height:10px;margin:0;padding:0;vertical-align:top;-webkit-appearance:none;-moz-appearance:none;border:none;background:0 0}.player-progress-buffer[value]::-webkit-progress-bar,.player-progress-played[value]::-webkit-progress-bar{background:0 0}.player-progress-buffer[value]::-webkit-progress-value,.player-progress-played[value]::-webkit-progress-value{background:currentColor}.player-progress-buffer[value]::-moz-progress-bar,.player-progress-played[value]::-moz-progress-bar{background:currentColor}.player-progress-played[value]{z-index:2;color:#3498db}.player-progress-buffer[value]{color:rgba(86,93,100,.25)}.player-progress-seek[type=range]{z-index:4;cursor:pointer;outline:0}.player-progress-seek[type=range]::-webkit-slider-runnable-track{background:0 0;border:0}.player-progress-seek[type=range]::-webkit-slider-thumb{-webkit-appearance:none;background:0 0;border:0;width:20px;height:10px}.player-progress-seek[type=range]::-moz-range-track{background:0 0;border:0}.player-progress-seek[type=range]::-moz-range-thumb{-moz-appearance:none;background:0 0;border:0;width:20px;height:10px}.player-progress-seek[type=range]::-ms-track{color:transparent;background:0 0;border:0}.player-progress-seek[type=range]::-ms-fill-lower,.player-progress-seek[type=range]::-ms-fill-upper{background:0 0;border:0}.player-progress-seek[type=range]::-ms-thumb{background:0 0;border:0;width:20px;height:10px}.player-progress-seek[type=range]:focus{outline:0}.player-progress-seek[type=range]::-moz-focus-outer{border:0}.player.loading .player-progress-buffer{-webkit-animation:progress 1s linear infinite;animation:progress 1s linear infinite;background-size:40px 40px;background-repeat:repeat-x;background-color:rgba(86,93,100,.25);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}.player-controls [data-player=pause],.player.playing .player-controls [data-player=play]{display:none}.player.playing .player-controls [data-player=pause]{display:inline-block}.player-volume[type=range]{display:inline-block;vertical-align:middle;-webkit-appearance:none;-moz-appearance:none;width:100px;margin:0 10px 0 0;padding:0;cursor:pointer;background:0 0}.player-volume[type=range]::-webkit-slider-runnable-track{height:6px;background:#565d64;border:0;border-radius:3px}.player-volume[type=range]::-webkit-slider-thumb{-webkit-appearance:none;margin-top:-3px;height:12px;width:12px;background:#cbd0d3;border:0;border-radius:6px;transition:background .3s ease;cursor:ew-resize}.player-volume[type=range]::-moz-range-track{height:6px;background:#565d64;border:0;border-radius:3px}.player-volume[type=range]::-moz-range-thumb{height:12px;width:12px;background:#cbd0d3;border:0;border-radius:6px;transition:background .3s ease;cursor:ew-resize}.player-volume[type=range]::-ms-track{height:6px;background:0 0;border-color:transparent;border-width:3px 0;color:transparent}.player-volume[type=range]::-ms-fill-lower,.player-volume[type=range]::-ms-fill-upper{height:6px;background:#565d64;border:0;border-radius:3px}.player-volume[type=range]::-ms-thumb{height:12px;width:12px;background:#cbd0d3;border:0;border-radius:6px;transition:background .3s ease;cursor:ew-resize}.player-volume[type=range]:focus{outline:0}.player-volume[type=range]:focus::-webkit-slider-thumb{background:#3498db}.player-volume[type=range]:focus::-moz-range-thumb{background:#3498db}.player-volume[type=range]:focus::-ms-thumb{background:#3498db}.player-audio.ios .player-controls-right,.player.ios .player-volume,.player.ios [data-player=mute],.player.ios [data-player=mute]+label{display:none}.player-audio.ios .player-controls-left{float:none}.player-audio .player-controls{padding-top:20px}.player-audio .player-progress{bottom:auto;top:0;background:#d6dadd}.player-fullscreen,.player.fullscreen-active{position:fixed;top:0;left:0;right:0;bottom:0;height:100%;width:100%;z-index:10000000;background:#000}.player-fullscreen video,.player.fullscreen-active video{height:100%}.player-fullscreen .player-video-wrapper,.player.fullscreen-active .player-video-wrapper{height:100%;width:100%}.player-fullscreen .player-video-wrapper .player-captions,.player.fullscreen-active .player-video-wrapper .player-captions{top:auto;bottom:90px}@media (min-width:560px) and (max-width:767px){.player-fullscreen .player-video-wrapper .player-captions,.player.fullscreen-active .player-video-wrapper .player-captions{bottom:60px}}@media (min-width:768px){.player-fullscreen .player-video-wrapper .player-captions,.player.fullscreen-active .player-video-wrapper .player-captions{bottom:80px}}.player-fullscreen .player-controls,.player.fullscreen-active .player-controls{position:absolute;bottom:0;left:0;right:0}.player-fullscreen.fullscreen-hide-controls.playing .player-controls,.player.fullscreen-active.fullscreen-hide-controls.playing .player-controls{-webkit-transform:translateY(100%) translateY(5px);transform:translateY(100%) translateY(5px);transition:-webkit-transform .3s 1s ease;transition:transform .3s 1s ease}.player-fullscreen.fullscreen-hide-controls.playing .player-controls.hover,.player.fullscreen-active.fullscreen-hide-controls.playing .player-controls.hover{-webkit-transform:translateY(0);transform:translateY(0);transition-delay:0}.player.captions-active .player-controls .icon-captions-on,.player.fullscreen-active .icon-exit-fullscreen,.player.muted .player-controls .icon-muted{display:block}.player [data-player=captions],.player [data-player=captions]+label,.player [data-player=fullscreen],.player [data-player=fullscreen]+label,.player.captions-active .player-controls .icon-captions-on+svg,.player.fullscreen-active .icon-exit-fullscreen+svg,.player.muted .player-controls .icon-muted+svg{display:none}.player.captions-enabled [data-player=captions],.player.captions-enabled [data-player=captions]+label,.player.fullscreen-enabled [data-player=fullscreen],.player.fullscreen-enabled [data-player=fullscreen]+label{display:inline-block}
\ No newline at end of file diff --git a/dist/plyr.js b/dist/plyr.js index adb68c82..5cb11bf8 100644 --- a/dist/plyr.js +++ b/dist/plyr.js @@ -1 +1 @@ -!function(e){"use strict";function t(e,t){h.debug&&window.console&&console[t?"error":"log"](e)}function n(){var e,t,n,r=navigator.userAgent,s=navigator.appName,a=""+parseFloat(navigator.appVersion),o=parseInt(navigator.appVersion,10);return-1!==navigator.appVersion.indexOf("Windows NT")&&-1!==navigator.appVersion.indexOf("rv:11")?(s="IE",a="11;"):-1!==(t=r.indexOf("MSIE"))?(s="IE",a=r.substring(t+5)):-1!==(t=r.indexOf("Chrome"))?(s="Chrome",a=r.substring(t+7)):-1!==(t=r.indexOf("Safari"))?(s="Safari",a=r.substring(t+7),-1!==(t=r.indexOf("Version"))&&(a=r.substring(t+8))):-1!==(t=r.indexOf("Firefox"))?(s="Firefox",a=r.substring(t+8)):(e=r.lastIndexOf(" ")+1)<(t=r.lastIndexOf("/"))&&(s=r.substring(e,t),a=r.substring(t+1),s.toLowerCase()==s.toUpperCase()&&(s=navigator.appName)),-1!==(n=a.indexOf(";"))&&(a=a.substring(0,n)),-1!==(n=a.indexOf(" "))&&(a=a.substring(0,n)),o=parseInt(""+a,10),isNaN(o)&&(a=""+parseFloat(navigator.appVersion),o=parseInt(navigator.appVersion,10)),[s,o]}function r(e,t){var n=e.media;if("video"==e.type)switch(t){case"video/webm":return!(!n.canPlayType||!n.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/no/,""));case"video/mp4":return!(!n.canPlayType||!n.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"').replace(/no/,""));case"video/ogg":return!(!n.canPlayType||!n.canPlayType('video/ogg; codecs="theora"').replace(/no/,""))}else if("audio"==e.type)switch(t){case"audio/mpeg":return!(!n.canPlayType||!n.canPlayType("audio/mpeg;").replace(/no/,""));case"audio/ogg":return!(!n.canPlayType||!n.canPlayType('audio/ogg; codecs="vorbis"').replace(/no/,""));case"audio/wav":return!(!n.canPlayType||!n.canPlayType('audio/wav; codecs="1"').replace(/no/,""))}return!1}function s(e,t,n){return e.replace(new RegExp(t.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"),"g"),n)}function a(e,t){e.length||(e=[e]);for(var n=e.length-1;n>=0;n--){var r=n>0?t.cloneNode(!0):t,s=e[n],a=s.parentNode,o=s.nextSibling;r.appendChild(s),o?a.insertBefore(r,o):a.appendChild(r)}}function o(e){e.parentNode.removeChild(e)}function i(e,t){e.insertBefore(t,e.firstChild)}function l(e,t){for(var n in t)e.setAttribute(n,t[n])}function c(e,t,n){if(e)if(e.classList)e.classList[n?"add":"remove"](t);else{var r=(" "+e.className+" ").replace(/\s+/g," ").replace(" "+t+" ","");e.className=r+(n?" "+t:"")}}function u(e,t,n,r){t=t.split(" ");for(var s=0;s<t.length;s++)e[r?"addEventListener":"removeEventListener"](t[s],n,!1)}function p(e,t,n){u(e,t,n,!0)}function d(e,t,n){u(e,t,n,!1)}function f(e,t){return 0===e||0===t||isNaN(e)||isNaN(t)?0:(e/t*100).toFixed(2)}function m(e,t){for(var n in t)t[n]&&t[n].constructor&&t[n].constructor===Object?(e[n]=e[n]||{},m(e[n],t[n])):e[n]=t[n];return e}function y(){var e={supportsFullScreen:!1,isFullScreen:function(){return!1},requestFullScreen:function(){},cancelFullScreen:function(){},fullScreenEventName:"",element:null,prefix:""},t="webkit moz o ms khtml".split(" ");if("undefined"!=typeof document.cancelFullScreen)e.supportsFullScreen=!0;else for(var n=0,r=t.length;r>n;n++){if(e.prefix=t[n],"undefined"!=typeof document[e.prefix+"CancelFullScreen"]){e.supportsFullScreen=!0;break}if("undefined"!=typeof document.msExitFullscreen&&document.msFullscreenEnabled){e.prefix="ms",e.supportsFullScreen=!0;break}}return"webkit"===e.prefix&&navigator.userAgent.match(/Version\/[\d\.]+.*Safari/)&&(e.supportsFullScreen=!1),e.supportsFullScreen&&(e.fullScreenEventName="ms"==e.prefix?"MSFullscreenChange":e.prefix+"fullscreenchange",e.isFullScreen=function(){switch(this.prefix){case"":return document.fullScreen;case"webkit":return document.webkitIsFullScreen;case"ms":return null!==document.msFullscreenElement;default:return document[this.prefix+"FullScreen"]}},e.requestFullScreen=function(e){return""===this.prefix?e.requestFullScreen():e[this.prefix+("ms"==this.prefix?"RequestFullscreen":"RequestFullScreen")]("webkit"===this.prefix?e.ALLOW_KEYBOARD_INPUT:null)},e.cancelFullScreen=function(){return""===this.prefix?document.cancelFullScreen():document[this.prefix+("ms"==this.prefix?"ExitFullscreen":"CancelFullScreen")]()},e.element=function(){return""===this.prefix?document.fullscreenElement:document[this.prefix+"FullscreenElement"]}),e}function b(){var e={supported:function(){try{return"localStorage"in window&&null!==window.localStorage}catch(e){return!1}}()};return e}function v(e){function u(e){if(!Z.usingTextTracks&&"video"===Z.type){for(Z.subcount=0,e="number"==typeof e?e:Z.media.currentTime;k(Z.captions[Z.subcount][0])<e.toFixed(1);)if(Z.subcount++,Z.subcount>Z.captions.length-1){Z.subcount=Z.captions.length-1;break}Z.media.currentTime.toFixed(1)>=v(Z.captions[Z.subcount][0])&&Z.media.currentTime.toFixed(1)<=k(Z.captions[Z.subcount][0])?(Z.currentCaption=Z.captions[Z.subcount][1],Z.captionsContainer.innerHTML=Z.currentCaption):Z.captionsContainer.innerHTML=""}}function m(){c(Z.container,h.classes.captions.enabled,!0),h.captions.defaultActive&&(c(Z.container,h.classes.captions.active,!0),Z.buttons.captions.setAttribute("checked","checked"))}function v(e){var t=[];return t=e.split(" --> "),x(t[0])}function k(e){var t=[];return t=e.split(" --> "),x(t[1])}function x(e){if(null===e||void 0===e)return 0;var t,n=[],r=[];return n=e.split(","),r=n[0].split(":"),t=Math.floor(60*r[0]*60)+Math.floor(60*r[1])+Math.floor(r[2])}function w(e){return Z.container.querySelectorAll(e)}function T(e){return w(e)[0]}function S(){try{return window.self!==window.top}catch(e){return!0}}function F(){t("Injecting custom controls.");var e=h.html;if(e=s(e,"{seektime}",h.seekTime),e=s(e,"{id}",Z.random),Z.container.insertAdjacentHTML("beforeend",e),h.tooltips)for(var n=w(h.selectors.labels),r=n.length-1;r>=0;r--){var a=n[r];c(a,h.classes.hidden,!1),c(a,h.classes.tooltip,!0)}}function N(){try{return Z.controls=T(h.selectors.controls),Z.buttons={},Z.buttons.seek=T(h.selectors.buttons.seek),Z.buttons.play=T(h.selectors.buttons.play),Z.buttons.pause=T(h.selectors.buttons.pause),Z.buttons.restart=T(h.selectors.buttons.restart),Z.buttons.rewind=T(h.selectors.buttons.rewind),Z.buttons.forward=T(h.selectors.buttons.forward),Z.buttons.mute=T(h.selectors.buttons.mute),Z.buttons.captions=T(h.selectors.buttons.captions),Z.buttons.fullscreen=T(h.selectors.buttons.fullscreen),Z.progress={},Z.progress.container=T(h.selectors.progress.container),Z.progress.buffer={},Z.progress.buffer.bar=T(h.selectors.progress.buffer),Z.progress.buffer.text=Z.progress.buffer.bar.getElementsByTagName("span")[0],Z.progress.played={},Z.progress.played.bar=T(h.selectors.progress.played),Z.progress.played.text=Z.progress.played.bar.getElementsByTagName("span")[0],Z.volume=T(h.selectors.buttons.volume),Z.duration=T(h.selectors.duration),Z.seekTime=w(h.selectors.seekTime),!0}catch(e){return t("It looks like there's a problem with your controls html. Bailing.",!0),!1}}function E(){var e=Z.buttons.play.innerText||"Play";"undefined"!=typeof h.title&&h.title.length&&(e+=", "+h.title),Z.buttons.play.setAttribute("aria-label",e)}function A(){if(Z.media=Z.container.querySelectorAll("audio, video")[0],!Z.media)return t("No audio or video element found!",!0),!1;if(Z.media.removeAttribute("controls"),Z.type="VIDEO"==Z.media.tagName?"video":"audio",c(Z.container,h.classes[Z.type],!0),c(Z.container,h.classes.stopped,null===Z.media.getAttribute("autoplay")),"video"===Z.type){var e=document.createElement("div");e.setAttribute("class",h.classes.videoWrapper),a(Z.media,e),Z.videoContainer=e}null!==Z.media.getAttribute("autoplay")&&I()}function C(){if("video"===Z.type){Z.videoContainer.insertAdjacentHTML("afterbegin","<div class='"+h.selectors.captions.replace(".","")+"'></div>"),Z.captionsContainer=T(h.selectors.captions),Z.usingTextTracks=!1,Z.media.textTracks&&(Z.usingTextTracks=!0);for(var e,n="",r=Z.media.childNodes,s=0;s<r.length;s++)"track"===r[s].nodeName.toLowerCase()&&(e=r[s].getAttribute("kind"),"captions"===e&&(n=r[s].getAttribute("src")));if(Z.captionExists=!0,""===n?(Z.captionExists=!1,t("No caption track found.")):t("Caption track found; URI: "+n),Z.captionExists){for(var a=Z.media.textTracks,o=0;o<a.length;o++)a[o].mode="hidden";if(m(Z),("IE"===Z.browserName&&10===Z.browserMajorVersion||"IE"===Z.browserName&&11===Z.browserMajorVersion||"Firefox"===Z.browserName&&Z.browserMajorVersion>=31||"Safari"===Z.browserName&&Z.browserMajorVersion>=7)&&(t("Detected IE 10/11 or Firefox 31+ or Safari 7+."),Z.usingTextTracks=!1),Z.usingTextTracks){t("TextTracks supported.");for(var i=0;i<a.length;i++){var l=a[i];"captions"===l.kind&&p(l,"cuechange",function(){this.activeCues[0]&&this.activeCues[0].hasOwnProperty("text")&&(Z.captionsContainer.innerHTML=this.activeCues[0].text)})}}else if(t("TextTracks not supported so rendering captions manually."),Z.currentCaption="",Z.captions=[],""!==n){var u=new XMLHttpRequest;u.onreadystatechange=function(){if(4===u.readyState)if(200===u.status){var e,n=[],r=u.responseText;n=r.split("\n\n");for(var s=0;s<n.length;s++)e=n[s],Z.captions[s]=[],Z.captions[s]=e.split("\n");Z.captions.shift(),t("Successfully loaded the caption file via AJAX.")}else t("There was a problem loading the caption file via AJAX.",!0)},u.open("get",n,!0),u.send()}if("Safari"===Z.browserName&&Z.browserMajorVersion>=7){t("Safari 7+ detected; removing track from DOM."),a=Z.media.getElementsByTagName("track");for(var d=0;d<a.length;d++)Z.media.removeChild(a[d])}}else c(Z.container,h.classes.captions.enabled)}}function M(){if("video"===Z.type&&h.fullscreen.enabled){var e=g.supportsFullScreen;e||h.fullscreen.fallback&&!S()?(t((e?"Native":"Fallback")+" fullscreen enabled."),c(Z.container,h.classes.fullscreen.enabled,!0)):t("Fullscreen not supported and fallback disabled.")}}function I(){Z.media.play()}function V(){Z.media.pause()}function O(e){"number"!=typeof e&&(e=h.seekTime),L(Z.media.currentTime-e)}function P(e){"number"!=typeof e&&(e=h.seekTime),L(Z.media.currentTime+e)}function L(e){var n=0;"number"==typeof e?n=e:"object"!=typeof e||"change"!==e.type&&"input"!==e.type||(n=e.target.value/e.target.max*Z.media.duration),0>n?n=0:n>Z.media.duration&&(n=Z.media.duration),Z.media.currentTime=n.toFixed(1),t("Seeking to "+Z.media.currentTime+" seconds"),u(n)}function j(){c(Z.container,h.classes.playing,!Z.media.paused),c(Z.container,h.classes.stopped,Z.media.paused)}function q(e){var t=g.supportsFullScreen;e&&e.type===g.fullScreenEventName?h.fullscreen.active=g.isFullScreen():t?(g.isFullScreen()?g.cancelFullScreen():g.requestFullScreen(Z.container),h.fullscreen.active=g.isFullScreen()):(h.fullscreen.active=!h.fullscreen.active,h.fullscreen.active?(p(document,"keyup",H),document.body.style.overflow="hidden"):(d(document,"keyup",H),document.body.style.overflow="")),c(Z.container,h.classes.fullscreen.active,h.fullscreen.active)}function H(e){27===(e.which||e.charCode||e.keyCode)&&h.fullscreen.active&&q()}function B(e){"undefined"==typeof e&&(e=h.storage.enabled&&b().supported?window.localStorage[h.storage.key]||h.volume:h.volume),e>10&&(e=10),Z.volume.value=e,Z.media.volume=parseFloat(e/10),W(),h.storage.enabled&&b().supported&&(window.localStorage.plyr_volume=e)}function R(e){"undefined"==typeof active&&(e=!Z.media.muted,Z.buttons.mute.checked=e),Z.media.muted=e,W()}function D(e){"undefined"==typeof e&&(e=-1===Z.container.className.indexOf(h.classes.captions.active),Z.buttons.captions.checked=e),e?c(Z.container,h.classes.captions.active,!0):c(Z.container,h.classes.captions.active)}function W(){c(Z.container,h.classes.muted,0===Z.media.volume||Z.media.muted)}function _(e){var t="waiting"===e.type;clearTimeout(Z.loadingTimer),Z.loadingTimer=setTimeout(function(){c(Z.container,h.classes.loading,t)},t?250:0)}function U(e){var t=Z.progress.played.bar,n=Z.progress.played.text,r=0;if(e)switch(e.type){case"timeupdate":case"seeking":r=f(Z.media.currentTime,Z.media.duration),"timeupdate"==e.type&&(Z.buttons.seek.value=r);break;case"change":case"input":r=e.target.value;break;case"playing":case"progress":t=Z.progress.buffer.bar,n=Z.progress.buffer.text,r=function(){var e=Z.media.buffered;return e.length?f(e.end(0),Z.media.duration):0}()}t.value=r,n.innerHTML=r}function X(){Z.secs=parseInt(Z.media.currentTime%60),Z.mins=parseInt(Z.media.currentTime/60%60),Z.secs=("0"+Z.secs).slice(-2),Z.mins=("0"+Z.mins).slice(-2),Z.duration.innerHTML=Z.mins+":"+Z.secs}function J(e){X(),U(e)}function $(){for(var e=Z.media.querySelectorAll("source"),t=e.length-1;t>=0;t--)o(e[t]);Z.media.removeAttribute("src")}function z(e){if(e.src){var t=document.createElement("source");l(t,e),i(Z.media,t)}}function K(e){if(V(),L(),j(),$(),"string"==typeof e)Z.media.setAttribute("src",e);else if(e.constructor===Array)for(var t in e)z(e[t]);J(),Z.media.load(),null!==Z.media.getAttribute("autoplay")&&I()}function Y(e){"video"===Z.type&&Z.media.setAttribute("poster",e)}function G(){p(Z.buttons.play,"click",function(){I(),setTimeout(function(){Z.buttons.pause.focus()},100)}),p(Z.buttons.pause,"click",function(){V(),setTimeout(function(){Z.buttons.play.focus()},100)}),p(Z.buttons.restart,"click",L),p(Z.buttons.rewind,"click",O),p(Z.buttons.forward,"click",P),p(Z.volume,"change input",function(){B(this.value)}),p(Z.buttons.mute,"change",function(){R(this.checked)}),p(Z.buttons.fullscreen,"click",q),p(document,g.fullScreenEventName,q),"video"===Z.type&&h.click&&p(Z.videoContainer,"click",function(){Z.media.paused?I():Z.media.ended?(L(),I()):V()}),p(Z.media,"timeupdate seeking",J),p(Z.media,"timeupdate",u),p(Z.buttons.seek,"change input",L),p(Z.buttons.captions,"click",function(){D(this.checked)}),p(Z.media,"ended",function(){"video"===Z.type&&(Z.captionsContainer.innerHTML=""),j()}),p(Z.media,"progress",U),p(Z.media,"playing",U),p(Z.media,"volumechange",W),p(Z.media,"play pause",j),p(Z.media,"waiting canplay seeked",_)}function Q(){return g=y(),Z.browserInfo=n(),Z.browserName=Z.browserInfo[0],Z.browserMajorVersion=Z.browserInfo[1],t(Z.browserName+" "+Z.browserMajorVersion),"IE"!==Z.browserName||8!==Z.browserMajorVersion&&9!==Z.browserMajorVersion?(A(),Z.random=Math.floor(1e4*Math.random()),F(),N()?(E(),C(),B(),M(),G(),void 0):!1):(t("Browser not suppported.",!0),!1)}var Z=this;return Z.container=e,Q(),{media:Z.media,play:I,pause:V,restart:L,rewind:O,forward:P,seek:L,setVolume:B,toggleMute:R,toggleCaptions:D,source:K,poster:Y,support:function(e){return r(Z,e)}}}var g,h,k={enabled:!0,debug:!1,seekTime:10,volume:5,click:!0,tooltips:!1,selectors:{container:".player",controls:".player-controls",labels:"[data-player] .sr-only, label .sr-only",buttons:{seek:"[data-player='seek']",play:"[data-player='play']",pause:"[data-player='pause']",restart:"[data-player='restart']",rewind:"[data-player='rewind']",forward:"[data-player='fast-forward']",mute:"[data-player='mute']",volume:"[data-player='volume']",captions:"[data-player='captions']",fullscreen:"[data-player='fullscreen']"},progress:{container:".player-progress",buffer:".player-progress-buffer",played:".player-progress-played"},captions:".player-captions",duration:".player-duration"},classes:{video:"player-video",videoWrapper:"player-video-wrapper",audio:"player-audio",stopped:"stopped",playing:"playing",muted:"muted",loading:"loading",tooltip:"player-tooltip",hidden:"sr-only",captions:{enabled:"captions-enabled",active:"captions-active"},fullscreen:{enabled:"fullscreen-enabled",active:"fullscreen-active"}},captions:{defaultActive:!1},fullscreen:{enabled:!0,fallback:!0},storage:{enabled:!0,key:"plyr_volume"},html:function(){return["<div class='player-controls'>","<div class='player-progress'>","<label for='seek{id}' class='sr-only'>Seek</label>","<input id='seek{id}' class='player-progress-seek' type='range' min='0' max='100' step='0.5' value='0' data-player='seek'>","<progress class='player-progress-played' max='100' value='0'>","<span>0</span>% played","</progress>","<progress class='player-progress-buffer' max='100' value='0'>","<span>0</span>% buffered","</progress>","</div>","<span class='player-controls-playback'>","<button type='button' data-player='restart'>","<svg><use xlink:href='#icon-restart'></use></svg>","<span class='sr-only'>Restart</span>","</button>","<button type='button' data-player='rewind'>","<svg><use xlink:href='#icon-rewind'></use></svg>","<span class='sr-only'>Rewind {seektime} secs</span>","</button>","<button type='button' data-player='play'>","<svg><use xlink:href='#icon-play'></use></svg>","<span class='sr-only'>Play</span>","</button>","<button type='button' data-player='pause'>","<svg><use xlink:href='#icon-pause'></use></svg>","<span class='sr-only'>Pause</span>","</button>","<button type='button' data-player='fast-forward'>","<svg><use xlink:href='#icon-fast-forward'></use></svg>","<span class='sr-only'>Forward {seektime} secs</span>","</button>","<span class='player-time'>","<span class='sr-only'>Time</span>","<span class='player-duration'>00:00</span>","</span>","</span>","<span class='player-controls-sound'>","<input class='inverted sr-only' id='mute{id}' type='checkbox' data-player='mute'>","<label id='mute{id}' for='mute{id}'>","<svg class='icon-muted'><use xlink:href='#icon-muted'></use></svg>","<svg><use xlink:href='#icon-volume'></use></svg>","<span class='sr-only'>Toggle Mute</span>","</label>","<label for='volume{id}' class='sr-only'>Volume</label>","<input id='volume{id}' class='player-volume' type='range' min='0' max='10' value='5' data-player='volume'>","<input class='sr-only' id='captions{id}' type='checkbox' data-player='captions'>","<label for='captions{id}'>","<svg class='icon-captions-on'><use xlink:href='#icon-captions-on'></use></svg>","<svg><use xlink:href='#icon-captions-off'></use></svg>","<span class='sr-only'>Toggle Captions</span>","</label>","<button type='button' data-player='fullscreen'>","<svg class='icon-exit-fullscreen'><use xlink:href='#icon-exit-fullscreen'></use></svg>","<svg><use xlink:href='#icon-enter-fullscreen'></use></svg>","<span class='sr-only'>Toggle Fullscreen</span>","</button>","</span>","</div>"].join("\n")}()};e.setup=function(e){if(h=m(k,e),!h.enabled)return!1;for(var t=document.querySelectorAll(h.selectors.container),n=[],r=t.length-1;r>=0;r--){var s=t[r];"VIDEO"===s.querySelectorAll("audio, video")[0].tagName&&/iPhone/i.test(navigator.userAgent)||("undefined"==typeof s.plyr&&(s.plyr=new v(s)),n.push(s.plyr))}return n}}(this.plyr=this.plyr||{});
\ No newline at end of file +!function(e){"use strict";function t(){var e=["<div class='player-controls'>","<div class='player-progress'>","<label for='seek{id}' class='sr-only'>Seek</label>","<input id='seek{id}' class='player-progress-seek' type='range' min='0' max='100' step='0.5' value='0' data-player='seek'>","<progress class='player-progress-played' max='100' value='0'>","<span>0</span>% played","</progress>","<progress class='player-progress-buffer' max='100' value='0'>","<span>0</span>% buffered","</progress>","</div>","<span class='player-controls-left'>"];return o(F.controls,"restart")&&e.push("<button type='button' data-player='restart'>","<svg><use xlink:href='#icon-restart'></use></svg>","<span class='sr-only'>Restart</span>","</button>"),o(F.controls,"rewind")&&e.push("<button type='button' data-player='rewind'>","<svg><use xlink:href='#icon-rewind'></use></svg>","<span class='sr-only'>Rewind {seektime} secs</span>","</button>"),o(F.controls,"play")&&e.push("<button type='button' data-player='play'>","<svg><use xlink:href='#icon-play'></use></svg>","<span class='sr-only'>Play</span>","</button>","<button type='button' data-player='pause'>","<svg><use xlink:href='#icon-pause'></use></svg>","<span class='sr-only'>Pause</span>","</button>"),o(F.controls,"fast-forward")&&e.push("<button type='button' data-player='fast-forward'>","<svg><use xlink:href='#icon-fast-forward'></use></svg>","<span class='sr-only'>Forward {seektime} secs</span>","</button>"),o(F.controls,"current-time")&&e.push("<span class='player-time'>","<span class='sr-only'>Current time</span>","<span class='player-current-time'>00:00</span>","</span>"),o(F.controls,"duration")&&e.push("<span class='player-time'>","<span class='sr-only'>Duration</span>","<span class='player-duration'>00:00</span>","</span>"),e.push("</span>","<span class='player-controls-right'>"),o(F.controls,"mute")&&e.push("<input class='inverted sr-only' id='mute{id}' type='checkbox' data-player='mute'>","<label id='mute{id}' for='mute{id}'>","<svg class='icon-muted'><use xlink:href='#icon-muted'></use></svg>","<svg><use xlink:href='#icon-volume'></use></svg>","<span class='sr-only'>Toggle Mute</span>","</label>"),o(F.controls,"volume")&&e.push("<label for='volume{id}' class='sr-only'>Volume</label>","<input id='volume{id}' class='player-volume' type='range' min='0' max='10' value='5' data-player='volume'>"),o(F.controls,"captions")&&e.push("<input class='sr-only' id='captions{id}' type='checkbox' data-player='captions'>","<label for='captions{id}'>","<svg class='icon-captions-on'><use xlink:href='#icon-captions-on'></use></svg>","<svg><use xlink:href='#icon-captions-off'></use></svg>","<span class='sr-only'>Toggle Captions</span>","</label>"),o(F.controls,"fullscreen")&&e.push("<button type='button' data-player='fullscreen'>","<svg class='icon-exit-fullscreen'><use xlink:href='#icon-exit-fullscreen'></use></svg>","<svg><use xlink:href='#icon-enter-fullscreen'></use></svg>","<span class='sr-only'>Toggle Fullscreen</span>","</button>"),e.push("</span>","</div>"),e.join("")}function n(e,t){F.debug&&window.console&&console[t?"error":"log"](e)}function r(){var e,t,n,r=navigator.userAgent,s=navigator.appName,a=""+parseFloat(navigator.appVersion),o=parseInt(navigator.appVersion,10);return-1!==navigator.appVersion.indexOf("Windows NT")&&-1!==navigator.appVersion.indexOf("rv:11")?(s="IE",a="11;"):-1!==(t=r.indexOf("MSIE"))?(s="IE",a=r.substring(t+5)):-1!==(t=r.indexOf("Chrome"))?(s="Chrome",a=r.substring(t+7)):-1!==(t=r.indexOf("Safari"))?(s="Safari",a=r.substring(t+7),-1!==(t=r.indexOf("Version"))&&(a=r.substring(t+8))):-1!==(t=r.indexOf("Firefox"))?(s="Firefox",a=r.substring(t+8)):(e=r.lastIndexOf(" ")+1)<(t=r.lastIndexOf("/"))&&(s=r.substring(e,t),a=r.substring(t+1),s.toLowerCase()==s.toUpperCase()&&(s=navigator.appName)),-1!==(n=a.indexOf(";"))&&(a=a.substring(0,n)),-1!==(n=a.indexOf(" "))&&(a=a.substring(0,n)),o=parseInt(""+a,10),isNaN(o)&&(a=""+parseFloat(navigator.appVersion),o=parseInt(navigator.appVersion,10)),{name:s,version:o,ios:/(iPad|iPhone|iPod)/g.test(navigator.platform)}}function s(e,t){var n=e.media;if("video"==e.type)switch(t){case"video/webm":return!(!n.canPlayType||!n.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/no/,""));case"video/mp4":return!(!n.canPlayType||!n.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"').replace(/no/,""));case"video/ogg":return!(!n.canPlayType||!n.canPlayType('video/ogg; codecs="theora"').replace(/no/,""))}else if("audio"==e.type)switch(t){case"audio/mpeg":return!(!n.canPlayType||!n.canPlayType("audio/mpeg;").replace(/no/,""));case"audio/ogg":return!(!n.canPlayType||!n.canPlayType('audio/ogg; codecs="vorbis"').replace(/no/,""));case"audio/wav":return!(!n.canPlayType||!n.canPlayType('audio/wav; codecs="1"').replace(/no/,""))}return!1}function a(e){if(!document.querySelectorAll("script[src='"+e+"']").length){var t=document.createElement("script");t.src=e;var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(t,n)}}function o(e,t){return Array.prototype.indexOf&&-1!=e.indexOf(t)}function i(e,t,n){return e.replace(new RegExp(t.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"),"g"),n)}function l(e,t){e.length||(e=[e]);for(var n=e.length-1;n>=0;n--){var r=n>0?t.cloneNode(!0):t,s=e[n],a=s.parentNode,o=s.nextSibling;r.appendChild(s),o?a.insertBefore(r,o):a.appendChild(r)}}function u(e){e.parentNode.removeChild(e)}function c(e,t){e.insertBefore(t,e.firstChild)}function p(e,t){for(var n in t)e.setAttribute(n,t[n])}function d(e,t,n){if(e)if(e.classList)e.classList[n?"add":"remove"](t);else{var r=(" "+e.className+" ").replace(/\s+/g," ").replace(" "+t+" ","");e.className=r+(n?" "+t:"")}}function f(e,t,n,r){if(t=t.split(" "),e instanceof NodeList)for(var s=0;s<e.length;s++)e[s]instanceof Node&&f(e[s],arguments[1],arguments[2],arguments[3]);else for(var a=0;a<t.length;a++)e[r?"addEventListener":"removeEventListener"](t[a],n,!1)}function m(e,t,n){e&&f(e,t,n,!0)}function y(e,t,n){e&&f(e,t,n,!1)}function b(e,t){var n=document.createEvent("MouseEvents");n.initEvent(t,!0,!0),e.dispatchEvent(n)}function v(e){return e.keyCode&&13!=e.keyCode?!0:(e.target.checked=!e.target.checked,b(e.target,"change"),void 0)}function g(e,t){return 0===e||0===t||isNaN(e)||isNaN(t)?0:(e/t*100).toFixed(2)}function h(e,t){for(var n in t)t[n]&&t[n].constructor&&t[n].constructor===Object?(e[n]=e[n]||{},h(e[n],t[n])):e[n]=t[n];return e}function k(){var e={supportsFullScreen:!1,isFullScreen:function(){return!1},requestFullScreen:function(){},cancelFullScreen:function(){},fullScreenEventName:"",element:null,prefix:""},t="webkit moz o ms khtml".split(" ");if("undefined"!=typeof document.cancelFullScreen)e.supportsFullScreen=!0;else for(var n=0,r=t.length;r>n;n++){if(e.prefix=t[n],"undefined"!=typeof document[e.prefix+"CancelFullScreen"]){e.supportsFullScreen=!0;break}if("undefined"!=typeof document.msExitFullscreen&&document.msFullscreenEnabled){e.prefix="ms",e.supportsFullScreen=!0;break}}return"webkit"===e.prefix&&navigator.userAgent.match(/Version\/[\d\.]+.*Safari/)&&(e.supportsFullScreen=!1),e.supportsFullScreen&&(e.fullScreenEventName="ms"==e.prefix?"MSFullscreenChange":e.prefix+"fullscreenchange",e.isFullScreen=function(e){switch("undefined"==typeof e&&(e=document),this.prefix){case"":return document.fullscreenElement==e;case"moz":return document.mozFullScreenElement==e;default:return document[this.prefix+"FullscreenElement"]==e}},e.requestFullScreen=function(e){return""===this.prefix?e.requestFullScreen():e[this.prefix+("ms"==this.prefix?"RequestFullscreen":"RequestFullScreen")]("webkit"===this.prefix?e.ALLOW_KEYBOARD_INPUT:null)},e.cancelFullScreen=function(){return""===this.prefix?document.cancelFullScreen():document[this.prefix+("ms"==this.prefix?"ExitFullscreen":"CancelFullScreen")]()},e.element=function(){return""===this.prefix?document.fullscreenElement:document[this.prefix+"FullscreenElement"]}),e}function w(){var e={supported:function(){try{return"localStorage"in window&&null!==window.localStorage}catch(e){return!1}}()};return e}function x(o){function f(e){if(!ot.usingTextTracks&&"video"===ot.type&&ot.supported.full){for(ot.subcount=0,e="number"==typeof e?e:ot.media.currentTime;S(ot.captions[ot.subcount][0])<e.toFixed(1);)if(ot.subcount++,ot.subcount>ot.captions.length-1){ot.subcount=ot.captions.length-1;break}ot.media.currentTime.toFixed(1)>=x(ot.captions[ot.subcount][0])&&ot.media.currentTime.toFixed(1)<=S(ot.captions[ot.subcount][0])?(ot.currentCaption=ot.captions[ot.subcount][1],ot.captionsContainer.innerHTML=ot.currentCaption):ot.captionsContainer.innerHTML=""}}function h(){ot.buttons.captions&&(d(ot.container,F.classes.captions.enabled,!0),F.captions.defaultActive&&(d(ot.container,F.classes.captions.active,!0),ot.buttons.captions.checked=!0))}function x(e){var t=[];return t=e.split(" --> "),C(t[0])}function S(e){var t=[];return t=e.split(" --> "),C(t[1])}function C(e){if(null===e||void 0===e)return 0;var t,n=[],r=[];return n=e.split(","),r=n[0].split(":"),t=Math.floor(60*r[0]*60)+Math.floor(60*r[1])+Math.floor(r[2])}function E(e){return ot.container.querySelectorAll(e)}function A(e){return E(e)[0]}function N(){try{return window.self!==window.top}catch(e){return!0}}function P(){var e=F.html;if(n("Injecting custom controls."),e||(e=t()),e=i(e,"{seektime}",F.seekTime),e=i(e,"{id}",Math.floor(1e4*Math.random())),ot.container.insertAdjacentHTML("beforeend",e),F.tooltips)for(var r=E(F.selectors.labels),s=r.length-1;s>=0;s--){var a=r[s];d(a,F.classes.hidden,!1),d(a,F.classes.tooltip,!0)}}function I(){try{return ot.controls=A(F.selectors.controls),ot.buttons={},ot.buttons.seek=A(F.selectors.buttons.seek),ot.buttons.play=A(F.selectors.buttons.play),ot.buttons.pause=A(F.selectors.buttons.pause),ot.buttons.restart=A(F.selectors.buttons.restart),ot.buttons.rewind=A(F.selectors.buttons.rewind),ot.buttons.forward=A(F.selectors.buttons.forward),ot.buttons.fullscreen=A(F.selectors.buttons.fullscreen),ot.buttons.mute=A(F.selectors.buttons.mute),ot.buttons.captions=A(F.selectors.buttons.captions),ot.checkboxes=E("[type='checkbox']"),ot.progress={},ot.progress.container=A(F.selectors.progress.container),ot.progress.buffer={},ot.progress.buffer.bar=A(F.selectors.progress.buffer),ot.progress.buffer.text=ot.progress.buffer.bar&&ot.progress.buffer.bar.getElementsByTagName("span")[0],ot.progress.played={},ot.progress.played.bar=A(F.selectors.progress.played),ot.progress.played.text=ot.progress.played.bar&&ot.progress.played.bar.getElementsByTagName("span")[0],ot.volume=A(F.selectors.buttons.volume),ot.duration=A(F.selectors.duration),ot.currentTime=A(F.selectors.currentTime),ot.seekTime=E(F.selectors.seekTime),!0}catch(e){return n("It looks like there's a problem with your controls html. Bailing.",!0),ot.media.setAttribute("controls",""),!1}}function M(){if(ot.buttons.play){var e=ot.buttons.play.innerText||"Play";"undefined"!=typeof F.title&&F.title.length&&(e+=", "+F.title),ot.buttons.play.setAttribute("aria-label",e)}}function L(){if(!ot.media)return n("No audio or video element found!",!0),!1;if(ot.supported.full&&(ot.media.removeAttribute("controls"),d(ot.container,F.classes[ot.type],!0),d(ot.container,F.classes.stopped,null===ot.media.getAttribute("autoplay")),ot.browser.ios&&d(ot.container,"ios",!0),"video"===ot.type)){var e=document.createElement("div");e.setAttribute("class",F.classes.videoWrapper),l(ot.media,e),ot.videoContainer=e;var t=ot.media.querySelectorAll("source")[0],r=t.src.match(F.youtube.regex);"video/youtube"==t.type&&r&&11==r[2].length&&O(r[2])}null!==ot.media.getAttribute("autoplay")&&R()}function O(e){ot.embed=!0,ot.media.style.display="none";var t=document.createElement("iframe");t.src="https://www.youtube.com/embed/"+e+"?rel=0&vq=hd720&iv_load_policy=3&controls=0&autoplay=0&showinfo=0&wmode=transparent&?enablejsapi=1",t.id="youtube"+Math.floor(1e4*Math.random()),d(ot.videoContainer,F.classes.embedWrapper,!0),ot.videoContainer.appendChild(t),a("https://www.youtube.com/iframe_api"),window.onYouTubeIframeAPIReady=function(){n("YouTube API Ready"),n(t.id),n(e),ot.youtube=new YT.Player(t.id,{events:{onStateChange:function(e){console.log(e)}}})}}function q(){if("video"===ot.type){ot.videoContainer.insertAdjacentHTML("afterbegin","<div class='"+F.selectors.captions.replace(".","")+"'></div>"),ot.captionsContainer=A(F.selectors.captions),ot.usingTextTracks=!1,ot.media.textTracks&&(ot.usingTextTracks=!0);for(var e,t="",r=ot.media.childNodes,s=0;s<r.length;s++)"track"===r[s].nodeName.toLowerCase()&&(e=r[s].getAttribute("kind"),"captions"===e&&(t=r[s].getAttribute("src")));if(ot.captionExists=!0,""===t?(ot.captionExists=!1,n("No caption track found.")):n("Caption track found; URI: "+t),ot.captionExists){for(var a=ot.media.textTracks,o=0;o<a.length;o++)a[o].mode="hidden";if(h(ot),("IE"===ot.browser.name&&10===ot.browser.version||"IE"===ot.browser.name&&11===ot.browser.version||"Firefox"===ot.browser.name&&ot.browser.version>=31||"Safari"===ot.browser.name&&ot.browser.version>=7)&&(n("Detected IE 10/11 or Firefox 31+ or Safari 7+."),ot.usingTextTracks=!1),ot.usingTextTracks){n("TextTracks supported.");for(var i=0;i<a.length;i++){var l=a[i];"captions"===l.kind&&m(l,"cuechange",function(){ot.captionsContainer.innerHTML="",this.activeCues[0]&&this.activeCues[0].hasOwnProperty("text")&&ot.captionsContainer.appendChild(this.activeCues[0].getCueAsHTML())})}}else if(n("TextTracks not supported so rendering captions manually."),ot.currentCaption="",ot.captions=[],""!==t){var u=new XMLHttpRequest;u.onreadystatechange=function(){if(4===u.readyState)if(200===u.status){var e,t=[],r=u.responseText;t=r.split("\n\n");for(var s=0;s<t.length;s++)e=t[s],ot.captions[s]=[],ot.captions[s]=e.split("\n");ot.captions.shift(),n("Successfully loaded the caption file via AJAX.")}else n("There was a problem loading the caption file via AJAX.",!0)},u.open("get",t,!0),u.send()}if("Safari"===ot.browser.name&&ot.browser.version>=7){n("Safari 7+ detected; removing track from DOM."),a=ot.media.getElementsByTagName("track");for(var c=0;c<a.length;c++)ot.media.removeChild(a[c])}}else d(ot.container,F.classes.captions.enabled)}}function H(){if("video"===ot.type&&F.fullscreen.enabled){var e=T.supportsFullScreen;e||F.fullscreen.fallback&&!N()?(n((e?"Native":"Fallback")+" fullscreen enabled."),d(ot.container,F.classes.fullscreen.enabled,!0)):n("Fullscreen not supported and fallback disabled."),F.fullscreen.hideControls&&d(ot.container,F.classes.fullscreen.hideControls,!0)}}function R(){ot.media.play()}function V(){ot.media.pause()}function B(e){"number"!=typeof e&&(e=F.seekTime),D(ot.media.currentTime-e)}function j(e){"number"!=typeof e&&(e=F.seekTime),D(ot.media.currentTime+e)}function D(e){var t=0;"number"==typeof e?t=e:"object"!=typeof e||"input"!==e.type&&"change"!==e.type||(t=e.target.value/e.target.max*ot.media.duration),0>t?t=0:t>ot.media.duration&&(t=ot.media.duration);try{ot.media.currentTime=t.toFixed(1)}catch(r){}n("Seeking to "+ot.media.currentTime+" seconds"),f(t)}function W(){d(ot.container,F.classes.playing,!ot.media.paused),d(ot.container,F.classes.stopped,ot.media.paused)}function _(e){var t=T.supportsFullScreen;e&&e.type===T.fullScreenEventName?ot.isFullscreen=T.isFullScreen(ot.container):t?(T.isFullScreen(ot.container)?T.cancelFullScreen():T.requestFullScreen(ot.container),ot.isFullscreen=T.isFullScreen(ot.container)):(ot.isFullscreen=!ot.isFullscreen,ot.isFullscreen?(m(document,"keyup",Y),document.body.style.overflow="hidden"):(y(document,"keyup",Y),document.body.style.overflow="")),d(ot.container,F.classes.fullscreen.active,ot.isFullscreen),ot.isFullscreen&&d(ot.controls,F.classes.hover,!1)}function Y(e){27===(e.which||e.charCode||e.keyCode)&&ot.isFullscreen&&_()}function z(e){ot.volume&&("undefined"==typeof e&&(e=F.storage.enabled&&w().supported?window.localStorage[F.storage.key]||F.volume:F.volume),e>10&&(e=10),ot.supported.full&&(ot.volume.value=e),ot.media.volume=parseFloat(e/10),J(),F.storage.enabled&&w().supported&&window.localStorage.setItem(F.storage.key,e))}function U(e){"undefined"==typeof e&&(e=!ot.media.muted),ot.supported.full&&(ot.buttons.mute.checked=e),ot.media.muted=e,J()}function X(e){ot.supported.full&&ot.buttons.captions&&("undefined"==typeof e&&(e=-1===ot.container.className.indexOf(F.classes.captions.active),ot.buttons.captions.checked=e),d(ot.container,F.classes.captions.active,e))}function J(){d(ot.container,F.classes.muted,0===ot.media.volume||ot.media.muted)}function $(e){var t="waiting"===e.type;clearTimeout(ot.loadingTimer),ot.loadingTimer=setTimeout(function(){d(ot.container,F.classes.loading,t)},t?250:0)}function K(e){var t=ot.progress.played.bar,n=ot.progress.played.text,r=0;if(e)switch(e.type){case"timeupdate":case"seeking":r=g(ot.media.currentTime,ot.media.duration),"timeupdate"==e.type&&ot.buttons.seek&&(ot.buttons.seek.value=r);break;case"change":case"input":r=e.target.value;break;case"playing":case"progress":t=ot.progress.buffer.bar,n=ot.progress.buffer.text,r=function(){var e=ot.media.buffered;return e.length?g(e.end(0),ot.media.duration):0}()}t&&(t.value=r),n&&(n.innerHTML=r)}function G(e,t){if(t){ot.secs=parseInt(e%60),ot.mins=parseInt(e/60%60),ot.hours=parseInt(e/60/60%60);var n=parseInt(ot.media.duration/60/60%60)>0;ot.secs=("0"+ot.secs).slice(-2),ot.mins=("0"+ot.mins).slice(-2),t.innerHTML=(n?ot.hours+":":"")+ot.mins+":"+ot.secs}}function Q(){var e=ot.media.duration||0;!ot.duration&&F.displayDuration&&ot.media.paused&&G(e,ot.currentTime),ot.duration&&G(e,ot.duration)}function Z(e){G(ot.media.currentTime,ot.currentTime),K(e)}function et(){for(var e=ot.media.querySelectorAll("source"),t=e.length-1;t>=0;t--)u(e[t]);ot.media.removeAttribute("src")}function tt(e){if(e.src){var t=document.createElement("source");p(t,e),c(ot.media,t)}}function nt(e){if(V(),D(),et(),"string"==typeof e)ot.media.setAttribute("src",e);else if(e.constructor===Array)for(var t in e)tt(e[t]);ot.supported.full&&(Z(),W()),ot.media.load(),null!==ot.media.getAttribute("autoplay")&&R()}function rt(e){"video"===ot.type&&ot.media.setAttribute("poster",e)}function st(){var e="IE"==ot.browser.name?"change":"input";m(ot.buttons.play,"click",function(){R(),setTimeout(function(){ot.buttons.pause.focus()},100)}),m(ot.buttons.pause,"click",function(){V(),setTimeout(function(){ot.buttons.play.focus()},100)}),m(ot.buttons.restart,"click",D),m(ot.buttons.rewind,"click",B),m(ot.buttons.forward,"click",j),m(ot.buttons.seek,e,D),m(ot.volume,e,function(){z(this.value)}),m(ot.buttons.mute,"change",function(){U(this.checked)}),m(ot.buttons.fullscreen,"click",_),T.supportsFullScreen&&m(document,T.fullScreenEventName,_),m(ot.media,"timeupdate seeking",Z),m(ot.media,"timeupdate",f),m(ot.media,"loadedmetadata",Q),m(ot.buttons.captions,"change",function(){X(this.checked)}),m(ot.media,"ended",function(){"video"===ot.type&&(ot.captionsContainer.innerHTML=""),W()}),m(ot.media,"progress",K),m(ot.media,"playing",K),m(ot.media,"volumechange",J),m(ot.media,"play pause",W),m(ot.media,"waiting canplay seeked",$),m(ot.checkboxes,"keyup",v),"video"===ot.type&&F.click&&m(ot.videoContainer,"click",function(){ot.media.paused?b(ot.buttons.play,"click"):ot.media.ended?(D(),b(ot.buttons.play,"click")):b(ot.buttons.pause,"click")}),F.fullscreen.hideControls&&m(ot.controls,"mouseenter mouseleave",function(e){d(ot.controls,F.classes.hover,"mouseenter"===e.type)})}function at(){if(T=k(),ot.browser=r(),ot.media=ot.container.querySelectorAll("audio, video")[0],ot.type=ot.media.tagName.toLowerCase(),ot.supported=e.supported(ot.type),!ot.supported.basic)return!1;if(n(ot.browser.name+" "+ot.browser.version),L(),ot.supported.full){if(P(),!I())return!1;F.displayDuration&&Q(),M(),ot.embed||q(),z(),H(),st()}return!0}var ot=this;return ot.container=o,at()?{media:ot.media,play:R,pause:V,restart:D,rewind:B,forward:j,seek:D,source:nt,poster:rt,setVolume:z,toggleMute:U,toggleCaptions:X,toggleFullscreen:_,isFullscreen:function(){return ot.isFullscreen||!1},support:function(e){return s(ot,e)}}:{}}var T,F,S={enabled:!0,debug:!1,seekTime:10,volume:5,click:!0,tooltips:!1,displayDuration:!0,selectors:{container:".player",controls:".player-controls",labels:"[data-player] .sr-only, label .sr-only",buttons:{seek:"[data-player='seek']",play:"[data-player='play']",pause:"[data-player='pause']",restart:"[data-player='restart']",rewind:"[data-player='rewind']",forward:"[data-player='fast-forward']",mute:"[data-player='mute']",volume:"[data-player='volume']",captions:"[data-player='captions']",fullscreen:"[data-player='fullscreen']"},progress:{container:".player-progress",buffer:".player-progress-buffer",played:".player-progress-played"},captions:".player-captions",currentTime:".player-current-time",duration:".player-duration"},classes:{video:"player-video",videoWrapper:"player-video-wrapper",embedWrapper:"player-video-embed",audio:"player-audio",stopped:"stopped",playing:"playing",muted:"muted",loading:"loading",tooltip:"player-tooltip",hidden:"sr-only",hover:"hover",captions:{enabled:"captions-enabled",active:"captions-active"},fullscreen:{enabled:"fullscreen-enabled",active:"fullscreen-active",hideControls:"fullscreen-hide-controls"}},captions:{defaultActive:!1},fullscreen:{enabled:!0,fallback:!0,hideControls:!0},storage:{enabled:!0,key:"plyr_volume"},controls:["restart","rewind","play","fast-forward","current-time","duration","mute","volume","captions","fullscreen"],onSetup:function(){},youtube:{regex:/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/}};e.supported=function(e){var t,n,s=r(),a="IE"===s.name&&s.version<=9,o=/iPhone|iPod/i.test(navigator.userAgent),i=!!document.createElement("audio").canPlayType,l=!!document.createElement("video").canPlayType;switch(e){case"video":t=l,n=t&&!a&&!o;break;case"audio":t=i,n=t&&!a;break;default:t=i&&l,n=t&&!a}return{basic:t,full:n}},e.setup=function(t){if(F=h(S,t),!F.enabled||!e.supported().basic)return!1;for(var n=document.querySelectorAll(F.selectors.container),r=[],s=n.length-1;s>=0;s--){var a=n[s];if("undefined"==typeof a.plyr){var o=new x(a);a.plyr=Object.keys(o).length?o:!1,F.onSetup.apply(a.plyr)}r.push(a.plyr)}return r}}(this.plyr=this.plyr||{});
\ No newline at end of file diff --git a/docs/dist/docs.css b/docs/dist/docs.css index 7737f4d8..55fb76d7 100644 --- a/docs/dist/docs.css +++ b/docs/dist/docs.css @@ -1 +1 @@ -/*! normalize.css v2.1.3 | MIT License | git.io/normalize */article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,video{display:inline-block}audio:not([controls]){display:none;height:0}[hidden],template{display:none}html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}a{background:0 0}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}dfn{font-style:italic}hr{box-sizing:content-box;height:0}mark{background:#ff0;color:#000}code,kbd,pre,samp{font-family:monospace,serif;font-size:1em}pre{white-space:pre-wrap}q{quotes:"\201C" "\201D" "\2018" "\2019"}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:0}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{border:0;padding:0}button,input,select,textarea{font-family:inherit;font-size:100%;margin:0}button,input{line-height:normal}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=search]{-webkit-appearance:textfield;box-sizing:content-box}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}textarea{overflow:auto;vertical-align:top}table{border-collapse:collapse;border-spacing:0}@font-face{font-family:Avenir;src:url(//cdn.plyr.io/fonts/avenir-medium.woff2) format("woff2"),url(//cdn.plyr.io/fonts/avenir-medium.woff) format("woff"),url(//cdn.plyr.io/fonts/avenir-medium.ttf) format("truetype");font-style:normal;font-weight:400}@font-face{font-family:Avenir;src:url(//cdn.plyr.io/fonts/avenir-bold.woff2) format("woff2"),url(//cdn.plyr.io/fonts/avenir-bold.woff) format("woff"),url(//cdn.plyr.io/fonts/avenir-bold.ttf) format("truetype");font-style:normal;font-weight:600}*,::after,::before{box-sizing:border-box}body{font-family:Avenir,"Helvetica Neue",Helvetica,Arial,sans-serif;background:#fff;line-height:1.5;text-align:center;color:#6D797F}.error body,html.error{height:100%}.error body{width:100%;display:table;table-layout:fixed}.error main{display:table-cell;width:100%;vertical-align:middle}h1,h2{letter-spacing:-.025em;color:#2E3C44;margin:0 0 10px;line-height:1.2;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}h1{font-size:64px;font-size:4rem;color:#3498DB}p,small{margin:0 0 20px}small{display:block;padding:0 10px;font-size:14px;font-size:.9rem}header{padding:20px;margin-bottom:20px}header p{font-size:18px;font-size:1.1rem}@media (min-width:560px){header{padding-top:60px;padding-bottom:60px}}section{padding-bottom:20px}@media (min-width:560px){section{padding-bottom:40px}}a{text-decoration:none;color:#3498db;border-bottom:1px solid currentColor;transition:all .3s ease}a:focus,a:hover{color:#000}a:focus{outline:#343f4a dotted thin;outline-offset:1px}a.logo{border:0}.btn{display:inline-block;padding:10px 30px;background:#3498db;border:0;color:#fff;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-weight:600;border-radius:3px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.btn:focus,.btn:hover{color:#fff;background:#258cd1}.example-audio .player{max-width:480px}.example-video .player{max-width:1200px}.example-audio .player,.example-video .player{margin:0 auto 20px}.example-audio .player-fullscreen,.example-audio .player.fullscreen-active,.example-video .player-fullscreen,.example-video .player.fullscreen-active{max-width:none}footer{margin-bottom:20px}footer p{margin-bottom:10px}
\ No newline at end of file +/*! normalize.css v2.1.3 | MIT License | git.io/normalize */article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,video{display:inline-block}audio:not([controls]){display:none;height:0}[hidden],template{display:none}html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}a{background:0 0}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}dfn{font-style:italic}hr{box-sizing:content-box;height:0}mark{background:#ff0;color:#000}code,kbd,pre,samp{font-family:monospace,serif;font-size:1em}pre{white-space:pre-wrap}q{quotes:"\201C" "\201D" "\2018" "\2019"}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:0}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{border:0;padding:0}button,input,select,textarea{font-family:inherit;font-size:100%;margin:0}button,input{line-height:normal}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=search]{-webkit-appearance:textfield;box-sizing:content-box}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}textarea{overflow:auto;vertical-align:top}table{border-collapse:collapse;border-spacing:0}@font-face{font-family:Avenir;src:url(//cdn.plyr.io/fonts/avenir-medium.woff2) format("woff2"),url(//cdn.plyr.io/fonts/avenir-medium.woff) format("woff"),url(//cdn.plyr.io/fonts/avenir-medium.ttf) format("truetype");font-style:normal;font-weight:400}@font-face{font-family:Avenir;src:url(//cdn.plyr.io/fonts/avenir-bold.woff2) format("woff2"),url(//cdn.plyr.io/fonts/avenir-bold.woff) format("woff"),url(//cdn.plyr.io/fonts/avenir-bold.ttf) format("truetype");font-style:normal;font-weight:600}*,::after,::before{box-sizing:border-box}body{font-family:Avenir,"Helvetica Neue",Helvetica,Arial,sans-serif;background:#fff;line-height:1.5;text-align:center;color:#6D797F}.error body,html.error{height:100%}.error body{width:100%;display:table;table-layout:fixed}.error main{display:table-cell;width:100%;vertical-align:middle}h1,h2{letter-spacing:-.025em;color:#2E3C44;margin:0 0 10px;line-height:1.2;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}h1{font-size:64px;font-size:4rem;color:#3498DB}p,small{margin:0 0 20px}small{display:block;padding:0 10px;font-size:14px;font-size:.9rem}header{padding:20px;margin-bottom:20px}header p{font-size:18px;font-size:1.1rem}@media (min-width:560px){header{padding-top:60px;padding-bottom:60px}}section{padding-bottom:20px}@media (min-width:560px){section{padding-bottom:40px}}a{text-decoration:none;color:#3498db;border-bottom:1px solid currentColor;transition:all .3s ease}a:focus,a:hover{color:#000}a:focus{outline:#343f4a dotted thin;outline-offset:1px}a.logo{border:0}.btn{display:inline-block;padding:10px 30px;background:#3498db;border:0;color:#fff;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-weight:600;border-radius:3px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.btn:focus,.btn:hover{color:#fff;background:#258cd1}.example-audio .player{max-width:520px}.example-video .player{max-width:1200px}.example-audio .player,.example-video .player{margin:0 auto 20px}.example-audio .player-fullscreen,.example-audio .player.fullscreen-active,.example-video .player-fullscreen,.example-video .player.fullscreen-active{max-width:none}footer{margin-bottom:20px}footer p{margin-bottom:10px}
\ No newline at end of file diff --git a/docs/dist/docs.js b/docs/dist/docs.js index 3d9b0748..b478db69 100644 --- a/docs/dist/docs.js +++ b/docs/dist/docs.js @@ -1 +1 @@ -var Hogan={};!function(t){function n(t,n,e){var s;return n&&"object"==typeof n&&(void 0!==n[t]?s=n[t]:e&&n.get&&"function"==typeof n.get&&(s=n.get(t))),s}function e(t,n,e,s,r,a){function i(){}function o(){}i.prototype=t,o.prototype=t.subs;var l,u=new i;u.subs=new o,u.subsText={},u.buf="",s=s||{},u.stackSubs=s,u.subsText=a;for(l in n)s[l]||(s[l]=n[l]);for(l in s)u.subs[l]=s[l];r=r||{},u.stackPartials=r;for(l in e)r[l]||(r[l]=e[l]);for(l in r)u.partials[l]=r[l];return u}function s(t){return String(null===t||void 0===t?"":t)}function r(t){return t=s(t),c.test(t)?t.replace(a,"&").replace(i,"<").replace(o,">").replace(l,"'").replace(u,"""):t}t.Template=function(t,n,e,s){t=t||{},this.r=t.code||this.r,this.c=e,this.options=s||{},this.text=n||"",this.partials=t.partials||{},this.subs=t.subs||{},this.buf=""},t.Template.prototype={r:function(){return""},v:r,t:s,render:function(t,n,e){return this.ri([t],n||{},e)},ri:function(t,n,e){return this.r(t,n,e)},ep:function(t,n){var s=this.partials[t],r=n[s.name];if(s.instance&&s.base==r)return s.instance;if("string"==typeof r){if(!this.c)throw new Error("No compiler available.");r=this.c.compile(r,this.options)}if(!r)return null;if(this.partials[t].base=r,s.subs){n.stackText||(n.stackText={});for(key in s.subs)n.stackText[key]||(n.stackText[key]=void 0!==this.activeSub&&n.stackText[this.activeSub]?n.stackText[this.activeSub]:this.text);r=e(r,s.subs,s.partials,this.stackSubs,this.stackPartials,n.stackText)}return this.partials[t].instance=r,r},rp:function(t,n,e,s){var r=this.ep(t,e);return r?r.ri(n,e,s):""},rs:function(t,n,e){var s=t[t.length-1];if(!p(s))return e(t,n,this),void 0;for(var r=0;r<s.length;r++)t.push(s[r]),e(t,n,this),t.pop()},s:function(t,n,e,s,r,a,i){var o;return p(t)&&0===t.length?!1:("function"==typeof t&&(t=this.ms(t,n,e,s,r,a,i)),o=!!t,!s&&o&&n&&n.push("object"==typeof t?t:n[n.length-1]),o)},d:function(t,e,s,r){var a,i=t.split("."),o=this.f(i[0],e,s,r),l=this.options.modelGet,u=null;if("."===t&&p(e[e.length-2]))o=e[e.length-1];else for(var c=1;c<i.length;c++)a=n(i[c],o,l),void 0!==a?(u=o,o=a):o="";return r&&!o?!1:(r||"function"!=typeof o||(e.push(u),o=this.mv(o,e,s),e.pop()),o)},f:function(t,e,s,r){for(var a=!1,i=null,o=!1,l=this.options.modelGet,u=e.length-1;u>=0;u--)if(i=e[u],a=n(t,i,l),void 0!==a){o=!0;break}return o?(r||"function"!=typeof a||(a=this.mv(a,e,s)),a):r?!1:""},ls:function(t,n,e,r,a){var i=this.options.delimiters;return this.options.delimiters=a,this.b(this.ct(s(t.call(n,r)),n,e)),this.options.delimiters=i,!1},ct:function(t,n,e){if(this.options.disableLambda)throw new Error("Lambda features disabled.");return this.c.compile(t,this.options).render(n,e)},b:function(t){this.buf+=t},fl:function(){var t=this.buf;return this.buf="",t},ms:function(t,n,e,s,r,a,i){var o,l=n[n.length-1],u=t.call(l);return"function"==typeof u?s?!0:(o=this.activeSub&&this.subsText&&this.subsText[this.activeSub]?this.subsText[this.activeSub]:this.text,this.ls(u,l,e,o.substring(r,a),i)):u},mv:function(t,n,e){var r=n[n.length-1],a=t.call(r);return"function"==typeof a?this.ct(s(a.call(r)),r,e):a},sub:function(t,n,e,s){var r=this.subs[t];r&&(this.activeSub=t,r(n,e,this,s),this.activeSub=!1)}};var a=/&/g,i=/</g,o=/>/g,l=/\'/g,u=/\"/g,c=/[&<>\"\']/,p=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}}("undefined"!=typeof exports?exports:Hogan),function(t){function n(t){"}"===t.n.substr(t.n.length-1)&&(t.n=t.n.substring(0,t.n.length-1))}function e(t){return t.trim?t.trim():t.replace(/^\s*|\s*$/g,"")}function s(t,n,e){if(n.charAt(e)!=t.charAt(0))return!1;for(var s=1,r=t.length;r>s;s++)if(n.charAt(e+s)!=t.charAt(s))return!1;return!0}function r(n,e,s,o){var l=[],u=null,c=null,p=null;for(c=s[s.length-1];n.length>0;){if(p=n.shift(),c&&"<"==c.tag&&!(p.tag in k))throw new Error("Illegal content in < super tag.");if(t.tags[p.tag]<=t.tags.$||a(p,o))s.push(p),p.nodes=r(n,p.tag,s,o);else{if("/"==p.tag){if(0===s.length)throw new Error("Closing tag without opener: /"+p.n);if(u=s.pop(),p.n!=u.n&&!i(p.n,u.n,o))throw new Error("Nesting error: "+u.n+" vs. "+p.n);return u.end=p.i,l}"\n"==p.tag&&(p.last=0==n.length||"\n"==n[0].tag)}l.push(p)}if(s.length>0)throw new Error("missing closing tag: "+s.pop().n);return l}function a(t,n){for(var e=0,s=n.length;s>e;e++)if(n[e].o==t.n)return t.tag="#",!0}function i(t,n,e){for(var s=0,r=e.length;r>s;s++)if(e[s].c==t&&e[s].o==n)return!0}function o(t){var n=[];for(var e in t)n.push('"'+u(e)+'": function(c,p,t,i) {'+t[e]+"}");return"{ "+n.join(",")+" }"}function l(t){var n=[];for(var e in t.partials)n.push('"'+u(e)+'":{name:"'+u(t.partials[e].name)+'", '+l(t.partials[e])+"}");return"partials: {"+n.join(",")+"}, subs: "+o(t.subs)}function u(t){return t.replace(y,"\\\\").replace(g,'\\"').replace(d,"\\n").replace(v,"\\r").replace(m,"\\u2028").replace(x,"\\u2029")}function c(t){return~t.indexOf(".")?"d":"f"}function p(t,n){var e="<"+(n.prefix||""),s=e+t.n+w++;return n.partials[s]={name:t.n,partials:{}},n.code+='t.b(t.rp("'+u(s)+'",c,p,"'+(t.indent||"")+'"));',s}function b(t,n){n.code+="t.b(t.t(t."+c(t.n)+'("'+u(t.n)+'",c,p,0)));'}function f(t){return"t.b("+t+");"}var h=/\S/,g=/\"/g,d=/\n/g,v=/\r/g,y=/\\/g,m=/\u2028/,x=/\u2029/;t.tags={"#":1,"^":2,"<":3,$:4,"/":5,"!":6,">":7,"=":8,_v:9,"{":10,"&":11,_t:12},t.scan=function(r,a){function i(){y.length>0&&(m.push({tag:"_t",text:new String(y)}),y="")}function o(){for(var n=!0,e=w;e<m.length;e++)if(n=t.tags[m[e].tag]<t.tags._v||"_t"==m[e].tag&&null===m[e].text.match(h),!n)return!1;return n}function l(t,n){if(i(),t&&o())for(var e,s=w;s<m.length;s++)m[s].text&&((e=m[s+1])&&">"==e.tag&&(e.indent=m[s].text.toString()),m.splice(s,1));else n||m.push({tag:"\n"});x=!1,w=m.length}function u(t,n){var s="="+S,r=t.indexOf(s,n),a=e(t.substring(t.indexOf("=",n)+1,r)).split(" ");return T=a[0],S=a[a.length-1],r+s.length-1}var c=r.length,p=0,b=1,f=2,g=p,d=null,v=null,y="",m=[],x=!1,k=0,w=0,T="{{",S="}}";for(a&&(a=a.split(" "),T=a[0],S=a[1]),k=0;c>k;k++)g==p?s(T,r,k)?(--k,i(),g=b):"\n"==r.charAt(k)?l(x):y+=r.charAt(k):g==b?(k+=T.length-1,v=t.tags[r.charAt(k+1)],d=v?r.charAt(k+1):"_v","="==d?(k=u(r,k),g=p):(v&&k++,g=f),x=k):s(S,r,k)?(m.push({tag:d,n:e(y),otag:T,ctag:S,i:"/"==d?x-T.length:k+S.length}),y="",k+=S.length-1,g=p,"{"==d&&("}}"==S?k++:n(m[m.length-1]))):y+=r.charAt(k);return l(x,!0),m};var k={_t:!0,"\n":!0,$:!0,"/":!0};t.stringify=function(n){return"{code: function (c,p,i) { "+t.wrapMain(n.code)+" },"+l(n)+"}"};var w=0;t.generate=function(n,e,s){w=0;var r={code:"",subs:{},partials:{}};return t.walk(n,r),s.asString?this.stringify(r,e,s):this.makeTemplate(r,e,s)},t.wrapMain=function(t){return'var t=this;t.b(i=i||"");'+t+"return t.fl();"},t.template=t.Template,t.makeTemplate=function(t,n,e){var s=this.makePartials(t);return s.code=new Function("c","p","i",this.wrapMain(t.code)),new this.template(s,n,this,e)},t.makePartials=function(t){var n,e={subs:{},partials:t.partials,name:t.name};for(n in e.partials)e.partials[n]=this.makePartials(e.partials[n]);for(n in t.subs)e.subs[n]=new Function("c","p","t","i",t.subs[n]);return e},t.codegen={"#":function(n,e){e.code+="if(t.s(t."+c(n.n)+'("'+u(n.n)+'",c,p,1),c,p,0,'+n.i+","+n.end+',"'+n.otag+" "+n.ctag+'")){t.rs(c,p,function(c,p,t){',t.walk(n.nodes,e),e.code+="});c.pop();}"},"^":function(n,e){e.code+="if(!t.s(t."+c(n.n)+'("'+u(n.n)+'",c,p,1),c,p,1,0,0,"")){',t.walk(n.nodes,e),e.code+="};"},">":p,"<":function(n,e){var s={partials:{},code:"",subs:{},inPartial:!0};t.walk(n.nodes,s);var r=e.partials[p(n,e)];r.subs=s.subs,r.partials=s.partials},$:function(n,e){var s={subs:{},code:"",partials:e.partials,prefix:n.n};t.walk(n.nodes,s),e.subs[n.n]=s.code,e.inPartial||(e.code+='t.sub("'+u(n.n)+'",c,p,i);')},"\n":function(t,n){n.code+=f('"\\n"'+(t.last?"":" + i"))},_v:function(t,n){n.code+="t.b(t.v(t."+c(t.n)+'("'+u(t.n)+'",c,p,0)));'},_t:function(t,n){n.code+=f('"'+u(t.text)+'"')},"{":b,"&":b},t.walk=function(n,e){for(var s,r=0,a=n.length;a>r;r++)s=t.codegen[n[r].tag],s&&s(n[r],e);return e},t.parse=function(t,n,e){return e=e||{},r(t,"",[],e.sectionTags||[])},t.cache={},t.cacheKey=function(t,n){return[t,!!n.asString,!!n.disableLambda,n.delimiters,!!n.modelGet].join("||")},t.compile=function(n,e){e=e||{};var s=t.cacheKey(n,e),r=this.cache[s];if(r){var a=r.partials;for(var i in a)delete a[i].instance;return r}return r=this.generate(this.parse(this.scan(n,e.delimiters),n,e),n,e),this.cache[s]=r}}("undefined"!=typeof exports?exports:Hogan);var Mustache=function(t){function n(n,e,s,r){var a=this.f(n,e,s,0),i=e;return a&&(i=i.concat(a)),t.Template.prototype.rp.call(this,n,i,s,r)}var e=function(e,s,r){this.rp=n,t.Template.call(this,e,s,r)};e.prototype=t.Template.prototype;var s,r=function(){this.cache={},this.generate=function(t,n){return new e(new Function("c","p","i",t),n,s)}};return r.prototype=t,s=new r,{to_html:function(t,n,e,r){var a=s.compile(t),i=a.render(n,e);return r?(r(i),void 0):i}}}(Hogan),templates={};templates.controls=new Hogan.Template({code:function(t,n,e){var s=this;return s.b(e=e||""),s.b('<div class="player-controls">'),s.b("\n"+e),s.b(' <div class="player-progress">'),s.b("\n"+e),s.b(' <label for="seek{id}" class="sr-only">Seek</label>'),s.b("\n"+e),s.b(' <input id="seek{id}" class="player-progress-seek" type="range" min="0" max="100" step="0.5" value="0" data-player="seek">'),s.b("\n"+e),s.b(' <progress class="player-progress-played" max="100" value="0">'),s.b("\n"+e),s.b(" <span>0</span>% played"),s.b("\n"+e),s.b(" </progress>"),s.b("\n"+e),s.b(' <progress class="player-progress-buffer" max="100" value="0">'),s.b("\n"+e),s.b(" <span>0</span>% buffered"),s.b("\n"+e),s.b(" </progress>"),s.b("\n"+e),s.b(" </div>"),s.b("\n"+e),s.b(' <span class="player-controls-playback">'),s.b("\n"+e),s.b(' <button type="button" data-player="restart">'),s.b("\n"+e),s.b(' <svg><use xlink:href="#icon-restart"></use></svg>'),s.b("\n"+e),s.b(' <span class="sr-only">Restart</span>'),s.b("\n"+e),s.b(" </button>"),s.b("\n"+e),s.b(' <button type="button" data-player="rewind">'),s.b("\n"+e),s.b(' <svg><use xlink:href="#icon-rewind"></use></svg>'),s.b("\n"+e),s.b(' <span class="sr-only">Rewind {seektime} secs</span>'),s.b("\n"+e),s.b(" </button>"),s.b("\n"+e),s.b(' <button type="button" data-player="play">'),s.b("\n"+e),s.b(' <svg><use xlink:href="#icon-play"></use></svg>'),s.b("\n"+e),s.b(' <span class="sr-only">Play</span>'),s.b("\n"+e),s.b(" </button>"),s.b("\n"+e),s.b(' <button type="button" data-player="pause">'),s.b("\n"+e),s.b(' <svg><use xlink:href="#icon-pause"></use></svg>'),s.b("\n"+e),s.b(' <span class="sr-only">Pause</span>'),s.b("\n"+e),s.b(" </button>"),s.b("\n"+e),s.b(' <button type="button" data-player="fast-forward">'),s.b("\n"+e),s.b(' <svg><use xlink:href="#icon-fast-forward"></use></svg>'),s.b("\n"+e),s.b(' <span class="sr-only">Forward {seektime} secs</span>'),s.b("\n"+e),s.b(" </button>"),s.b("\n"+e),s.b(' <span class="player-time">'),s.b("\n"+e),s.b(' <span class="sr-only">Time</span>'),s.b("\n"+e),s.b(' <span class="player-duration">00:00</span>'),s.b("\n"+e),s.b(" </span>"),s.b("\n"+e),s.b(" </span>"),s.b("\n"+e),s.b(' <span class="player-controls-sound">'),s.b("\n"+e),s.b(' <input class="inverted sr-only" id="mute{id}" type="checkbox" data-player="mute">'),s.b("\n"+e),s.b(' <label id="mute{id}" for="mute{id}">'),s.b("\n"+e),s.b(' <svg class="icon-muted"><use xlink:href="#icon-muted"></use></svg>'),s.b("\n"+e),s.b(' <svg><use xlink:href="#icon-volume"></use></svg>'),s.b("\n"+e),s.b(' <span class="sr-only">Toggle Mute</span>'),s.b("\n"+e),s.b(" </label>"),s.b("\n"),s.b("\n"+e),s.b(' <label for="volume{id}" class="sr-only">Volume</label>'),s.b("\n"+e),s.b(' <input id="volume{id}" class="player-volume" type="range" min="0" max="10" step="0.5" value="0" data-player="volume">'),s.b("\n"),s.b("\n"+e),s.b(' <input class="sr-only" id="captions{id}" type="checkbox" data-player="captions">'),s.b("\n"+e),s.b(' <label for="captions{id}">'),s.b("\n"+e),s.b(' <svg class="icon-captions-on"><use xlink:href="#icon-captions-on"></use></svg>'),s.b("\n"+e),s.b(' <svg><use xlink:href="#icon-captions-off"></use></svg>'),s.b("\n"+e),s.b(' <span class="sr-only">Toggle Captions</span>'),s.b("\n"+e),s.b(" </label>"),s.b("\n"),s.b("\n"+e),s.b(' <button type="button" data-player="fullscreen">'),s.b("\n"+e),s.b(' <svg class="icon-exit-fullscreen"><use xlink:href="#icon-exit-fullscreen"></use></svg>'),s.b("\n"+e),s.b(' <svg><use xlink:href="#icon-enter-fullscreen"></use></svg>'),s.b("\n"+e),s.b(' <span class="sr-only">Toggle Fullscreen</span>'),s.b("\n"+e),s.b(" </button>"),s.b("\n"+e),s.b(" </span>"),s.b("\n"+e),s.b("</div>"),s.fl()},partials:{},subs:{}}),plyr.setup({debug:!0,title:"Video demo",html:templates.controls.render({}),captions:{defaultActive:!0},tooltips:!0}),document.domain.indexOf("plyr.io")>-1&&(!function(t,n,e,s,r,a,i){t.GoogleAnalyticsObject=r,t[r]=t[r]||function(){(t[r].q=t[r].q||[]).push(arguments)},t[r].l=1*new Date,a=n.createElement(e),i=n.getElementsByTagName(e)[0],a.async=1,a.src=s,i.parentNode.insertBefore(a,i)}(window,document,"script","//www.google-analytics.com/analytics.js","ga"),ga("create","UA-40881672-11","auto"),ga("send","pageview"));
\ No newline at end of file +var Hogan={};!function(t){function n(t,n,e){var s;return n&&"object"==typeof n&&(void 0!==n[t]?s=n[t]:e&&n.get&&"function"==typeof n.get&&(s=n.get(t))),s}function e(t,n,e,s,a,r){function i(){}function o(){}i.prototype=t,o.prototype=t.subs;var l,u=new i;u.subs=new o,u.subsText={},u.buf="",s=s||{},u.stackSubs=s,u.subsText=r;for(l in n)s[l]||(s[l]=n[l]);for(l in s)u.subs[l]=s[l];a=a||{},u.stackPartials=a;for(l in e)a[l]||(a[l]=e[l]);for(l in a)u.partials[l]=a[l];return u}function s(t){return String(null===t||void 0===t?"":t)}function a(t){return t=s(t),c.test(t)?t.replace(r,"&").replace(i,"<").replace(o,">").replace(l,"'").replace(u,"""):t}t.Template=function(t,n,e,s){t=t||{},this.r=t.code||this.r,this.c=e,this.options=s||{},this.text=n||"",this.partials=t.partials||{},this.subs=t.subs||{},this.buf=""},t.Template.prototype={r:function(){return""},v:a,t:s,render:function(t,n,e){return this.ri([t],n||{},e)},ri:function(t,n,e){return this.r(t,n,e)},ep:function(t,n){var s=this.partials[t],a=n[s.name];if(s.instance&&s.base==a)return s.instance;if("string"==typeof a){if(!this.c)throw new Error("No compiler available.");a=this.c.compile(a,this.options)}if(!a)return null;if(this.partials[t].base=a,s.subs){n.stackText||(n.stackText={});for(key in s.subs)n.stackText[key]||(n.stackText[key]=void 0!==this.activeSub&&n.stackText[this.activeSub]?n.stackText[this.activeSub]:this.text);a=e(a,s.subs,s.partials,this.stackSubs,this.stackPartials,n.stackText)}return this.partials[t].instance=a,a},rp:function(t,n,e,s){var a=this.ep(t,e);return a?a.ri(n,e,s):""},rs:function(t,n,e){var s=t[t.length-1];if(!p(s))return e(t,n,this),void 0;for(var a=0;a<s.length;a++)t.push(s[a]),e(t,n,this),t.pop()},s:function(t,n,e,s,a,r,i){var o;return p(t)&&0===t.length?!1:("function"==typeof t&&(t=this.ms(t,n,e,s,a,r,i)),o=!!t,!s&&o&&n&&n.push("object"==typeof t?t:n[n.length-1]),o)},d:function(t,e,s,a){var r,i=t.split("."),o=this.f(i[0],e,s,a),l=this.options.modelGet,u=null;if("."===t&&p(e[e.length-2]))o=e[e.length-1];else for(var c=1;c<i.length;c++)r=n(i[c],o,l),void 0!==r?(u=o,o=r):o="";return a&&!o?!1:(a||"function"!=typeof o||(e.push(u),o=this.mv(o,e,s),e.pop()),o)},f:function(t,e,s,a){for(var r=!1,i=null,o=!1,l=this.options.modelGet,u=e.length-1;u>=0;u--)if(i=e[u],r=n(t,i,l),void 0!==r){o=!0;break}return o?(a||"function"!=typeof r||(r=this.mv(r,e,s)),r):a?!1:""},ls:function(t,n,e,a,r){var i=this.options.delimiters;return this.options.delimiters=r,this.b(this.ct(s(t.call(n,a)),n,e)),this.options.delimiters=i,!1},ct:function(t,n,e){if(this.options.disableLambda)throw new Error("Lambda features disabled.");return this.c.compile(t,this.options).render(n,e)},b:function(t){this.buf+=t},fl:function(){var t=this.buf;return this.buf="",t},ms:function(t,n,e,s,a,r,i){var o,l=n[n.length-1],u=t.call(l);return"function"==typeof u?s?!0:(o=this.activeSub&&this.subsText&&this.subsText[this.activeSub]?this.subsText[this.activeSub]:this.text,this.ls(u,l,e,o.substring(a,r),i)):u},mv:function(t,n,e){var a=n[n.length-1],r=t.call(a);return"function"==typeof r?this.ct(s(r.call(a)),a,e):r},sub:function(t,n,e,s){var a=this.subs[t];a&&(this.activeSub=t,a(n,e,this,s),this.activeSub=!1)}};var r=/&/g,i=/</g,o=/>/g,l=/\'/g,u=/\"/g,c=/[&<>\"\']/,p=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}}("undefined"!=typeof exports?exports:Hogan),function(t){function n(t){"}"===t.n.substr(t.n.length-1)&&(t.n=t.n.substring(0,t.n.length-1))}function e(t){return t.trim?t.trim():t.replace(/^\s*|\s*$/g,"")}function s(t,n,e){if(n.charAt(e)!=t.charAt(0))return!1;for(var s=1,a=t.length;a>s;s++)if(n.charAt(e+s)!=t.charAt(s))return!1;return!0}function a(n,e,s,o){var l=[],u=null,c=null,p=null;for(c=s[s.length-1];n.length>0;){if(p=n.shift(),c&&"<"==c.tag&&!(p.tag in k))throw new Error("Illegal content in < super tag.");if(t.tags[p.tag]<=t.tags.$||r(p,o))s.push(p),p.nodes=a(n,p.tag,s,o);else{if("/"==p.tag){if(0===s.length)throw new Error("Closing tag without opener: /"+p.n);if(u=s.pop(),p.n!=u.n&&!i(p.n,u.n,o))throw new Error("Nesting error: "+u.n+" vs. "+p.n);return u.end=p.i,l}"\n"==p.tag&&(p.last=0==n.length||"\n"==n[0].tag)}l.push(p)}if(s.length>0)throw new Error("missing closing tag: "+s.pop().n);return l}function r(t,n){for(var e=0,s=n.length;s>e;e++)if(n[e].o==t.n)return t.tag="#",!0}function i(t,n,e){for(var s=0,a=e.length;a>s;s++)if(e[s].c==t&&e[s].o==n)return!0}function o(t){var n=[];for(var e in t)n.push('"'+u(e)+'": function(c,p,t,i) {'+t[e]+"}");return"{ "+n.join(",")+" }"}function l(t){var n=[];for(var e in t.partials)n.push('"'+u(e)+'":{name:"'+u(t.partials[e].name)+'", '+l(t.partials[e])+"}");return"partials: {"+n.join(",")+"}, subs: "+o(t.subs)}function u(t){return t.replace(m,"\\\\").replace(g,'\\"').replace(d,"\\n").replace(v,"\\r").replace(y,"\\u2028").replace(x,"\\u2029")}function c(t){return~t.indexOf(".")?"d":"f"}function p(t,n){var e="<"+(n.prefix||""),s=e+t.n+w++;return n.partials[s]={name:t.n,partials:{}},n.code+='t.b(t.rp("'+u(s)+'",c,p,"'+(t.indent||"")+'"));',s}function b(t,n){n.code+="t.b(t.t(t."+c(t.n)+'("'+u(t.n)+'",c,p,0)));'}function f(t){return"t.b("+t+");"}var h=/\S/,g=/\"/g,d=/\n/g,v=/\r/g,m=/\\/g,y=/\u2028/,x=/\u2029/;t.tags={"#":1,"^":2,"<":3,$:4,"/":5,"!":6,">":7,"=":8,_v:9,"{":10,"&":11,_t:12},t.scan=function(a,r){function i(){m.length>0&&(y.push({tag:"_t",text:new String(m)}),m="")}function o(){for(var n=!0,e=w;e<y.length;e++)if(n=t.tags[y[e].tag]<t.tags._v||"_t"==y[e].tag&&null===y[e].text.match(h),!n)return!1;return n}function l(t,n){if(i(),t&&o())for(var e,s=w;s<y.length;s++)y[s].text&&((e=y[s+1])&&">"==e.tag&&(e.indent=y[s].text.toString()),y.splice(s,1));else n||y.push({tag:"\n"});x=!1,w=y.length}function u(t,n){var s="="+S,a=t.indexOf(s,n),r=e(t.substring(t.indexOf("=",n)+1,a)).split(" ");return T=r[0],S=r[r.length-1],a+s.length-1}var c=a.length,p=0,b=1,f=2,g=p,d=null,v=null,m="",y=[],x=!1,k=0,w=0,T="{{",S="}}";for(r&&(r=r.split(" "),T=r[0],S=r[1]),k=0;c>k;k++)g==p?s(T,a,k)?(--k,i(),g=b):"\n"==a.charAt(k)?l(x):m+=a.charAt(k):g==b?(k+=T.length-1,v=t.tags[a.charAt(k+1)],d=v?a.charAt(k+1):"_v","="==d?(k=u(a,k),g=p):(v&&k++,g=f),x=k):s(S,a,k)?(y.push({tag:d,n:e(m),otag:T,ctag:S,i:"/"==d?x-T.length:k+S.length}),m="",k+=S.length-1,g=p,"{"==d&&("}}"==S?k++:n(y[y.length-1]))):m+=a.charAt(k);return l(x,!0),y};var k={_t:!0,"\n":!0,$:!0,"/":!0};t.stringify=function(n){return"{code: function (c,p,i) { "+t.wrapMain(n.code)+" },"+l(n)+"}"};var w=0;t.generate=function(n,e,s){w=0;var a={code:"",subs:{},partials:{}};return t.walk(n,a),s.asString?this.stringify(a,e,s):this.makeTemplate(a,e,s)},t.wrapMain=function(t){return'var t=this;t.b(i=i||"");'+t+"return t.fl();"},t.template=t.Template,t.makeTemplate=function(t,n,e){var s=this.makePartials(t);return s.code=new Function("c","p","i",this.wrapMain(t.code)),new this.template(s,n,this,e)},t.makePartials=function(t){var n,e={subs:{},partials:t.partials,name:t.name};for(n in e.partials)e.partials[n]=this.makePartials(e.partials[n]);for(n in t.subs)e.subs[n]=new Function("c","p","t","i",t.subs[n]);return e},t.codegen={"#":function(n,e){e.code+="if(t.s(t."+c(n.n)+'("'+u(n.n)+'",c,p,1),c,p,0,'+n.i+","+n.end+',"'+n.otag+" "+n.ctag+'")){t.rs(c,p,function(c,p,t){',t.walk(n.nodes,e),e.code+="});c.pop();}"},"^":function(n,e){e.code+="if(!t.s(t."+c(n.n)+'("'+u(n.n)+'",c,p,1),c,p,1,0,0,"")){',t.walk(n.nodes,e),e.code+="};"},">":p,"<":function(n,e){var s={partials:{},code:"",subs:{},inPartial:!0};t.walk(n.nodes,s);var a=e.partials[p(n,e)];a.subs=s.subs,a.partials=s.partials},$:function(n,e){var s={subs:{},code:"",partials:e.partials,prefix:n.n};t.walk(n.nodes,s),e.subs[n.n]=s.code,e.inPartial||(e.code+='t.sub("'+u(n.n)+'",c,p,i);')},"\n":function(t,n){n.code+=f('"\\n"'+(t.last?"":" + i"))},_v:function(t,n){n.code+="t.b(t.v(t."+c(t.n)+'("'+u(t.n)+'",c,p,0)));'},_t:function(t,n){n.code+=f('"'+u(t.text)+'"')},"{":b,"&":b},t.walk=function(n,e){for(var s,a=0,r=n.length;r>a;a++)s=t.codegen[n[a].tag],s&&s(n[a],e);return e},t.parse=function(t,n,e){return e=e||{},a(t,"",[],e.sectionTags||[])},t.cache={},t.cacheKey=function(t,n){return[t,!!n.asString,!!n.disableLambda,n.delimiters,!!n.modelGet].join("||")},t.compile=function(n,e){e=e||{};var s=t.cacheKey(n,e),a=this.cache[s];if(a){var r=a.partials;for(var i in r)delete r[i].instance;return a}return a=this.generate(this.parse(this.scan(n,e.delimiters),n,e),n,e),this.cache[s]=a}}("undefined"!=typeof exports?exports:Hogan);var Mustache=function(t){function n(n,e,s,a){var r=this.f(n,e,s,0),i=e;return r&&(i=i.concat(r)),t.Template.prototype.rp.call(this,n,i,s,a)}var e=function(e,s,a){this.rp=n,t.Template.call(this,e,s,a)};e.prototype=t.Template.prototype;var s,a=function(){this.cache={},this.generate=function(t,n){return new e(new Function("c","p","i",t),n,s)}};return a.prototype=t,s=new a,{to_html:function(t,n,e,a){var r=s.compile(t),i=r.render(n,e);return a?(a(i),void 0):i}}}(Hogan),templates={};templates.controls=new Hogan.Template({code:function(t,n,e){var s=this;return s.b(e=e||""),s.b('<div class="player-controls">'),s.b("\n"+e),s.b(' <div class="player-progress">'),s.b("\n"+e),s.b(' <label for="seek{id}" class="sr-only">Seek</label>'),s.b("\n"+e),s.b(' <input id="seek{id}" class="player-progress-seek" type="range" min="0" max="100" step="0.5" value="0" data-player="seek">'),s.b("\n"+e),s.b(' <progress class="player-progress-played" max="100" value="0">'),s.b("\n"+e),s.b(" <span>0</span>% played"),s.b("\n"+e),s.b(" </progress>"),s.b("\n"+e),s.b(' <progress class="player-progress-buffer" max="100" value="0">'),s.b("\n"+e),s.b(" <span>0</span>% buffered"),s.b("\n"+e),s.b(" </progress>"),s.b("\n"+e),s.b(" </div>"),s.b("\n"+e),s.b(' <span class="player-controls-left">'),s.b("\n"+e),s.b(' <button type="button" data-player="restart">'),s.b("\n"+e),s.b(' <svg><use xlink:href="#icon-restart"></use></svg>'),s.b("\n"+e),s.b(' <span class="sr-only">Restart</span>'),s.b("\n"+e),s.b(" </button>"),s.b("\n"+e),s.b(' <button type="button" data-player="rewind">'),s.b("\n"+e),s.b(' <svg><use xlink:href="#icon-rewind"></use></svg>'),s.b("\n"+e),s.b(' <span class="sr-only">Rewind {seektime} secs</span>'),s.b("\n"+e),s.b(" </button>"),s.b("\n"+e),s.b(' <button type="button" data-player="play">'),s.b("\n"+e),s.b(' <svg><use xlink:href="#icon-play"></use></svg>'),s.b("\n"+e),s.b(' <span class="sr-only">Play</span>'),s.b("\n"+e),s.b(" </button>"),s.b("\n"+e),s.b(' <button type="button" data-player="pause">'),s.b("\n"+e),s.b(' <svg><use xlink:href="#icon-pause"></use></svg>'),s.b("\n"+e),s.b(' <span class="sr-only">Pause</span>'),s.b("\n"+e),s.b(" </button>"),s.b("\n"+e),s.b(' <button type="button" data-player="fast-forward">'),s.b("\n"+e),s.b(' <svg><use xlink:href="#icon-fast-forward"></use></svg>'),s.b("\n"+e),s.b(' <span class="sr-only">Forward {seektime} secs</span>'),s.b("\n"+e),s.b(" </button>"),s.b("\n"+e),s.b(' <span class="player-time">'),s.b("\n"+e),s.b(' <span class="sr-only">Current time</span>'),s.b("\n"+e),s.b(' <span class="player-current-time">00:00</span>'),s.b("\n"+e),s.b(" </span>"),s.b("\n"+e),s.b(' <span class="player-time">'),s.b("\n"+e),s.b(' <span class="sr-only">Duration</span>'),s.b("\n"+e),s.b(' <span class="player-duration">00:00</span>'),s.b("\n"+e),s.b(" </span>"),s.b("\n"+e),s.b(" </span>"),s.b("\n"+e),s.b(' <span class="player-controls-right">'),s.b("\n"+e),s.b(' <input class="inverted sr-only" id="mute{id}" type="checkbox" data-player="mute">'),s.b("\n"+e),s.b(' <label id="mute{id}" for="mute{id}">'),s.b("\n"+e),s.b(' <svg class="icon-muted"><use xlink:href="#icon-muted"></use></svg>'),s.b("\n"+e),s.b(' <svg><use xlink:href="#icon-volume"></use></svg>'),s.b("\n"+e),s.b(' <span class="sr-only">Toggle Mute</span>'),s.b("\n"+e),s.b(" </label>"),s.b("\n"),s.b("\n"+e),s.b(' <label for="volume{id}" class="sr-only">Volume</label>'),s.b("\n"+e),s.b(' <input id="volume{id}" class="player-volume" type="range" min="0" max="10" step="0.5" value="0" data-player="volume">'),s.b("\n"),s.b("\n"+e),s.b(' <input class="sr-only" id="captions{id}" type="checkbox" data-player="captions">'),s.b("\n"+e),s.b(' <label for="captions{id}">'),s.b("\n"+e),s.b(' <svg class="icon-captions-on"><use xlink:href="#icon-captions-on"></use></svg>'),s.b("\n"+e),s.b(' <svg><use xlink:href="#icon-captions-off"></use></svg>'),s.b("\n"+e),s.b(' <span class="sr-only">Toggle Captions</span>'),s.b("\n"+e),s.b(" </label>"),s.b("\n"),s.b("\n"+e),s.b(' <button type="button" data-player="fullscreen">'),s.b("\n"+e),s.b(' <svg class="icon-exit-fullscreen"><use xlink:href="#icon-exit-fullscreen"></use></svg>'),s.b("\n"+e),s.b(' <svg><use xlink:href="#icon-enter-fullscreen"></use></svg>'),s.b("\n"+e),s.b(' <span class="sr-only">Toggle Fullscreen</span>'),s.b("\n"+e),s.b(" </button>"),s.b("\n"+e),s.b(" </span>"),s.b("\n"+e),s.b("</div>"),s.fl()},partials:{},subs:{}}),plyr.setup({debug:!0,title:"Video demo",html:templates.controls.render({}),captions:{defaultActive:!0},onSetup:function(){var t=this,n=t.media.tagName.toLowerCase(),e=document.querySelector("[data-toggle='fullscreen']");console.log("✓ Setup done for <"+n+">"),"video"===n&&e&&e.addEventListener("click",t.toggleFullscreen,!1)}}),document.domain.indexOf("plyr.io")>-1&&(!function(t,n,e,s,a,r,i){t.GoogleAnalyticsObject=a,t[a]=t[a]||function(){(t[a].q=t[a].q||[]).push(arguments)},t[a].l=1*new Date,r=n.createElement(e),i=n.getElementsByTagName(e)[0],r.async=1,r.src=s,i.parentNode.insertBefore(r,i)}(window,document,"script","//www.google-analytics.com/analytics.js","ga"),ga("create","UA-40881672-11","auto"),ga("send","pageview"));
\ No newline at end of file diff --git a/docs/dist/templates.js b/docs/dist/templates.js index b4cc6db2..0cb6d126 100644 --- a/docs/dist/templates.js +++ b/docs/dist/templates.js @@ -1,2 +1,2 @@ var templates = {}; - templates['controls'] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("<div class=\"player-controls\">");t.b("\n" + i);t.b(" <div class=\"player-progress\">");t.b("\n" + i);t.b(" <label for=\"seek{id}\" class=\"sr-only\">Seek</label>");t.b("\n" + i);t.b(" <input id=\"seek{id}\" class=\"player-progress-seek\" type=\"range\" min=\"0\" max=\"100\" step=\"0.5\" value=\"0\" data-player=\"seek\">");t.b("\n" + i);t.b(" <progress class=\"player-progress-played\" max=\"100\" value=\"0\">");t.b("\n" + i);t.b(" <span>0</span>% played");t.b("\n" + i);t.b(" </progress>");t.b("\n" + i);t.b(" <progress class=\"player-progress-buffer\" max=\"100\" value=\"0\">");t.b("\n" + i);t.b(" <span>0</span>% buffered");t.b("\n" + i);t.b(" </progress>");t.b("\n" + i);t.b(" </div>");t.b("\n" + i);t.b(" <span class=\"player-controls-playback\">");t.b("\n" + i);t.b(" <button type=\"button\" data-player=\"restart\">");t.b("\n" + i);t.b(" <svg><use xlink:href=\"#icon-restart\"></use></svg>");t.b("\n" + i);t.b(" <span class=\"sr-only\">Restart</span>");t.b("\n" + i);t.b(" </button>");t.b("\n" + i);t.b(" <button type=\"button\" data-player=\"rewind\">");t.b("\n" + i);t.b(" <svg><use xlink:href=\"#icon-rewind\"></use></svg>");t.b("\n" + i);t.b(" <span class=\"sr-only\">Rewind {seektime} secs</span>");t.b("\n" + i);t.b(" </button>");t.b("\n" + i);t.b(" <button type=\"button\" data-player=\"play\">");t.b("\n" + i);t.b(" <svg><use xlink:href=\"#icon-play\"></use></svg>");t.b("\n" + i);t.b(" <span class=\"sr-only\">Play</span>");t.b("\n" + i);t.b(" </button>");t.b("\n" + i);t.b(" <button type=\"button\" data-player=\"pause\">");t.b("\n" + i);t.b(" <svg><use xlink:href=\"#icon-pause\"></use></svg>");t.b("\n" + i);t.b(" <span class=\"sr-only\">Pause</span>");t.b("\n" + i);t.b(" </button>");t.b("\n" + i);t.b(" <button type=\"button\" data-player=\"fast-forward\">");t.b("\n" + i);t.b(" <svg><use xlink:href=\"#icon-fast-forward\"></use></svg>");t.b("\n" + i);t.b(" <span class=\"sr-only\">Forward {seektime} secs</span>");t.b("\n" + i);t.b(" </button>");t.b("\n" + i);t.b(" <span class=\"player-time\">");t.b("\n" + i);t.b(" <span class=\"sr-only\">Time</span>");t.b("\n" + i);t.b(" <span class=\"player-duration\">00:00</span>");t.b("\n" + i);t.b(" </span>");t.b("\n" + i);t.b(" </span>");t.b("\n" + i);t.b(" <span class=\"player-controls-sound\">");t.b("\n" + i);t.b(" <input class=\"inverted sr-only\" id=\"mute{id}\" type=\"checkbox\" data-player=\"mute\">");t.b("\n" + i);t.b(" <label id=\"mute{id}\" for=\"mute{id}\">");t.b("\n" + i);t.b(" <svg class=\"icon-muted\"><use xlink:href=\"#icon-muted\"></use></svg>");t.b("\n" + i);t.b(" <svg><use xlink:href=\"#icon-volume\"></use></svg>");t.b("\n" + i);t.b(" <span class=\"sr-only\">Toggle Mute</span>");t.b("\n" + i);t.b(" </label>");t.b("\n");t.b("\n" + i);t.b(" <label for=\"volume{id}\" class=\"sr-only\">Volume</label>");t.b("\n" + i);t.b(" <input id=\"volume{id}\" class=\"player-volume\" type=\"range\" min=\"0\" max=\"10\" step=\"0.5\" value=\"0\" data-player=\"volume\">");t.b("\n");t.b("\n" + i);t.b(" <input class=\"sr-only\" id=\"captions{id}\" type=\"checkbox\" data-player=\"captions\">");t.b("\n" + i);t.b(" <label for=\"captions{id}\">");t.b("\n" + i);t.b(" <svg class=\"icon-captions-on\"><use xlink:href=\"#icon-captions-on\"></use></svg>");t.b("\n" + i);t.b(" <svg><use xlink:href=\"#icon-captions-off\"></use></svg>");t.b("\n" + i);t.b(" <span class=\"sr-only\">Toggle Captions</span>");t.b("\n" + i);t.b(" </label>");t.b("\n");t.b("\n" + i);t.b(" <button type=\"button\" data-player=\"fullscreen\">");t.b("\n" + i);t.b(" <svg class=\"icon-exit-fullscreen\"><use xlink:href=\"#icon-exit-fullscreen\"></use></svg>");t.b("\n" + i);t.b(" <svg><use xlink:href=\"#icon-enter-fullscreen\"></use></svg>");t.b("\n" + i);t.b(" <span class=\"sr-only\">Toggle Fullscreen</span>");t.b("\n" + i);t.b(" </button>");t.b("\n" + i);t.b(" </span>");t.b("\n" + i);t.b("</div>");return t.fl(); },partials: {}, subs: { }});
\ No newline at end of file + templates['controls'] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("<div class=\"player-controls\">");t.b("\n" + i);t.b(" <div class=\"player-progress\">");t.b("\n" + i);t.b(" <label for=\"seek{id}\" class=\"sr-only\">Seek</label>");t.b("\n" + i);t.b(" <input id=\"seek{id}\" class=\"player-progress-seek\" type=\"range\" min=\"0\" max=\"100\" step=\"0.5\" value=\"0\" data-player=\"seek\">");t.b("\n" + i);t.b(" <progress class=\"player-progress-played\" max=\"100\" value=\"0\">");t.b("\n" + i);t.b(" <span>0</span>% played");t.b("\n" + i);t.b(" </progress>");t.b("\n" + i);t.b(" <progress class=\"player-progress-buffer\" max=\"100\" value=\"0\">");t.b("\n" + i);t.b(" <span>0</span>% buffered");t.b("\n" + i);t.b(" </progress>");t.b("\n" + i);t.b(" </div>");t.b("\n" + i);t.b(" <span class=\"player-controls-left\">");t.b("\n" + i);t.b(" <button type=\"button\" data-player=\"restart\">");t.b("\n" + i);t.b(" <svg><use xlink:href=\"#icon-restart\"></use></svg>");t.b("\n" + i);t.b(" <span class=\"sr-only\">Restart</span>");t.b("\n" + i);t.b(" </button>");t.b("\n" + i);t.b(" <button type=\"button\" data-player=\"rewind\">");t.b("\n" + i);t.b(" <svg><use xlink:href=\"#icon-rewind\"></use></svg>");t.b("\n" + i);t.b(" <span class=\"sr-only\">Rewind {seektime} secs</span>");t.b("\n" + i);t.b(" </button>");t.b("\n" + i);t.b(" <button type=\"button\" data-player=\"play\">");t.b("\n" + i);t.b(" <svg><use xlink:href=\"#icon-play\"></use></svg>");t.b("\n" + i);t.b(" <span class=\"sr-only\">Play</span>");t.b("\n" + i);t.b(" </button>");t.b("\n" + i);t.b(" <button type=\"button\" data-player=\"pause\">");t.b("\n" + i);t.b(" <svg><use xlink:href=\"#icon-pause\"></use></svg>");t.b("\n" + i);t.b(" <span class=\"sr-only\">Pause</span>");t.b("\n" + i);t.b(" </button>");t.b("\n" + i);t.b(" <button type=\"button\" data-player=\"fast-forward\">");t.b("\n" + i);t.b(" <svg><use xlink:href=\"#icon-fast-forward\"></use></svg>");t.b("\n" + i);t.b(" <span class=\"sr-only\">Forward {seektime} secs</span>");t.b("\n" + i);t.b(" </button>");t.b("\n" + i);t.b(" <span class=\"player-time\">");t.b("\n" + i);t.b(" <span class=\"sr-only\">Current time</span>");t.b("\n" + i);t.b(" <span class=\"player-current-time\">00:00</span>");t.b("\n" + i);t.b(" </span>");t.b("\n" + i);t.b(" <span class=\"player-time\">");t.b("\n" + i);t.b(" <span class=\"sr-only\">Duration</span>");t.b("\n" + i);t.b(" <span class=\"player-duration\">00:00</span>");t.b("\n" + i);t.b(" </span>");t.b("\n" + i);t.b(" </span>");t.b("\n" + i);t.b(" <span class=\"player-controls-right\">");t.b("\n" + i);t.b(" <input class=\"inverted sr-only\" id=\"mute{id}\" type=\"checkbox\" data-player=\"mute\">");t.b("\n" + i);t.b(" <label id=\"mute{id}\" for=\"mute{id}\">");t.b("\n" + i);t.b(" <svg class=\"icon-muted\"><use xlink:href=\"#icon-muted\"></use></svg>");t.b("\n" + i);t.b(" <svg><use xlink:href=\"#icon-volume\"></use></svg>");t.b("\n" + i);t.b(" <span class=\"sr-only\">Toggle Mute</span>");t.b("\n" + i);t.b(" </label>");t.b("\n");t.b("\n" + i);t.b(" <label for=\"volume{id}\" class=\"sr-only\">Volume</label>");t.b("\n" + i);t.b(" <input id=\"volume{id}\" class=\"player-volume\" type=\"range\" min=\"0\" max=\"10\" step=\"0.5\" value=\"0\" data-player=\"volume\">");t.b("\n");t.b("\n" + i);t.b(" <input class=\"sr-only\" id=\"captions{id}\" type=\"checkbox\" data-player=\"captions\">");t.b("\n" + i);t.b(" <label for=\"captions{id}\">");t.b("\n" + i);t.b(" <svg class=\"icon-captions-on\"><use xlink:href=\"#icon-captions-on\"></use></svg>");t.b("\n" + i);t.b(" <svg><use xlink:href=\"#icon-captions-off\"></use></svg>");t.b("\n" + i);t.b(" <span class=\"sr-only\">Toggle Captions</span>");t.b("\n" + i);t.b(" </label>");t.b("\n");t.b("\n" + i);t.b(" <button type=\"button\" data-player=\"fullscreen\">");t.b("\n" + i);t.b(" <svg class=\"icon-exit-fullscreen\"><use xlink:href=\"#icon-exit-fullscreen\"></use></svg>");t.b("\n" + i);t.b(" <svg><use xlink:href=\"#icon-enter-fullscreen\"></use></svg>");t.b("\n" + i);t.b(" <span class=\"sr-only\">Toggle Fullscreen</span>");t.b("\n" + i);t.b(" </button>");t.b("\n" + i);t.b(" </span>");t.b("\n" + i);t.b("</div>");return t.fl(); },partials: {}, subs: { }});
\ No newline at end of file diff --git a/docs/error.html b/docs/error.html index 05c19563..63cd0f0b 100644 --- a/docs/error.html +++ b/docs/error.html @@ -1,18 +1,18 @@ <!doctype html> <html lang="en" class="error"> - <head> - <meta charset="utf-8" /> - <title>Doh. Looks like something went wrong.</title> - <meta name="viewport" content="width=device-width, initial-scale=1"> + <head> + <meta charset="utf-8" /> + <title>Doh. Looks like something went wrong.</title> + <meta name="viewport" content="width=device-width, initial-scale=1"> - <!-- Docs styles --> - <link rel="stylesheet" href="//cdn.plyr.io/1.0.24/docs.css"> - </head> - <body> - <main> - <h1>Doh.</h1> - <p>Looks like something went wrong.</p> - <a href="http://plyr.io" class="btn">Back to plyr.io</a> - </main> - </body> + <!-- Docs styles --> + <link rel="stylesheet" href="//cdn.plyr.io/1.1.5/docs.css"> + </head> + <body> + <main> + <h1>Doh.</h1> + <p>Looks like something went wrong.</p> + <a href="http://plyr.io" class="btn">Back to plyr.io</a> + </main> + </body> </html>
\ No newline at end of file diff --git a/docs/index.html b/docs/index.html index d8a08997..3d383d8c 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,79 +1,95 @@ <!doctype html> <html lang="en"> - <head> - <meta charset="utf-8" /> - <title>Plyr - A simple HTML5 media player</title> - <meta name="description" content="A simple HTML5 media player with custom controls and WebVTT captions."> - <meta name="author" content="Sam Potts"> - <meta name="viewport" content="width=device-width, initial-scale=1"> + <head> + <meta charset="utf-8" /> + <title>Plyr - A simple HTML5 media player</title> + <meta name="description" content="A simple HTML5 media player with custom controls and WebVTT captions."> + <meta name="author" content="Sam Potts"> + <meta name="viewport" content="width=device-width, initial-scale=1"> - <!-- Styles --> - <link rel="stylesheet" href="//cdn.plyr.io/1.0.24/plyr.css"> + <!-- Styles --> + <link rel="stylesheet" href="//cdn.plyr.io/1.1.5/plyr.css"> - <!-- Docs styles --> - <link rel="stylesheet" href="//cdn.plyr.io/1.0.24/docs.css"> - </head> - <body> - <header> - <h1>Plyr</h1> - <p>A simple HTML5 media player with custom controls and WebVTT captions.</p> - <a href="https://github.com/selz/plyr" target="_blank" class="btn">Download on GitHub</a> - </header> + <!-- Docs styles --> + <link rel="stylesheet" href="//cdn.plyr.io/1.1.5/docs.css"> + </head> + <body> + <header> + <h1>Plyr</h1> + <p>A simple HTML5 media player with custom controls and WebVTT captions.</p> + <a href="https://github.com/selz/plyr" target="_blank" class="btn">Download on GitHub</a> + </header> - <main> - <section class="example-video"> - <div class="player"> - <video poster="//cdn.selz.com/plyr/1.0/poster.jpg" controls crossorigin> - <!-- Video files --> - <source src="//cdn.selz.com/plyr/1.0/movie.mp4" type="video/mp4"> - <source src="//cdn.selz.com/plyr/1.0/movie.webm" type="video/webm"> - - <!-- Text track file --> - <track kind="captions" label="English" srclang="en" src="//cdn.selz.com/plyr/1.0/en.vtt" default> - - <!-- Fallback for browsers that don't support the <video> element --> - <div> - <a href="//cdn.selz.com/plyr/1.0/movie.mp4">Download</a> - </div> - </video> - </div> - <small>Big Buck Bunny. More info can be found at <a href="https://peach.blender.org" target="_blank">peach.blender.org</a>.</small> - </section> + <main> + <section class="example-video"> + <div class="player"> + <video poster="//cdn.selz.com/plyr/1.0/poster.jpg" controls crossorigin> + <!-- Video files --> + <source src="//cdn.selz.com/plyr/1.0/movie.mp4" type="video/mp4"> + <source src="//cdn.selz.com/plyr/1.0/movie.webm" type="video/webm"> + + <!-- Text track file --> + <track kind="captions" label="English" srclang="en" src="//cdn.selz.com/plyr/1.0/en.vtt" default> + + <!-- Fallback for browsers that don't support the <video> element --> + <div> + <a href="//cdn.selz.com/plyr/1.0/movie.mp4">Download</a> + </div> + </video> + </div> + <small>Big Buck Bunny. More info can be found at <a href="https://peach.blender.org" target="_blank">peach.blender.org</a>.</small> + </section> - <section class="example-audio"> - <div class="player"> - <audio controls> - <!-- Audio files --> - <source src="//cdn.selz.com/plyr/1.0/logistics-96-sample.mp3" type="audio/mp3"> - <source src="//cdn.selz.com/plyr/1.0/logistics-96-sample.ogg" type="audio/ogg"> - - <!-- Fallback for browsers that don't support the <audio> element --> - <div> - <a href="//cdn.selz.com/plyr/1.0/logistics-96-sample.mp3">Download</a> - </div> - </audio> - </div> - <small>"96" by Logistics, which can be purchased from <a href="https://www.hospitalrecords.com/shop/artist/logistics" target="_blank">Hospital Records</a>.</small> - </section> - </main> + <section class="example-audio"> + <div class="player"> + <audio controls> + <!-- Audio files --> + <source src="//cdn.selz.com/plyr/1.0/logistics-96-sample.mp3" type="audio/mp3"> + <source src="//cdn.selz.com/plyr/1.0/logistics-96-sample.ogg" type="audio/ogg"> + + <!-- Fallback for browsers that don't support the <audio> element --> + <div> + <a href="//cdn.selz.com/plyr/1.0/logistics-96-sample.mp3">Download</a> + </div> + </audio> + </div> + <small>"96" by Logistics, which can be purchased from <a href="https://www.hospitalrecords.com/shop/artist/logistics" target="_blank">Hospital Records</a>.</small> + </section> + </main> - <footer> - <p>Used by …</p> - <a href="https://selz.com" target="_blank" class="logo"> - <img src="https://d33i624pw6jj68.cloudfront.net/static/img/logos/selz.svg" alt="Selz"> - </a> - </footer> + <footer> + <p>Used by …</p> + <a href="https://selz.com" target="_blank" class="logo"> + <img src="https://d33i624pw6jj68.cloudfront.net/static/img/logos/selz.svg" alt="Selz"> + </a> + </footer> - <!-- Load SVG defs --> - <!-- You should bundle all SVG/Icons into one file using a build tool such as gulp and svg store --> - <script> - (function(d,p){var a=new XMLHttpRequest(),b=d.body;a.open("GET",p,!0);a.send();a.onload=function(){var c=d.createElement("div");c.style.display="none";c.innerHTML=a.responseText;b.insertBefore(c,b.childNodes[0])}})(document,"//cdn.plyr.io/1.0.24/sprite.svg"); - </script> + <!-- Load SVG defs --> + <!-- You should bundle all SVG/Icons into one file using a build tool such as gulp and svg store --> + <script> + (function(d, u){ + var a = new XMLHttpRequest(), + b = d.body; - <!-- Plyr core script --> - <script src="//cdn.plyr.io/1.0.24/plyr.js"></script> + // Check for CORS support + // If you're loading from same domain, you can remove the if statement + if("withCredentials" in a) { + a.open("GET", u, true); + a.send(); + a.onload = function(){ + var c = d.createElement("div"); + c.style.display="none"; + c.innerHTML = a.responseText; + b.insertBefore(c, b.childNodes[0]); + } + } + })(document, "https://cdn.plyr.io/1.1.5/sprite.svg"); + </script> - <!-- Docs script --> - <script src="//cdn.plyr.io/1.0.24/docs.js"></script> - </body> + <!-- Plyr core script --> + <script src="//cdn.plyr.io/1.1.5/plyr.js"></script> + + <!-- Docs script --> + <script src="//cdn.plyr.io/1.1.5/docs.js"></script> + </body> </html>
\ No newline at end of file diff --git a/docs/src/js/docs.js b/docs/src/js/docs.js index b977290c..18e88d90 100644 --- a/docs/src/js/docs.js +++ b/docs/src/js/docs.js @@ -12,9 +12,20 @@ plyr.setup({ captions: { defaultActive: true }, - tooltips: true + onSetup: function() { + var player = this, + type = player.media.tagName.toLowerCase(), + toggle = document.querySelector("[data-toggle='fullscreen']"); + + console.log("✓ Setup done for <" + type + ">"); + + if(type === "video" && toggle) { + toggle.addEventListener("click", player.toggleFullscreen, false); + } + } }); + // Google analytics // For demo site (http://[www.]plyr.io) only if(document.domain.indexOf("plyr.io") > -1) { diff --git a/docs/src/less/docs.less b/docs/src/less/docs.less index 7cb191d7..f68e0148 100644 --- a/docs/src/less/docs.less +++ b/docs/src/less/docs.less @@ -12,153 +12,153 @@ // Variables // --------------------------------------- // Colors -@blue: #3498DB; -@gray-dark: #343f4a; -@gray: #565d64; -@gray-light: #cbd0d3; +@blue: #3498DB; +@gray-dark: #343f4a; +@gray: #565d64; +@gray-light: #cbd0d3; // Elements -@link-color: @blue; -@padding-base: 20px; +@link-color: @blue; +@padding-base: 20px; // Breakpoints -@screen-md: 768px; +@screen-md: 768px; // BORDER-BOX ALL THE THINGS! // http://paulirish.com/2012/box-sizing-border-box-ftw/ *, *::after, *::before { - box-sizing: border-box; + box-sizing: border-box; } // Base body { - font-family: "Avenir", "Helvetica Neue", Helvetica, Arial, sans-serif; - background: #fff; - line-height: 1.5; - text-align: center; - color: #6D797F; + font-family: "Avenir", "Helvetica Neue", Helvetica, Arial, sans-serif; + background: #fff; + line-height: 1.5; + text-align: center; + color: #6D797F; } // Error page html.error, .error body { - height: 100%; + height: 100%; } .error body { - width: 100%; - display: table; - table-layout: fixed; + width: 100%; + display: table; + table-layout: fixed; } .error main { - display: table-cell; - width: 100%; - vertical-align: middle; + display: table-cell; + width: 100%; + vertical-align: middle; } // Type h1, h2 { - letter-spacing: -.025em; - color: #2E3C44; - margin: 0 0 (@padding-base / 2); - line-height: 1.2; - .font-smoothing(); + letter-spacing: -.025em; + color: #2E3C44; + margin: 0 0 (@padding-base / 2); + line-height: 1.2; + .font-smoothing(); } h1 { - .font-size(64); - color: #3498DB; + .font-size(64); + color: #3498DB; } p, small { - margin: 0 0 @padding-base; + margin: 0 0 @padding-base; } small { - display: block; - padding: 0 (@padding-base / 2); - .font-size(14); + display: block; + padding: 0 (@padding-base / 2); + .font-size(14); } // Header header { - padding: @padding-base; - margin-bottom: @padding-base; + padding: @padding-base; + margin-bottom: @padding-base; - p { - .font-size(18); - } - @media (min-width: 560px) { - padding-top: (@padding-base * 3); - padding-bottom: (@padding-base * 3); - } + p { + .font-size(18); + } + @media (min-width: 560px) { + padding-top: (@padding-base * 3); + padding-bottom: (@padding-base * 3); + } } // Sections section { - padding-bottom: @padding-base; + padding-bottom: @padding-base; - @media (min-width: 560px) { - padding-bottom: (@padding-base * 2); - } + @media (min-width: 560px) { + padding-bottom: (@padding-base * 2); + } } // Links & Buttons a { - text-decoration: none; - color: @link-color; - border-bottom: 1px solid currentColor; - transition: all .3s ease; - - &:hover, - &:focus { - color: #000; - } - &:focus { - .tab-focus(); - } - &.logo { - border: 0; - } + text-decoration: none; + color: @link-color; + border-bottom: 1px solid currentColor; + transition: all .3s ease; + + &:hover, + &:focus { + color: #000; + } + &:focus { + .tab-focus(); + } + &.logo { + border: 0; + } } .btn { - display: inline-block; - padding: (@padding-base / 2) (@padding-base * 1.5); - background: @link-color; - border: 0; - color: #fff; - .font-smoothing(on); - font-weight: 600; - border-radius: 3px; - user-select: none; - - &:hover, - &:focus { - color: #fff; - background: darken(@link-color, 5%); - } + display: inline-block; + padding: (@padding-base / 2) (@padding-base * 1.5); + background: @link-color; + border: 0; + color: #fff; + .font-smoothing(on); + font-weight: 600; + border-radius: 3px; + user-select: none; + + &:hover, + &:focus { + color: #fff; + background: darken(@link-color, 5%); + } } // Players .example-audio .player { - max-width: 480px; + max-width: 520px; } .example-video .player { - max-width: 1200px; + max-width: 1200px; } .example-audio .player, .example-video .player { - margin: 0 auto @padding-base; + margin: 0 auto @padding-base; - &-fullscreen, - &.fullscreen-active { - max-width: none; - } + &-fullscreen, + &.fullscreen-active { + max-width: none; + } } // Footer footer { - margin-bottom: @padding-base; + margin-bottom: @padding-base; - p { - margin-bottom: (@padding-base / 2); - } + p { + margin-bottom: (@padding-base / 2); + } }
\ No newline at end of file diff --git a/docs/src/less/lib/fontface.less b/docs/src/less/lib/fontface.less index 704503d1..479f7fa4 100644 --- a/docs/src/less/lib/fontface.less +++ b/docs/src/less/lib/fontface.less @@ -1,16 +1,16 @@ @font-face { - font-family: "Avenir"; - src: url("//cdn.plyr.io/fonts/avenir-medium.woff2") format("woff2"), - url("//cdn.plyr.io/fonts/avenir-medium.woff") format("woff"), - url("//cdn.plyr.io/fonts/avenir-medium.ttf") format("truetype"); - font-style: normal; - font-weight: 400; + font-family: "Avenir"; + src: url("//cdn.plyr.io/fonts/avenir-medium.woff2") format("woff2"), + url("//cdn.plyr.io/fonts/avenir-medium.woff") format("woff"), + url("//cdn.plyr.io/fonts/avenir-medium.ttf") format("truetype"); + font-style: normal; + font-weight: 400; } @font-face { - font-family: "Avenir"; - src: url("//cdn.plyr.io/fonts/avenir-bold.woff2") format("woff2"), - url("//cdn.plyr.io/fonts/avenir-bold.woff") format("woff"), - url("//cdn.plyr.io/fonts/avenir-bold.ttf") format("truetype"); - font-style: normal; - font-weight: 600; + font-family: "Avenir"; + src: url("//cdn.plyr.io/fonts/avenir-bold.woff2") format("woff2"), + url("//cdn.plyr.io/fonts/avenir-bold.woff") format("woff"), + url("//cdn.plyr.io/fonts/avenir-bold.ttf") format("truetype"); + font-style: normal; + font-weight: 600; }
\ No newline at end of file diff --git a/docs/src/less/lib/mixins.less b/docs/src/less/lib/mixins.less index b3a1f63b..a4451b1c 100644 --- a/docs/src/less/lib/mixins.less +++ b/docs/src/less/lib/mixins.less @@ -5,38 +5,38 @@ // Contain floats: nicolasgallagher.com/micro-clearfix-hack/ // --------------------------------------- .clearfix() { - zoom: 1; - &:before, - &:after { content: ""; display: table; } - &:after { clear: both; } + zoom: 1; + &:before, + &:after { content: ""; display: table; } + &:after { clear: both; } } // Webkit-style focus // --------------------------------------- .tab-focus() { - // Default - outline: thin dotted @gray-dark; - // Webkit - //outline: 5px auto -webkit-focus-ring-color; - outline-offset: 1px; + // Default + outline: thin dotted @gray-dark; + // Webkit + //outline: 5px auto -webkit-focus-ring-color; + outline-offset: 1px; } // Use rems for font sizing // Leave <body> at 100%/16px // --------------------------------------- .font-size(@font-size: 16){ - @rem: round((@font-size / 16), 1); - font-size: (@font-size * 1px); - font-size: ~"@{rem}rem"; + @rem: round((@font-size / 16), 1); + font-size: (@font-size * 1px); + font-size: ~"@{rem}rem"; } // Font smoothing // --------------------------------------- .font-smoothing(@mode: on) when (@mode = on) { - -moz-osx-font-smoothing: grayscale; - -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + -webkit-font-smoothing: antialiased; } .font-smoothing(@mode: on) when (@mode = off) { - -moz-osx-font-smoothing: auto; - -webkit-font-smoothing: subpixel-antialiased; + -moz-osx-font-smoothing: auto; + -webkit-font-smoothing: subpixel-antialiased; }
\ No newline at end of file diff --git a/docs/src/templates/controls.html b/docs/src/templates/controls.html index 6d93faa4..47ccbd55 100644 --- a/docs/src/templates/controls.html +++ b/docs/src/templates/controls.html @@ -1,62 +1,66 @@ <div class="player-controls"> - <div class="player-progress"> - <label for="seek{id}" class="sr-only">Seek</label> - <input id="seek{id}" class="player-progress-seek" type="range" min="0" max="100" step="0.5" value="0" data-player="seek"> - <progress class="player-progress-played" max="100" value="0"> - <span>0</span>% played - </progress> - <progress class="player-progress-buffer" max="100" value="0"> - <span>0</span>% buffered - </progress> - </div> - <span class="player-controls-playback"> - <button type="button" data-player="restart"> - <svg><use xlink:href="#icon-restart"></use></svg> - <span class="sr-only">Restart</span> - </button> - <button type="button" data-player="rewind"> - <svg><use xlink:href="#icon-rewind"></use></svg> - <span class="sr-only">Rewind {seektime} secs</span> - </button> - <button type="button" data-player="play"> - <svg><use xlink:href="#icon-play"></use></svg> - <span class="sr-only">Play</span> - </button> - <button type="button" data-player="pause"> - <svg><use xlink:href="#icon-pause"></use></svg> - <span class="sr-only">Pause</span> - </button> - <button type="button" data-player="fast-forward"> - <svg><use xlink:href="#icon-fast-forward"></use></svg> - <span class="sr-only">Forward {seektime} secs</span> - </button> - <span class="player-time"> - <span class="sr-only">Time</span> - <span class="player-duration">00:00</span> - </span> - </span> - <span class="player-controls-sound"> - <input class="inverted sr-only" id="mute{id}" type="checkbox" data-player="mute"> - <label id="mute{id}" for="mute{id}"> - <svg class="icon-muted"><use xlink:href="#icon-muted"></use></svg> - <svg><use xlink:href="#icon-volume"></use></svg> - <span class="sr-only">Toggle Mute</span> - </label> + <div class="player-progress"> + <label for="seek{id}" class="sr-only">Seek</label> + <input id="seek{id}" class="player-progress-seek" type="range" min="0" max="100" step="0.5" value="0" data-player="seek"> + <progress class="player-progress-played" max="100" value="0"> + <span>0</span>% played + </progress> + <progress class="player-progress-buffer" max="100" value="0"> + <span>0</span>% buffered + </progress> + </div> + <span class="player-controls-left"> + <button type="button" data-player="restart"> + <svg><use xlink:href="#icon-restart"></use></svg> + <span class="sr-only">Restart</span> + </button> + <button type="button" data-player="rewind"> + <svg><use xlink:href="#icon-rewind"></use></svg> + <span class="sr-only">Rewind {seektime} secs</span> + </button> + <button type="button" data-player="play"> + <svg><use xlink:href="#icon-play"></use></svg> + <span class="sr-only">Play</span> + </button> + <button type="button" data-player="pause"> + <svg><use xlink:href="#icon-pause"></use></svg> + <span class="sr-only">Pause</span> + </button> + <button type="button" data-player="fast-forward"> + <svg><use xlink:href="#icon-fast-forward"></use></svg> + <span class="sr-only">Forward {seektime} secs</span> + </button> + <span class="player-time"> + <span class="sr-only">Current time</span> + <span class="player-current-time">00:00</span> + </span> + <span class="player-time"> + <span class="sr-only">Duration</span> + <span class="player-duration">00:00</span> + </span> + </span> + <span class="player-controls-right"> + <input class="inverted sr-only" id="mute{id}" type="checkbox" data-player="mute"> + <label id="mute{id}" for="mute{id}"> + <svg class="icon-muted"><use xlink:href="#icon-muted"></use></svg> + <svg><use xlink:href="#icon-volume"></use></svg> + <span class="sr-only">Toggle Mute</span> + </label> - <label for="volume{id}" class="sr-only">Volume</label> - <input id="volume{id}" class="player-volume" type="range" min="0" max="10" step="0.5" value="0" data-player="volume"> + <label for="volume{id}" class="sr-only">Volume</label> + <input id="volume{id}" class="player-volume" type="range" min="0" max="10" step="0.5" value="0" data-player="volume"> - <input class="sr-only" id="captions{id}" type="checkbox" data-player="captions"> - <label for="captions{id}"> - <svg class="icon-captions-on"><use xlink:href="#icon-captions-on"></use></svg> - <svg><use xlink:href="#icon-captions-off"></use></svg> - <span class="sr-only">Toggle Captions</span> - </label> + <input class="sr-only" id="captions{id}" type="checkbox" data-player="captions"> + <label for="captions{id}"> + <svg class="icon-captions-on"><use xlink:href="#icon-captions-on"></use></svg> + <svg><use xlink:href="#icon-captions-off"></use></svg> + <span class="sr-only">Toggle Captions</span> + </label> - <button type="button" data-player="fullscreen"> - <svg class="icon-exit-fullscreen"><use xlink:href="#icon-exit-fullscreen"></use></svg> - <svg><use xlink:href="#icon-enter-fullscreen"></use></svg> - <span class="sr-only">Toggle Fullscreen</span> - </button> - </span> + <button type="button" data-player="fullscreen"> + <svg class="icon-exit-fullscreen"><use xlink:href="#icon-exit-fullscreen"></use></svg> + <svg><use xlink:href="#icon-enter-fullscreen"></use></svg> + <span class="sr-only">Toggle Fullscreen</span> + </button> + </span> </div>
\ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index 7b530d25..a8724dfc 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -4,59 +4,60 @@ /*global require, __dirname*/ /*jshint -W079 */ -var fs = require("fs"), - path = require("path"), - gulp = require("gulp"), - gutil = require("gulp-util"), - concat = require("gulp-concat"), - uglify = require("gulp-uglify"), - less = require("gulp-less"), - sass = require("gulp-sass"), - minify = require("gulp-minify-css"), - run = require("run-sequence"), - prefix = require("gulp-autoprefixer"), - svgstore = require("gulp-svgstore"), - svgmin = require("gulp-svgmin"), - hogan = require("gulp-hogan-compile"), - rename = require("gulp-rename"), - s3 = require("gulp-s3"), - gzip = require("gulp-gzip"), - replace = require("gulp-replace"), - open = require("gulp-open"); +var fs = require("fs"), + path = require("path"), + gulp = require("gulp"), + gutil = require("gulp-util"), + concat = require("gulp-concat"), + uglify = require("gulp-uglify"), + less = require("gulp-less"), + sass = require("gulp-sass"), + minify = require("gulp-minify-css"), + run = require("run-sequence"), + prefix = require("gulp-autoprefixer"), + svgstore = require("gulp-svgstore"), + svgmin = require("gulp-svgmin"), + hogan = require("gulp-hogan-compile"), + rename = require("gulp-rename"), + s3 = require("gulp-s3"), + gzip = require("gulp-gzip"), + replace = require("gulp-replace"), + open = require("gulp-open"), + size = require("gulp-size"); var root = __dirname, paths = { - plyr: { - // Source paths - src: { - less: path.join(root, "src/less/**/*"), - sass: path.join(root, "src/sass/**/*"), - js: path.join(root, "src/js/**/*"), - sprite: path.join(root, "src/sprite/*.svg") - }, - // Output paths - output: path.join(root, "dist/") - }, - docs: { - // Source paths - src: { - less: path.join(root, "docs/src/less/**/*"), - js: path.join(root, "docs/src/js/**/*"), - templates: path.join(root, "docs/src/templates/*.html") - }, - // Output paths - output: path.join(root, "docs/dist/"), - // Docs - root: path.join(root, "docs/") - }, - upload: [path.join(root, "dist/**"), path.join(root, "docs/dist/**")] + plyr: { + // Source paths + src: { + less: path.join(root, "src/less/**/*"), + sass: path.join(root, "src/sass/**/*"), + js: path.join(root, "src/js/**/*"), + sprite: path.join(root, "src/sprite/*.svg") + }, + // Output paths + output: path.join(root, "dist/") + }, + docs: { + // Source paths + src: { + less: path.join(root, "docs/src/less/**/*"), + js: path.join(root, "docs/src/js/**/*"), + templates: path.join(root, "docs/src/templates/*.html") + }, + // Output paths + output: path.join(root, "docs/dist/"), + // Docs + root: path.join(root, "docs/") + }, + upload: [path.join(root, "dist/**"), path.join(root, "docs/dist/**")] }, // Task arrays tasks = { - less: [], - sass: [], - js: [] + less: [], + sass: [], + js: [] }, // Fetch bundles from JSON @@ -69,88 +70,88 @@ function loadJSON(path) { } var build = { - js: function (files, bundle) { - for (var key in files) { - (function(key) { - var name = "js-" + key; - tasks.js.push(name); + js: function (files, bundle) { + for (var key in files) { + (function(key) { + var name = "js-" + key; + tasks.js.push(name); - gulp.task(name, function () { - return gulp - .src(bundles[bundle].js[key]) - .pipe(concat(key)) - .pipe(uglify()) - .pipe(gulp.dest(paths[bundle].output)); - }); - })(key); - } - }, - less: function(files, bundle) { - for (var key in files) { - (function (key) { - var name = "less-" + key; - tasks.less.push(name); + gulp.task(name, function () { + return gulp + .src(bundles[bundle].js[key]) + .pipe(concat(key)) + .pipe(uglify()) + .pipe(gulp.dest(paths[bundle].output)); + }); + })(key); + } + }, + less: function(files, bundle) { + for (var key in files) { + (function (key) { + var name = "less-" + key; + tasks.less.push(name); - gulp.task(name, function () { - return gulp - .src(bundles[bundle].less[key]) - .pipe(less()) - .on("error", gutil.log) - .pipe(concat(key)) - .pipe(prefix(["last 2 versions"], { cascade: true })) - .pipe(minify()) - .pipe(gulp.dest(paths[bundle].output)); - }); - })(key); - } - }, - sass: function(files, bundle) { - for (var key in files) { - (function (key) { - var name = "sass-" + key; - tasks.sass.push(name); + gulp.task(name, function () { + return gulp + .src(bundles[bundle].less[key]) + .pipe(less()) + .on("error", gutil.log) + .pipe(concat(key)) + .pipe(prefix(["last 2 versions"], { cascade: true })) + .pipe(minify()) + .pipe(gulp.dest(paths[bundle].output)); + }); + })(key); + } + }, + sass: function(files, bundle) { + for (var key in files) { + (function (key) { + var name = "sass-" + key; + tasks.sass.push(name); - gulp.task(name, function () { - return gulp - .src(bundles[bundle].sass[key]) - .pipe(sass()) - .on("error", gutil.log) - .pipe(concat(key)) - .pipe(prefix(["last 2 versions"], { cascade: true })) - .pipe(minify()) - .pipe(gulp.dest(paths[bundle].output)); - }); - })(key); - } - }, - sprite: function() { - // Process Icons - gulp.task("sprite", function () { - return gulp - .src(paths.plyr.src.sprite) - .pipe(svgmin({ - plugins: [{ - removeDesc: true - }] - })) - .pipe(svgstore()) - .pipe(gulp.dest(paths.plyr.output)); - }); - }, - templates: function() { - // Build templates - gulp.task("templates", function () { - return gulp - .src(paths.docs.src.templates) - .pipe(hogan("templates.js", { - wrapper: false, - templateName: function (file) { - return path.basename(file.relative.replace(/\\/g, "-"), path.extname(file.relative)); - } - })) - .pipe(gulp.dest(paths.docs.output)); - }); - } + gulp.task(name, function () { + return gulp + .src(bundles[bundle].sass[key]) + .pipe(sass()) + .on("error", gutil.log) + .pipe(concat(key)) + .pipe(prefix(["last 2 versions"], { cascade: true })) + .pipe(minify()) + .pipe(gulp.dest(paths[bundle].output)); + }); + })(key); + } + }, + sprite: function() { + // Process Icons + gulp.task("sprite", function () { + return gulp + .src(paths.plyr.src.sprite) + .pipe(svgmin({ + plugins: [{ + removeDesc: true + }] + })) + .pipe(svgstore()) + .pipe(gulp.dest(paths.plyr.output)); + }); + }, + templates: function() { + // Build templates + gulp.task("templates", function () { + return gulp + .src(paths.docs.src.templates) + .pipe(hogan("templates.js", { + wrapper: false, + templateName: function (file) { + return path.basename(file.relative.replace(/\\/g, "-"), path.extname(file.relative)); + } + })) + .pipe(gulp.dest(paths.docs.output)); + }); + } }; // Plyr core files @@ -166,22 +167,22 @@ build.js(bundles.docs.js, "docs"); // Default gulp task gulp.task("default", function(){ - run("templates", tasks.js, tasks.less, "sprite"); + run("templates", tasks.js, tasks.less, "sprite"); }); // Build all JS (inc. templates) gulp.task("js", function(){ - run("templates", tasks.js); + run("templates", tasks.js); }); // Build SASS (for testing, default is LESS) gulp.task("sass", function(){ - run(tasks.sass); + run(tasks.sass); }); // Watch for file changes gulp.task("watch", function () { - // Plyr core + // Plyr core gulp.watch(paths.plyr.src.js, tasks.js); gulp.watch(paths.plyr.src.less, tasks.less); gulp.watch(paths.plyr.src.sprite, "sprite"); @@ -189,7 +190,7 @@ gulp.task("watch", function () { // Docs gulp.watch(paths.docs.src.js, tasks.js); gulp.watch(paths.docs.src.less, tasks.less); - gulp.watch(paths.docs.src.templates, "js"); + gulp.watch(paths.docs.src.templates, "js"); }); // Publish a version to CDN and docs @@ -198,69 +199,78 @@ gulp.task("watch", function () { // Some options var aws = loadJSON(path.join(root, "aws.json")), version = package.version, -maxAge = 31536000, // seconds 1 year +maxAge = 31536000, // seconds 1 year options = { - cdn: { - headers: { - "Cache-Control": "max-age=" + maxAge + ", no-transform, public", - "Vary": "Accept-Encoding" - }, - gzippedOnly: true - }, - docs: { - headers: { - "Cache-Control": "public, must-revalidate, proxy-revalidate, max-age=0", - "Vary": "Accept-Encoding" - }, - gzippedOnly: true - } + cdn: { + headers: { + "Cache-Control": "max-age=" + maxAge + ", no-transform, public", + "Vary": "Accept-Encoding" + }, + gzippedOnly: true + }, + docs: { + headers: { + "Cache-Control": "public, must-revalidate, proxy-revalidate, max-age=0", + "Vary": "Accept-Encoding" + }, + gzippedOnly: true + } }, cdnpath = new RegExp(aws.cdn.bucket + "\/(\\d+\\.)?(\\d+\\.)?(\\*|\\d+)","gi"); // Publish version to CDN bucket gulp.task("cdn", function () { - console.log("Uploading " + version + " to " + aws.cdn.bucket); + console.log("Uploading " + version + " to " + aws.cdn.bucket); - // Upload to CDN - gulp.src(paths.upload) - .pipe(rename(function (path) { - path.dirname = path.dirname.replace(".", version); - })) - .pipe(gzip()) - .pipe(s3(aws.cdn, options.cdn)); + // Upload to CDN + gulp.src(paths.upload) + .pipe(size({ + showFiles: true, + gzip: true + })) + .pipe(rename(function (path) { + path.dirname = path.dirname.replace(".", version); + })) + .pipe(gzip()) + .pipe(s3(aws.cdn, options.cdn)); }); // Publish to Docs bucket gulp.task("docs", function () { - console.log("Uploading " + version + " docs to " + aws.docs.bucket); + console.log("Uploading " + version + " docs to " + aws.docs.bucket); - // Replace versioned files in *.html - gulp.src([paths.docs.root + "*.html"]) - .pipe(replace(cdnpath, aws.cdn.bucket + "/" + version)) - .pipe(gulp.dest(paths.docs.root)) - .pipe(gzip()) - .pipe(s3(aws.docs, options.docs)); + // Replace versioned files in readme.md + gulp.src([root + "/readme.md"]) + .pipe(replace(cdnpath, aws.cdn.bucket + "/" + version)) + .pipe(gulp.dest(root)); - // Upload error.html to cdn using docs options - gulp.src([paths.docs.root + "error.html"]) - .pipe(gzip()) - .pipe(s3(aws.cdn, options.docs)); + // Replace versioned files in *.html + gulp.src([paths.docs.root + "*.html"]) + .pipe(replace(cdnpath, aws.cdn.bucket + "/" + version)) + .pipe(gulp.dest(paths.docs.root)) + .pipe(gzip()) + .pipe(s3(aws.docs, options.docs)); + + // Upload error.html to cdn using docs options + gulp.src([paths.docs.root + "error.html"]) + .pipe(gzip()) + .pipe(s3(aws.cdn, options.docs)); }); // Open the docs site to check it's sweet gulp.task("open", function () { - console.log("Opening " + aws.docs.bucket + "..."); + console.log("Opening " + aws.docs.bucket + "..."); - // A file must be specified or gulp will skip the task - // Doesn't matter which file since we set the URL above - // Weird, I know... - gulp.src([paths.docs.root + "index.html"]) - .pipe(open("", { - url: "http://" + aws.docs.bucket - })); + // A file must be specified or gulp will skip the task + // Doesn't matter which file since we set the URL above + // Weird, I know... + gulp.src([paths.docs.root + "index.html"]) + .pipe(open("", { + url: "http://" + aws.docs.bucket + })); }); // Do everything gulp.task("publish", function () { - run("templates", tasks.js, tasks.less, "sprite", "cdn", "docs", "open"); + run("templates", tasks.js, tasks.less, "sprite", "cdn", "docs", "open"); });
\ No newline at end of file diff --git a/package.json b/package.json index e138861a..192df16d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "plyr", - "version": "1.0.24", + "version": "1.1.5", "description": "A simple HTML5 media player using custom controls", "homepage": "http://plyr.io", "main": "gulpfile.js", @@ -18,6 +18,7 @@ "gulp-replace": "^0.5.3", "gulp-s3": "^0.3.0", "gulp-sass": "^1.3.3", + "gulp-size": "^1.2.1", "gulp-svgmin": "^1.0.0", "gulp-svgstore": "^5.0.0", "gulp-uglify": "~0.3.1", @@ -3,14 +3,14 @@ A simple, accessible HTML5 media player. [Checkout the demo](http://plyr.io) -[](http://plyr.io) +[](http://plyr.io) ## Why? We wanted a lightweight, accessible and customisable media player that just supports *modern* browsers. Sure, there are many other players out there but we wanted to keep things simple, using the right elements for the job. ## Features - **Accessible** - full support for captions and screen readers. -- **Lightweight** - just 5.7KB minified and gzipped. +- **Lightweight** - just 6.4KB minified and gzipped. - **Customisable** - make the player look how you want with the markup you want. - **Semantic** - uses the *right* elements. `<input type="range">` for volume and `<progress>` for progress and well, `<button>`s for buttons. There's no `<span>` or `<a href="#">` button hacks. - **Responsive** - as you'd expect these days. @@ -25,11 +25,10 @@ Oh and yes, it works with Bootstrap. Check out [the changelog](changelog.md) ## Planned development -- Accept a string selector, a node, or a nodelist for the `container` property of `selectors`. -- Multiple language captions (with selection) - Playlists (audio and video) -- Set source by API -- Tooltip option (for seeking and controls) +- YouTube and Vimeo support +- Playback speed +- Multiple language captions (with selection) ... and whatever else has been raised in [issues](https://github.com/Selz/plyr/issues) If you have any cool ideas or features, please let me know by [creating an issue](https://github.com/Selz/plyr/issues/new) or of course, forking and sending a pull request. @@ -38,7 +37,7 @@ If you have any cool ideas or features, please let me know by [creating an issue Check `docs/index.html` and `docs/dist/docs.js` for an example setup. -**Heads up**, the example `index.html` file needs to be served from a webserver (such as Apache, Nginx, IIS or similar) unless you change the file sources to include http or https. e.g. change `//cdn.plyr.io/1.0.24/plyr.js` to `https://cdn.plyr.io/1.0.24/plyr.js` +**Heads up**, the example `index.html` file needs to be served from a webserver (such as Apache, Nginx, IIS or similar) unless you change the file sources to include http or https. e.g. change `//cdn.plyr.io/1.1.5/plyr.js` to `https://cdn.plyr.io/1.1.5/plyr.js` ### Bower If bower is your thang, you can grab Plyr using: @@ -47,15 +46,22 @@ bower install plyr ``` More info on setting up dependencies can be found in the [Bower Docs](http://bower.io/docs/creating-packages/#maintaining-dependencies) +### Ember +The awesome [@louisrudner](https://twitter.com/louisrudner) has created an ember component, available by running: +``` +ember addon:install ember-cli-plyr +``` +More info is on [npm](https://www.npmjs.com/package/ember-cli-plyr) and [GitHub](https://github.com/louisrudner/ember-cli-plyr) + ### CDN If you want to use our CDN, you can use the following. HTTPS (SSL) is supported. ```html -<link rel="stylesheet" href="//cdn.plyr.io/1.0.24/plyr.css"> -<script src="//cdn.plyr.io/1.0.24/plyr.js"></script> +<link rel="stylesheet" href="//cdn.plyr.io/1.1.5/plyr.css"> +<script src="//cdn.plyr.io/1.1.5/plyr.js"></script> ``` -You can also access the `sprite.svg` file at `//cdn.plyr.io/1.0.24/sprite.svg`. +You can also access the `sprite.svg` file at `//cdn.plyr.io/1.1.5/sprite.svg`. ### CSS 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. @@ -130,21 +136,17 @@ You'll notice the `crossorigin` attribute on the example `<video>` and `<audio>` More info on CORS here: [https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS) -###JavaScript -Much of the behaviour of the player is configurable when initialising the library. Below is an example of a default instance. +### JavaScript +Much of the behaviour of the player is configurable when initialising the library. Here's an example of a default setup: ```html <script src="dist/plyr.js"></script> -<script> -plyr.setup({ - *options* -}); -</script> +<script>plyr.setup();</script> ``` #### Options -You can pass the following options to the setup method. +You can pass the following options to the setup method using `plyr.setup({...})`. <table class="table" width="100%"> <thead> @@ -169,6 +171,12 @@ You can pass the following options to the setup method. <td>See <a href="controls.md">controls.md</a> for more info on how the html needs to be structured.</td> </tr> <tr> + <td><code>controls</code></td> + <td>Array</td> + <td><code>["restart", "rewind", "play", "fast-forward", "current-time", "duration", "mute", "volume", "captions", "fullscreen"]</code></td> + <td>Toggle which control elements you would like to display when using the default controls html. If you specify a <code>html</code> option, this is redundant. The default value is to display everything.</td> + </tr> + <tr> <td><code>debug</code></td> <td>Boolean</td> <td><code>false</code></td> @@ -198,6 +206,12 @@ You can pass the following options to the setup method. <td><code>false</code></td> <td>Display control labels as tooltips on :hover & :focus (by default, the labels are screen reader only).</td> </tr> + <tr> + <td><code>displayDuration</code></td> + <td>Boolean</td> + <td><code>true</code></td> + <td>Displays the duration of the media on the "metadataloaded" event (on startup) in the current time display. This will only work if the `preload` attribute is not set to `none` (or is not set at all) and you choose not to display the duration (see <code>controls</code> option).</td> + </tr> <tr> <td><code>selectors</code></td> <td>Object</td> @@ -220,7 +234,7 @@ You can pass the following options to the setup method. <td><code>fullscreen</code></td> <td>Object</td> <td>—</td> - <td>Two properties; <code>enabled</code> which toggles if fullscreen should be enabled (if the browser supports it). The default value is <code>true</code>. Also an extra property called <code>fallback</code> which will enable a full window view for older browsers. The default value is <code>true</code>.</td> + <td>Three properties; <code>enabled</code> which toggles if fullscreen should be enabled (if the browser supports it). The default value is <code>true</code>. A <code>fallback</code> property which will enable a full window view for older browsers. The default value is <code>true</code>. A <code>hideControls</code> property which will 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`). The default value is <code>true</code>.</td> </tr> <tr> <td><code>storage</code></td> @@ -228,6 +242,12 @@ You can pass the following options to the setup method. <td>—</td> <td>Two properties; <code>enabled</code> which toggles if local storage should be enabled (if the browser supports it). The default value is `true`. This enables storing user settings, currently it only stores volume but more will be added later. The second property <code>key</code> is the key used for the local storage. The default is <code>plyr_volume</code> until more settings are stored.</td> </tr> + <tr> + <td><code>onSetup</code></td> + <td>Function</td> + <td>—</td> + <td>This callback function is called on every new plyr instance created. The context (<code>this</code>) is the plyr instance itself.</td> + </tr> </tbody> </table> @@ -296,6 +316,16 @@ Here's a list of the methods supported: <td>Toggles whether captions are enabled.</td> </tr> <tr> + <td><code>toggleFullscreen()</code></td> + <td>Event</td> + <td>Toggles fullscreen. This can only be initiated by a user gesture due to browser security, i.e. a user event such as click.</td> + </tr> + <tr> + <td><code>isFullscreen()</code></td> + <td>—</td> + <td>Boolean returned if the player is in fullscreen.</td> + </tr> + <tr> <td><code>support(...)</code></td> <td>String</td> <td>Determine if a player supports a certain MIME type.</td> @@ -315,7 +345,7 @@ Here's a list of the methods supported: This will inject a child `source` element for every element in the array with the specified attributes. `src` is the only required attribute although adding `type` is recommended as it helps the browser decide which file to download and play. </td> </tr> - <tr> + <tr> <td><code>poster(...)</code></td> <td>String</td> <td>Set the poster url. This is supported for the <code>video</code> element only.</td> @@ -338,11 +368,12 @@ A complete list of events can be found here: [Media Events - W3.org](http://www.w3.org/2010/05/video/mediaevents.html) ## Fullscreen + Fullscreen in Plyr is supported for all browsers that [currently support it](http://caniuse.com/#feat=fullscreen). If you're using the default CSS, you can also use a "full browser" mode which will use the full browser window by adding the `player-fullscreen` class to your container. ## Browser support -<table width="100%" style="text-align: center;"> +<table width="100%" style="text-align: center"> <thead> <tr> <td>Safari</td> @@ -359,15 +390,15 @@ Fullscreen in Plyr is supported for all browsers that [currently support it](htt <td>✔</td> <td>✔</td> <td>✔</td> - <td>✖²</td> + <td>API²</td> <td>✔³</td> </tr> </tbody> </table> -¹ iPhone forces the native player for `<video>` so no customisation possible +¹ Mobile Safari on the iPhone forces the native player for `<video>` so no useful customisation is possible. `<audio>` elements have volume controls disabled. -² Native player used (no support for `<progress>` or `<input type="range">`) +² Native player used (no support for `<progress>` or `<input type="range">`) but the API is supported (v1.0.28+) ³ IE10 has no native fullscreen support, fallback can be used (see options) @@ -380,19 +411,24 @@ If a User Agent is disabled but supports `<video>` and `<audio>` natively, it wi Any unsupported browsers will display links to download the media if the correct html is used. +### Checking for support +There's an API method for checking support. You can call `plyr.supported()` and optionally pass a type to it, e.g. `plyr.supported("video")`. It will return an object with two keys; `basic` meaning there's basic support for that media type (or both if no type is passed) and `full` meaning there's full support for plyr. + ## Issues If you find anything weird with Plyr, please let us know using the GitHub issues tracker. ## Author -Plyr is developed by Sam Potts ([@sam_potts](https://twitter.com/sam_potts)) ([sampotts.me](http://sampotts.me)) +Plyr is developed by [@sam_potts](https://twitter.com/sam_potts) / [sampotts.me](http://sampotts.me) with help from the awesome [contributors](https://github.com/Selz/plyr/graphs/contributors) ## Mentions - [The Changelog](http://thechangelog.com/plyr-simple-html5-media-player-custom-controls-webvtt-captions/) - [HTML5 Weekly #177](http://html5weekly.com/issues/177) +- [Responsive Design #149](http://us4.campaign-archive2.com/?u=559bc631fe5294fc66f5f7f89&id=451a61490f) - [Web Design Weekly #174](https://web-design-weekly.com/2015/02/24/web-design-weekly-174/) - [Hacker News](https://news.ycombinator.com/item?id=9136774) - [Web Platform Daily](http://webplatformdaily.org/releases/2015-03-04) - [LayerVault Designer News](https://news.layervault.com/stories/45394-plyr--a-simple-html5-media-player) +- [The Treehouse Show #131](https://teamtreehouse.com/library/episode-131-origami-react-responsive-hero-images) ## Used by - [Selz.com](https://selz.com) @@ -410,4 +446,4 @@ Also these links helped created Plyr: - [Styling the `<progress>` element - hongkiat.com](http://www.hongkiat.com/blog/html5-progress-bar/) ## Copyright and License -[The MIT license](license.md).
\ No newline at end of file +[The MIT license](license.md). diff --git a/src/js/plyr.js b/src/js/plyr.js index 90ef2d8e..865bb9a9 100644 --- a/src/js/plyr.js +++ b/src/js/plyr.js @@ -1,7 +1,7 @@ // ========================================================================== // Plyr -// plyr.js v1.0.24 -// https://github.com/sampotts/plyr +// plyr.js v1.1.5 +// https://github.com/selz/plyr // License: The MIT License (MIT) // ========================================================================== // Credits: http://paypal.github.io/accessible-html5-video-player/ @@ -9,6 +9,7 @@ (function (api) { "use strict"; + /*global YT*/ // Globals var fullscreen, config; @@ -21,6 +22,7 @@ volume: 5, click: true, tooltips: false, + displayDuration: true, selectors: { container: ".player", controls: ".player-controls", @@ -43,11 +45,13 @@ played: ".player-progress-played" }, captions: ".player-captions", + currentTime: ".player-current-time", duration: ".player-duration" }, classes: { video: "player-video", videoWrapper: "player-video-wrapper", + embedWrapper: "player-video-embed", audio: "player-audio", stopped: "stopped", playing: "playing", @@ -55,13 +59,15 @@ loading: "loading", tooltip: "player-tooltip", hidden: "sr-only", + hover: "hover", captions: { enabled: "captions-enabled", active: "captions-active" }, fullscreen: { enabled: "fullscreen-enabled", - active: "fullscreen-active" + active: "fullscreen-active", + hideControls: "fullscreen-hide-controls" } }, captions: { @@ -69,77 +75,159 @@ }, fullscreen: { enabled: true, - fallback: true + fallback: true, + hideControls: true }, storage: { enabled: true, key: "plyr_volume" }, - html: (function() { - return [ - "<div class='player-controls'>", - "<div class='player-progress'>", - "<label for='seek{id}' class='sr-only'>Seek</label>", - "<input id='seek{id}' class='player-progress-seek' type='range' min='0' max='100' step='0.5' value='0' data-player='seek'>", - "<progress class='player-progress-played' max='100' value='0'>", - "<span>0</span>% played", - "</progress>", - "<progress class='player-progress-buffer' max='100' value='0'>", - "<span>0</span>% buffered", - "</progress>", - "</div>", - "<span class='player-controls-playback'>", - "<button type='button' data-player='restart'>", - "<svg><use xlink:href='#icon-restart'></use></svg>", - "<span class='sr-only'>Restart</span>", - "</button>", - "<button type='button' data-player='rewind'>", - "<svg><use xlink:href='#icon-rewind'></use></svg>", - "<span class='sr-only'>Rewind {seektime} secs</span>", - "</button>", - "<button type='button' data-player='play'>", - "<svg><use xlink:href='#icon-play'></use></svg>", - "<span class='sr-only'>Play</span>", - "</button>", - "<button type='button' data-player='pause'>", - "<svg><use xlink:href='#icon-pause'></use></svg>", - "<span class='sr-only'>Pause</span>", - "</button>", - "<button type='button' data-player='fast-forward'>", - "<svg><use xlink:href='#icon-fast-forward'></use></svg>", - "<span class='sr-only'>Forward {seektime} secs</span>", - "</button>", - "<span class='player-time'>", - "<span class='sr-only'>Time</span>", - "<span class='player-duration'>00:00</span>", - "</span>", - "</span>", - "<span class='player-controls-sound'>", - "<input class='inverted sr-only' id='mute{id}' type='checkbox' data-player='mute'>", - "<label id='mute{id}' for='mute{id}'>", - "<svg class='icon-muted'><use xlink:href='#icon-muted'></use></svg>", - "<svg><use xlink:href='#icon-volume'></use></svg>", - "<span class='sr-only'>Toggle Mute</span>", - "</label>", - "<label for='volume{id}' class='sr-only'>Volume</label>", - "<input id='volume{id}' class='player-volume' type='range' min='0' max='10' value='5' data-player='volume'>", - "<input class='sr-only' id='captions{id}' type='checkbox' data-player='captions'>", - "<label for='captions{id}'>", - "<svg class='icon-captions-on'><use xlink:href='#icon-captions-on'></use></svg>", - "<svg><use xlink:href='#icon-captions-off'></use></svg>", - "<span class='sr-only'>Toggle Captions</span>", - "</label>", - "<button type='button' data-player='fullscreen'>", - "<svg class='icon-exit-fullscreen'><use xlink:href='#icon-exit-fullscreen'></use></svg>", - "<svg><use xlink:href='#icon-enter-fullscreen'></use></svg>", - "<span class='sr-only'>Toggle Fullscreen</span>", - "</button>", - "</span>", - "</div>" - ].join("\n"); - })() + controls: ["restart", "rewind", "play", "fast-forward", "current-time", "duration", "mute", "volume", "captions", "fullscreen"], + onSetup: function() {}, + youtube: { + regex: /^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/ + } }; + // Build the default HTML + function _buildControls() { + // Open and add the progress and seek elements + var html = [ + "<div class='player-controls'>", + "<div class='player-progress'>", + "<label for='seek{id}' class='sr-only'>Seek</label>", + "<input id='seek{id}' class='player-progress-seek' type='range' min='0' max='100' step='0.5' value='0' data-player='seek'>", + "<progress class='player-progress-played' max='100' value='0'>", + "<span>0</span>% played", + "</progress>", + "<progress class='player-progress-buffer' max='100' value='0'>", + "<span>0</span>% buffered", + "</progress>", + "</div>", + "<span class='player-controls-left'>"]; + + // Restart button + if(_inArray(config.controls, "restart")) { + html.push( + "<button type='button' data-player='restart'>", + "<svg><use xlink:href='#icon-restart'></use></svg>", + "<span class='sr-only'>Restart</span>", + "</button>" + ); + } + + // Rewind button + if(_inArray(config.controls, "rewind")) { + html.push( + "<button type='button' data-player='rewind'>", + "<svg><use xlink:href='#icon-rewind'></use></svg>", + "<span class='sr-only'>Rewind {seektime} secs</span>", + "</button>" + ); + } + + // Play/pause button + if(_inArray(config.controls, "play")) { + html.push( + "<button type='button' data-player='play'>", + "<svg><use xlink:href='#icon-play'></use></svg>", + "<span class='sr-only'>Play</span>", + "</button>", + "<button type='button' data-player='pause'>", + "<svg><use xlink:href='#icon-pause'></use></svg>", + "<span class='sr-only'>Pause</span>", + "</button>" + ); + } + + // Fast forward button + if(_inArray(config.controls, "fast-forward")) { + html.push( + "<button type='button' data-player='fast-forward'>", + "<svg><use xlink:href='#icon-fast-forward'></use></svg>", + "<span class='sr-only'>Forward {seektime} secs</span>", + "</button>" + ); + } + + // Media current time display + if(_inArray(config.controls, "current-time")) { + html.push( + "<span class='player-time'>", + "<span class='sr-only'>Current time</span>", + "<span class='player-current-time'>00:00</span>", + "</span>" + ); + } + + // Media duration display + if(_inArray(config.controls, "duration")) { + html.push( + "<span class='player-time'>", + "<span class='sr-only'>Duration</span>", + "<span class='player-duration'>00:00</span>", + "</span>" + ); + } + + // Close left controls + html.push( + "</span>", + "<span class='player-controls-right'>" + ); + + // Toggle mute button + if(_inArray(config.controls, "mute")) { + html.push( + "<input class='inverted sr-only' id='mute{id}' type='checkbox' data-player='mute'>", + "<label id='mute{id}' for='mute{id}'>", + "<svg class='icon-muted'><use xlink:href='#icon-muted'></use></svg>", + "<svg><use xlink:href='#icon-volume'></use></svg>", + "<span class='sr-only'>Toggle Mute</span>", + "</label>" + ); + } + + // Volume range control + if(_inArray(config.controls, "volume")) { + html.push( + "<label for='volume{id}' class='sr-only'>Volume</label>", + "<input id='volume{id}' class='player-volume' type='range' min='0' max='10' value='5' data-player='volume'>" + ); + } + + // Toggle captions button + if(_inArray(config.controls, "captions")) { + html.push( + "<input class='sr-only' id='captions{id}' type='checkbox' data-player='captions'>", + "<label for='captions{id}'>", + "<svg class='icon-captions-on'><use xlink:href='#icon-captions-on'></use></svg>", + "<svg><use xlink:href='#icon-captions-off'></use></svg>", + "<span class='sr-only'>Toggle Captions</span>", + "</label>" + ); + } + + // Toggle fullscreen button + if(_inArray(config.controls, "fullscreen")) { + html.push( + "<button type='button' data-player='fullscreen'>", + "<svg class='icon-exit-fullscreen'><use xlink:href='#icon-exit-fullscreen'></use></svg>", + "<svg><use xlink:href='#icon-enter-fullscreen'></use></svg>", + "<span class='sr-only'>Toggle Fullscreen</span>", + "</button>" + ); + } + + // Close everything + html.push( + "</span>", + "</div>" + ); + + return html.join(""); + } + // Debugging function _log(text, error) { if(config.debug && window.console) { @@ -151,70 +239,76 @@ // Unfortunately, due to mixed support, UA sniffing is required function _browserSniff() { var nAgt = navigator.userAgent, - browserName = navigator.appName, - fullVersion = ""+parseFloat(navigator.appVersion), - majorVersion = parseInt(navigator.appVersion,10), + name = navigator.appName, + fullVersion = "" + parseFloat(navigator.appVersion), + majorVersion = parseInt(navigator.appVersion, 10), nameOffset, verOffset, ix; // MSIE 11 if ((navigator.appVersion.indexOf("Windows NT") !== -1) && (navigator.appVersion.indexOf("rv:11") !== -1)) { - browserName = "IE"; + name = "IE"; fullVersion = "11;"; } // MSIE else if ((verOffset=nAgt.indexOf("MSIE")) !== -1) { - browserName = "IE"; - fullVersion = nAgt.substring(verOffset+5); + name = "IE"; + fullVersion = nAgt.substring(verOffset + 5); } // Chrome else if ((verOffset=nAgt.indexOf("Chrome")) !== -1) { - browserName = "Chrome"; - fullVersion = nAgt.substring(verOffset+7); + name = "Chrome"; + fullVersion = nAgt.substring(verOffset + 7); } // Safari else if ((verOffset=nAgt.indexOf("Safari")) !== -1) { - browserName = "Safari"; - fullVersion = nAgt.substring(verOffset+7); + name = "Safari"; + fullVersion = nAgt.substring(verOffset + 7); if ((verOffset=nAgt.indexOf("Version")) !== -1) { - fullVersion = nAgt.substring(verOffset+8); + fullVersion = nAgt.substring(verOffset + 8); } } // Firefox else if ((verOffset=nAgt.indexOf("Firefox")) !== -1) { - browserName = "Firefox"; - fullVersion = nAgt.substring(verOffset+8); + name = "Firefox"; + fullVersion = nAgt.substring(verOffset + 8); } // In most other browsers, "name/version" is at the end of userAgent - else if ( (nameOffset=nAgt.lastIndexOf(" ")+1) < (verOffset=nAgt.lastIndexOf("/")) ) { - browserName = nAgt.substring(nameOffset,verOffset); - fullVersion = nAgt.substring(verOffset+1); - if (browserName.toLowerCase()==browserName.toUpperCase()) { - browserName = navigator.appName; + else if ((nameOffset=nAgt.lastIndexOf(" ") + 1) < (verOffset=nAgt.lastIndexOf("/"))) { + name = nAgt.substring(nameOffset,verOffset); + fullVersion = nAgt.substring(verOffset + 1); + + if (name.toLowerCase() == name.toUpperCase()) { + name = navigator.appName; } } // Trim the fullVersion string at semicolon/space if present - if ((ix=fullVersion.indexOf(";")) !== -1) { - fullVersion=fullVersion.substring(0,ix); + if ((ix = fullVersion.indexOf(";")) !== -1) { + fullVersion = fullVersion.substring(0, ix); } - if ((ix=fullVersion.indexOf(" ")) !== -1) { - fullVersion=fullVersion.substring(0,ix); + if ((ix = fullVersion.indexOf(" ")) !== -1) { + fullVersion = fullVersion.substring(0, ix); } // Get major version - majorVersion = parseInt(""+fullVersion,10); + majorVersion = parseInt("" + fullVersion, 10); if (isNaN(majorVersion)) { - fullVersion = ""+parseFloat(navigator.appVersion); - majorVersion = parseInt(navigator.appVersion,10); + fullVersion = "" + parseFloat(navigator.appVersion); + majorVersion = parseInt(navigator.appVersion, 10); } + // Return data - return [browserName, majorVersion]; + return { + name: name, + version: majorVersion, + ios: /(iPad|iPhone|iPod)/g.test(navigator.platform) + }; } // Check for mime type support against a player instance // Credits: http://diveintohtml5.info/everything.html // Related: http://www.leanbackplayer.com/test/h5mt.html - function _support(player, mimeType) { + function _supportMime(player, mimeType) { var media = player.media; // Only check video types for video players @@ -240,6 +334,23 @@ // If we got this far, we're stuffed return false; } + + // Inject a script + function _injectScript(source) { + if(document.querySelectorAll("script[src='" + source + "']").length) { + return; + } + + var tag = document.createElement("script"); + tag.src = source; + var firstScriptTag = document.getElementsByTagName("script")[0]; + firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); + } + + // Element exists in an array + function _inArray(haystack, needle) { + return Array.prototype.indexOf && (haystack.indexOf(needle) != -1); + } // Replace all function _replaceAll(string, find, replace) { @@ -248,7 +359,7 @@ // Wrap an element function _wrap(elements, wrapper) { - // Convert `elms` to an array, if necessary. + // Convert `elements` to an array, if necessary. if (!elements.length) { elements = [elements]; } @@ -256,16 +367,16 @@ // Loops backwards to prevent having to clone the wrapper on the // first element (see `child` below). for (var i = elements.length - 1; i >= 0; i--) { - var child = (i > 0) ? wrapper.cloneNode(true) : wrapper; - var el = elements[i]; + var child = (i > 0) ? wrapper.cloneNode(true) : wrapper; + var element = elements[i]; // Cache the current parent and sibling. - var parent = el.parentNode; - var sibling = el.nextSibling; + var parent = element.parentNode; + var sibling = element.nextSibling; // Wrap the element (is automatically removed from its current // parent). - child.appendChild(el); + child.appendChild(element); // If the element had a sibling, insert the wrapper before // the sibling to maintain the HTML structure; otherwise, just @@ -312,6 +423,17 @@ function _toggleHandler(element, events, callback, toggle) { events = events.split(" "); + // If a nodelist is passed, call itself on each node + if(element instanceof NodeList) { + for (var x = 0; x < element.length; x++) { + if (element[x] instanceof Node) { + _toggleHandler(element[x], arguments[1], arguments[2], arguments[3]); + } + } + return; + } + + // If a single node is passed, bind the event listener for (var i = 0; i < events.length; i++) { element[toggle ? "addEventListener" : "removeEventListener"](events[i], callback, false); } @@ -319,12 +441,42 @@ // Bind event function _on(element, events, callback) { - _toggleHandler(element, events, callback, true); + if(element) { + _toggleHandler(element, events, callback, true); + } } // Unbind event function _off(element, events, callback) { - _toggleHandler(element, events, callback, false); + if(element) { + _toggleHandler(element, events, callback, false); + } + } + + // Trigger event + function _triggerEvent(element, event) { + // Create faux event + var fauxEvent = document.createEvent("MouseEvents"); + + // Set the event type + fauxEvent.initEvent(event, true, true); + + // Dispatch the event + element.dispatchEvent(fauxEvent); + } + + // Toggle checkbox + function _toggleCheckbox(event) { + // Only listen for return key + if(event.keyCode && event.keyCode != 13) { + return true; + } + + // Toggle the checkbox + event.target.checked = !event.target.checked; + + // Trigger change event + _triggerEvent(event.target, "change"); } // Get percentage @@ -386,7 +538,7 @@ } } - // Safari doesn't support the ALLOW_KEYBOARD_INPUT flag so set it to not supported + // Safari doesn't support the ALLOW_KEYBOARD_INPUT flag (for security) so set it to not supported // https://bugs.webkit.org/show_bug.cgi?id=121496 if(fullscreen.prefix === "webkit" && !!navigator.userAgent.match(/Version\/[\d\.]+.*Safari/)) { fullscreen.supportsFullScreen = false; @@ -398,19 +550,18 @@ // Sometimes the prefix is "ms", sometimes "MS" to keep you on your toes fullscreen.fullScreenEventName = (fullscreen.prefix == "ms" ? "MSFullscreenChange" : fullscreen.prefix + "fullscreenchange"); - fullscreen.isFullScreen = function() { + fullscreen.isFullScreen = function(element) { + if(typeof element == "undefined") { + element = document; + } + switch (this.prefix) { case "": - return document.fullScreen; - case "webkit": - return document.webkitIsFullScreen; - case "ms": - // Docs say document.msFullScreenElement returns undefined - // if no element is full screem but it returns null, cheers - // https://msdn.microsoft.com/en-us/library/ie/dn265028%28v=vs.85%29.aspx - return (document.msFullscreenElement !== null); + return document.fullscreenElement == element; + case "moz": + return document.mozFullScreenElement == element; default: - return document[this.prefix + "FullScreen"]; + return document[this.prefix + "FullscreenElement"] == element; } }; fullscreen.requestFullScreen = function(element) { @@ -451,7 +602,7 @@ // Seek the manual caption time and update UI function _seekManualCaptions(time) { // If it's not video, or we're using textTracks, bail. - if (player.usingTextTracks || player.type !== "video") { + if (player.usingTextTracks || player.type !== "video" || !player.supported.full) { return; } @@ -487,11 +638,16 @@ // Display captions container and button (for initialization) function _showCaptions() { + // If there's no caption toggle, bail + if(!player.buttons.captions) { + return; + } + _toggleClass(player.container, config.classes.captions.enabled, true); if (config.captions.defaultActive) { _toggleClass(player.container, config.classes.captions.active, true); - player.buttons.captions.setAttribute("checked", "checked"); + player.buttons.captions.checked = true; } } @@ -543,18 +699,22 @@ // Insert controls function _injectControls() { + // Make a copy of the html + var html = config.html; + // Insert custom video controls _log("Injecting custom controls."); - // Use specified html - // Need to do a default? - var html = config.html; + // If no controls are specified, create default + if(!html) { + html = _buildControls(); + } // Replace seek time instances html = _replaceAll(html, "{seektime}", config.seekTime); - // Replace all id references - html = _replaceAll(html, "{id}", player.random); + // Replace all id references with random numbers + html = _replaceAll(html, "{id}", Math.floor(Math.random() * (10000))); // Inject into the container player.container.insertAdjacentHTML("beforeend", html); @@ -585,9 +745,12 @@ player.buttons.restart = _getElement(config.selectors.buttons.restart); player.buttons.rewind = _getElement(config.selectors.buttons.rewind); player.buttons.forward = _getElement(config.selectors.buttons.forward); + player.buttons.fullscreen = _getElement(config.selectors.buttons.fullscreen); + + // Inputs player.buttons.mute = _getElement(config.selectors.buttons.mute); player.buttons.captions = _getElement(config.selectors.buttons.captions); - player.buttons.fullscreen = _getElement(config.selectors.buttons.fullscreen); + player.checkboxes = _getElements("[type='checkbox']"); // Progress player.progress = {}; @@ -596,30 +759,41 @@ // Progress - Buffering player.progress.buffer = {}; player.progress.buffer.bar = _getElement(config.selectors.progress.buffer); - player.progress.buffer.text = player.progress.buffer.bar.getElementsByTagName("span")[0]; + player.progress.buffer.text = player.progress.buffer.bar && player.progress.buffer.bar.getElementsByTagName("span")[0]; // Progress - Played player.progress.played = {}; player.progress.played.bar = _getElement(config.selectors.progress.played); - player.progress.played.text = player.progress.played.bar.getElementsByTagName("span")[0]; + player.progress.played.text = player.progress.played.bar && player.progress.played.bar.getElementsByTagName("span")[0]; // Volume player.volume = _getElement(config.selectors.buttons.volume); // Timing player.duration = _getElement(config.selectors.duration); + player.currentTime = _getElement(config.selectors.currentTime); player.seekTime = _getElements(config.selectors.seekTime); return true; } catch(e) { _log("It looks like there's a problem with your controls html. Bailing.", true); + + // Restore native video controls + player.media.setAttribute("controls", ""); + return false; } } // Setup aria attributes function _setupAria() { + // If there's no play button, bail + if(!player.buttons.play) { + return; + } + + // Find the current text var label = player.buttons.play.innerText || "Play"; // If there's a media title set, use that for the label @@ -632,37 +806,47 @@ // Setup media function _setupMedia() { - player.media = player.container.querySelectorAll("audio, video")[0]; - // If there's no media, bail if(!player.media) { _log("No audio or video element found!", true); return false; } - // Remove native video controls - player.media.removeAttribute("controls"); + if(player.supported.full) { + // Remove native video controls + player.media.removeAttribute("controls"); + + // Add type class + _toggleClass(player.container, config.classes[player.type], true); - // Set media type - player.type = (player.media.tagName == "VIDEO" ? "video" : "audio"); + // If there's no autoplay attribute, assume the video is stopped and add state class + _toggleClass(player.container, config.classes.stopped, (player.media.getAttribute("autoplay") === null)); + + // Add iOS class + if(player.browser.ios) { + _toggleClass(player.container, "ios", true); + } - // Add type class - _toggleClass(player.container, config.classes[player.type], true); + // Inject the player wrapper + if(player.type === "video") { + // Create the wrapper div + var wrapper = document.createElement("div"); + wrapper.setAttribute("class", config.classes.videoWrapper); - // If there's no autoplay attribute, assume the video is stopped and add state class - _toggleClass(player.container, config.classes.stopped, (player.media.getAttribute("autoplay") === null)); + // Wrap the video in a container + _wrap(player.media, wrapper); - // Inject the player wrapper - if(player.type === "video") { - // Create the wrapper div - var wrapper = document.createElement("div"); - wrapper.setAttribute("class", config.classes.videoWrapper); + // Cache the container + player.videoContainer = wrapper; - // Wrap the video in a container - _wrap(player.media, wrapper); + // YouTube + var firstSource = player.media.querySelectorAll("source")[0], + matches = firstSource.src.match(config.youtube.regex); - // Cache the container - player.videoContainer = wrapper; + if(firstSource.type == "video/youtube" && matches && matches[2].length == 11) { + _setupYouTube(matches[2]); + } + } } // Autoplay @@ -671,6 +855,48 @@ } } + // Setup YouTube + function _setupYouTube(id) { + player.embed = true; + + // Hide the <video> element + player.media.style.display = "none"; + + // Create the YouTube iframe + var iframe = document.createElement("iframe"); + iframe.src = "https://www.youtube.com/embed/"+ id + "?rel=0&vq=hd720&iv_load_policy=3&controls=0&autoplay=0&showinfo=0&wmode=transparent&?enablejsapi=1"; + iframe.id = "youtube" + Math.floor(Math.random() * (10000)); + + // Add embed class for responsive + _toggleClass(player.videoContainer, config.classes.embedWrapper, true); + + // Append the iframe + player.videoContainer.appendChild(iframe); + + // Add the API + _injectScript("https://www.youtube.com/iframe_api"); + + // Setup callback for the API + window.onYouTubeIframeAPIReady = function() { + _log("YouTube API Ready"); + _log(iframe.id); + _log(id); + + player.youtube = new YT.Player(iframe.id, { + events: { + onReady: function() { + console.log("ready"); + }, + onStateChange: function(e) { + console.log(e); + } + } + }); + + _log(player.youtube); + } + } + // Setup captions function _setupCaptions() { if(player.type === "video") { @@ -727,10 +953,10 @@ _showCaptions(player); // If IE 10/11 or Firefox 31+ or Safari 7+, don"t use native captioning (still doesn"t work although they claim it"s now supported) - if ((player.browserName === "IE" && player.browserMajorVersion === 10) || - (player.browserName === "IE" && player.browserMajorVersion === 11) || - (player.browserName === "Firefox" && player.browserMajorVersion >= 31) || - (player.browserName === "Safari" && player.browserMajorVersion >= 7)) { + if ((player.browser.name === "IE" && player.browser.version === 10) || + (player.browser.name === "IE" && player.browser.version === 11) || + (player.browser.name === "Firefox" && player.browser.version >= 31) || + (player.browser.name === "Safari" && player.browser.version >= 7)) { // Debugging _log("Detected IE 10/11 or Firefox 31+ or Safari 7+."); @@ -748,10 +974,12 @@ if (track.kind === "captions") { _on(track, "cuechange", function() { - if (this.activeCues[0]) { - if (this.activeCues[0].hasOwnProperty("text")) { - player.captionsContainer.innerHTML = this.activeCues[0].text; - } + // Clear container + player.captionsContainer.innerHTML = ""; + + // Display a cue, if there is one + if (this.activeCues[0] && this.activeCues[0].hasOwnProperty("text")) { + player.captionsContainer.appendChild(this.activeCues[0].getCueAsHTML()); } }); } @@ -802,7 +1030,7 @@ } // If Safari 7+, removing track from DOM [see "turn off native caption rendering" above] - if (player.browserName === "Safari" && player.browserMajorVersion >= 7) { + if (player.browser.name === "Safari" && player.browser.version >= 7) { _log("Safari 7+ detected; removing track from DOM."); // Find all <track> elements @@ -832,6 +1060,11 @@ else { _log("Fullscreen not supported and fallback disabled."); } + + // Set control hide class hook + if(config.fullscreen.hideControls) { + _toggleClass(player.container, config.classes.fullscreen.hideControls, true); + } } } @@ -873,7 +1106,7 @@ targetTime = input; } // Event - else if (typeof input === "object" && (input.type === "change" || input.type === "input")) { + else if (typeof input === "object" && (input.type === "input" || input.type === "change")) { // It's the seek slider // Seek to the selected time targetTime = ((input.target.value / input.target.max) * player.media.duration); @@ -888,7 +1121,11 @@ } // Set the current time - player.media.currentTime = targetTime.toFixed(1); + // Try/catch incase the media isn't set and we're calling seek() from source() and IE moans + try { + player.media.currentTime = targetTime.toFixed(1); + } + catch(e) {} // Logging _log("Seeking to " + player.media.currentTime + " seconds"); @@ -910,12 +1147,12 @@ // If it's a fullscreen change event, it's probably a native close if(event && event.type === fullscreen.fullScreenEventName) { - config.fullscreen.active = fullscreen.isFullScreen(); + player.isFullscreen = fullscreen.isFullScreen(player.container); } // If there's native support, use it else if(nativeSupport) { // Request fullscreen - if(!fullscreen.isFullScreen()) { + if(!fullscreen.isFullScreen(player.container)) { fullscreen.requestFullScreen(player.container); } // Bail from fullscreen @@ -924,14 +1161,14 @@ } // Check if we're actually full screen (it could fail) - config.fullscreen.active = fullscreen.isFullScreen(); + player.isFullscreen = fullscreen.isFullScreen(player.container); } else { // Otherwise, it's a simple toggle - config.fullscreen.active = !config.fullscreen.active; + player.isFullscreen = !player.isFullscreen; // Bind/unbind escape key - if(config.fullscreen.active) { + if(player.isFullscreen) { _on(document, "keyup", _handleEscapeFullscreen); document.body.style.overflow = "hidden"; } @@ -942,19 +1179,29 @@ } // Set class hook - _toggleClass(player.container, config.classes.fullscreen.active, config.fullscreen.active); + _toggleClass(player.container, config.classes.fullscreen.active, player.isFullscreen); + + // Remove hover class because mouseleave doesn't occur + if (player.isFullscreen) { + _toggleClass(player.controls, config.classes.hover, false); + } } // Bail from faux-fullscreen function _handleEscapeFullscreen(event) { // If it's a keypress and not escape, bail - if((event.which || event.charCode || event.keyCode) === 27 && config.fullscreen.active) { + if((event.which || event.charCode || event.keyCode) === 27 && player.isFullscreen) { _toggleFullscreen(); } } // Set volume function _setVolume(volume) { + // Bail if there's no volume element + if(!player.volume) { + return; + } + // Use default if needed if(typeof volume === "undefined") { if(config.storage.enabled && _storage().supported) { @@ -969,42 +1216,56 @@ volume = 10; } - player.volume.value = volume; + // If the controls are there + if(player.supported.full) { + player.volume.value = volume; + } + + // Set the player volume player.media.volume = parseFloat(volume / 10); + + // Update the UI _checkMute(); // Store the volume in storage if(config.storage.enabled && _storage().supported) { - window.localStorage.plyr_volume = volume; + window.localStorage.setItem(config.storage.key, volume); } } // Mute function _toggleMute(muted) { // If the method is called without parameter, toggle based on current value - if(typeof active === "undefined") { + if(typeof muted === "undefined") { muted = !player.media.muted; + } + + // If the controls are there + if(player.supported.full) { player.buttons.mute.checked = muted; } + // Set mute on the player player.media.muted = muted; + + // Update UI _checkMute(); } // Toggle captions - function _toggleCaptions(active) { - // If the method is called without parameter, toggle based on current value - if(typeof active === "undefined") { - active = (player.container.className.indexOf(config.classes.captions.active) === -1); - player.buttons.captions.checked = active; + function _toggleCaptions(show) { + // If there's no full support, or there's no caption toggle + if(!player.supported.full || !player.buttons.captions) { + return; } - if (active) { - _toggleClass(player.container, config.classes.captions.active, true); - } - else { - _toggleClass(player.container, config.classes.captions.active); + // If the method is called without parameter, toggle based on current value + if(typeof show === "undefined") { + show = (player.container.className.indexOf(config.classes.captions.active) === -1); + player.buttons.captions.checked = show; } + + _toggleClass(player.container, config.classes.captions.active, show); } // Check mute state @@ -1039,7 +1300,7 @@ value = _getPercentage(player.media.currentTime, player.media.duration); // Set seek range value only if it's a "natural" time event - if(event.type == "timeupdate") { + if(event.type == "timeupdate" && player.buttons.seek) { player.buttons.seek.value = value; } @@ -1071,27 +1332,55 @@ } // Set values - progress.value = value; - text.innerHTML = value; + if(progress) { + progress.value = value; + } + if(text) { + text.innerHTML = value; + } } - // Update the displayed play time - function _updateTimeDisplay() { - player.secs = parseInt(player.media.currentTime % 60); - player.mins = parseInt((player.media.currentTime / 60) % 60); + // Update the displayed time + function _updateTimeDisplay(time, element) { + // Bail if there's no duration display + if(!element) { + return; + } + + player.secs = parseInt(time % 60); + player.mins = parseInt((time / 60) % 60); + player.hours = parseInt(((time / 60) / 60) % 60); + + // Do we need to display hours? + var displayHours = (parseInt(((player.media.duration / 60) / 60) % 60) > 0) // Ensure it"s two digits. For example, 03 rather than 3. player.secs = ("0" + player.secs).slice(-2); player.mins = ("0" + player.mins).slice(-2); // Render - player.duration.innerHTML = player.mins + ":" + player.secs; + element.innerHTML = (displayHours ? player.hours + ":" : "") + player.mins + ":" + player.secs; + } + + // Show the duration on metadataloaded + function _displayDuration() { + var duration = player.media.duration || 0; + + // If there's only one time display, display duration there + if(!player.duration && config.displayDuration && player.media.paused) { + _updateTimeDisplay(duration, player.currentTime); + } + + // If there's a duration element, update content + if(player.duration) { + _updateTimeDisplay(duration, player.duration); + } } // Handle time change event function _timeUpdate(event) { // Duration - _updateTimeDisplay(); + _updateTimeDisplay(player.media.currentTime, player.currentTime); // Playing progress _updateProgress(event); @@ -1134,9 +1423,6 @@ // Restart _seek(); - // Update the UI - _checkPlaying(); - // Remove current sources _removeSources(); @@ -1155,8 +1441,13 @@ } } - // Reset time display - _timeUpdate(); + if(player.supported.full) { + // Reset time display + _timeUpdate(); + + // Update the UI + _checkPlaying(); + } // Re-load sources player.media.load(); @@ -1176,6 +1467,9 @@ // Listen for events function _listeners() { + // IE doesn't support input event, so we fallback to change + var inputEvent = (player.browser.name == "IE" ? "change" : "input"); + // Play _on(player.buttons.play, "click", function() { _play(); @@ -1197,9 +1491,11 @@ // Fast forward _on(player.buttons.forward, "click", _forward); - // Get the HTML5 range input element and append audio volume adjustment on change/input - // IE10 doesn't support the "input" event so they have to wait for change - _on(player.volume, "change input", function() { + // Seek + _on(player.buttons.seek, inputEvent, _seek); + + // Set volume + _on(player.volume, inputEvent, function() { _setVolume(this.value); }); @@ -1212,22 +1508,8 @@ _on(player.buttons.fullscreen, "click", _toggleFullscreen); // Handle user exiting fullscreen by escaping etc - _on(document, fullscreen.fullScreenEventName, _toggleFullscreen); - - // Click video - if(player.type === "video" && config.click) { - _on(player.videoContainer, "click", function() { - if(player.media.paused) { - _play(); - } - else if(player.media.ended) { - _seek(); - _play(); - } - else { - _pause(); - } - }); + if(fullscreen.supportsFullScreen) { + _on(document, fullscreen.fullScreenEventName, _toggleFullscreen); } // Time change on media @@ -1236,19 +1518,22 @@ // Update manual captions _on(player.media, "timeupdate", _seekManualCaptions); - // Seek - _on(player.buttons.seek, "change input", _seek); + // Display duration + _on(player.media, "loadedmetadata", _displayDuration); // Captions - _on(player.buttons.captions, "click", function() { + _on(player.buttons.captions, "change", function() { _toggleCaptions(this.checked); }); - // Clear captions at end of video + // Handle the media finishing _on(player.media, "ended", function() { + // Clear if(player.type === "video") { player.captionsContainer.innerHTML = ""; } + + // Reset UI _checkPlaying(); }); @@ -1266,58 +1551,101 @@ // Loading _on(player.media, "waiting canplay seeked", _checkLoading); + + // Toggle checkboxes on return key (as they look like buttons) + _on(player.checkboxes, "keyup", _toggleCheckbox); + + // Click video + if(player.type === "video" && config.click) { + _on(player.videoContainer, "click", function() { + if(player.media.paused) { + _triggerEvent(player.buttons.play, "click"); + } + else if(player.media.ended) { + _seek(); + _triggerEvent(player.buttons.play, "click"); + } + else { + _triggerEvent(player.buttons.pause, "click"); + } + }); + } + + // Bind to mouse hover + if(config.fullscreen.hideControls) { + _on(player.controls, "mouseenter mouseleave", function(event) { + _toggleClass(player.controls, config.classes.hover, (event.type === "mouseenter")); + }); + } } function _init() { // Setup the fullscreen api fullscreen = _fullscreen(); - // Sniff - player.browserInfo = _browserSniff(); - player.browserName = player.browserInfo[0]; - player.browserMajorVersion = player.browserInfo[1]; + // Sniff out the browser + player.browser = _browserSniff(); - // Debug info - _log(player.browserName + " " + player.browserMajorVersion); + // Get the media element + player.media = player.container.querySelectorAll("audio, video")[0]; - // If IE8, stop customization (use fallback) - // If IE9, stop customization (use native controls) - if (player.browserName === "IE" && (player.browserMajorVersion === 8 || player.browserMajorVersion === 9) ) { - _log("Browser not suppported.", true); + // Set media type + player.type = player.media.tagName.toLowerCase(); + + // Check for full support + player.supported = api.supported(player.type); + + // If no native support, bail + if(!player.supported.basic) { return false; } + // Debug info + _log(player.browser.name + " " + player.browser.version); + // Setup media _setupMedia(); - // Generate random number for id/for attribute values for controls - player.random = Math.floor(Math.random() * (10000)); + // If there's full support + if(player.supported.full) { + // Inject custom controls + _injectControls(); - // Inject custom controls - _injectControls(); + // Find the elements + if(!_findElements()) { + return false; + } - // Find the elements - if(!_findElements()) { - return false; - } + // Display duration if available + if(config.displayDuration) { + _displayDuration(); + } - // Set up aria-label for Play button with the title option - _setupAria(); + // Set up aria-label for Play button with the title option + _setupAria(); - // Captions - _setupCaptions(); + // Captions + if(!player.embed) { + _setupCaptions(); + } - // Set volume - _setVolume(); + // Set volume + _setVolume(); + + // Setup fullscreen + _setupFullscreen(); - // Setup fullscreen - _setupFullscreen(); + // Listeners + _listeners(); + } - // Listeners - _listeners(); + // Successful setup + return true; } - _init(); + if(!_init()) { + return {}; + } return { media: player.media, @@ -1327,13 +1655,47 @@ rewind: _rewind, forward: _forward, seek: _seek, + source: _parseSource, + poster: _updatePoster, setVolume: _setVolume, toggleMute: _toggleMute, toggleCaptions: _toggleCaptions, - source: _parseSource, - poster: _updatePoster, - support: function(mimeType) { return _support(player, mimeType); } + toggleFullscreen: _toggleFullscreen, + isFullscreen: function() { return player.isFullscreen || false; }, + support: function(mimeType) { return _supportMime(player, mimeType); } + } + } + + // Check for support + api.supported = function(type) { + var browser = _browserSniff(), + oldIE = (browser.name === "IE" && browser.version <= 9), + iPhone = /iPhone|iPod/i.test(navigator.userAgent), + audio = !!document.createElement("audio").canPlayType, + video = !!document.createElement("video").canPlayType, + basic, full; + + switch (type) { + case "video": + basic = video; + full = (basic && (!oldIE && !iPhone)); + break; + + case "audio": + basic = audio; + full = (basic && !oldIE); + break; + + default: + basic = (audio && video); + full = (basic && !oldIE); + break; } + + return { + basic: basic, + full: full + }; } // Expose setup function @@ -1341,36 +1703,38 @@ // Extend the default options with user specified config = _extend(defaults, options); - // If enabled carry on + // Bail if disabled or no basic support // You may want to disable certain UAs etc - if(!config.enabled) { + if(!config.enabled || !api.supported().basic) { return false; } // Get the players - var elements = document.querySelectorAll(config.selectors.container), players = []; + var elements = document.querySelectorAll(config.selectors.container), + players = []; // Create a player instance for each element for (var i = elements.length - 1; i >= 0; i--) { // Get the current element var element = elements[i]; - // Disabled for <video> for iPhone - // Since it doesn't allow customisation - if (element.querySelectorAll("audio, video")[0].tagName === "VIDEO" - && /iPhone/i.test(navigator.userAgent)) { - continue; - } - // Setup a player instance and add to the element if(typeof element.plyr === "undefined") { - element.plyr = new Plyr(element); + // Create new instance + var instance = new Plyr(element); + + // Set plyr to false if setup failed + element.plyr = (Object.keys(instance).length ? instance : false); + + // Callback + config.onSetup.apply(element.plyr); } - // Add to return array + // Add to return array even if it's already setup players.push(element.plyr); } return players; } -}(this.plyr = this.plyr || {}));
\ No newline at end of file + +}(this.plyr = this.plyr || {})); diff --git a/src/js/plyr.youtube.js b/src/js/plyr.youtube.js new file mode 100644 index 00000000..0b28460a --- /dev/null +++ b/src/js/plyr.youtube.js @@ -0,0 +1,32 @@ +// ========================================================================== +// Plyr +// plyr.youtube.js v1.1.4 +// https://github.com/selz/plyr +// License: The MIT License (MIT) +// ========================================================================== + +(function (api) { + "use strict"; + + api.youtube = { + setup: function() { + console.log("Setup youtube"); + console.log(this); + + var player = this; + + // Find child <source> elements + var sources = player.media.querySelectorAll("source"); + + // Remove each + for (var i = sources.length - 1; i >= 0; i--) { + var source = sources[i]; + + if(source.type == "video/youtube") { + console.log(source.src); + } + } + } + }; + +}(this.plyr.plugins = this.plyr.plugins || {}));
\ No newline at end of file diff --git a/src/less/plyr.less b/src/less/plyr.less index 4880e3e9..4a1f95a7 100644 --- a/src/less/plyr.less +++ b/src/less/plyr.less @@ -5,566 +5,628 @@ // Variables // ------------------------------- // Colors -@blue: #3498DB; -@gray-dark: #343f4a; -@gray: #565d64; -@gray-light: #cbd0d3; +@blue: #3498DB; +@gray-dark: #343f4a; +@gray: #565d64; +@gray-light: #cbd0d3; +@off-white: #d6dadd; // Font sizes -@font-size-small: 14px; -@font-size-base: 16px; +@font-size-small: 14px; +@font-size-base: 16px; @font-size-large: ceil((@font-size-base * 1.5)); // Controls -@control-spacing: 10px; -@controls-bg: @gray-dark; -@control-bg-hover: @blue; -@control-color: @gray-light; -@control-color-inactive: @gray; -@control-color-hover: #fff; +@control-spacing: 10px; +@controls-bg: @gray-dark; +@control-bg-hover: @blue; +@control-color: @gray-light; +@control-color-inactive: @gray; +@control-color-hover: #fff; // Tooltips -@tooltip-bg: @controls-bg; -@tooltip-color: #fff; -@tooltip-padding: @control-spacing; -@tooltip-arrow-size: 5px; -@tooltip-radius: 3px; +@tooltip-bg: @controls-bg; +@tooltip-color: #fff; +@tooltip-padding: @control-spacing; +@tooltip-arrow-size: 5px; +@tooltip-radius: 3px; // Progress -@progress-bg: lighten(@gray, 10%); -@progress-playing-bg: @blue; -@progress-buffered-bg: @gray; -@progress-loading-size: 40px; -@progress-loading-bg: rgba(0,0,0, .15); +@progress-bg: rgba(red(@gray), green(@gray), blue(@gray), .2); +@progress-playing-bg: @blue; +@progress-buffered-bg: rgba(red(@gray), green(@gray), blue(@gray), .25); +@progress-loading-size: 40px; +@progress-loading-bg: rgba(0,0,0, .15); // Volume -@volume-track-height: 6px; -@volume-track-bg: @gray; -@volume-thumb-height: (@volume-track-height * 2); -@volume-thumb-width: (@volume-track-height * 2); -@volume-thumb-bg: @control-color; -@volume-thumb-bg-focus: @control-bg-hover; +@volume-track-height: 6px; +@volume-track-bg: @gray; +@volume-thumb-height: (@volume-track-height * 2); +@volume-thumb-width: (@volume-track-height * 2); +@volume-thumb-bg: @control-color; +@volume-thumb-bg-focus: @control-bg-hover; // Breakpoints -@bp-control-split: 560px; // When controls split into left/right -@bp-captions-large: 768px; // When captions jump to the larger font size +@bp-control-split: 560px; // When controls split into left/right +@bp-captions-large: 768px; // When captions jump to the larger font size // Utility classes & mixins // ------------------------------- // 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; + position: absolute !important; + clip: rect(1px, 1px, 1px, 1px); + padding: 0 !important; + border: 0 !important; + height: 1px !important; + width: 1px !important; + overflow: hidden; } // Contain floats: nicolasgallagher.com/micro-clearfix-hack/ .clearfix() { - zoom: 1; - &:before, - &:after { content: ""; display: table; } - &:after { clear: both; } + zoom: 1; + &:before, + &:after { content: ""; display: table; } + &:after { clear: both; } } // Tab focus styles .tab-focus() { - outline: thin dotted #000; - outline-offset: 0; + outline: thin dotted #000; + outline-offset: 0; } // Animation // --------------------------------------- @keyframes progress { - to { background-position: @progress-loading-size 0; } + to { background-position: @progress-loading-size 0; } } // <input type="range"> styling // --------------------------------------- .volume-thumb() { - height: @volume-thumb-height; - width: @volume-thumb-width; - background: @volume-thumb-bg; - border: 0; - border-radius: (@volume-thumb-height / 2); - transition: background .3s ease; - cursor: ew-resize; + height: @volume-thumb-height; + width: @volume-thumb-width; + background: @volume-thumb-bg; + border: 0; + border-radius: (@volume-thumb-height / 2); + transition: background .3s ease; + cursor: ew-resize; } .volume-track() { - height: @volume-track-height; - background: @volume-track-bg; - border: 0; - border-radius: (@volume-track-height / 2); + height: @volume-track-height; + background: @volume-track-bg; + border: 0; + border-radius: (@volume-track-height / 2); } .seek-thumb() { - background: transparent; - border: 0; - width: (@control-spacing * 2); - height: @control-spacing; + background: transparent; + border: 0; + width: (@control-spacing * 2); + height: @control-spacing; } .seek-track() { - background: none; - border: 0; + background: none; + border: 0; } // Font smoothing // --------------------------------------- .font-smoothing(@mode: on) when (@mode = on) { - -moz-osx-font-smoothing: grayscale; - -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + -webkit-font-smoothing: antialiased; } .font-smoothing(@mode: on) when (@mode = off) { - -moz-osx-font-smoothing: auto; - -webkit-font-smoothing: subpixel-antialiased; + -moz-osx-font-smoothing: auto; + -webkit-font-smoothing: subpixel-antialiased; } // Styles // ------------------------------- // Base .player { - position: relative; - max-width: 100%; - min-width: 290px; - - // border-box everything - // http://paulirish.com/2012/box-sizing-border-box-ftw/ - &, - *, - *::after, - *::before { - box-sizing: border-box; - } - - // For video - &-video-wrapper { - position: relative; - } - video { - width: 100%; - height: auto; - vertical-align: middle; - } - - // Captions - &-captions { - display: none; - position: absolute; - bottom: 0; - left: 0; - width: 100%; - padding: 20px; - min-height: 2.5em; - color: #fff; - font-size: @font-size-base; - font-weight: 600; - text-shadow: - -1px -1px 0 @gray, - 1px -1px 0 @gray, - -1px 1px 0 @gray, - 1px 1px 0 @gray; - text-align: center; - .font-smoothing(); - - @media (min-width: @bp-captions-large) { - font-size: @font-size-large; - } - } - &.captions-active &-captions { - display: block; - } - - // Player controls - &-controls { - .clearfix(); - .font-smoothing(); - position: relative; - padding: (@control-spacing * 2) @control-spacing @control-spacing; - background: @controls-bg; - line-height: 1; - text-align: center; - - // Layout - &-sound { - display: block; - margin: @control-spacing auto 0; - } - @media (min-width: @bp-control-split) { - &-playback { - float: left; - } - &-sound { - float: right; - margin-top: 0; - } - } - - input + label, - button { - display: inline-block; - vertical-align: middle; - margin: 0 2px; - padding: (@control-spacing / 2) @control-spacing; - - transition: background .3s ease; - border-radius: 3px; - cursor: pointer; - - svg { - width: 18px; - height: 18px; - display: block; - fill: currentColor; - transition: fill .3s ease; - } - } - input + label, - .inverted:checked + label { - color: @control-color-inactive; - } - button, - .inverted + label, - input:checked + label { - color: @control-color; - } - button { - border: 0; - background: transparent; - overflow: hidden; - } - - // Specificity for overriding .inverted - button:focus, - button:hover, - [type="checkbox"]:focus + label, - [type="checkbox"] + label:hover { - background: @control-bg-hover; - color: @control-color-hover; - } - button:focus, - input:focus + label { - outline: 0; - } - .icon-exit-fullscreen, - .icon-muted, - .icon-captions-on { - display: none; - } - .player-time { - display: inline-block; - vertical-align: middle; - margin-left: @control-spacing; - color: @control-color; - font-weight: 600; - font-size: @font-size-small; - .font-smoothing(); - } - } - - // Tooltips - &-tooltip { - visibility: hidden; - position: absolute; - z-index: 2; - bottom: 100%; - margin-bottom: @tooltip-padding; - padding: @tooltip-padding (@tooltip-padding * 1.5); + position: relative; + max-width: 100%; + min-width: 290px; + + // border-box everything + // http://paulirish.com/2012/box-sizing-border-box-ftw/ + &, + *, + *::after, + *::before { + box-sizing: border-box; + } + + // For video + &-video-wrapper { + position: relative; + } + video { + width: 100%; + height: auto; + vertical-align: middle; + } + + // For embeds + &-video-embed { + padding-bottom: 56.25%; /* 16:9 */ + height: 0; + + iframe { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + border: 0; + } + } + + // Captions + &-captions { + display: none; + position: absolute; + bottom: 0; + left: 0; + width: 100%; + padding: 20px; + min-height: 2.5em; + color: #fff; + font-size: @font-size-base; + font-weight: 600; + text-shadow: + -1px -1px 0 @gray, + 1px -1px 0 @gray, + -1px 1px 0 @gray, + 1px 1px 0 @gray; + text-align: center; + .font-smoothing(); + + @media (min-width: @bp-captions-large) { + font-size: @font-size-large; + } + } + &.captions-active &-captions { + display: block; + } + + // Player controls + &-controls { + .clearfix(); + .font-smoothing(); + position: relative; + padding: @control-spacing; + background: @controls-bg; + line-height: 1; + text-align: center; + + // Layout + &-right { + display: block; + margin: @control-spacing auto 0; + } + @media (min-width: @bp-control-split) { + &-left { + float: left; + } + &-right { + float: right; + margin-top: 0; + } + } + + input + label, + button { + display: inline-block; + vertical-align: middle; + margin: 0 2px; + padding: (@control-spacing / 2) @control-spacing; + + transition: background .3s ease; + border-radius: 3px; + cursor: pointer; + + svg { + width: 18px; + height: 18px; + display: block; + fill: currentColor; + transition: fill .3s ease; + } + } + input + label, + .inverted:checked + label { + color: @control-color-inactive; + } + button, + .inverted + label, + input:checked + label { + color: @control-color; + } + button { + border: 0; + background: transparent; + overflow: hidden; + } + + // Specificity for overriding .inverted + button:focus, + button:hover, + [type="checkbox"]:focus + label, + [type="checkbox"] + label:hover { + background: @control-bg-hover; + color: @control-color-hover; + } + button:focus, + input:focus + label { + outline: 0; + } + .icon-exit-fullscreen, + .icon-muted, + .icon-captions-on { + display: none; + } + .player-time { + display: inline-block; + vertical-align: middle; + margin-left: @control-spacing; + color: @control-color; + font-weight: 600; + font-size: @font-size-small; + .font-smoothing(); + } + + // Media duration hidden on small screens + .player-time + .player-time { + display: none; + + @media (min-width: @bp-control-split) { + display: inline-block; + } + + // Add a slash in before + &::before { + content: "\2044"; + margin-right: @control-spacing; + color: darken(@control-color, 30%); + } + } + } + + // Tooltips + &-tooltip { + visibility: hidden; + position: absolute; + z-index: 2; + bottom: 100%; + margin-bottom: @tooltip-padding; + padding: @tooltip-padding (@tooltip-padding * 1.5); opacity: 0; - background: @tooltip-bg; - border-radius: @tooltip-radius; - color: @tooltip-color; - font-size: @font-size-small; - line-height: 1.5; - font-weight: 600; - - transform: translate(-50%, (@tooltip-padding * 3)); + background: @tooltip-bg; + border-radius: @tooltip-radius; + color: @tooltip-color; + font-size: @font-size-small; + line-height: 1.5; + font-weight: 600; + + transform: translate(-50%, (@tooltip-padding * 3)); transition: transform .2s .2s ease, opacity .2s .2s ease; - &::after { - content: ""; - display: block; - position: absolute; - left: 50%; - bottom: -@tooltip-arrow-size; - margin-left: -@tooltip-arrow-size; - width: 0; - height: 0; - transition: inherit; - border-style: solid; - border-width: @tooltip-arrow-size @tooltip-arrow-size 0 @tooltip-arrow-size; - border-color: @controls-bg transparent transparent; - } - } - label:hover .player-tooltip, - input:focus + label .player-tooltip, - button:hover .player-tooltip, - button:focus .player-tooltip { - visibility: visible; - opacity: 1; - transform: translate(-50%, 0); - } - label:hover .player-tooltip, - button:hover .player-tooltip { - z-index: 3; - } - - // Player progress - // <progress> element - &-progress { - position: absolute; - top: 0; - left: 0; - right: 0; - width: 100%; - height: @control-spacing; - background: @progress-bg; - - &-buffer[value], - &-played[value], - &-seek[type=range] { - position: absolute; - left: 0; - top: 0; - width: 100%; - height: @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; - } - - // Inherit from currentColor; - &::-webkit-progress-value { - background: currentColor; - } - &::-moz-progress-bar { - background: currentColor; - } - } - &-played[value] { - z-index: 2; - color: @progress-playing-bg; - } - &-buffer[value] { - color: @progress-buffered-bg; - } - - // Seek control - // <input[type='range']> element - // Specificity is for bootstrap compatibility - &-seek[type=range] { - z-index: 4; - cursor: pointer; - outline: 0; - - // Webkit - &::-webkit-slider-runnable-track { - .seek-track(); - } - &::-webkit-slider-thumb { - -webkit-appearance: none; - .seek-thumb(); - } - - // Mozilla - &::-moz-range-track { - .seek-track(); - } - &::-moz-range-thumb { - -moz-appearance: none; - .seek-thumb(); - } - - // Microsoft - &::-ms-track { - color: transparent; - .seek-track(); - } - &::-ms-fill-lower, - &::-ms-fill-upper { - .seek-track(); - } - &::-ms-thumb { - .seek-thumb(); - } - - &:focus { - outline: 0; - } - &::-moz-focus-outer { - border: 0; - } - } - } - - // Loading state - &.loading .player-progress-buffer { - animation: progress 1s linear infinite; - background-size: @progress-loading-size @progress-loading-size; - background-repeat: repeat-x; - background-color: @progress-buffered-bg; - background-image: linear-gradient( - -45deg, - @progress-loading-bg 25%, - transparent 25%, - transparent 50%, - @progress-loading-bg 50%, - @progress-loading-bg 75%, - transparent 75%, - transparent); - color: transparent; - } - - // States - &-controls [data-player='pause'], - &.playing .player-controls [data-player='play'] { - display: none; - } - &.playing .player-controls [data-player='pause'] { - display: inline-block; - } - - // Volume control - // <input[type='range']> element - // Specificity is for bootstrap compatibility - &-volume[type=range] { - display: inline-block; - vertical-align: middle; - -webkit-appearance: none; - -moz-appearance: none; - width: 100px; - margin: 0 @control-spacing 0 0; - padding: 0; - cursor: pointer; - background: none; - - // Webkit - &::-webkit-slider-runnable-track { - .volume-track(); - } - &::-webkit-slider-thumb { - -webkit-appearance: none; - margin-top: -((@volume-thumb-height - @volume-track-height) / 2); - .volume-thumb(); - } - - // Mozilla - &::-moz-range-track { - .volume-track(); - } - &::-moz-range-thumb { - .volume-thumb(); - } - - // Microsoft - &::-ms-track { - height: @volume-track-height; - background: transparent; - border-color: transparent; - border-width: ((@volume-thumb-height - @volume-track-height) / 2) 0; - color: transparent; - } - &::-ms-fill-lower, - &::-ms-fill-upper { - .volume-track(); - } - &::-ms-thumb { - .volume-thumb(); - } - - &:focus { - outline: 0; - - &::-webkit-slider-thumb { - background: @volume-thumb-bg-focus; - } - &::-moz-range-thumb { - background: @volume-thumb-bg-focus; - } - &::-ms-thumb { - background: @volume-thumb-bg-focus; - } - } - } - - // 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; - - .player-video-wrapper { - height: 100%; - width: 100%; - - video { - height: 100%; - } - .player-captions { - top: auto; - bottom: 90px; - - @media (min-width: @bp-control-split) and (max-width: (@bp-captions-large - 1)) { - bottom: 60px; - } - @media (min-width: @bp-captions-large) { - bottom: 80px; - } - } - } - .player-controls { - position: absolute; - bottom: 0; - left: 0; - right: 0; - } - } - - // Change icons on state change - &.fullscreen-active .icon-exit-fullscreen, - &.muted .player-controls .icon-muted, - &.captions-active .player-controls .icon-captions-on { - display: block; - - & + svg { - display: none; - } - } - - // Some options are hidden by default - [data-player='captions'], - [data-player='captions'] + label, - [data-player='fullscreen'], - [data-player='fullscreen'] + label { - display: none; - } - &.captions-enabled [data-player='captions'], - &.captions-enabled [data-player='captions'] + label, - &.fullscreen-enabled [data-player='fullscreen'], - &.fullscreen-enabled [data-player='fullscreen'] + label { - display: inline-block; - } - - // Full browser view hides toggle - &-fullscreen [data-player='fullscreen'], - &-fullscreen [data-player='fullscreen'] + label { - display: none !important; - } + &::after { + content: ""; + display: block; + position: absolute; + left: 50%; + bottom: -@tooltip-arrow-size; + margin-left: -@tooltip-arrow-size; + width: 0; + height: 0; + transition: inherit; + border-style: solid; + border-width: @tooltip-arrow-size @tooltip-arrow-size 0 @tooltip-arrow-size; + border-color: @controls-bg transparent transparent; + } + } + label:hover .player-tooltip, + input:focus + label .player-tooltip, + button:hover .player-tooltip, + button:focus .player-tooltip { + visibility: visible; + opacity: 1; + transform: translate(-50%, 0); + } + label:hover .player-tooltip, + button:hover .player-tooltip { + z-index: 3; + } + + // Player progress + // <progress> element + &-progress { + position: absolute; + bottom: 100%; + left: 0; + right: 0; + width: 100%; + height: @control-spacing; + background: @progress-bg; + + &-buffer[value], + &-played[value], + &-seek[type=range] { + position: absolute; + left: 0; + top: 0; + width: 100%; + height: @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; + } + + // Inherit from currentColor; + &::-webkit-progress-value { + background: currentColor; + } + &::-moz-progress-bar { + background: currentColor; + } + } + &-played[value] { + z-index: 2; + color: @progress-playing-bg; + } + &-buffer[value] { + color: @progress-buffered-bg; + } + + // Seek control + // <input[type='range']> element + // Specificity is for bootstrap compatibility + &-seek[type=range] { + z-index: 4; + cursor: pointer; + outline: 0; + + // Webkit + &::-webkit-slider-runnable-track { + .seek-track(); + } + &::-webkit-slider-thumb { + -webkit-appearance: none; + .seek-thumb(); + } + + // Mozilla + &::-moz-range-track { + .seek-track(); + } + &::-moz-range-thumb { + -moz-appearance: none; + .seek-thumb(); + } + + // Microsoft + &::-ms-track { + color: transparent; + .seek-track(); + } + &::-ms-fill-lower, + &::-ms-fill-upper { + .seek-track(); + } + &::-ms-thumb { + .seek-thumb(); + } + + &:focus { + outline: 0; + } + &::-moz-focus-outer { + border: 0; + } + } + } + + // Loading state + &.loading .player-progress-buffer { + animation: progress 1s linear infinite; + background-size: @progress-loading-size @progress-loading-size; + background-repeat: repeat-x; + background-color: @progress-buffered-bg; + background-image: linear-gradient( + -45deg, + @progress-loading-bg 25%, + transparent 25%, + transparent 50%, + @progress-loading-bg 50%, + @progress-loading-bg 75%, + transparent 75%, + transparent); + color: transparent; + } + + // States + &-controls [data-player='pause'], + &.playing .player-controls [data-player='play'] { + display: none; + } + &.playing .player-controls [data-player='pause'] { + display: inline-block; + } + + // Volume control + // <input[type='range']> element + // Specificity is for bootstrap compatibility + &-volume[type=range] { + display: inline-block; + vertical-align: middle; + -webkit-appearance: none; + -moz-appearance: none; + width: 100px; + margin: 0 @control-spacing 0 0; + padding: 0; + cursor: pointer; + background: none; + + // Webkit + &::-webkit-slider-runnable-track { + .volume-track(); + } + &::-webkit-slider-thumb { + -webkit-appearance: none; + margin-top: -((@volume-thumb-height - @volume-track-height) / 2); + .volume-thumb(); + } + + // Mozilla + &::-moz-range-track { + .volume-track(); + } + &::-moz-range-thumb { + .volume-thumb(); + } + + // Microsoft + &::-ms-track { + height: @volume-track-height; + background: transparent; + border-color: transparent; + border-width: ((@volume-thumb-height - @volume-track-height) / 2) 0; + color: transparent; + } + &::-ms-fill-lower, + &::-ms-fill-upper { + .volume-track(); + } + &::-ms-thumb { + .volume-thumb(); + } + + &:focus { + outline: 0; + + &::-webkit-slider-thumb { + background: @volume-thumb-bg-focus; + } + &::-moz-range-thumb { + background: @volume-thumb-bg-focus; + } + &::-ms-thumb { + background: @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 + &.ios &-volume, + &.ios [data-player='mute'], + &.ios [data-player='mute'] + label, + &-audio.ios &-controls-right { + display: none; + } + // Center buttons so it looks less odd + &-audio.ios &-controls-left { + float: none; + } + + // Audio specific styles + // Position the progress within the container + &-audio .player-controls { + padding-top: (@control-spacing * 2); + } + &-audio .player-progress { + bottom: auto; + top: 0; + background: @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%; + } + .player-video-wrapper { + height: 100%; + width: 100%; + + .player-captions { + top: auto; + bottom: 90px; + + @media (min-width: @bp-control-split) and (max-width: (@bp-captions-large - 1)) { + bottom: 60px; + } + @media (min-width: @bp-captions-large) { + bottom: 80px; + } + } + } + .player-controls { + position: absolute; + bottom: 0; + left: 0; + right: 0; + } + + // Hide controls when playing in full screen + &.fullscreen-hide-controls.playing .player-controls { + transform: translateY(100%) translateY(@control-spacing / 2); + transition: transform .3s 1s ease; + + &.hover { + transform: translateY(0); + transition-delay: 0; + } + } + } + + // Change icons on state change + &.fullscreen-active .icon-exit-fullscreen, + &.muted .player-controls .icon-muted, + &.captions-active .player-controls .icon-captions-on { + display: block; + + & + svg { + display: none; + } + } + + // Some options are hidden by default + [data-player='captions'], + [data-player='captions'] + label, + [data-player='fullscreen'], + [data-player='fullscreen'] + label { + display: none; + } + &.captions-enabled [data-player='captions'], + &.captions-enabled [data-player='captions'] + label, + &.fullscreen-enabled [data-player='fullscreen'], + &.fullscreen-enabled [data-player='fullscreen'] + label { + display: inline-block; + } }
\ No newline at end of file diff --git a/src/sass/plyr.scss b/src/sass/plyr.scss index 58a66cde..69688d38 100644 --- a/src/sass/plyr.scss +++ b/src/sass/plyr.scss @@ -5,568 +5,621 @@ // Variables // ------------------------------- // Colors -$blue: #3498DB; -$gray-dark: #343f4a; -$gray: #565d64; -$gray-light: #cbd0d3; +$blue: #3498DB !default; +$gray-dark: #343f4a !default; +$gray: #565d64 !default; +$gray-light: #cbd0d3 !default; +$off-white: #d6dadd !default; // Font sizes -$font-size-small: 14px; -$font-size-base: 16px; -$font-size-large: ceil(($font-size-base * 1.5)); +$font-size-small: 14px !default; +$font-size-base: 16px !default; +$font-size-large: ceil(($font-size-base * 1.5)) !default; // Controls -$control-spacing: 10px; -$controls-bg: $gray-dark; -$control-bg-hover: $blue; -$control-color: $gray-light; -$control-color-inactive: $gray; -$control-color-hover: #fff; +$control-spacing: 10px !default; +$controls-bg: $gray-dark !default; +$control-bg-hover: $blue !default; +$control-color: $gray-light !default; +$control-color-inactive: $gray !default; +$control-color-hover: #fff !default; // Tooltips -$tooltip-bg: $controls-bg; -$tooltip-color: #fff; -$tooltip-padding: $control-spacing; -$tooltip-arrow-size: 5px; -$tooltip-radius: 3px; +$tooltip-bg: $controls-bg !default; +$tooltip-color: #fff !default; +$tooltip-padding: $control-spacing !default; +$tooltip-arrow-size: 5px !default; +$tooltip-radius: 3px !default; // Progress -$progress-bg: lighten($gray, 10%); -$progress-playing-bg: $blue; -$progress-buffered-bg: $gray; -$progress-loading-size: 40px; -$progress-loading-bg: rgba(0,0,0, .15); - -// Range -$volume-track-height: 6px; -$volume-track-bg: $gray; -$volume-thumb-height: ($volume-track-height * 2); -$volume-thumb-width: ($volume-track-height * 2); -$volume-thumb-bg: $control-color; -$volume-thumb-bg-focus: $control-bg-hover; +$progress-bg: rgba(red($gray), green($gray), blue($gray), .2) !default; +$progress-playing-bg: $blue !default; +$progress-buffered-bg: rgba(red($gray), green($gray), blue($gray), .25) !default; +$progress-loading-size: 40px !default; +$progress-loading-bg: rgba(0,0,0, .15) !default; + +// Volume +$volume-track-height: 6px !default; +$volume-track-bg: $gray !default; +$volume-thumb-height: ($volume-track-height * 2) !default; +$volume-thumb-width: ($volume-track-height * 2) !default; +$volume-thumb-bg: $control-color !default; +$volume-thumb-bg-focus: $control-bg-hover !default; // Breakpoints -$bp-control-split: 560px; // When controls split into left/right -$bp-captions-large: 768px; // When captions jump to the larger font size +$bp-control-split: 560px !default; // When controls split into left/right +$bp-captions-large: 768px !default; // When captions jump to the larger font size // Utility classes & mixins // ------------------------------- // 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; + position: absolute !important; + clip: rect(1px, 1px, 1px, 1px); + padding: 0 !important; + border: 0 !important; + height: 1px !important; + width: 1px !important; + overflow: hidden; } // Contain floats: nicolasgallagher.com/micro-clearfix-hack/ @mixin clearfix() { - zoom: 1; - &:before, - &:after { content: ""; display: table; } - &:after { clear: both; } + zoom: 1; + &:before, + &:after { content: ""; display: table; } + &:after { clear: both; } } // Tab focus styles @mixin tab-focus() { - outline: thin dotted #000; - outline-offset: 0; + outline: thin dotted #000; + outline-offset: 0; } // Animation // --------------------------------------- @keyframes progress { - to { background-position: @progress-loading-size 0; } + to { background-position: $progress-loading-size 0; } } // <input type="range"> styling // --------------------------------------- @mixin volume-thumb() { - height: $volume-thumb-height; - width: $volume-thumb-width; - background: $volume-thumb-bg; - border: 0; - border-radius: ($volume-thumb-height / 2); - transition: background .3s ease; - cursor: ew-resize; + height: $volume-thumb-height; + width: $volume-thumb-width; + background: $volume-thumb-bg; + border: 0; + border-radius: ($volume-thumb-height / 2); + transition: background .3s ease; + cursor: ew-resize; } @mixin volume-track() { - height: $volume-track-height; - background: $volume-track-bg; - border: 0; - border-radius: ($volume-track-height / 2); + height: $volume-track-height; + background: $volume-track-bg; + border: 0; + border-radius: ($volume-track-height / 2); } -@mixin seek-thumb() { - background: transparent; - border: 0; - width: ($control-spacing * 2); - height: $control-spacing; +@mixin seek-thumb() +{ + background: transparent; + border: 0; + width: ($control-spacing * 2); + height: $control-spacing; } -@mixin seek-track() { - background: none; - border: 0; +@mixin seek-track() +{ + background: none; + border: 0; } // Font smoothing // --------------------------------------- -@mixin font-smoothing($mode: on) when ($mode = on) +@mixin font-smoothing($mode: on) { - -moz-osx-font-smoothing: grayscale; - -webkit-font-smoothing: antialiased; -} -@mixin font-smoothing($mode: on) when ($mode = off) -{ - -moz-osx-font-smoothing: auto; - -webkit-font-smoothing: subpixel-antialiased; + @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; + } } // Styles // ------------------------------- // Base .player { - position: relative; - max-width: 100%; - min-width: 290px; - - // border-box everything - // http://paulirish.com/2012/box-sizing-border-box-ftw/ - &, - *, - *::after, - *::before { - box-sizing: border-box; - } - - // For video - &-video-wrapper { - position: relative; - } - video { - width: 100%; - height: auto; - vertical-align: middle; - } - - // Captions - &-captions { - display: none; - position: absolute; - bottom: 0; - left: 0; - width: 100%; - padding: 20px; - min-height: 2.5em; - color: #fff; - font-size: $font-size-base; - font-weight: 600; - text-shadow: - -1px -1px 0 $gray, - 1px -1px 0 $gray, - -1px 1px 0 $gray, - 1px 1px 0 $gray; - text-align: center; - @include font-smoothing(); - - @media (min-width: $bp-captions-large) { - font-size: $font-size-large; - } - } - &.captions-active &-captions { - display: block; - } - - // Player controls - &-controls { - @include clearfix(); - @include font-smoothing(); - position: relative; - padding: ($control-spacing * 2) $control-spacing $control-spacing; - background: $controls-bg; - line-height: 1; - text-align: center; - - // Layout - &-sound { - display: block; - margin: $control-spacing auto 0; - } - @media (min-width: $bp-control-split) { - &-playback { - float: left; - } - &-sound { - float: right; - margin-top: 0; - } - } - - input + label, - button { - display: inline-block; - vertical-align: middle; - margin: 0 2px; - padding: ($control-spacing / 2) $control-spacing; - - transition: background .3s ease; - border-radius: 3px; - cursor: pointer; - - svg { - width: 18px; - height: 18px; - display: block; - fill: currentColor; - transition: fill .3s ease; - } - } - input + label, - .inverted:checked + label { - color: $control-color-inactive; - } - button, - .inverted + label, - input:checked + label { - color: $control-color; - } - button { - border: 0; - background: transparent; - overflow: hidden; - } - input:focus + label, - button:focus { - @include tab-focus(); - color: $control-color-focus; - } - button:hover, - input + label:hover { - background: $control-bg-hover; - color: $control-color-hover; - } - .icon-exit-fullscreen, - .icon-muted, - .icon-captions-on { - display: none; - } - .player-time { - display: inline-block; - vertical-align: middle; - margin-left: $control-spacing; - color: $control-color; - font-weight: 600; - font-size: $font-size-small; - @include font-smoothing(); - } - } - - // Tooltips - &-tooltip { - visibility: hidden; - position: absolute; - z-index: 2; - bottom: 100%; - margin-bottom: $tooltip-padding; - padding: $tooltip-padding ($tooltip-padding * 1.5); + position: relative; + max-width: 100%; + min-width: 290px; + + // border-box everything + // http://paulirish.com/2012/box-sizing-border-box-ftw/ + &, + *, + *::after, + *::before { + box-sizing: border-box; + } + + // For video + &-video-wrapper { + position: relative; + } + video { + width: 100%; + height: auto; + vertical-align: middle; + } + + // Captions + &-captions { + display: none; + position: absolute; + bottom: 0; + left: 0; + width: 100%; + padding: 20px; + min-height: 2.5em; + color: #fff; + font-size: $font-size-base; + font-weight: 600; + text-shadow: + -1px -1px 0 $gray, + 1px -1px 0 $gray, + -1px 1px 0 $gray, + 1px 1px 0 $gray; + text-align: center; + @include font-smoothing(); + + @media (min-width: $bp-captions-large) { + font-size: $font-size-large; + } + } + &.captions-active &-captions { + display: block; + } + + // Player controls + &-controls { + @include clearfix(); + @include font-smoothing(); + position: relative; + padding: $control-spacing; + background: $controls-bg; + line-height: 1; + text-align: center; + + // Layout + &-right { + display: block; + margin: $control-spacing auto 0; + } + @media (min-width: $bp-control-split) { + &-left { + float: left; + } + &-right { + float: right; + margin-top: 0; + } + } + + input + label, + button { + display: inline-block; + vertical-align: middle; + margin: 0 2px; + padding: ($control-spacing / 2) $control-spacing; + + transition: background .3s ease; + border-radius: 3px; + cursor: pointer; + + svg { + width: 18px; + height: 18px; + display: block; + fill: currentColor; + transition: fill .3s ease; + } + } + input + label, + .inverted:checked + label { + color: $control-color-inactive; + } + button, + .inverted + label, + input:checked + label { + color: $control-color; + } + button { + border: 0; + background: transparent; + overflow: hidden; + } + + // Specificity for overriding .inverted + button:focus, + button:hover, + [type="checkbox"]:focus + label, + [type="checkbox"] + label:hover { + background: $control-bg-hover; + color: $control-color-hover; + } + button:focus, + input:focus + label { + outline: 0; + } + .icon-exit-fullscreen, + .icon-muted, + .icon-captions-on { + display: none; + } + .player-time { + display: inline-block; + vertical-align: middle; + margin-left: $control-spacing; + color: $control-color; + font-weight: 600; + font-size: $font-size-small; + @include font-smoothing(); + } + + // Media duration hidden on small screens + .player-time + .player-time { + display: none; + + @media (min-width: $bp-control-split) { + display: inline-block; + } + + // Add a slash in before + &::before { + content: "\2044"; + margin-right: $control-spacing; + color: darken($control-color, 30%); + } + } + } + + // Tooltips + &-tooltip { + visibility: hidden; + position: absolute; + z-index: 2; + bottom: 100%; + margin-bottom: $tooltip-padding; + padding: $tooltip-padding ($tooltip-padding * 1.5); opacity: 0; - background: $tooltip-bg; - border-radius: $tooltip-radius; - color: $tooltip-color; - font-size: $font-size-small; - line-height: 1.5; - font-weight: 600; - - transform: translate(-50%, ($tooltip-padding * 3)); + background: $tooltip-bg; + border-radius: $tooltip-radius; + color: $tooltip-color; + font-size: $font-size-small; + line-height: 1.5; + font-weight: 600; + + transform: translate(-50%, ($tooltip-padding * 3)); transition: transform .2s .2s ease, opacity .2s .2s ease; - &::after { - content: ""; - display: block; - position: absolute; - left: 50%; - bottom: -$tooltip-arrow-size; - margin-left: -$tooltip-arrow-size; - width: 0; - height: 0; - transition: inherit; - border-style: solid; - border-width: $tooltip-arrow-size $tooltip-arrow-size 0 $tooltip-arrow-size; - border-color: $controls-bg transparent transparent; - } - } - label:hover .player-tooltip, - input:focus + label .player-tooltip, - button:hover .player-tooltip, - button:focus .player-tooltip { - visibility: visible; - opacity: 1; - transform: translate(-50%, 0); - } - label:hover .player-tooltip, - button:hover .player-tooltip { - z-index: 3; - } - - // Player progress - // <progress> element - &-progress { - position: absolute; - top: 0; - left: 0; - right: 0; - width: 100%; - height: $control-spacing; - background: $progress-bg; - - &-buffer[value], - &-played[value], - &-seek[type=range] { - position: absolute; - left: 0; - top: 0; - width: 100%; - height: 100%; - margin: 0; - vertical-align: top; - - -webkit-appearance: none; - -moz-appearance: none; - border: none; - background: transparent; - } - - &-buffer[value], - &-played[value] { - &::-webkit-progress-bar { - background: transparent; - } - - // Inherit from currentColor; - &::-webkit-progress-value { - background: currentColor; - } - &::-moz-progress-bar { - background: currentColor; - } - } - &-played[value] { - z-index: 2; - color: $progress-playing-bg; - } - &-buffer[value] { - color: $progress-buffered-bg; - } - - // Seek control - // <input[type='range']> element - // Specificity is for bootstrap compatibility - &-seek[type=range] { - z-index: 3; - 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; - } - } - } - - // Loading state - &.loading .player-progress-buffer { - animation: progress 1s linear infinite; - background-size: $progress-loading-size $progress-loading-size; - background-repeat: repeat-x; - background-color: $progress-buffered-bg; - background-image: linear-gradient( - -45deg, - $progress-loading-bg 25%, - transparent 25%, - transparent 50%, - $progress-loading-bg 50%, - $progress-loading-bg 75%, - transparent 75%, - transparent); - color: transparent; - } - - // States - &-controls [data-player='pause'], - &.playing .player-controls [data-player='play'] { - display: none; - } - &.playing .player-controls [data-player='pause'] { - display: inline-block; - } - - // Volume control - // <input[type='range']> element - // Specificity is for bootstrap compatibility - &-volume[type=range] { - vertical-align: middle; - -webkit-appearance: none; - -moz-appearance: none; - width: 100px; - margin: 0 $control-spacing 0 0; - padding: 0; - cursor: pointer; - background: none; - - // Webkit - &::-webkit-slider-runnable-track { - @include range-track(); - } - &::-webkit-slider-thumb { - -webkit-appearance: none; - margin-top: -(($volume-thumb-height - $volume-track-height) / 2); - @include range-thumb(); - } - - // Mozilla - &::-moz-range-track { - @include range-track(); - } - &::-moz-range-thumb { - @include range-thumb(); - } - - // Microsoft - &::-ms-track { - height: $volume-track-height; - background: transparent; - border-color: transparent; - border-width: (($volume-thumb-height - $volume-track-height) / 2) 0; - color: transparent; - } - &::-ms-fill-lower, - &::-ms-fill-upper { - @include range-track(); - } - &::-ms-thumb { - @include range-thumb(); - } - - &:focus { - outline: 0; - - &::-webkit-slider-thumb { - background: $volume-thumb-bg-focus; - } - &::-moz-range-thumb { - background: $volume-thumb-bg-focus; - } - &::-ms-thumb { - background: $volume-thumb-bg-focus; - } - } - } - - // 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; - - .player-video-wrapper { - height: 100%; - width: 100%; - - video { - height: 100%; - } - .player-captions { - top: auto; - bottom: 90px; - - @media (min-width: $bp-control-split) and (max-width: ($bp-captions-large - 1)) { - bottom: 60px; - } - @media (min-width: $bp-captions-large) { - bottom: 80px; - } - } - } - .player-controls { - position: absolute; - bottom: 0; - left: 0; - right: 0; - } - } - - // Change icons on state change - &.fullscreen-active .icon-exit-fullscreen, - &.muted .player-controls .icon-muted, - &.captions-active .player-controls .icon-captions-on { - display: block; - - & + svg { - display: none; - } - } - - // Some options are hidden by default - [data-player='captions'], - [data-player='captions'] + label, - [data-player='fullscreen'], - [data-player='fullscreen'] + label { - display: none; - } - &.captions-enabled [data-player='captions'], - &.captions-enabled [data-player='captions'] + label, - &.fullscreen-enabled [data-player='fullscreen'], - &.fullscreen-enabled [data-player='fullscreen'] + label { - display: inline-block; - } - - // Full browser view hides toggle - &-fullscreen [data-player='fullscreen'], - &-fullscreen [data-player='fullscreen'] + label { - display: none !important; - } -} + &::after { + content: ""; + display: block; + position: absolute; + left: 50%; + bottom: -$tooltip-arrow-size; + margin-left: -$tooltip-arrow-size; + width: 0; + height: 0; + transition: inherit; + border-style: solid; + border-width: $tooltip-arrow-size $tooltip-arrow-size 0 $tooltip-arrow-size; + border-color: $controls-bg transparent transparent; + } + } + label:hover .player-tooltip, + input:focus + label .player-tooltip, + button:hover .player-tooltip, + button:focus .player-tooltip { + visibility: visible; + opacity: 1; + transform: translate(-50%, 0); + } + label:hover .player-tooltip, + button:hover .player-tooltip { + z-index: 3; + } + + // Player progress + // <progress> element + &-progress { + position: absolute; + bottom: 100%; + left: 0; + right: 0; + width: 100%; + height: $control-spacing; + background: $progress-bg; + + &-buffer[value], + &-played[value], + &-seek[type=range] { + position: absolute; + left: 0; + top: 0; + width: 100%; + height: $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; + } + + // Inherit from currentColor; + &::-webkit-progress-value { + background: currentColor; + } + &::-moz-progress-bar { + background: currentColor; + } + } + &-played[value] { + z-index: 2; + color: $progress-playing-bg; + } + &-buffer[value] { + color: $progress-buffered-bg; + } + + // Seek control + // <input[type='range']> 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; + } + } + } + + // Loading state + &.loading .player-progress-buffer { + animation: progress 1s linear infinite; + background-size: $progress-loading-size $progress-loading-size; + background-repeat: repeat-x; + background-color: $progress-buffered-bg; + background-image: linear-gradient( + -45deg, + $progress-loading-bg 25%, + transparent 25%, + transparent 50%, + $progress-loading-bg 50%, + $progress-loading-bg 75%, + transparent 75%, + transparent); + color: transparent; + } + + // States + &-controls [data-player='pause'], + &.playing .player-controls [data-player='play'] { + display: none; + } + &.playing .player-controls [data-player='pause'] { + display: inline-block; + } + + // Volume control + // <input[type='range']> element + // Specificity is for bootstrap compatibility + &-volume[type=range] { + display: inline-block; + vertical-align: middle; + -webkit-appearance: none; + -moz-appearance: none; + width: 100px; + margin: 0 $control-spacing 0 0; + padding: 0; + cursor: pointer; + background: none; + + // Webkit + &::-webkit-slider-runnable-track { + @include volume-track(); + } + &::-webkit-slider-thumb { + -webkit-appearance: none; + margin-top: -(($volume-thumb-height - $volume-track-height) / 2); + @include volume-thumb(); + } + + // Mozilla + &::-moz-range-track { + @include volume-track(); + } + &::-moz-range-thumb { + @include volume-thumb(); + } + + // Microsoft + &::-ms-track { + height: $volume-track-height; + background: transparent; + border-color: transparent; + border-width: (($volume-thumb-height - $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: $volume-thumb-bg-focus; + } + &::-moz-range-thumb { + background: $volume-thumb-bg-focus; + } + &::-ms-thumb { + background: $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 + &.ios &-volume, + &.ios [data-player='mute'], + &.ios [data-player='mute'] + label, + &-audio.ios &-controls-right { + display: none; + } + // Center buttons so it looks less odd + &-audio.ios &-controls-left { + float: none; + } + + // Audio specific styles + // Position the progress within the container + &-audio .player-controls { + padding-top: ($control-spacing * 2); + } + &-audio .player-progress { + bottom: auto; + top: 0; + background: $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%; + } + .player-video-wrapper { + height: 100%; + width: 100%; + + .player-captions { + top: auto; + bottom: 90px; + + @media (min-width: $bp-control-split) and (max-width: ($bp-captions-large - 1)) { + bottom: 60px; + } + @media (min-width: $bp-captions-large) { + bottom: 80px; + } + } + } + .player-controls { + position: absolute; + bottom: 0; + left: 0; + right: 0; + } + + // Hide controls when playing in full screen + &.fullscreen-hide-controls.playing .player-controls { + transform: translateY(100%) translateY($control-spacing / 2); + transition: transform .3s 1s ease; + + &.hover { + transform: translateY(0); + transition-delay: 0; + } + } + } + + // Change icons on state change + &.fullscreen-active .icon-exit-fullscreen, + &.muted .player-controls .icon-muted, + &.captions-active .player-controls .icon-captions-on { + display: block; + + & + svg { + display: none; + } + } + + // Some options are hidden by default + [data-player='captions'], + [data-player='captions'] + label, + [data-player='fullscreen'], + [data-player='fullscreen'] + label { + display: none; + } + &.captions-enabled [data-player='captions'], + &.captions-enabled [data-player='captions'] + label, + &.fullscreen-enabled [data-player='fullscreen'], + &.fullscreen-enabled [data-player='fullscreen'] + label { + display: inline-block; + } +}
\ No newline at end of file |