Merge branch 'master' into master

This commit is contained in:
Sam Potts 2017-11-04 22:14:55 +11:00 committed by GitHub
commit be4b5ef4db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 1390 additions and 1116 deletions

View File

@ -1,5 +1,17 @@
# Changelog # Changelog
## v2.0.16
- Fullscreen bug fix (fixes #664)
## v2.0.15
- Demo fix
## v2.0.14
- CDN URL updates. Sorry, still working on V3 as hard as I can...
## v2.0.13
- Repo moved and Vimeo demo fix
## v2.0.12 ## v2.0.12
- Ability to set custom `blankUrl` for source changes (https://github.com/sampotts/plyr/pull/504) - Ability to set custom `blankUrl` for source changes (https://github.com/sampotts/plyr/pull/504)
- Ability to set caption button listener (https://github.com/sampotts/plyr/pull/468) - Ability to set caption button listener (https://github.com/sampotts/plyr/pull/468)

2
demo/dist/demo.js vendored
View File

@ -1 +1 @@
"document"in self&&("classList"in document.createElement("_")?function(){"use strict";var e=document.createElement("_");if(e.classList.add("c1","c2"),!e.classList.contains("c2")){var t=function(e){var t=DOMTokenList.prototype[e];DOMTokenList.prototype[e]=function(e){var i,o=arguments.length;for(i=0;i<o;i++)e=arguments[i],t.call(this,e)}};t("add"),t("remove")}if(e.classList.toggle("c3",!1),e.classList.contains("c3")){var i=DOMTokenList.prototype.toggle;DOMTokenList.prototype.toggle=function(e,t){return 1 in arguments&&!this.contains(e)==!t?t:i.call(this,e)}}e=null}():function(e){"use strict";if("Element"in e){var t=e.Element.prototype,i=Object,o=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")},s=Array.prototype.indexOf||function(e){for(var t=0,i=this.length;t<i;t++)if(t in this&&this[t]===e)return t;return-1},n=function(e,t){this.name=e,this.code=DOMException[e],this.message=t},r=function(e,t){if(""===t)throw new n("SYNTAX_ERR","An invalid or illegal string was specified");if(/\s/.test(t))throw new n("INVALID_CHARACTER_ERR","String contains an invalid character");return s.call(e,t)},a=function(e){for(var t=o.call(e.getAttribute("class")||""),i=t?t.split(/\s+/):[],s=0,n=i.length;s<n;s++)this.push(i[s]);this._updateClassName=function(){e.setAttribute("class",this.toString())}},c=a.prototype=[],l=function(){return new a(this)};if(n.prototype=Error.prototype,c.item=function(e){return this[e]||null},c.contains=function(e){return e+="",-1!==r(this,e)},c.add=function(){var e,t=arguments,i=0,o=t.length,s=!1;do{e=t[i]+"",-1===r(this,e)&&(this.push(e),s=!0)}while(++i<o);s&&this._updateClassName()},c.remove=function(){var e,t,i=arguments,o=0,s=i.length,n=!1;do{for(e=i[o]+"",t=r(this,e);-1!==t;)this.splice(t,1),n=!0,t=r(this,e)}while(++o<s);n&&this._updateClassName()},c.toggle=function(e,t){e+="";var i=this.contains(e),o=i?!0!==t&&"remove":!1!==t&&"add";return o&&this[o](e),!0===t||!1===t?t:!i},c.toString=function(){return this.join(" ")},i.defineProperty){var u={get:l,enumerable:!0,configurable:!0};try{i.defineProperty(t,"classList",u)}catch(e){-2146823252===e.number&&(u.enumerable=!1,i.defineProperty(t,"classList",u))}}else i.prototype.__defineGetter__&&t.__defineGetter__("classList",l)}}(self)),function(){function e(e,t,i){if(e)if(e.classList)e.classList[i?"add":"remove"](t);else{var o=(" "+e.className+" ").replace(/\s+/g," ").replace(" "+t+" ","");e.className=o+(i?" "+t:"")}}function t(t,i){if(t in n&&(i||t!==r)&&(r.length||t!==n.video)){switch(t){case n.video:o.source({type:"video",title:"View From A Blue Moon",sources:[{src:"https://cdn.selz.com/plyr/1.5/View_From_A_Blue_Moon_Trailer-HD.mp4",type:"video/mp4"},{src:"https://cdn.selz.com/plyr/1.5/View_From_A_Blue_Moon_Trailer-HD.webm",type:"video/webm"}],poster:"https://cdn.selz.com/plyr/1.5/View_From_A_Blue_Moon_Trailer-HD.jpg",tracks:[{kind:"captions",label:"English",srclang:"en",src:"https://cdn.selz.com/plyr/1.5/View_From_A_Blue_Moon_Trailer-HD.en.vtt",default:!0}]});break;case n.audio:o.source({type:"audio",title:"Kishi Bashi &ndash; &ldquo;It All Began With A Burst&rdquo;",sources:[{src:"https://cdn.selz.com/plyr/1.5/Kishi_Bashi_-_It_All_Began_With_a_Burst.mp3",type:"audio/mp3"},{src:"https://cdn.selz.com/plyr/1.5/Kishi_Bashi_-_It_All_Began_With_a_Burst.ogg",type:"audio/ogg"}]});break;case n.youtube:o.source({type:"video",title:"View From A Blue Moon",sources:[{src:"bTqVqk7FSmY",type:"youtube"}]});break;case n.vimeo:o.source({type:"video",title:"View From A Blue Moon",sources:[{src:"147865858",type:"vimeo"}]})}r=t;for(var a=s.length-1;a>=0;a--)e(s[a].parentElement,"active",!1);e(document.querySelector('[data-source="'+t+'"]').parentElement,"active",!0)}}var i=plyr.setup({debug:!0,title:"Video demo",iconUrl:"../dist/plyr.svg",tooltips:{controls:!0},captions:{defaultActive:!0}});plyr.loadSprite("dist/demo.svg");for(var o=i[0],s=document.querySelectorAll("[data-source]"),n={video:"video",audio:"audio",youtube:"youtube",vimeo:"vimeo"},r=window.location.hash.replace("#",""),a=window.history&&window.history.pushState,c=s.length-1;c>=0;c--)s[c].addEventListener("click",function(){var e=this.getAttribute("data-source");t(e),a&&history.pushState({type:e},"","#"+e)});if(window.addEventListener("popstate",function(e){e.state&&"type"in e.state&&t(e.state.type)}),a){var l=!r.length;l&&(r=n.video),r in n&&history.replaceState({type:r},"",l?"":"#"+r),r!==n.video&&t(r,!0)}}(),document.domain.indexOf("plyr.io")>-1&&(!function(e,t,i,o,s,n,r){e.GoogleAnalyticsObject=s,e[s]=e[s]||function(){(e[s].q=e[s].q||[]).push(arguments)},e[s].l=1*new Date,n=t.createElement(i),r=t.getElementsByTagName(i)[0],n.async=1,n.src="//www.google-analytics.com/analytics.js",r.parentNode.insertBefore(n,r)}(window,document,"script",0,"ga"),ga("create","UA-40881672-11","auto"),ga("send","pageview")); "document"in self&&("classList"in document.createElement("_")?!function(){"use strict";var t=document.createElement("_");if(t.classList.add("c1","c2"),!t.classList.contains("c2")){var e=function(t){var e=DOMTokenList.prototype[t];DOMTokenList.prototype[t]=function(t){var i,o=arguments.length;for(i=0;i<o;i++)t=arguments[i],e.call(this,t)}};e("add"),e("remove")}if(t.classList.toggle("c3",!1),t.classList.contains("c3")){var i=DOMTokenList.prototype.toggle;DOMTokenList.prototype.toggle=function(t,e){return 1 in arguments&&!this.contains(t)==!e?e:i.call(this,t)}}t=null}():!function(t){"use strict";if("Element"in t){var e="classList",i="prototype",o=t.Element[i],s=Object,n=String[i].trim||function(){return this.replace(/^\s+|\s+$/g,"")},r=Array[i].indexOf||function(t){for(var e=0,i=this.length;e<i;e++)if(e in this&&this[e]===t)return e;return-1},a=function(t,e){this.name=t,this.code=DOMException[t],this.message=e},c=function(t,e){if(""===e)throw new a("SYNTAX_ERR","An invalid or illegal string was specified");if(/\s/.test(e))throw new a("INVALID_CHARACTER_ERR","String contains an invalid character");return r.call(t,e)},l=function(t){for(var e=n.call(t.getAttribute("class")||""),i=e?e.split(/\s+/):[],o=0,s=i.length;o<s;o++)this.push(i[o]);this._updateClassName=function(){t.setAttribute("class",this.toString())}},u=l[i]=[],d=function(){return new l(this)};if(a[i]=Error[i],u.item=function(t){return this[t]||null},u.contains=function(t){return t+="",c(this,t)!==-1},u.add=function(){var t,e=arguments,i=0,o=e.length,s=!1;do t=e[i]+"",c(this,t)===-1&&(this.push(t),s=!0);while(++i<o);s&&this._updateClassName()},u.remove=function(){var t,e,i=arguments,o=0,s=i.length,n=!1;do for(t=i[o]+"",e=c(this,t);e!==-1;)this.splice(e,1),n=!0,e=c(this,t);while(++o<s);n&&this._updateClassName()},u.toggle=function(t,e){t+="";var i=this.contains(t),o=i?e!==!0&&"remove":e!==!1&&"add";return o&&this[o](t),e===!0||e===!1?e:!i},u.toString=function(){return this.join(" ")},s.defineProperty){var p={get:d,enumerable:!0,configurable:!0};try{s.defineProperty(o,e,p)}catch(h){h.number===-2146823252&&(p.enumerable=!1,s.defineProperty(o,e,p))}}else s[i].__defineGetter__&&o.__defineGetter__(e,d)}}(self)),function(){function t(t,e,i){if(t)if(t.classList)t.classList[i?"add":"remove"](e);else{var o=(" "+t.className+" ").replace(/\s+/g," ").replace(" "+e+" ","");t.className=o+(i?" "+e:"")}}function e(e,i){if(e in n&&(i||e!==r)&&(r.length||e!==n.video)){switch(e){case n.video:o.source({type:"video",title:"View From A Blue Moon",sources:[{src:"https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.mp4",type:"video/mp4"},{src:"https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.webm",type:"video/webm"}],poster:"https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.jpg",tracks:[{kind:"captions",label:"English",srclang:"en",src:"https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.en.vtt","default":!0}]});break;case n.audio:o.source({type:"audio",title:"Kishi Bashi &ndash; &ldquo;It All Began With A Burst&rdquo;",sources:[{src:"https://cdn.plyr.io/static/demo/Kishi_Bashi_-_It_All_Began_With_a_Burst.mp3",type:"audio/mp3"},{src:"https://cdn.plyr.io/static/demo/Kishi_Bashi_-_It_All_Began_With_a_Burst.ogg",type:"audio/ogg"}]});break;case n.youtube:o.source({type:"video",title:"View From A Blue Moon",sources:[{src:"bTqVqk7FSmY",type:"youtube"}]});break;case n.vimeo:o.source({type:"video",title:"View From A Blue Moon",sources:[{src:"147865858",type:"vimeo"}]})}r=e;for(var a=s.length-1;a>=0;a--)t(s[a].parentElement,"active",!1);t(document.querySelector('[data-source="'+e+'"]').parentElement,"active",!0)}}var i=plyr.setup({debug:!0,title:"Video demo",iconUrl:"../dist/plyr.svg",tooltips:{controls:!0},captions:{defaultActive:!0}});plyr.loadSprite("dist/demo.svg");for(var o=i[0],s=document.querySelectorAll("[data-source]"),n={video:"video",audio:"audio",youtube:"youtube",vimeo:"vimeo"},r=window.location.hash.replace("#",""),a=window.history&&window.history.pushState,c=s.length-1;c>=0;c--)s[c].addEventListener("click",function(){var t=this.getAttribute("data-source");e(t),a&&history.pushState({type:t},"","#"+t)});if(window.addEventListener("popstate",function(t){t.state&&"type"in t.state&&e(t.state.type)}),a){var l=!r.length;l&&(r=n.video),r in n&&history.replaceState({type:r},"",l?"":"#"+r),r!==n.video&&e(r,!0)}}(),document.domain.indexOf("plyr.io")>-1&&(!function(t,e,i,o,s,n,r){t.GoogleAnalyticsObject=s,t[s]=t[s]||function(){(t[s].q=t[s].q||[]).push(arguments)},t[s].l=1*new Date,n=e.createElement(i),r=e.getElementsByTagName(i)[0],n.async=1,n.src=o,r.parentNode.insertBefore(n,r)}(window,document,"script","//www.google-analytics.com/analytics.js","ga"),ga("create","UA-40881672-11","auto"),ga("send","pageview"));

View File

@ -1,18 +1,25 @@
<!doctype html> <!doctype html>
<html lang="en" class="error"> <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">
<!-- Docs styles --> <head>
<link rel="stylesheet" href="dist/demo.css"> <meta charset="utf-8" />
</head> <title>Doh. Looks like something went wrong.</title>
<body> <meta name="viewport" content="width=device-width, initial-scale=1">
<main>
<h1>Doh.</h1> <!-- Docs styles -->
<p>Looks like something went wrong.</p> <link rel="stylesheet" href="dist/demo.css">
<a href="http://plyr.io" class="btn btn--primary">Back to plyr.io</a>
</main> <!-- Preload -->
</body> <link rel="preload" as="font" crossorigin type="font/woff2" href="https://cdn.plyr.io/static/fonts/avenir-medium.woff2">
</html> <link rel="preload" as="font" crossorigin type="font/woff2" href="https://cdn.plyr.io/static/fonts/avenir-bold.woff2">
</head>
<body>
<main>
<h1>Doh.</h1>
<p>Looks like something went wrong.</p>
<a href="http://plyr.io" class="btn btn--primary">Back to plyr.io</a>
</main>
</body>
</html>

View File

@ -1,88 +1,103 @@
<!doctype html> <!doctype html>
<html lang="en"> <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">
<!-- Styles --> <head>
<link rel="stylesheet" href="../dist/plyr.css"> <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">
<!-- Docs styles --> <!-- Styles -->
<link rel="stylesheet" href="dist/demo.css"> <link rel="stylesheet" href="../dist/plyr.css">
</head>
<body>
<header>
<h1>Plyr</h1>
<p>A simple, accessible HTML5 media player by <a href="https://twitter.com/sam_potts" target="_blank">@sam_potts</a></p>
<nav>
<ul>
<li>
<a href="https://github.com/sampotts/plyr" target="_blank" class="btn btn--large btn--primary" data-shr-network="github">
<svg class="icon"><use xlink:href="#icon-github"/></svg>Download on GitHub
</a>
</li>
<li>
<a href="https://twitter.com/intent/tweet?text=A+simple+HTML5+media+player+with+custom+controls+and+WebVTT+captions.&url=http%3A%2F%2Fplyr.io&via=Sam_Potts" target="_blank" class="btn btn--large btn--twitter" data-shr-network="twitter">
<svg class="icon"><use xlink:href="#icon-twitter"/></svg>Tweet
</a>
</li>
</ul>
</nav>
</header>
<main role="main" id="main"> <!-- Docs styles -->
<nav class="btn__bar"> <link rel="stylesheet" href="dist/demo.css">
<ul>
<li class="active">
<button type="button" class="btn" data-source="video">Video</button>
</li>
<li>
<button type="button" class="btn" data-source="audio">Audio</button>
</li>
<li>
<button type="button" class="btn btn--youtube" data-source="youtube"><svg class="icon"><use xlink:href="#icon-youtube"/></svg>YouTube</button>
</li>
<li>
<button type="button" class="btn btn--vimeo" data-source="vimeo"><svg class="icon"><use xlink:href="#icon-vimeo"/></svg>Vimeo</button>
</li>
</ul>
</nav>
<section>
<video poster="https://cdn.selz.com/plyr/1.5/View_From_A_Blue_Moon_Trailer-HD.jpg?v1" controls crossorigin>
<!-- Video files -->
<source src="https://cdn.selz.com/plyr/1.5/View_From_A_Blue_Moon_Trailer-HD.mp4" type="video/mp4">
<source src="https://cdn.selz.com/plyr/1.5/View_From_A_Blue_Moon_Trailer-HD.webm" type="video/webm">
<!-- Text track file --> <!-- Preload -->
<track kind="captions" label="English" srclang="en" src="https://cdn.selz.com/plyr/1.5/View_From_A_Blue_Moon_Trailer-HD.en.vtt" default> <link rel="preload" as="font" crossorigin type="font/woff2" href="https://cdn.plyr.io/static/fonts/avenir-medium.woff2">
<link rel="preload" as="font" crossorigin type="font/woff2" href="https://cdn.plyr.io/static/fonts/avenir-bold.woff2">
</head>
<!-- Fallback for browsers that don't support the <video> element --> <body>
<a href="https://cdn.selz.com/plyr/1.5/View_From_A_Blue_Moon_Trailer-HD.mp4" download>Download</a> <header>
</video> <h1>Plyr</h1>
<p>A simple, accessible HTML5 media player by <a href="https://twitter.com/sam_potts" target="_blank">@sam_potts</a></p>
<nav>
<ul>
<li>
<a href="https://github.com/sampotts/plyr" target="_blank" class="btn btn--large btn--primary" data-shr-network="github">
<svg class="icon">
<use xlink:href="#icon-github" />
</svg>Download on GitHub
</a>
</li>
<li>
<a href="https://twitter.com/intent/tweet?text=A+simple+HTML5+media+player+with+custom+controls+and+WebVTT+captions.&url=http%3A%2F%2Fplyr.io&via=Sam_Potts"
target="_blank" class="btn btn--large btn--twitter" data-shr-network="twitter">
<svg class="icon">
<use xlink:href="#icon-twitter" />
</svg>Tweet
</a>
</li>
</ul>
</nav>
</header>
<ul> <main role="main" id="main">
<li class="plyr__cite plyr__cite--video"><small><a href="http://viewfromabluemoon.com/" target="_blank">View From A Blue Moon</a> &copy; Brainfarm</small></li> <nav class="btn__bar">
<li class="plyr__cite plyr__cite--audio"><small><a href="http://www.kishibashi.com/" target="_blank">Kishi Bashi &ndash; &ldquo;It All Began With A Burst&rdquo;</a> &copy; Kishi Bashi</small></li> <ul>
<li class="plyr__cite plyr__cite--youtube"><small><a href="https://www.youtube.com/watch?v=bTqVqk7FSmY" target="_blank">View From A Blue Moon</a> on <span class="color--youtube"><svg class="icon"><use xlink:href="#icon-youtube"/></svg>YouTube</span></small></li> <li class="active">
<li class="plyr__cite plyr__cite--vimeo"><small><a href="https://vimeo.com/ondemand/viewfromabluemoon4k" target="_blank">View From A Blue Moon</a> on <span class="color--vimeo"><svg class="icon"><use xlink:href="#icon-vimeo"/></svg>Vimeo</span></small></li> <button type="button" class="btn" data-source="video">Video</button>
</ul> </li>
</section> <li>
</main> <button type="button" class="btn" data-source="audio">Audio</button>
</li>
<li>
<button type="button" class="btn btn--youtube" data-source="youtube"><svg class="icon"><use xlink:href="#icon-youtube"/></svg>YouTube</button>
</li>
<li>
<button type="button" class="btn btn--vimeo" data-source="vimeo"><svg class="icon"><use xlink:href="#icon-vimeo"/></svg>Vimeo</button>
</li>
</ul>
</nav>
<section>
<video poster="https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.jpg?v1" controls crossorigin>
<!-- Video files -->
<source src="https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.mp4" type="video/mp4">
<source src="https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.webm" type="video/webm">
<!-- Plyr core script --> <!-- Text track file -->
<script src="../dist/plyr.js"></script> <track kind="captions" label="English" srclang="en" src="https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.en.vtt"
default>
<!-- Docs script --> <!-- Fallback for browsers that don't support the <video> element -->
<script src="dist/demo.js"></script> <a href="https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.mp4" download>Download</a>
</video>
<!-- Rangetouch to fix <input type="range"> on touch devices (see https://rangetouch.com) --> <ul>
<script src="https://cdn.rangetouch.com/1.0.1/rangetouch.js" async></script> <li class="plyr__cite plyr__cite--video"><small><a href="http://viewfromabluemoon.com/" target="_blank">View From A Blue Moon</a> &copy; Brainfarm</small></li>
<li class="plyr__cite plyr__cite--audio"><small><a href="http://www.kishibashi.com/" target="_blank">Kishi Bashi &ndash; &ldquo;It All Began With A Burst&rdquo;</a> &copy; Kishi Bashi</small></li>
<li class="plyr__cite plyr__cite--youtube"><small><a href="https://www.youtube.com/watch?v=bTqVqk7FSmY" target="_blank">View From A Blue Moon</a> on <span class="color--youtube"><svg class="icon"><use xlink:href="#icon-youtube"/></svg>YouTube</span></small></li>
<li class="plyr__cite plyr__cite--vimeo"><small><a href="https://vimeo.com/ondemand/viewfromabluemoon4k" target="_blank">View From A Blue Moon</a> on <span class="color--vimeo"><svg class="icon"><use xlink:href="#icon-vimeo"/></svg>Vimeo</span></small></li>
</ul>
</section>
</main>
<!-- Sharing libary (https://shr.one) --> <!-- Plyr core script -->
<script src="https://cdn.shr.one/1.0.1/shr.js"></script> <script src="../dist/plyr.js"></script>
<script>if(window.shr) { window.shr.setup({ count: { classname: 'btn__count' } }); }</script>
</body> <!-- Docs script -->
</html> <script src="dist/demo.js"></script>
<!-- Rangetouch to fix <input type="range"> on touch devices (see https://rangetouch.com) -->
<script src="https://cdn.rangetouch.com/1.0.1/rangetouch.js" async></script>
<!-- Sharing libary (https://shr.one) -->
<script src="https://cdn.shr.one/1.0.1/shr.js"></script>
<script>
if (window.shr) { window.shr.setup({ count: { classname: 'btn__count' } }); }
</script>
</body>
</html>

View File

@ -12,68 +12,68 @@
// Setup the player // Setup the player
var instances = plyr.setup({ var instances = plyr.setup({
debug: true, debug: true,
title: 'Video demo', title: "Video demo",
iconUrl: '../dist/plyr.svg', iconUrl: "../dist/plyr.svg",
tooltips: { tooltips: {
controls: true controls: true
}, },
captions: { captions: {
defaultActive: true defaultActive: true
} }
}); });
plyr.loadSprite('dist/demo.svg'); plyr.loadSprite("dist/demo.svg");
// Plyr returns an array regardless // Plyr returns an array regardless
var player = instances[0]; var player = instances[0];
// Setup type toggle // Setup type toggle
var buttons = document.querySelectorAll('[data-source]'), var buttons = document.querySelectorAll("[data-source]"),
types = { types = {
video: 'video', video: "video",
audio: 'audio', audio: "audio",
youtube: 'youtube', youtube: "youtube",
vimeo: 'vimeo' vimeo: "vimeo"
}, },
currentType = window.location.hash.replace('#', ''), currentType = window.location.hash.replace("#", ""),
historySupport = (window.history && window.history.pushState); historySupport = window.history && window.history.pushState;
// Bind to each button // Bind to each button
for (var i = buttons.length - 1; i >= 0; i--) { for (var i = buttons.length - 1; i >= 0; i--) {
buttons[i].addEventListener('click', function() { buttons[i].addEventListener("click", function() {
var type = this.getAttribute('data-source'); var type = this.getAttribute("data-source");
newSource(type); newSource(type);
if (historySupport) { if (historySupport) {
history.pushState({ 'type': type }, '', '#' + type); history.pushState({ type: type }, "", "#" + type);
} }
}); });
} }
// List for backwards/forwards // List for backwards/forwards
window.addEventListener('popstate', function(event) { window.addEventListener("popstate", function(event) {
if(event.state && 'type' in event.state) { if (event.state && "type" in event.state) {
newSource(event.state.type); newSource(event.state.type);
} }
}); });
// On load // On load
if(historySupport) { if (historySupport) {
var video = !currentType.length; var video = !currentType.length;
// If there's no current type set, assume video // If there's no current type set, assume video
if(video) { if (video) {
currentType = types.video; currentType = types.video;
} }
// Replace current history state // Replace current history state
if(currentType in types) { if (currentType in types) {
history.replaceState({ 'type': currentType }, '', (video ? '' : '#' + currentType)); history.replaceState({ type: currentType }, "", video ? "" : "#" + currentType);
} }
// If it's not video, load the source // If it's not video, load the source
if(currentType !== types.video) { if (currentType !== types.video) {
newSource(currentType, true); newSource(currentType, true);
} }
} }
@ -82,11 +82,10 @@
function toggleClass(element, className, state) { function toggleClass(element, className, state) {
if (element) { if (element) {
if (element.classList) { if (element.classList) {
element.classList[state ? 'add' : 'remove'](className); element.classList[state ? "add" : "remove"](className);
} } else {
else { var name = (" " + element.className + " ").replace(/\s+/g, " ").replace(" " + className + " ", "");
var name = (' ' + element.className + ' ').replace(/\s+/g, ' ').replace(' ' + className + ' ', ''); element.className = name + (state ? " " + className : "");
element.className = name + (state ? ' ' + className : '');
} }
} }
} }
@ -94,68 +93,78 @@
// Set a new source // Set a new source
function newSource(type, init) { function newSource(type, init) {
// Bail if new type isn't known, it's the current type, or current type is empty (video is default) and new type is video // Bail if new type isn't known, it's the current type, or current type is empty (video is default) and new type is video
if(!(type in types) || (!init && type === currentType) || (!currentType.length && type === types.video)) { if (!(type in types) || (!init && type === currentType) || (!currentType.length && type === types.video)) {
return; return;
} }
switch(type) { switch (type) {
case types.video: case types.video:
player.source({ player.source({
type: 'video', type: "video",
title: 'View From A Blue Moon', title: "View From A Blue Moon",
sources: [{ sources: [
src: 'https://cdn.selz.com/plyr/1.5/View_From_A_Blue_Moon_Trailer-HD.mp4', {
type: 'video/mp4' src: "https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.mp4",
}, type: "video/mp4"
{ },
src: 'https://cdn.selz.com/plyr/1.5/View_From_A_Blue_Moon_Trailer-HD.webm', {
type: 'video/webm' src: "https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.webm",
}], type: "video/webm"
poster: 'https://cdn.selz.com/plyr/1.5/View_From_A_Blue_Moon_Trailer-HD.jpg', }
tracks: [{ ],
kind: 'captions', poster: "https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.jpg",
label: 'English', tracks: [
srclang:'en', {
src: 'https://cdn.selz.com/plyr/1.5/View_From_A_Blue_Moon_Trailer-HD.en.vtt', kind: "captions",
default: true label: "English",
}] srclang: "en",
src: "https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.en.vtt",
default: true
}
]
}); });
break; break;
case types.audio: case types.audio:
player.source({ player.source({
type: 'audio', type: "audio",
title: 'Kishi Bashi &ndash; &ldquo;It All Began With A Burst&rdquo;', title: "Kishi Bashi &ndash; &ldquo;It All Began With A Burst&rdquo;",
sources: [{ sources: [
src: 'https://cdn.selz.com/plyr/1.5/Kishi_Bashi_-_It_All_Began_With_a_Burst.mp3', {
type: 'audio/mp3' src: "https://cdn.plyr.io/static/demo/Kishi_Bashi_-_It_All_Began_With_a_Burst.mp3",
}, type: "audio/mp3"
{ },
src: 'https://cdn.selz.com/plyr/1.5/Kishi_Bashi_-_It_All_Began_With_a_Burst.ogg', {
type: 'audio/ogg' src: "https://cdn.plyr.io/static/demo/Kishi_Bashi_-_It_All_Began_With_a_Burst.ogg",
}] type: "audio/ogg"
}
]
}); });
break; break;
case types.youtube: case types.youtube:
player.source({ player.source({
type: 'video', type: "video",
title: 'View From A Blue Moon', title: "View From A Blue Moon",
sources: [{ sources: [
src: 'bTqVqk7FSmY', {
type: 'youtube' src: "bTqVqk7FSmY",
}] type: "youtube"
}
]
}); });
break; break;
case types.vimeo: case types.vimeo:
player.source({ player.source({
type: 'video', type: "video",
title: 'View From A Blue Moon', title: "View From A Blue Moon",
sources: [{ sources: [
src: '147865858', {
type: 'vimeo' src: "147865858",
}] type: "vimeo"
}
]
}); });
break; break;
} }
@ -165,21 +174,30 @@
// Remove active classes // Remove active classes
for (var x = buttons.length - 1; x >= 0; x--) { for (var x = buttons.length - 1; x >= 0; x--) {
toggleClass(buttons[x].parentElement, 'active', false); toggleClass(buttons[x].parentElement, "active", false);
} }
// Set active on parent // Set active on parent
toggleClass(document.querySelector('[data-source="'+ type +'"]').parentElement, 'active', true); toggleClass(document.querySelector('[data-source="' + type + '"]').parentElement, "active", true);
} }
})(); })();
// Google analytics // Google analytics
// For demo site (http://[www.]plyr.io) only // For demo site (http://[www.]plyr.io) only
if(document.domain.indexOf('plyr.io') > -1) { if (document.domain.indexOf("plyr.io") > -1) {
(function(i,s,o,g,r,a,m){i.GoogleAnalyticsObject=r;i[r]=i[r]||function(){ (function(i, s, o, g, r, a, m) {
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), i.GoogleAnalyticsObject = r;
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) (i[r] =
})(window,document,'script','//www.google-analytics.com/analytics.js','ga'); i[r] ||
ga('create', 'UA-40881672-11', 'auto'); function() {
ga('send', 'pageview'); (i[r].q = i[r].q || []).push(arguments);
}),
(i[r].l = 1 * new Date());
(a = s.createElement(o)), (m = s.getElementsByTagName(o)[0]);
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m);
})(window, document, "script", "//www.google-analytics.com/analytics.js", "ga");
ga("create", "UA-40881672-11", "auto");
ga("send", "pageview");
} }

View File

@ -4,15 +4,17 @@
@font-face { @font-face {
font-family: "Avenir"; font-family: "Avenir";
src: url("//cdn.plyr.io/fonts/avenir-medium.woff2") format("woff2"), src: url("//cdn.plyr.io/static/fonts/avenir-medium.woff2") format("woff2"),
url("//cdn.plyr.io/fonts/avenir-medium.woff") format("woff"); url("//cdn.plyr.io/static/fonts/avenir-medium.woff") format("woff");
font-style: normal; font-style: normal;
font-weight: @font-weight-base; font-weight: @font-weight-base;
font-display: swap;
} }
@font-face { @font-face {
font-family: "Avenir"; font-family: "Avenir";
src: url("//cdn.plyr.io/fonts/avenir-bold.woff2") format("woff2"), src: url("//cdn.plyr.io/static/fonts/avenir-bold.woff2") format("woff2"),
url("//cdn.plyr.io/fonts/avenir-bold.woff") format("woff"); url("//cdn.plyr.io/static/fonts/avenir-bold.woff") format("woff");
font-style: normal; font-style: normal;
font-weight: @font-weight-bold; font-weight: @font-weight-bold;
} font-display: swap;
}

View File

@ -77,20 +77,20 @@ function loadJSON(path) {
// Create a file from a string // Create a file from a string
// http://stackoverflow.com/questions/23230569/how-do-you-create-a-file-from-a-string-in-gulp // http://stackoverflow.com/questions/23230569/how-do-you-create-a-file-from-a-string-in-gulp
function createFile(filename, string) { function createFile(filename, string) {
var src = require('stream').Readable({ var src = require('stream').Readable({
objectMode: true objectMode: true
}); });
src._read = function () { src._read = function () {
this.push(new gutil.File({ this.push(new gutil.File({
cwd: "", cwd: "",
base: "", base: "",
path: filename, path: filename,
contents: new Buffer(string), contents: new Buffer(string),
// stats also required for some functions // stats also required for some functions
// https://nodejs.org/api/fs.html#fs_class_fs_stats // https://nodejs.org/api/fs.html#fs_class_fs_stats
stat: { stat: {
size: string.length size: string.length
} }
})); }));
this.push(null); this.push(null);
} }

View File

@ -1,51 +1,43 @@
{ {
"name": "plyr", "name": "plyr",
"version": "2.0.13", "version": "2.0.16",
"description": "A simple, accessible and customizable HTML5, YouTube and Vimeo media player", "description": "A simple, accessible and customizable HTML5, YouTube and Vimeo media player",
"homepage": "http://plyr.io", "homepage": "http://plyr.io",
"main": "src/js/plyr.js", "main": "src/js/plyr.js",
"dependencies": {}, "dependencies": {},
"devDependencies": { "devDependencies": {
"gulp": "^3.9.1", "gulp": "^3.9.1",
"gulp-autoprefixer": "^3.1.0", "gulp-autoprefixer": "^3.1.0",
"gulp-clean-css": "^2.0.6", "gulp-clean-css": "^2.0.6",
"gulp-concat": "^2.3.3", "gulp-concat": "^2.3.3",
"gulp-less": "^3.0.5", "gulp-less": "^3.0.5",
"gulp-open": "^2.0.0", "gulp-open": "^2.0.0",
"gulp-rename": "^1.2.0", "gulp-rename": "^1.2.0",
"gulp-replace": "^0.5.3", "gulp-replace": "^0.5.3",
"gulp-s3": "^0.3.0", "gulp-s3": "^0.3.0",
"gulp-sass": "^2.3.1", "gulp-sass": "^2.3.1",
"gulp-size": "^2.1.0", "gulp-size": "^2.1.0",
"gulp-svgmin": "^1.2.2", "gulp-svgmin": "^1.2.2",
"gulp-svgstore": "^5.0.5", "gulp-svgstore": "^5.0.5",
"gulp-uglify": "^1.5.3", "gulp-uglify": "^1.5.3",
"gulp-util": "^3.0.7", "gulp-util": "^3.0.7",
"run-sequence": "^1.1.5", "run-sequence": "^1.1.5",
"through2": "^2.0.1" "through2": "^2.0.1"
}, },
"keywords": [ "keywords": ["HTML5 Video", "HTML5 Audio", "Media Player", "DASH", "Shaka", "WordPress", "HLS"],
"HTML5 Video", "repository": {
"HTML5 Audio", "type": "git",
"Media Player", "url": "git://github.com/sampotts/plyr.git"
"DASH", },
"Shaka", "license": "MIT",
"WordPress", "bugs": {
"HLS" "url": "https://github.com/sampotts/plyr/issues"
], },
"repository": { "directories": {
"type": "git", "doc": "readme.md"
"url": "git://github.com/sampotts/plyr.git" },
}, "scripts": {
"license": "MIT", "test": "echo \"Error: no test specified\" && exit 1"
"bugs": { },
"url": "https://github.com/sampotts/plyr/issues" "author": "Sam Potts <sam@potts.es>"
},
"directories": {
"doc": "readme.md"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Sam Potts <sam@potts.es>"
} }

View File

@ -5,7 +5,7 @@ A simple, accessible and customizable HTML5, YouTube and Vimeo media player.
[Checkout the demo](https://plyr.io) [Checkout the demo](https://plyr.io)
[![Image of Plyr](https://cdn.selz.com/plyr/plyr_v1.8.9.png)](https://plyr.io) [![Image of Plyr](https://cdn.plyr.io/static/demo/screenshot.png)](https://plyr.io)
## Why? ## Why?
We wanted a lightweight, accessible and customizable media player that supports [*modern*](#browser-support) browsers. Sure, there are many other players out there but we wanted to keep things simple, using the right elements for the job. We wanted a lightweight, accessible and customizable media player that supports [*modern*](#browser-support) browsers. Sure, there are many other players out there but we wanted to keep things simple, using the right elements for the job.
@ -137,7 +137,7 @@ Include the `plyr.js` script before the closing `</body>` tag and then call `ply
If you want to use our CDN (provided by [Fastly](https://www.fastly.com/)) for the JavaScript, you can use the following: If you want to use our CDN (provided by [Fastly](https://www.fastly.com/)) for the JavaScript, you can use the following:
```html ```html
<script src="https://cdn.plyr.io/2.0.13/plyr.js"></script> <script src="https://cdn.plyr.io/2.0.16/plyr.js"></script>
``` ```
### CSS ### CSS
@ -150,11 +150,11 @@ Include the `plyr.css` stylsheet into your `<head>`
If you want to use our CDN (provided by [Fastly](https://www.fastly.com/)) for the default CSS, you can use the following: If you want to use our CDN (provided by [Fastly](https://www.fastly.com/)) for the default CSS, you can use the following:
```html ```html
<link rel="stylesheet" href="https://cdn.plyr.io/2.0.13/plyr.css"> <link rel="stylesheet" href="https://cdn.plyr.io/2.0.16/plyr.css">
``` ```
### SVG Sprite ### SVG Sprite
The SVG sprite is loaded automatically from our CDN (provided by [Fastly](https://www.fastly.com/)). To change this, see the [options](#options) below. For reference, the CDN hosted SVG sprite can be found at `https://cdn.plyr.io/2.0.13/plyr.svg`. The SVG sprite is loaded automatically from our CDN (provided by [Fastly](https://www.fastly.com/)). To change this, see the [options](#options) below. For reference, the CDN hosted SVG sprite can be found at `https://cdn.plyr.io/2.0.16/plyr.svg`.
## Advanced ## Advanced

File diff suppressed because it is too large Load Diff

View File

@ -9,7 +9,9 @@
// Animation // Animation
// --------------------------------------- // ---------------------------------------
@keyframes plyr-progress { @keyframes plyr-progress {
to { background-position: @plyr-progress-loading-size 0; } to {
background-position: @plyr-progress-loading-size 0;
}
} }
// Styles // Styles
@ -35,7 +37,10 @@
& when (@plyr-touch-action = true) { & when (@plyr-touch-action = true) {
// Fix 300ms delay // Fix 300ms delay
a, button, input, label { a,
button,
input,
label {
touch-action: manipulation; touch-action: manipulation;
} }
} }
@ -56,7 +61,7 @@
// Range inputs // Range inputs
// Specificity is for bootstrap compatibility // Specificity is for bootstrap compatibility
input[type='range'] { input[type="range"] {
display: block; display: block;
height: (@plyr-range-thumb-height * @plyr-range-thumb-active-scale); height: (@plyr-range-thumb-height * @plyr-range-thumb-active-scale);
width: 100%; width: 100%;
@ -137,12 +142,12 @@
} }
// Video range inputs // Video range inputs
.plyr--video input[type='range'].tab-focus:focus { .plyr--video input[type="range"].tab-focus:focus {
outline: 1px dotted fade(@plyr-video-control-color, 50%); outline: 1px dotted fade(@plyr-video-control-color, 50%);
} }
// Audio range inputs // Audio range inputs
.plyr--audio input[type='range'].tab-focus:focus { .plyr--audio input[type="range"].tab-focus:focus {
outline: 1px dotted fade(@plyr-audio-control-color, 50%); outline: 1px dotted fade(@plyr-audio-control-color, 50%);
} }
@ -221,7 +226,7 @@
width: 100%; width: 100%;
padding: (@plyr-control-spacing * 2); padding: (@plyr-control-spacing * 2);
transform: translateY(-(@plyr-control-spacing * 4)); transform: translateY(-(@plyr-control-spacing * 4));
transition: transform .3s ease; transition: transform 0.3s ease;
color: @plyr-captions-color; color: @plyr-captions-color;
font-size: @plyr-font-size-captions-base; font-size: @plyr-font-size-captions-base;
text-align: center; text-align: center;
@ -268,6 +273,11 @@
align-items: center; align-items: center;
line-height: 1; line-height: 1;
text-align: center; text-align: center;
pointer-events: none;
& > * {
pointer-events: all;
}
// Spacing // Spacing
> button, > button,
@ -298,7 +308,7 @@
background: transparent; background: transparent;
border-radius: 3px; border-radius: 3px;
cursor: pointer; cursor: pointer;
transition: background .3s ease, color .3s ease, opacity .3s ease; transition: background 0.3s ease, color 0.3s ease, opacity 0.3s ease;
color: inherit; color: inherit;
svg { svg {
@ -347,7 +357,7 @@
border-bottom-left-radius: inherit; border-bottom-left-radius: inherit;
border-bottom-right-radius: inherit; border-bottom-right-radius: inherit;
color: @plyr-video-control-color; color: @plyr-video-control-color;
transition: opacity .3s ease; transition: opacity 0.3s ease;
button { button {
// Hover and tab focus // Hover and tab focus
@ -391,7 +401,7 @@
border-radius: 100%; border-radius: 100%;
box-shadow: 0 1px 1px fade(#000, 15%); box-shadow: 0 1px 1px fade(#000, 15%);
color: @plyr-video-control-color; color: @plyr-video-control-color;
transition: all .3s ease; transition: all 0.3s ease;
svg { svg {
position: relative; position: relative;
@ -418,11 +428,11 @@
} }
// States // States
.plyr__controls [data-plyr='pause'], .plyr__controls [data-plyr="pause"],
.plyr--playing .plyr__controls [data-plyr='play'] { .plyr--playing .plyr__controls [data-plyr="play"] {
display: none; display: none;
} }
.plyr--playing .plyr__controls [data-plyr='pause'] { .plyr--playing .plyr__controls [data-plyr="pause"] {
display: inline-block; display: inline-block;
} }
@ -438,12 +448,12 @@
} }
// Some options are hidden by default // Some options are hidden by default
.plyr [data-plyr='captions'], .plyr [data-plyr="captions"],
.plyr [data-plyr='fullscreen'] { .plyr [data-plyr="fullscreen"] {
display: none; display: none;
} }
.plyr--captions-enabled [data-plyr='captions'], .plyr--captions-enabled [data-plyr="captions"],
.plyr--fullscreen-enabled [data-plyr='fullscreen'] { .plyr--fullscreen-enabled [data-plyr="fullscreen"] {
display: inline-block; display: inline-block;
} }
@ -465,13 +475,13 @@
font-size: @plyr-font-size-small; font-size: @plyr-font-size-small;
line-height: 1.3; line-height: 1.3;
transform: translate(-50%, 10px) scale(.8); transform: translate(-50%, 10px) scale(0.8);
transform-origin: 50% 100%; transform-origin: 50% 100%;
transition: transform .2s .1s ease, opacity .2s .1s ease; transition: transform 0.2s 0.1s ease, opacity 0.2s 0.1s ease;
&::before { &::before {
// Arrows // Arrows
content: ''; content: "";
position: absolute; position: absolute;
width: 0; width: 0;
height: 0; height: 0;
@ -499,7 +509,7 @@
// First tooltip // First tooltip
.plyr__controls button:first-child .plyr__tooltip { .plyr__controls button:first-child .plyr__tooltip {
left: 0; left: 0;
transform: translate(0, 10px) scale(.8); transform: translate(0, 10px) scale(0.8);
transform-origin: 0 100%; transform-origin: 0 100%;
&::before { &::before {
@ -510,7 +520,7 @@
// Last tooltip // Last tooltip
.plyr__controls button:last-child .plyr__tooltip { .plyr__controls button:last-child .plyr__tooltip {
right: 0; right: 0;
transform: translate(0, 10px) scale(.8); transform: translate(0, 10px) scale(0.8);
transform-origin: 100% 100%; transform-origin: 100% 100%;
&::before { &::before {
@ -529,7 +539,6 @@
} }
} }
// Playback progress // Playback progress
// -------------------------------------------------------------- // --------------------------------------------------------------
// <progress> element // <progress> element
@ -621,13 +630,13 @@
} }
.plyr__progress--buffer { .plyr__progress--buffer {
&::-webkit-progress-value { &::-webkit-progress-value {
transition: width .2s ease; transition: width 0.2s ease;
} }
&::-moz-progress-bar { &::-moz-progress-bar {
transition: width .2s ease; transition: width 0.2s ease;
} }
&::-ms-fill { &::-ms-fill {
transition: width .2s ease; transition: width 0.2s ease;
} }
} }
.plyr--video .plyr__progress--buffer, .plyr--video .plyr__progress--buffer,
@ -658,7 +667,8 @@
@plyr-progress-loading-bg 50%, @plyr-progress-loading-bg 50%,
@plyr-progress-loading-bg 75%, @plyr-progress-loading-bg 75%,
transparent 75%, transparent 75%,
transparent); transparent
);
color: transparent; color: transparent;
} }
.plyr--video.plyr--loading .plyr__progress--buffer { .plyr--video.plyr--loading .plyr__progress--buffer {
@ -685,7 +695,7 @@
// Add a slash in before // Add a slash in before
&::before { &::before {
content: '\2044'; content: "\2044";
margin-right: @plyr-control-spacing; margin-right: @plyr-control-spacing;
} }
} }
@ -716,21 +726,15 @@
// It's not supported to change volume using JavaScript: // It's not supported to change volume using JavaScript:
// https://developer.apple.com/library/safari/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/Device-SpecificConsiderations/Device-SpecificConsiderations.html // https://developer.apple.com/library/safari/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/Device-SpecificConsiderations/Device-SpecificConsiderations.html
.plyr--is-ios .plyr__volume, .plyr--is-ios .plyr__volume,
.plyr--is-ios [data-plyr='mute'] { .plyr--is-ios [data-plyr="mute"] {
display: none !important; display: none !important;
} }
// Fullscreen // Fullscreen
// -------------------------------------------------------------- // --------------------------------------------------------------
.plyr--fullscreen-active { .plyr--fullscreen-active {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
height: 100%; height: 100%;
width: 100%; width: 100%;
z-index: 10000000;
background: #000; background: #000;
border-radius: 0 !important; border-radius: 0 !important;
@ -745,12 +749,6 @@
// Revert overflow change // Revert overflow change
overflow: visible; overflow: visible;
} }
.plyr__controls {
position: absolute;
bottom: 0;
left: 0;
right: 0;
}
// Vimeo requires some different styling // Vimeo requires some different styling
&.plyr--vimeo .plyr__video-wrapper { &.plyr--vimeo .plyr__video-wrapper {
@ -759,3 +757,13 @@
transform: translateY(-50%); transform: translateY(-50%);
} }
} }
// Fallback for unsupported browsers
.plyr--fullscreen-fallback.plyr--fullscreen-active {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 10000000;
}

View File

@ -9,7 +9,9 @@
// Animation // Animation
// --------------------------------------- // ---------------------------------------
@keyframes plyr-progress { @keyframes plyr-progress {
to { background-position: $plyr-progress-loading-size 0; } to {
background-position: $plyr-progress-loading-size 0;
}
} }
// Styles // Styles
@ -34,10 +36,13 @@
} }
@if $plyr-touch-action == true { @if $plyr-touch-action == true {
// Fix 300ms delay // Fix 300ms delay
a, button, input, label { a,
touch-action: manipulation; button,
} input,
label {
touch-action: manipulation;
}
} }
// Focus // Focus
@ -56,7 +61,7 @@
// Range inputs // Range inputs
// Specificity is for bootstrap compatibility // Specificity is for bootstrap compatibility
input[type='range'] { input[type="range"] {
display: block; display: block;
height: ($plyr-range-thumb-height * $plyr-range-thumb-active-scale); height: ($plyr-range-thumb-height * $plyr-range-thumb-active-scale);
width: 100%; width: 100%;
@ -137,13 +142,13 @@
} }
// Video range inputs // Video range inputs
.plyr--video input[type='range'].tab-focus:focus { .plyr--video input[type="range"].tab-focus:focus {
outline: 1px dotted transparentize($plyr-video-control-color, .5); outline: 1px dotted transparentize($plyr-video-control-color, 0.5);
} }
// Audio range inputs // Audio range inputs
.plyr--audio input[type='range'].tab-focus:focus { .plyr--audio input[type="range"].tab-focus:focus {
outline: 1px dotted transparentize($plyr-audio-control-color, .5); outline: 1px dotted transparentize($plyr-audio-control-color, 0.5);
} }
// Screen reader only elements // Screen reader only elements
@ -220,7 +225,7 @@
width: 100%; width: 100%;
padding: ($plyr-control-spacing * 2); padding: ($plyr-control-spacing * 2);
transform: translateY(-($plyr-control-spacing * 6)); transform: translateY(-($plyr-control-spacing * 6));
transition: transform .3s ease; transition: transform 0.3s ease;
color: $plyr-captions-color; color: $plyr-captions-color;
font-size: $plyr-font-size-captions-base; font-size: $plyr-font-size-captions-base;
text-align: center; text-align: center;
@ -267,7 +272,12 @@
align-items: center; align-items: center;
line-height: 1; line-height: 1;
text-align: center; text-align: center;
pointer-events: none;
& > * {
pointer-events: all;
}
// Spacing // Spacing
> button, > button,
.plyr__progress, .plyr__progress,
@ -292,12 +302,12 @@
flex-shrink: 0; flex-shrink: 0;
overflow: visible; // IE11 overflow: visible; // IE11
vertical-align: middle; vertical-align: middle;
padding: ($plyr-control-spacing * .7); padding: ($plyr-control-spacing * 0.7);
border: 0; border: 0;
background: transparent; background: transparent;
border-radius: 3px; border-radius: 3px;
cursor: pointer; cursor: pointer;
transition: background .3s ease, color .3s ease, opacity .3s ease; transition: background 0.3s ease, color 0.3s ease, opacity 0.3s ease;
color: inherit; color: inherit;
svg { svg {
@ -341,11 +351,14 @@
right: 0; right: 0;
bottom: 0; bottom: 0;
padding: ($plyr-control-spacing * 5) $plyr-control-spacing $plyr-control-spacing; padding: ($plyr-control-spacing * 5) $plyr-control-spacing $plyr-control-spacing;
background: linear-gradient(transparentize($plyr-video-controls-bg, 1), transparentize($plyr-video-controls-bg, .5)); background: linear-gradient(
transparentize($plyr-video-controls-bg, 1),
transparentize($plyr-video-controls-bg, 0.5)
);
border-bottom-left-radius: inherit; border-bottom-left-radius: inherit;
border-bottom-right-radius: inherit; border-bottom-right-radius: inherit;
color: $plyr-video-control-color; color: $plyr-video-control-color;
transition: opacity .3s ease; transition: opacity 0.3s ease;
button { button {
// Hover and tab focus // Hover and tab focus
@ -387,9 +400,9 @@
background: $plyr-video-control-bg-hover; background: $plyr-video-control-bg-hover;
border: 4px solid currentColor; border: 4px solid currentColor;
border-radius: 100%; border-radius: 100%;
box-shadow: 0 1px 1px transparentize(#000, .85); box-shadow: 0 1px 1px transparentize(#000, 0.85);
color: $plyr-video-control-color; color: $plyr-video-control-color;
transition: all .3s ease; transition: all 0.3s ease;
svg { svg {
position: relative; position: relative;
@ -401,7 +414,7 @@
} }
&:focus { &:focus {
outline: 1px dotted transparentize($plyr-video-control-color, .5); outline: 1px dotted transparentize($plyr-video-control-color, 0.5);
} }
} }
.plyr .plyr__play-large { .plyr .plyr__play-large {
@ -416,11 +429,11 @@
} }
// States // States
.plyr__controls [data-plyr='pause'], .plyr__controls [data-plyr="pause"],
.plyr--playing .plyr__controls [data-plyr='play'] { .plyr--playing .plyr__controls [data-plyr="play"] {
display: none; display: none;
} }
.plyr--playing .plyr__controls [data-plyr='pause'] { .plyr--playing .plyr__controls [data-plyr="pause"] {
display: inline-block; display: inline-block;
} }
@ -436,12 +449,12 @@
} }
// Some options are hidden by default // Some options are hidden by default
.plyr [data-plyr='captions'], .plyr [data-plyr="captions"],
.plyr [data-plyr='fullscreen'] { .plyr [data-plyr="fullscreen"] {
display: none; display: none;
} }
.plyr--captions-enabled [data-plyr='captions'], .plyr--captions-enabled [data-plyr="captions"],
.plyr--fullscreen-enabled [data-plyr='fullscreen'] { .plyr--fullscreen-enabled [data-plyr="fullscreen"] {
display: inline-block; display: inline-block;
} }
@ -463,13 +476,13 @@
font-size: $plyr-font-size-small; font-size: $plyr-font-size-small;
line-height: 1.3; line-height: 1.3;
transform: translate(-50%, 10px) scale(.8); transform: translate(-50%, 10px) scale(0.8);
transform-origin: 50% 100%; transform-origin: 50% 100%;
transition: transform .2s .1s ease, opacity .2s .1s ease; transition: transform 0.2s 0.1s ease, opacity 0.2s 0.1s ease;
&::before { &::before {
// Arrows // Arrows
content: ''; content: "";
position: absolute; position: absolute;
width: 0; width: 0;
height: 0; height: 0;
@ -497,7 +510,7 @@
// First tooltip // First tooltip
.plyr__controls button:first-child .plyr__tooltip { .plyr__controls button:first-child .plyr__tooltip {
left: 0; left: 0;
transform: translate(0, 10px) scale(.8); transform: translate(0, 10px) scale(0.8);
transform-origin: 0 100%; transform-origin: 0 100%;
&::before { &::before {
@ -508,7 +521,7 @@
// Last tooltip // Last tooltip
.plyr__controls button:last-child .plyr__tooltip { .plyr__controls button:last-child .plyr__tooltip {
right: 0; right: 0;
transform: translate(0, 10px) scale(.8); transform: translate(0, 10px) scale(0.8);
transform-origin: 100% 100%; transform-origin: 100% 100%;
&::before { &::before {
@ -618,13 +631,13 @@
} }
.plyr__progress--buffer { .plyr__progress--buffer {
&::-webkit-progress-value { &::-webkit-progress-value {
transition: width .2s ease; transition: width 0.2s ease;
} }
&::-moz-progress-bar { &::-moz-progress-bar {
transition: width .2s ease; transition: width 0.2s ease;
} }
&::-ms-fill { &::-ms-fill {
transition: width .2s ease; transition: width 0.2s ease;
} }
} }
.plyr--video .plyr__progress--buffer, .plyr--video .plyr__progress--buffer,
@ -655,7 +668,8 @@
$plyr-progress-loading-bg 50%, $plyr-progress-loading-bg 50%,
$plyr-progress-loading-bg 75%, $plyr-progress-loading-bg 75%,
transparent 75%, transparent 75%,
transparent); transparent
);
color: transparent; color: transparent;
} }
.plyr--video.plyr--loading .plyr__progress--buffer { .plyr--video.plyr--loading .plyr__progress--buffer {
@ -682,7 +696,7 @@
// Add a slash in before // Add a slash in before
&::before { &::before {
content: '\2044'; content: "\2044";
margin-right: $plyr-control-spacing; margin-right: $plyr-control-spacing;
} }
} }
@ -713,21 +727,15 @@
// It's not supported to change volume using JavaScript: // It's not supported to change volume using JavaScript:
// https://developer.apple.com/library/safari/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/Device-SpecificConsiderations/Device-SpecificConsiderations.html // https://developer.apple.com/library/safari/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/Device-SpecificConsiderations/Device-SpecificConsiderations.html
.plyr--is-ios .plyr__volume, .plyr--is-ios .plyr__volume,
.plyr--is-ios [data-plyr='mute'] { .plyr--is-ios [data-plyr="mute"] {
display: none !important; display: none !important;
} }
// Fullscreen // Fullscreen
// -------------------------------------------------------------- // --------------------------------------------------------------
.plyr--fullscreen-active { .plyr--fullscreen-active {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
height: 100%; height: 100%;
width: 100%; width: 100%;
z-index: 10000000;
background: #000; background: #000;
border-radius: 0 !important; border-radius: 0 !important;
@ -742,12 +750,6 @@
// Revert overflow change // Revert overflow change
overflow: visible; overflow: visible;
} }
.plyr__controls {
position: absolute;
bottom: 0;
left: 0;
right: 0;
}
// Vimeo requires some different styling // Vimeo requires some different styling
&.plyr--vimeo .plyr__video-wrapper { &.plyr--vimeo .plyr__video-wrapper {
@ -756,3 +758,13 @@
transform: translateY(-50%); transform: translateY(-50%);
} }
} }
// Fallback for unsupported browsers
.plyr--fullscreen-fallback.plyr--fullscreen-active {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 10000000;
}