!function(e){"use strict";function t(e,t){h.debug&&window.console&&console[t?"error":"log"](e)}function n(){var e,t,n,r=navigator.userAgent,s=navigator.appName,a=""+parseFloat(navigator.appVersion),o=parseInt(navigator.appVersion,10);return-1!==navigator.appVersion.indexOf("Windows NT")&&-1!==navigator.appVersion.indexOf("rv:11")?(s="IE",a="11;"):-1!==(t=r.indexOf("MSIE"))?(s="IE",a=r.substring(t+5)):-1!==(t=r.indexOf("Chrome"))?(s="Chrome",a=r.substring(t+7)):-1!==(t=r.indexOf("Safari"))?(s="Safari",a=r.substring(t+7),-1!==(t=r.indexOf("Version"))&&(a=r.substring(t+8))):-1!==(t=r.indexOf("Firefox"))?(s="Firefox",a=r.substring(t+8)):(e=r.lastIndexOf(" ")+1)<(t=r.lastIndexOf("/"))&&(s=r.substring(e,t),a=r.substring(t+1),s.toLowerCase()==s.toUpperCase()&&(s=navigator.appName)),-1!==(n=a.indexOf(";"))&&(a=a.substring(0,n)),-1!==(n=a.indexOf(" "))&&(a=a.substring(0,n)),o=parseInt(""+a,10),isNaN(o)&&(a=""+parseFloat(navigator.appVersion),o=parseInt(navigator.appVersion,10)),[s,o]}function r(e,t){var n=e.media;if("video"==e.type)switch(t){case"video/webm":return!(!n.canPlayType||!n.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/no/,""));case"video/mp4":return!(!n.canPlayType||!n.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"').replace(/no/,""));case"video/ogg":return!(!n.canPlayType||!n.canPlayType('video/ogg; codecs="theora"').replace(/no/,""))}else if("audio"==e.type)switch(t){case"audio/mpeg":return!(!n.canPlayType||!n.canPlayType("audio/mpeg;").replace(/no/,""));case"audio/ogg":return!(!n.canPlayType||!n.canPlayType('audio/ogg; codecs="vorbis"').replace(/no/,""));case"audio/wav":return!(!n.canPlayType||!n.canPlayType('audio/wav; codecs="1"').replace(/no/,""))}return!1}function s(e,t,n){return e.replace(new RegExp(t.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"),"g"),n)}function a(e,t){e.length||(e=[e]);for(var n=e.length-1;n>=0;n--){var r=n>0?t.cloneNode(!0):t,s=e[n],a=s.parentNode,o=s.nextSibling;r.appendChild(s),o?a.insertBefore(r,o):a.appendChild(r)}}function o(e){e.parentNode.removeChild(e)}function i(e,t){e.insertBefore(t,e.firstChild)}function l(e,t){for(var n in t)e.setAttribute(n,t[n])}function c(e,t,n){if(e)if(e.classList)e.classList[n?"add":"remove"](t);else{var r=(" "+e.className+" ").replace(/\s+/g," ").replace(" "+t+" ","");e.className=r+(n?" "+t:"")}}function u(e,t,n,r){t=t.split(" ");for(var s=0;sn;n++){if(e.prefix=t[n],"undefined"!=typeof document[e.prefix+"CancelFullScreen"]){e.supportsFullScreen=!0;break}if("undefined"!=typeof document.msExitFullscreen&&document.msFullscreenEnabled){e.prefix="ms",e.supportsFullScreen=!0;break}}return"webkit"===e.prefix&&navigator.userAgent.match(/Version\/[\d\.]+.*Safari/)&&(e.supportsFullScreen=!1),e.supportsFullScreen&&(e.fullScreenEventName="ms"==e.prefix?"MSFullscreenChange":e.prefix+"fullscreenchange",e.isFullScreen=function(){switch(this.prefix){case"":return document.fullScreen;case"webkit":return document.webkitIsFullScreen;case"ms":return null!==document.msFullscreenElement;default:return document[this.prefix+"FullScreen"]}},e.requestFullScreen=function(e){return""===this.prefix?e.requestFullScreen():e[this.prefix+("ms"==this.prefix?"RequestFullscreen":"RequestFullScreen")]("webkit"===this.prefix?e.ALLOW_KEYBOARD_INPUT:null)},e.cancelFullScreen=function(){return""===this.prefix?document.cancelFullScreen():document[this.prefix+("ms"==this.prefix?"ExitFullscreen":"CancelFullScreen")]()},e.element=function(){return""===this.prefix?document.fullscreenElement:document[this.prefix+"FullscreenElement"]}),e}function y(){var e={supported:function(){try{return"localStorage"in window&&null!==window.localStorage}catch(e){return!1}}()};return e}function v(e){function u(e){if(!Q.usingTextTracks&&"video"===Q.type){for(Q.subcount=0,e="number"==typeof e?e:Q.media.currentTime;k(Q.captions[Q.subcount][0])Q.captions.length-1){Q.subcount=Q.captions.length-1;break}Q.media.currentTime.toFixed(1)>=v(Q.captions[Q.subcount][0])&&Q.media.currentTime.toFixed(1)<=k(Q.captions[Q.subcount][0])?(Q.currentCaption=Q.captions[Q.subcount][1],Q.captionsContainer.innerHTML=Q.currentCaption):Q.captionsContainer.innerHTML=""}}function m(){c(Q.container,h.classes.captions.enabled,!0),h.captions.defaultActive&&(c(Q.container,h.classes.captions.active,!0),Q.buttons.captions.setAttribute("checked","checked"))}function v(e){var t=[];return t=e.split(" --> "),x(t[0])}function k(e){var t=[];return t=e.split(" --> "),x(t[1])}function x(e){if(null===e||void 0===e)return 0;var t,n=[],r=[];return n=e.split(","),r=n[0].split(":"),t=Math.floor(60*r[0]*60)+Math.floor(60*r[1])+Math.floor(r[2])}function w(e){return Q.container.querySelectorAll(e)}function T(e){return w(e)[0]}function S(){try{return window.self!==window.top}catch(e){return!0}}function F(){t("Injecting custom controls.");var e=h.html;e=s(e,"{seektime}",h.seekTime),e=s(e,"{id}",Q.random),Q.container.insertAdjacentHTML("beforeend",e)}function N(){try{return Q.controls=T(h.selectors.controls),Q.buttons={},Q.buttons.seek=T(h.selectors.buttons.seek),Q.buttons.play=T(h.selectors.buttons.play),Q.buttons.pause=T(h.selectors.buttons.pause),Q.buttons.restart=T(h.selectors.buttons.restart),Q.buttons.rewind=T(h.selectors.buttons.rewind),Q.buttons.forward=T(h.selectors.buttons.forward),Q.buttons.mute=T(h.selectors.buttons.mute),Q.buttons.captions=T(h.selectors.buttons.captions),Q.buttons.fullscreen=T(h.selectors.buttons.fullscreen),Q.progress={},Q.progress.container=T(h.selectors.progress.container),Q.progress.buffer={},Q.progress.buffer.bar=T(h.selectors.progress.buffer),Q.progress.buffer.text=Q.progress.buffer.bar.getElementsByTagName("span")[0],Q.progress.played={},Q.progress.played.bar=T(h.selectors.progress.played),Q.progress.played.text=Q.progress.played.bar.getElementsByTagName("span")[0],Q.volume=T(h.selectors.buttons.volume),Q.duration=T(h.selectors.duration),Q.seekTime=w(h.selectors.seekTime),!0}catch(e){return t("It looks like there's a problem with your controls html. Bailing.",!0),!1}}function C(){var e=Q.buttons.play.innerText||"Play";"undefined"!=typeof h.title&&h.title.length&&(e+=", "+h.title),Q.buttons.play.setAttribute("aria-label",e)}function E(){if(Q.media=Q.container.querySelectorAll("audio, video")[0],!Q.media)return t("No audio or video element found!",!0),!1;if(Q.media.removeAttribute("controls"),Q.type="video"==Q.media.tagName.toLowerCase()?"video":"audio",c(Q.container,h.classes[Q.type],!0),c(Q.container,h.classes.stopped,null===Q.media.getAttribute("autoplay")),"video"===Q.type){var e=document.createElement("div");e.setAttribute("class",h.classes.videoWrapper),a(Q.media,e),Q.videoContainer=e}null!==Q.media.getAttribute("autoplay")&&I()}function A(){if("video"===Q.type){Q.videoContainer.insertAdjacentHTML("afterbegin","
"),Q.captionsContainer=T(h.selectors.captions),Q.usingTextTracks=!1,Q.media.textTracks&&(Q.usingTextTracks=!0);for(var e,n="",r=Q.media.childNodes,s=0;s=31||"Safari"===Q.browserName&&Q.browserMajorVersion>=7)&&(t("Detected IE 10/11 or Firefox 31+ or Safari 7+."),Q.usingTextTracks=!1),Q.usingTextTracks){t("TextTracks supported.");for(var i=0;i=7){t("Safari 7+ detected; removing track from DOM."),a=Q.media.getElementsByTagName("track");for(var d=0;dn?n=0:n>Q.media.duration&&(n=Q.media.duration),Q.media.currentTime=n.toFixed(1),t("Seeking to "+Q.media.currentTime+" seconds"),u(n)}function j(){c(Q.container,h.classes.playing,!Q.media.paused),c(Q.container,h.classes.stopped,Q.media.paused)}function q(e){var t=g.supportsFullScreen;e&&e.type===g.fullScreenEventName?h.fullscreen.active=g.isFullScreen():t?(g.isFullScreen()?g.cancelFullScreen():g.requestFullScreen(Q.container),h.fullscreen.active=g.isFullScreen()):(h.fullscreen.active=!h.fullscreen.active,h.fullscreen.active?(p(document,"keyup",H),document.body.style.overflow="hidden"):(d(document,"keyup",H),document.body.style.overflow="")),c(Q.container,h.classes.fullscreen.active,h.fullscreen.active)}function H(e){27===(e.which||e.charCode||e.keyCode)&&h.fullscreen.active&&q()}function B(e){"undefined"==typeof e&&(e=h.storage.enabled&&y().supported?window.localStorage.plyr_volume||h.volume:h.volume),e>10&&(e=10),Q.volume.value=e,Q.media.volume=parseFloat(e/10),_(),h.storage.enabled&&y().supported&&(window.localStorage.plyr_volume=e)}function R(e){"undefined"==typeof active&&(e=!Q.media.muted,Q.buttons.mute.checked=e),Q.media.muted=e,_()}function W(e){"undefined"==typeof e&&(e=-1===Q.container.className.indexOf(h.classes.captions.active),Q.buttons.captions.checked=e),e?c(Q.container,h.classes.captions.active,!0):c(Q.container,h.classes.captions.active)}function _(){c(Q.container,h.classes.muted,0===Q.media.volume||Q.media.muted)}function D(e){var t=Q.progress.played.bar,n=Q.progress.played.text,r=0;if(e)switch(e.type){case"timeupdate":case"seeking":r=f(Q.media.currentTime,Q.media.duration),"timeupdate"==e.type&&(Q.buttons.seek.value=r);break;case"change":case"input":r=e.target.value;break;case"playing":case"progress":t=Q.progress.buffer.bar,n=Q.progress.buffer.text,r=function(){var e=Q.media.buffered;return e.length?f(e.end(0),Q.media.duration):0}()}t.value=r,n.innerHTML=r}function U(){Q.secs=parseInt(Q.media.currentTime%60),Q.mins=parseInt(Q.media.currentTime/60%60),Q.secs=("0"+Q.secs).slice(-2),Q.mins=("0"+Q.mins).slice(-2),Q.duration.innerHTML=Q.mins+":"+Q.secs}function X(e){U(),D(e)}function J(){for(var e=Q.media.querySelectorAll("source"),t=e.length-1;t>=0;t--)o(e[t]);Q.media.removeAttribute("src")}function $(e){if(e.src){var t=document.createElement("source");l(t,e),i(Q.media,t)}}function z(e){if(V(),P(),j(),J(),"string"==typeof e)Q.media.setAttribute("src",e);else if(e.constructor===Array)for(var t in e)$(e[t]);X(),Q.media.load(),null!==Q.media.getAttribute("autoplay")&&I()}function K(e){"video"===Q.type&&Q.media.setAttribute("poster",e)}function Y(){p(Q.buttons.play,"click",function(){I(),setTimeout(function(){Q.buttons.pause.focus()},100)}),p(Q.buttons.pause,"click",function(){V(),setTimeout(function(){Q.buttons.play.focus()},100)}),p(Q.buttons.restart,"click",P),p(Q.buttons.rewind,"click",L),p(Q.buttons.forward,"click",O),p(Q.volume,"change input",function(){B(this.value)}),p(Q.buttons.mute,"change",function(){R(this.checked)}),p(Q.buttons.fullscreen,"click",q),p(document,g.fullScreenEventName,q),"video"===Q.type&&h.click&&p(Q.videoContainer,"click",function(){Q.media.paused?I():Q.media.ended?(P(),I()):V()}),p(Q.media,"timeupdate seeking",X),p(Q.media,"timeupdate",u),p(Q.buttons.seek,"change input",P),p(Q.buttons.captions,"click",function(){W(this.checked)}),p(Q.media,"ended",function(){"video"===Q.type&&(Q.captionsContainer.innerHTML=""),j()}),p(Q.media,"progress",D),p(Q.media,"playing",D),p(Q.media,"volumechange",_),p(Q.media,"play pause",j)}function G(){return g=b(),Q.browserInfo=n(),Q.browserName=Q.browserInfo[0],Q.browserMajorVersion=Q.browserInfo[1],t(Q.browserName+" "+Q.browserMajorVersion),"IE"!==Q.browserName||8!==Q.browserMajorVersion&&9!==Q.browserMajorVersion?(E(),Q.random=Math.floor(1e4*Math.random()),F(),N()?(C(),A(),B(),M(),Y(),void 0):!1):(t("Browser not suppported.",!0),!1)}var Q=this;return Q.container=e,G(),{media:Q.media,play:I,pause:V,restart:P,rewind:L,forward:O,seek:P,setVolume:B,toggleMute:R,toggleCaptions:W,source:z,poster:K,support:function(e){return r(Q,e)}}}var g,h,k={enabled:!0,debug:!1,seekTime:10,volume:5,click:!0,selectors:{container:".player",controls:".player-controls",buttons:{seek:"[data-player='seek']",play:"[data-player='play']",pause:"[data-player='pause']",restart:"[data-player='restart']",rewind:"[data-player='rewind']",forward:"[data-player='fast-forward']",mute:"[data-player='mute']",volume:"[data-player='volume']",captions:"[data-player='captions']",fullscreen:"[data-player='fullscreen']"},progress:{container:".player-progress",buffer:".player-progress-buffer",played:".player-progress-played"},captions:".player-captions",duration:".player-duration"},classes:{video:"player-video",videoWrapper:"player-video-wrapper",audio:"player-audio",stopped:"stopped",playing:"playing",muted:"muted",captions:{enabled:"captions-enabled",active:"captions-active"},fullscreen:{enabled:"fullscreen-enabled",active:"fullscreen-active"}},captions:{defaultActive:!1},fullscreen:{enabled:!0,fallback:!0},storage:{enabled:!0},html:function(){return["
","
","","","","0% played","","","0% buffered","","
","","","","","","","","Time","00:00","","","","","","","","","","","","
"].join("\n")}()};e.setup=function(e){if(h=m(k,e),!h.enabled)return!1;for(var t=document.querySelectorAll(h.selectors.container),n=[],r=t.length-1;r>=0;r--){var s=t[r];"undefined"==typeof s.plyr&&(s.plyr=new v(s)),n.push(s.plyr)}return n}}(this.plyr=this.plyr||{});