Merge branch 'develop' of https://github.com/Selz/plyr into develop
# Conflicts: # dist/plyr.css # dist/plyr.js
This commit is contained in:
commit
f608317eec
2
demo/dist/demo.css
vendored
2
demo/dist/demo.css
vendored
File diff suppressed because one or more lines are too long
2
demo/dist/demo.js
vendored
2
demo/dist/demo.js
vendored
@ -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,s=arguments.length;for(i=0;s>i;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="classList",i="prototype",s=e.Element[i],o=Object,n=String[i].trim||function(){return this.replace(/^\s+|\s+$/g,"")},r=Array[i].indexOf||function(e){for(var t=0,i=this.length;i>t;t++)if(t in this&&this[t]===e)return t;return-1},a=function(e,t){this.name=e,this.code=DOMException[e],this.message=t},c=function(e,t){if(""===t)throw new a("SYNTAX_ERR","An invalid or illegal string was specified");if(/\s/.test(t))throw new a("INVALID_CHARACTER_ERR","String contains an invalid character");return r.call(e,t)},l=function(e){for(var t=n.call(e.getAttribute("class")||""),i=t?t.split(/\s+/):[],s=0,o=i.length;o>s;s++)this.push(i[s]);this._updateClassName=function(){e.setAttribute("class",this.toString())}},u=l[i]=[],d=function(){return new l(this)};if(a[i]=Error[i],u.item=function(e){return this[e]||null},u.contains=function(e){return e+="",-1!==c(this,e)},u.add=function(){var e,t=arguments,i=0,s=t.length,o=!1;do e=t[i]+"",-1===c(this,e)&&(this.push(e),o=!0);while(++i<s);o&&this._updateClassName()},u.remove=function(){var e,t,i=arguments,s=0,o=i.length,n=!1;do for(e=i[s]+"",t=c(this,e);-1!==t;)this.splice(t,1),n=!0,t=c(this,e);while(++s<o);n&&this._updateClassName()},u.toggle=function(e,t){e+="";var i=this.contains(e),s=i?t!==!0&&"remove":t!==!1&&"add";return s&&this[s](e),t===!0||t===!1?t:!i},u.toString=function(){return this.join(" ")},o.defineProperty){var p={get:d,enumerable:!0,configurable:!0};try{o.defineProperty(s,t,p)}catch(h){-2146823252===h.number&&(p.enumerable=!1,o.defineProperty(s,t,p))}}else o[i].__defineGetter__&&s.__defineGetter__(t,d)}}(self)),function(){function e(e,t,i){if(e)if(e.classList)e.classList[i?"add":"remove"](t);else{var s=(" "+e.className+" ").replace(/\s+/g," ").replace(" "+t+" ","");e.className=s+(i?" "+t:"")}}function t(t,i){if(t in n&&(i||t!==r)&&(r.length||t!==n.video)){switch(t){case n.video:s.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:s.source({type:"audio",title:"Kishi Bashi – “It All Began With A Burst”",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:s.source({type:"video",title:"View From A Blue Moon",sources:[{src:"bTqVqk7FSmY",type:"youtube"}]});break;case n.vimeo:s.source({type:"video",title:"View From A Blue Moon",sources:[{src:"143418951",type:"vimeo"}]})}r=t;for(var a=o.length-1;a>=0;a--)e(o[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},controls:["play-large","play","speed-up","progress","current-time","mute","volume","captions","settings","fullscreen"]});plyr.loadSprite("dist/demo.svg");for(var s=i[0],o=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=o.length-1;c>=0;c--)o[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,s,o,n,r){e.GoogleAnalyticsObject=o,e[o]=e[o]||function(){(e[o].q=e[o].q||[]).push(arguments)},e[o].l=1*new Date,n=t.createElement(i),r=t.getElementsByTagName(i)[0],n.async=1,n.src=s,r.parentNode.insertBefore(n,r)}(window,document,"script","//www.google-analytics.com/analytics.js","ga"),ga("create","UA-40881672-11","auto"),ga("send","pageview"));
|
||||
"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,s=arguments.length;for(i=0;i<s;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="classList",i="prototype",s=e.Element[i],o=Object,n=String[i].trim||function(){return this.replace(/^\s+|\s+$/g,"")},r=Array[i].indexOf||function(e){for(var t=0,i=this.length;t<i;t++)if(t in this&&this[t]===e)return t;return-1},a=function(e,t){this.name=e,this.code=DOMException[e],this.message=t},c=function(e,t){if(""===t)throw new a("SYNTAX_ERR","An invalid or illegal string was specified");if(/\s/.test(t))throw new a("INVALID_CHARACTER_ERR","String contains an invalid character");return r.call(e,t)},l=function(e){for(var t=n.call(e.getAttribute("class")||""),i=t?t.split(/\s+/):[],s=0,o=i.length;s<o;s++)this.push(i[s]);this._updateClassName=function(){e.setAttribute("class",this.toString())}},u=l[i]=[],d=function(){return new l(this)};if(a[i]=Error[i],u.item=function(e){return this[e]||null},u.contains=function(e){return e+="",c(this,e)!==-1},u.add=function(){var e,t=arguments,i=0,s=t.length,o=!1;do e=t[i]+"",c(this,e)===-1&&(this.push(e),o=!0);while(++i<s);o&&this._updateClassName()},u.remove=function(){var e,t,i=arguments,s=0,o=i.length,n=!1;do for(e=i[s]+"",t=c(this,e);t!==-1;)this.splice(t,1),n=!0,t=c(this,e);while(++s<o);n&&this._updateClassName()},u.toggle=function(e,t){e+="";var i=this.contains(e),s=i?t!==!0&&"remove":t!==!1&&"add";return s&&this[s](e),t===!0||t===!1?t:!i},u.toString=function(){return this.join(" ")},o.defineProperty){var p={get:d,enumerable:!0,configurable:!0};try{o.defineProperty(s,t,p)}catch(e){e.number===-2146823252&&(p.enumerable=!1,o.defineProperty(s,t,p))}}else o[i].__defineGetter__&&s.__defineGetter__(t,d)}}(self)),function(){function e(e,t,i){if(e)if(e.classList)e.classList[i?"add":"remove"](t);else{var s=(" "+e.className+" ").replace(/\s+/g," ").replace(" "+t+" ","");e.className=s+(i?" "+t:"")}}function t(t,i){if(t in n&&(i||t!==r)&&(r.length||t!==n.video)){switch(t){case n.video:s.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:s.source({type:"audio",title:"Kishi Bashi – “It All Began With A Burst”",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:s.source({type:"video",title:"View From A Blue Moon",sources:[{src:"bTqVqk7FSmY",type:"youtube"}]});break;case n.vimeo:s.source({type:"video",title:"View From A Blue Moon",sources:[{src:"143418951",type:"vimeo"}]})}r=t;for(var a=o.length-1;a>=0;a--)e(o[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},controls:["play-large","play","speed-up","progress","current-time","mute","volume","captions","settings","fullscreen"]});plyr.loadSprite("dist/demo.svg");for(var s=i[0],o=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=o.length-1;c>=0;c--)o[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,s,o,n,r){e.GoogleAnalyticsObject=o,e[o]=e[o]||function(){(e[o].q=e[o].q||[]).push(arguments)},e[o].l=1*new Date,n=t.createElement(i),r=t.getElementsByTagName(i)[0],n.async=1,n.src=s,r.parentNode.insertBefore(n,r)}(window,document,"script","//www.google-analytics.com/analytics.js","ga"),ga("create","UA-40881672-11","auto"),ga("send","pageview"));
|
2
dist/plyr.css
vendored
2
dist/plyr.css
vendored
File diff suppressed because one or more lines are too long
4
dist/plyr.js
vendored
4
dist/plyr.js
vendored
File diff suppressed because one or more lines are too long
12
package.json
12
package.json
@ -7,21 +7,21 @@
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"gulp": "^3.9.1",
|
||||
"gulp-autoprefixer": "^3.1.0",
|
||||
"gulp-clean-css": "^2.0.6",
|
||||
"gulp-autoprefixer": "^3.1.1",
|
||||
"gulp-clean-css": "^2.0.12",
|
||||
"gulp-concat": "^2.3.3",
|
||||
"gulp-less": "^3.0.5",
|
||||
"gulp-open": "^2.0.0",
|
||||
"gulp-rename": "^1.2.0",
|
||||
"gulp-replace": "^0.5.3",
|
||||
"gulp-s3": "^0.3.0",
|
||||
"gulp-sass": "^2.3.1",
|
||||
"gulp-sass": "^2.3.2",
|
||||
"gulp-size": "^2.1.0",
|
||||
"gulp-svgmin": "^1.2.2",
|
||||
"gulp-svgstore": "^5.0.5",
|
||||
"gulp-uglify": "^1.5.3",
|
||||
"gulp-svgstore": "^6.0.0",
|
||||
"gulp-uglify": "^2.0.0",
|
||||
"gulp-util": "^3.0.7",
|
||||
"run-sequence": "^1.1.5",
|
||||
"run-sequence": "^1.2.2",
|
||||
"through2": "^2.0.1"
|
||||
},
|
||||
"keywords": [
|
||||
|
219
src/js/plyr.js
219
src/js/plyr.js
@ -9,7 +9,7 @@
|
||||
|
||||
;(function(root, factory) {
|
||||
'use strict';
|
||||
/*global define,module*/
|
||||
/* global define,module */
|
||||
|
||||
if (typeof module === 'object' && typeof module.exports === 'object') {
|
||||
// Node, CommonJS-like
|
||||
@ -25,8 +25,7 @@
|
||||
'use strict';
|
||||
|
||||
// Globals
|
||||
var fullscreen,
|
||||
scroll = { x: 0, y: 0 },
|
||||
var scroll = { x: 0, y: 0 },
|
||||
|
||||
// Default config
|
||||
defaults = {
|
||||
@ -118,6 +117,10 @@
|
||||
enabled: 'plyr--fullscreen-enabled',
|
||||
active: 'plyr--fullscreen-active'
|
||||
},
|
||||
pip: {
|
||||
enabled: 'plyr--pip-enabled',
|
||||
active: 'plyr--pip-active'
|
||||
},
|
||||
tabFocus: 'tab-focus'
|
||||
},
|
||||
captions: {
|
||||
@ -191,7 +194,7 @@
|
||||
|
||||
// Credits: http://paypal.github.io/accessible-html5-video-player/
|
||||
// Unfortunately, due to mixed support, UA sniffing is required
|
||||
function _browserSniff() {
|
||||
function _getBrowser() {
|
||||
var ua = navigator.userAgent,
|
||||
name = navigator.appName,
|
||||
fullVersion = '' + parseFloat(navigator.appVersion),
|
||||
@ -270,32 +273,6 @@
|
||||
};
|
||||
}
|
||||
|
||||
// Check for mime type support against a player instance
|
||||
// Credits: http://diveintohtml5.info/everything.html
|
||||
// Related: http://www.leanbackplyr.com/test/h5mt.html
|
||||
function _supportMime(plyr, mimeType) {
|
||||
var media = plyr.media;
|
||||
|
||||
if (plyr.type === 'video') {
|
||||
// Check type
|
||||
switch (mimeType) {
|
||||
case 'video/webm': return !!(media.canPlayType && media.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/no/, ''));
|
||||
case 'video/mp4': return !!(media.canPlayType && media.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"').replace(/no/, ''));
|
||||
case 'video/ogg': return !!(media.canPlayType && media.canPlayType('video/ogg; codecs="theora"').replace(/no/, ''));
|
||||
}
|
||||
} else if (plyr.type === 'audio') {
|
||||
// Check type
|
||||
switch (mimeType) {
|
||||
case 'audio/mpeg': return !!(media.canPlayType && media.canPlayType('audio/mpeg;').replace(/no/, ''));
|
||||
case 'audio/ogg': return !!(media.canPlayType && media.canPlayType('audio/ogg; codecs="vorbis"').replace(/no/, ''));
|
||||
case 'audio/wav': return !!(media.canPlayType && media.canPlayType('audio/wav; codecs="1"').replace(/no/, ''));
|
||||
}
|
||||
}
|
||||
|
||||
// If we got this far, we're stuffed
|
||||
return false;
|
||||
}
|
||||
|
||||
// Inject a script
|
||||
function _injectScript(source) {
|
||||
if (document.querySelectorAll('script[src="' + source + '"]').length) {
|
||||
@ -587,45 +564,38 @@
|
||||
};
|
||||
|
||||
// Fullscreen API
|
||||
function _fullscreen() {
|
||||
var fullscreen = {
|
||||
supportsFullScreen: false,
|
||||
isFullScreen: function() { return false; },
|
||||
requestFullScreen: function() {},
|
||||
cancelFullScreen: function() {},
|
||||
fullScreenEventName: '',
|
||||
element: null,
|
||||
prefix: ''
|
||||
},
|
||||
browserPrefixes = 'webkit o moz ms khtml'.split(' ');
|
||||
|
||||
// Check for native support
|
||||
if (!_is.undefined(document.cancelFullScreen)) {
|
||||
fullscreen.supportsFullScreen = true;
|
||||
} else {
|
||||
// Check for fullscreen support by vendor prefix
|
||||
for (var i = 0, il = browserPrefixes.length; i < il; i++ ) {
|
||||
fullscreen.prefix = browserPrefixes[i];
|
||||
|
||||
if (!_is.undefined(document[fullscreen.prefix + 'CancelFullScreen'])) {
|
||||
fullscreen.supportsFullScreen = true;
|
||||
break;
|
||||
} else if (!_is.undefined(document.msExitFullscreen) && document.msFullscreenEnabled) {
|
||||
// Special case for MS (when isn't it?)
|
||||
fullscreen.prefix = 'ms';
|
||||
fullscreen.supportsFullScreen = true;
|
||||
break;
|
||||
}
|
||||
var _fullscreen;
|
||||
(function() {
|
||||
// Determine the prefix
|
||||
var prefix = (function() {
|
||||
if (!_is.undefined(document.cancelFullScreen)) {
|
||||
return '';
|
||||
} else {
|
||||
// Check for fullscreen support by vendor prefix
|
||||
['webkit', 'o', 'moz', 'ms', 'khtml'].forEach(function(prefix) {
|
||||
if (!_is.undefined(document[prefix + 'CancelFullScreen'])) {
|
||||
return prefix;
|
||||
} else if (!_is.undefined(document.msExitFullscreen) && document.msFullscreenEnabled) {
|
||||
// Special case for MS (when isn't it?)
|
||||
return 'ms';
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Update methods to do something useful
|
||||
if (fullscreen.supportsFullScreen) {
|
||||
// If we got this far, there's no support
|
||||
return false;
|
||||
})();
|
||||
|
||||
_fullscreen = {
|
||||
// Yet again Microsoft awesomeness,
|
||||
// Sometimes the prefix is 'ms', sometimes 'MS' to keep you on your toes
|
||||
fullscreen.fullScreenEventName = (fullscreen.prefix === 'ms' ? 'MSFullscreenChange' : fullscreen.prefix + 'fullscreenchange');
|
||||
eventType: (prefix === 'ms' ? 'MSFullscreenChange' : prefix + 'fullscreenchange'),
|
||||
|
||||
fullscreen.isFullScreen = function(element) {
|
||||
// Is an element fullscreen
|
||||
isFullScreen: function(element) {
|
||||
if (!_support.fullscreen) {
|
||||
return false;
|
||||
}
|
||||
if (_is.undefined(element)) {
|
||||
element = document.body;
|
||||
}
|
||||
@ -635,29 +605,40 @@
|
||||
case 'moz':
|
||||
return document.mozFullScreenElement === element;
|
||||
default:
|
||||
return document[this.prefix + 'FullscreenElement'] === element;
|
||||
return document[prefix + 'FullscreenElement'] === element;
|
||||
}
|
||||
},
|
||||
requestFullScreen: function(element) {
|
||||
if (!_support.fullscreen) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
fullscreen.requestFullScreen = function(element) {
|
||||
if (_is.undefined(element)) {
|
||||
element = document.body;
|
||||
}
|
||||
return (this.prefix === '') ? element.requestFullScreen() : element[this.prefix + (this.prefix === 'ms' ? 'RequestFullscreen' : 'RequestFullScreen')]();
|
||||
};
|
||||
fullscreen.cancelFullScreen = function() {
|
||||
return (this.prefix === '') ? document.cancelFullScreen() : document[this.prefix + (this.prefix === 'ms' ? 'ExitFullscreen' : 'CancelFullScreen')]();
|
||||
};
|
||||
fullscreen.element = function() {
|
||||
return (this.prefix === '') ? document.fullscreenElement : document[this.prefix + 'FullscreenElement'];
|
||||
};
|
||||
}
|
||||
return (prefix === '') ? element.requestFullScreen() : element[prefix + (prefix === 'ms' ? 'RequestFullscreen' : 'RequestFullScreen')]();
|
||||
},
|
||||
cancelFullScreen: function() {
|
||||
if (!_support.fullscreen) {
|
||||
return false;
|
||||
}
|
||||
return (prefix === '') ? document.cancelFullScreen() : document[prefix + (prefix === 'ms' ? 'ExitFullscreen' : 'CancelFullScreen')]();
|
||||
},
|
||||
element: function() {
|
||||
if (!_support.fullscreen) {
|
||||
return null;
|
||||
}
|
||||
return (prefix === '') ? document.fullscreenElement : document[prefix + 'FullscreenElement'];
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
return fullscreen;
|
||||
}
|
||||
|
||||
// Local storage
|
||||
var _storage = {
|
||||
supported: (function() {
|
||||
// Check for support
|
||||
var _support = {
|
||||
// Fullscreen support and set prefix
|
||||
fullscreen: _fullscreen.prefix !== false,
|
||||
// Local storage mode
|
||||
// We can't assume if local storage is present that we can use it
|
||||
storage: (function() {
|
||||
if (!('localStorage' in window)) {
|
||||
return false;
|
||||
}
|
||||
@ -682,7 +663,37 @@
|
||||
}
|
||||
|
||||
return false;
|
||||
})()
|
||||
})(),
|
||||
// Picture-in-picture support
|
||||
// Safari only currently
|
||||
pip: function(plyr) {
|
||||
return _is.function(plyr.media.webkitSetPresentationMode);
|
||||
},
|
||||
// Check for mime type support against a player instance
|
||||
// Credits: http://diveintohtml5.info/everything.html
|
||||
// Related: http://www.leanbackplyr.com/test/h5mt.html
|
||||
mime: function(plyr, type) {
|
||||
var media = plyr.media;
|
||||
|
||||
if (plyr.type === 'video') {
|
||||
// Check type
|
||||
switch (type) {
|
||||
case 'video/webm': return !!(media.canPlayType && media.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/no/, ''));
|
||||
case 'video/mp4': return !!(media.canPlayType && media.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"').replace(/no/, ''));
|
||||
case 'video/ogg': return !!(media.canPlayType && media.canPlayType('video/ogg; codecs="theora"').replace(/no/, ''));
|
||||
}
|
||||
} else if (plyr.type === 'audio') {
|
||||
// Check type
|
||||
switch (type) {
|
||||
case 'audio/mpeg': return !!(media.canPlayType && media.canPlayType('audio/mpeg;').replace(/no/, ''));
|
||||
case 'audio/ogg': return !!(media.canPlayType && media.canPlayType('audio/ogg; codecs="vorbis"').replace(/no/, ''));
|
||||
case 'audio/wav': return !!(media.canPlayType && media.canPlayType('audio/wav; codecs="1"').replace(/no/, ''));
|
||||
}
|
||||
}
|
||||
|
||||
// If we got this far, we're stuffed
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
// Player instance
|
||||
@ -867,8 +878,6 @@
|
||||
|
||||
// Settings button
|
||||
if (_inArray(config.controls, 'settings')) {
|
||||
|
||||
|
||||
html.push(
|
||||
'<div class="plyr__menu">',
|
||||
'<button type="button" id="plyr-settings-toggle-{id}" data-plyr="settings" aria-haspopup="true" aria-controls="plyr-settings-{id}" aria-expanded="false">',
|
||||
@ -888,7 +897,7 @@
|
||||
'</button>',
|
||||
'</li>',
|
||||
'<li>',
|
||||
'<button type="button" data-plyr="slide-speed">',
|
||||
'<button type="button" data-plyr="slide-quality">',
|
||||
config.i18n.quality + ' <span class="plyr__menu__value">Auto</span>',
|
||||
'</button>',
|
||||
'</li>',
|
||||
@ -923,7 +932,7 @@
|
||||
|
||||
if ((plyr.type !== 'audio' || config.fullscreen.allowAudio) && config.fullscreen.enabled) {
|
||||
// Check for native support
|
||||
var nativeSupport = fullscreen.supportsFullScreen;
|
||||
var nativeSupport = _support.fullscreen;
|
||||
|
||||
if (nativeSupport || (config.fullscreen.fallback && !_inFrame())) {
|
||||
_log((nativeSupport ? 'Native' : 'Fallback') + ' fullscreen enabled');
|
||||
@ -1435,7 +1444,7 @@
|
||||
plyr.storage = {};
|
||||
|
||||
// Bail if we don't have localStorage support or it's disabled
|
||||
if (!_storage.supported || !config.storage.enabled) {
|
||||
if (!_support.storage || !config.storage.enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1463,7 +1472,7 @@
|
||||
// Save a value back to local storage
|
||||
function _updateStorage(value) {
|
||||
// Bail if we don't have localStorage support or it's disabled
|
||||
if (!_storage.supported || !config.storage.enabled) {
|
||||
if (!_support.storage || !config.storage.enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1492,6 +1501,9 @@
|
||||
_toggleClass(plyr.container, config.classes.type.replace('{0}', 'video'), true);
|
||||
}
|
||||
|
||||
// Check for picture-in-picture support
|
||||
_toggleClass(plyr.container, config.classes.pip.enabled, _support.pip(plyr));
|
||||
|
||||
// If there's no autoplay attribute, assume the video is stopped and add state class
|
||||
_toggleClass(plyr.container, config.classes.stopped, config.autoplay);
|
||||
|
||||
@ -2126,27 +2138,27 @@
|
||||
// Toggle fullscreen
|
||||
function _toggleFullscreen(event) {
|
||||
// Check for native support
|
||||
var nativeSupport = fullscreen.supportsFullScreen;
|
||||
var nativeSupport = _support.fullscreen;
|
||||
|
||||
if (nativeSupport) {
|
||||
// If it's a fullscreen change event, update the UI
|
||||
if (event && event.type === fullscreen.fullScreenEventName) {
|
||||
plyr.isFullscreen = fullscreen.isFullScreen(plyr.container);
|
||||
if (event && event.type === _fullscreen.eventType) {
|
||||
plyr.isFullscreen = _fullscreen.isFullScreen(plyr.container);
|
||||
} else {
|
||||
// Else it's a user request to enter or exit
|
||||
if (!fullscreen.isFullScreen(plyr.container)) {
|
||||
if (!_fullscreen.isFullScreen(plyr.container)) {
|
||||
// Save scroll position
|
||||
_saveScrollPosition();
|
||||
|
||||
// Request full screen
|
||||
fullscreen.requestFullScreen(plyr.container);
|
||||
_fullscreen.requestFullScreen(plyr.container);
|
||||
} else {
|
||||
// Bail from fullscreen
|
||||
fullscreen.cancelFullScreen();
|
||||
_fullscreen.cancelFullScreen();
|
||||
}
|
||||
|
||||
// Check if we're actually full screen (it could fail)
|
||||
plyr.isFullscreen = fullscreen.isFullScreen(plyr.container);
|
||||
plyr.isFullscreen = _fullscreen.isFullScreen(plyr.container);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -3009,7 +3021,7 @@
|
||||
|
||||
// Escape is handle natively when in full screen
|
||||
// So we only need to worry about non native
|
||||
if (!fullscreen.supportsFullScreen && plyr.isFullscreen && code === 27) {
|
||||
if (!_support.fullscreen && plyr.isFullscreen && code === 27) {
|
||||
_toggleFullscreen();
|
||||
}
|
||||
|
||||
@ -3073,8 +3085,8 @@
|
||||
_proxyListener(plyr.buttons.fullscreen, 'click', config.listeners.fullscreen, _toggleFullscreen);
|
||||
|
||||
// Handle user exiting fullscreen by escaping etc
|
||||
if (fullscreen.supportsFullScreen) {
|
||||
_on(document, fullscreen.fullScreenEventName, _toggleFullscreen);
|
||||
if (_support.fullscreen) {
|
||||
_on(document, _fullscreen.eventType, _toggleFullscreen);
|
||||
}
|
||||
|
||||
// Captions
|
||||
@ -3330,11 +3342,8 @@
|
||||
return null;
|
||||
}
|
||||
|
||||
// Setup the fullscreen api
|
||||
fullscreen = _fullscreen();
|
||||
|
||||
// Sniff out the browser
|
||||
plyr.browser = _browserSniff();
|
||||
plyr.browser = _getBrowser();
|
||||
|
||||
// Bail if nothing to setup
|
||||
if (!_is.htmlElement(plyr.media)) {
|
||||
@ -3493,7 +3502,7 @@
|
||||
toggleFullscreen: _toggleFullscreen,
|
||||
toggleControls: _toggleControls,
|
||||
isFullscreen: function() { return plyr.isFullscreen || false; },
|
||||
support: function(mimeType) { return _supportMime(plyr, mimeType); },
|
||||
support: function(mimeType) { return _support.mime(plyr, mimeType); },
|
||||
destroy: _destroy
|
||||
};
|
||||
|
||||
@ -3564,7 +3573,7 @@
|
||||
|
||||
// Check for support
|
||||
function supported(type) {
|
||||
var browser = _browserSniff(),
|
||||
var browser = _getBrowser(),
|
||||
isOldIE = (browser.isIE && browser.version <= 9),
|
||||
isIos = browser.isIos,
|
||||
isIphone = /iPhone|iPod/i.test(navigator.userAgent),
|
||||
|
@ -30,6 +30,7 @@
|
||||
max-width: 100%;
|
||||
min-width: 200px;
|
||||
font-family: @plyr-font-family;
|
||||
font-weight: 500;
|
||||
direction: ltr;
|
||||
|
||||
& when (@plyr-border-box = true) {
|
||||
@ -239,7 +240,6 @@
|
||||
color: @plyr-captions-color;
|
||||
font-size: @plyr-font-size-captions-base;
|
||||
text-align: center;
|
||||
font-weight: 400;
|
||||
|
||||
span {
|
||||
border-radius: 2px;
|
||||
@ -521,7 +521,7 @@
|
||||
.plyr__menu__value {
|
||||
margin-left: auto;
|
||||
padding-left: 25px;
|
||||
font-weight: 400;
|
||||
font-weight: 500;
|
||||
color: fade(@plyr-menu-color, 80%);
|
||||
}
|
||||
|
||||
@ -555,6 +555,7 @@
|
||||
|
||||
color: @plyr-tooltip-color;
|
||||
font-size: @plyr-font-size-small;
|
||||
font-weight: 500;
|
||||
line-height: 1.3;
|
||||
|
||||
transform: translate(-50%, 10px) scale(.8);
|
||||
|
Loading…
x
Reference in New Issue
Block a user