diff --git a/dist/plyr.js b/dist/plyr.js index e656ea35..f79c1ae2 100644 --- a/dist/plyr.js +++ b/dist/plyr.js @@ -1 +1 @@ -!function(e){"use strict";function t(){var e=["
","
","","","","0% played","","","0% buffered","","
",""];return a(F.controls,"restart")&&e.push(""),a(F.controls,"rewind")&&e.push(""),a(F.controls,"play")&&e.push("",""),a(F.controls,"fast-forward")&&e.push(""),a(F.controls,"current-time")&&e.push("","Current time","00:00",""),a(F.controls,"duration")&&e.push("","Duration","00:00",""),e.push("",""),a(F.controls,"mute")&&e.push("",""),a(F.controls,"volume")&&e.push("",""),a(F.controls,"captions")&&e.push("",""),a(F.controls,"fullscreen")&&e.push(""),e.push("","
"),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,t){return Array.prototype.indexOf&&-1!=e.indexOf(t)}function o(e,t,n){return e.replace(new RegExp(t.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"),"g"),n)}function i(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 l(e){for(var t=e.parentNode;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}function c(e){e.parentNode.removeChild(e)}function u(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){var s=t.split(" ");if(e instanceof NodeList)for(var a=0;an;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 x(){var e={supported:function(){try{return"localStorage"in window&&null!==window.localStorage}catch(e){return!1}}()};return e}function w(a){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])ot.captions.length-1){ot.subcount=ot.captions.length-1;break}ot.media.currentTime.toFixed(1)>=w(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 w(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=o(e,"{seektime}",F.seekTime),e=o(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),i(ot.media,e),ot.videoContainer=e}null!==ot.media.getAttribute("autoplay")&&H()}function O(){if("video"===ot.type){ot.videoContainer.insertAdjacentHTML("afterbegin","
"),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=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=7){n("Safari 7+ detected; removing track from DOM."),a=ot.media.getElementsByTagName("track");for(var u=0;ut?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 D(){d(ot.container,F.classes.playing,!ot.media.paused),d(ot.container,F.classes.stopped,ot.media.paused)}function W(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",z),document.body.style.overflow="hidden"):(y(document,"keyup",z),document.body.style.overflow="")),d(ot.container,F.classes.fullscreen.active,ot.isFullscreen),ot.isFullscreen&&d(ot.controls,F.classes.hover,!1)}function z(e){27===(e.which||e.charCode||e.keyCode)&&ot.isFullscreen&&W()}function U(e){"undefined"==typeof e&&(e=F.storage.enabled&&x().supported?window.localStorage[F.storage.key]||F.volume:F.volume),e>10&&(e=10),0>e&&(e=0),ot.media.volume=parseFloat(e/10),ot.media.muted&&e>0&&X()}function X(e){"undefined"==typeof e&&(e=!ot.media.muted),ot.media.muted=e}function _(){var e=ot.media.muted?0:10*ot.media.volume;ot.supported.full&&ot.volume&&(ot.volume.value=e),F.storage.enabled&&x().supported&&window.localStorage.setItem(F.storage.key,e),d(ot.container,F.classes.muted,0===e),ot.supported.full&&ot.buttons.mute&&(ot.buttons.mute.checked=0===e)}function J(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 $(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 Y(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 G(){var e=ot.media.duration||0;!ot.duration&&F.displayDuration&&ot.media.paused&&Y(e,ot.currentTime),ot.duration&&Y(e,ot.duration)}function Q(e){Y(ot.media.currentTime,ot.currentTime),K(e)}function Z(){for(var e=ot.media.querySelectorAll("source"),t=e.length-1;t>=0;t--)c(e[t]);ot.media.removeAttribute("src")}function et(e){if(e.src){var t=document.createElement("source");p(t,e),u(ot.media,t)}}function tt(e){if(V(),j(),Z(),"string"==typeof e)ot.media.setAttribute("src",e);else if(e.constructor===Array)for(var t in e)et(e[t]);ot.supported.full&&(Q(),D()),ot.media.load(),null!==ot.media.getAttribute("autoplay")&&H()}function nt(e){"video"===ot.type&&ot.media.setAttribute("poster",e)}function rt(){var e="IE"==ot.browser.name?"change":"input";m(ot.buttons.play,"click",function(){H(),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",j),m(ot.buttons.rewind,"click",B),m(ot.buttons.forward,"click",R),m(ot.buttons.seek,e,j),m(ot.volume,e,function(){U(this.value)}),m(ot.buttons.mute,"change",function(){X(this.checked)}),m(ot.buttons.fullscreen,"click",W),T.supportsFullScreen&&m(document,T.fullScreenEventName,W),m(ot.media,"timeupdate seeking",Q),m(ot.media,"timeupdate",f),m(ot.media,"loadedmetadata",G),m(ot.buttons.captions,"change",function(){J(this.checked)}),m(ot.media,"ended",function(){"video"===ot.type&&(ot.captionsContainer.innerHTML=""),D()}),m(ot.media,"progress",K),m(ot.media,"playing",K),m(ot.media,"volumechange",_),m(ot.media,"play pause",D),m(ot.media,"waiting canplay seeked",$),m(ot.checkboxes,"keyup",b),"video"===ot.type&&F.click&&m(ot.videoContainer,"click",function(){ot.media.paused?v(ot.buttons.play,"click"):ot.media.ended?(j(),v(ot.buttons.play,"click")):v(ot.buttons.pause,"click")}),F.fullscreen.hideControls&&m(ot.controls,"mouseenter mouseleave",function(e){d(ot.controls,F.classes.hover,"mouseenter"===e.type)})}function st(){if(!ot.init)return null;ot.container.setAttribute("class",F.selectors.container.replace(".","")),c(A(F.selectors.controls)),"video"===ot.type&&(c(A(F.selectors.captions)),l(ot.videoContainer)),ot.media.setAttribute("controls","");var e=ot.media.cloneNode(!0);ot.media.parentNode.replaceChild(e,ot.media),ot.init=!1}function at(){if(ot.init)return null;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&&G(),M(),O(),U(),q(),rt()}ot.init=!0}var ot=this;return ot.container=a,at(),ot.init?{media:ot.media,play:H,pause:V,restart:j,rewind:B,forward:R,seek:j,source:tt,poster:nt,setVolume:U,toggleMute:X,toggleCaptions:J,toggleFullscreen:W,isFullscreen:function(){return ot.isFullscreen||!1},support:function(e){return s(ot,e)},destroy:st,restore:at}:{}}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",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(){}};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 w(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 +!function(e){"use strict";function t(){var e=["
","
","","","","0% played","","","0% buffered","","
",""];return a(F.controls,"restart")&&e.push(""),a(F.controls,"rewind")&&e.push(""),a(F.controls,"play")&&e.push("",""),a(F.controls,"fast-forward")&&e.push(""),a(F.controls,"current-time")&&e.push("","Current time","00:00",""),a(F.controls,"duration")&&e.push("","Duration","00:00",""),e.push("",""),a(F.controls,"mute")&&e.push("",""),a(F.controls,"volume")&&e.push("",""),a(F.controls,"captions")&&e.push("",""),a(F.controls,"fullscreen")&&e.push(""),e.push("","
"),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,t){return Array.prototype.indexOf&&-1!=e.indexOf(t)}function o(e,t,n){return e.replace(new RegExp(t.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"),"g"),n)}function i(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 l(e){for(var t=e.parentNode;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}function c(e){e.parentNode.removeChild(e)}function u(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){var s=t.split(" ");if(e instanceof NodeList)for(var a=0;an;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 x(){var e={supported:function(){try{return"localStorage"in window&&null!==window.localStorage}catch(e){return!1}}()};return e}function w(a){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])ot.captions.length-1){ot.subcount=ot.captions.length-1;break}ot.media.currentTime.toFixed(1)>=w(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 w(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=o(e,"{seektime}",F.seekTime),e=o(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),i(ot.media,e),ot.videoContainer=e}null!==ot.media.getAttribute("autoplay")&&H()}function O(){if("video"===ot.type){ot.videoContainer.insertAdjacentHTML("afterbegin","
"),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=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=7){n("Safari 7+ detected; removing track from DOM."),a=ot.media.getElementsByTagName("track");for(var u=0;ut?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 D(){d(ot.container,F.classes.playing,!ot.media.paused),d(ot.container,F.classes.stopped,ot.media.paused)}function W(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",z),document.body.style.overflow="hidden"):(y(document,"keyup",z),document.body.style.overflow="")),d(ot.container,F.classes.fullscreen.active,ot.isFullscreen),ot.isFullscreen&&d(ot.controls,F.classes.hover,!1)}function z(e){27===(e.which||e.charCode||e.keyCode)&&ot.isFullscreen&&W()}function U(e){"undefined"==typeof e&&(e=F.storage.enabled&&x().supported?window.localStorage[F.storage.key]||F.volume:F.volume),n(e),e>10&&(e=10),0>e&&(e=0),ot.media.volume=parseFloat(e/10),ot.media.muted&&e>0&&X()}function X(e){"undefined"==typeof e&&(e=!ot.media.muted),ot.media.muted=e}function _(){var e=ot.media.muted?0:10*ot.media.volume;ot.supported.full&&ot.volume&&(ot.volume.value=e),F.storage.enabled&&x().supported&&window.localStorage.setItem(F.storage.key,e),d(ot.container,F.classes.muted,0===e),ot.supported.full&&ot.buttons.mute&&(ot.buttons.mute.checked=0===e)}function J(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 $(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 Y(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 G(){var e=ot.media.duration||0;!ot.duration&&F.displayDuration&&ot.media.paused&&Y(e,ot.currentTime),ot.duration&&Y(e,ot.duration)}function Q(e){Y(ot.media.currentTime,ot.currentTime),K(e)}function Z(){for(var e=ot.media.querySelectorAll("source"),t=e.length-1;t>=0;t--)c(e[t]);ot.media.removeAttribute("src")}function et(e){if(e.src){var t=document.createElement("source");p(t,e),u(ot.media,t)}}function tt(e){if(V(),j(),Z(),"string"==typeof e)ot.media.setAttribute("src",e);else if(e.constructor===Array)for(var t in e)et(e[t]);ot.supported.full&&(Q(),D()),ot.media.load(),null!==ot.media.getAttribute("autoplay")&&H()}function nt(e){"video"===ot.type&&ot.media.setAttribute("poster",e)}function rt(){var e="IE"==ot.browser.name?"change":"input";m(ot.buttons.play,"click",function(){H(),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",j),m(ot.buttons.rewind,"click",B),m(ot.buttons.forward,"click",R),m(ot.buttons.seek,e,j),m(ot.volume,e,function(){U(this.value)}),m(ot.buttons.mute,"change",function(){X(this.checked)}),m(ot.buttons.fullscreen,"click",W),T.supportsFullScreen&&m(document,T.fullScreenEventName,W),m(ot.media,"timeupdate seeking",Q),m(ot.media,"timeupdate",f),m(ot.media,"loadedmetadata",G),m(ot.buttons.captions,"change",function(){J(this.checked)}),m(ot.media,"ended",function(){"video"===ot.type&&(ot.captionsContainer.innerHTML=""),D()}),m(ot.media,"progress",K),m(ot.media,"playing",K),m(ot.media,"volumechange",_),m(ot.media,"play pause",D),m(ot.media,"waiting canplay seeked",$),m(ot.checkboxes,"keyup",b),"video"===ot.type&&F.click&&m(ot.videoContainer,"click",function(){ot.media.paused?v(ot.buttons.play,"click"):ot.media.ended?(j(),v(ot.buttons.play,"click")):v(ot.buttons.pause,"click")}),F.fullscreen.hideControls&&m(ot.controls,"mouseenter mouseleave",function(e){d(ot.controls,F.classes.hover,"mouseenter"===e.type)})}function st(){if(!ot.init)return null;ot.container.setAttribute("class",F.selectors.container.replace(".","")),c(A(F.selectors.controls)),"video"===ot.type&&(c(A(F.selectors.captions)),l(ot.videoContainer)),ot.media.setAttribute("controls","");var e=ot.media.cloneNode(!0);ot.media.parentNode.replaceChild(e,ot.media),ot.init=!1}function at(){if(ot.init)return null;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&&G(),M(),O(),U(),_(),q(),rt()}ot.init=!0}var ot=this;return ot.container=a,at(),ot.init?{media:ot.media,play:H,pause:V,restart:j,rewind:B,forward:R,seek:j,source:tt,poster:nt,setVolume:U,toggleMute:X,toggleCaptions:J,toggleFullscreen:W,isFullscreen:function(){return ot.isFullscreen||!1},support:function(e){return s(ot,e)},destroy:st,restore:at}:{}}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",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(){}};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 w(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.js b/docs/dist/docs.js index b478db69..ab82d8b5 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,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=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,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"==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('
'),s.b("\n"+e),s.b('
'),s.b("\n"+e),s.b(' '),s.b("\n"+e),s.b(' '),s.b("\n"+e),s.b(' '),s.b("\n"+e),s.b(" 0% played"),s.b("\n"+e),s.b(" "),s.b("\n"+e),s.b(' '),s.b("\n"+e),s.b(" 0% buffered"),s.b("\n"+e),s.b(" "),s.b("\n"+e),s.b("
"),s.b("\n"+e),s.b(' '),s.b("\n"+e),s.b(' "),s.b("\n"+e),s.b(' "),s.b("\n"+e),s.b(' "),s.b("\n"+e),s.b(' "),s.b("\n"+e),s.b(' "),s.b("\n"+e),s.b(' '),s.b("\n"+e),s.b(' Current time'),s.b("\n"+e),s.b(' 00:00'),s.b("\n"+e),s.b(" "),s.b("\n"+e),s.b(' '),s.b("\n"+e),s.b(' Duration'),s.b("\n"+e),s.b(' 00:00'),s.b("\n"+e),s.b(" "),s.b("\n"+e),s.b(" "),s.b("\n"+e),s.b(' '),s.b("\n"+e),s.b(' '),s.b("\n"+e),s.b(' "),s.b("\n"),s.b("\n"+e),s.b(' '),s.b("\n"+e),s.b(' '),s.b("\n"),s.b("\n"+e),s.b(' '),s.b("\n"+e),s.b(' "),s.b("\n"),s.b("\n"+e),s.b(' "),s.b("\n"+e),s.b(" "),s.b("\n"+e),s.b("
"),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 +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=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,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"==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('
'),s.b("\n"+e),s.b('
'),s.b("\n"+e),s.b(' '),s.b("\n"+e),s.b(' '),s.b("\n"+e),s.b(' '),s.b("\n"+e),s.b(" 0% played"),s.b("\n"+e),s.b(" "),s.b("\n"+e),s.b(' '),s.b("\n"+e),s.b(" 0% buffered"),s.b("\n"+e),s.b(" "),s.b("\n"+e),s.b("
"),s.b("\n"+e),s.b(' '),s.b("\n"+e),s.b(' "),s.b("\n"+e),s.b(' "),s.b("\n"+e),s.b(' "),s.b("\n"+e),s.b(' "),s.b("\n"+e),s.b(' "),s.b("\n"+e),s.b(' '),s.b("\n"+e),s.b(' Current time'),s.b("\n"+e),s.b(' 00:00'),s.b("\n"+e),s.b(" "),s.b("\n"+e),s.b(' '),s.b("\n"+e),s.b(' Duration'),s.b("\n"+e),s.b(' 00:00'),s.b("\n"+e),s.b(" "),s.b("\n"+e),s.b(" "),s.b("\n"+e),s.b(' '),s.b("\n"+e),s.b(' '),s.b("\n"+e),s.b(' "),s.b("\n"),s.b("\n"+e),s.b(' '),s.b("\n"+e),s.b(' '),s.b("\n"),s.b("\n"+e),s.b(' '),s.b("\n"+e),s.b(' "),s.b("\n"),s.b("\n"+e),s.b(' "),s.b("\n"+e),s.b(" "),s.b("\n"+e),s.b("
"),s.fl()},partials:{},subs:{}}),plyr.setup({debug:!0,volume:9,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/src/js/docs.js b/docs/src/js/docs.js index 18e88d90..46f20f26 100644 --- a/docs/src/js/docs.js +++ b/docs/src/js/docs.js @@ -7,6 +7,7 @@ // Setup the player plyr.setup({ debug: true, + volume: 9, title: "Video demo", html: templates.controls.render({}), captions: { diff --git a/package.json b/package.json index 21de5ef3..6c27a2f4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "plyr", - "version": "1.1.9", + "version": "1.1.10", "description": "A simple HTML5 media player using custom controls", "homepage": "http://plyr.io", "main": "gulpfile.js", diff --git a/src/js/plyr.js b/src/js/plyr.js index 2a047c39..ba3d09b2 100644 --- a/src/js/plyr.js +++ b/src/js/plyr.js @@ -1,6 +1,6 @@ // ========================================================================== // Plyr -// plyr.js v1.1.9 +// plyr.js v1.1.10 // https://github.com/selz/plyr // License: The MIT License (MIT) // ========================================================================== @@ -1156,6 +1156,8 @@ } } + _log(volume); + // Maximum is 10 if(volume > 10) { volume = 10; @@ -1624,6 +1626,7 @@ // Set volume _setVolume(); + _updateVolume(); // Setup fullscreen _setupFullscreen();