!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=t(e,document):"function"==typeof define&&define.amd?define(null,function(){t(e,document)}):e.plyr=t(e,document)}("undefined"!=typeof window?window:this,function(e,t){"use strict";function n(){var e,n,r,a=navigator.userAgent,s=navigator.appName,o=""+parseFloat(navigator.appVersion),i=parseInt(navigator.appVersion,10),l=!1,u=!1,c=!1,p=!1;return-1!==navigator.appVersion.indexOf("Windows NT")&&-1!==navigator.appVersion.indexOf("rv:11")?(l=!0,s="IE",o="11;"):-1!==(n=a.indexOf("MSIE"))?(l=!0,s="IE",o=a.substring(n+5)):-1!==(n=a.indexOf("Chrome"))?(c=!0,s="Chrome",o=a.substring(n+7)):-1!==(n=a.indexOf("Safari"))?(p=!0,s="Safari",o=a.substring(n+7),-1!==(n=a.indexOf("Version"))&&(o=a.substring(n+8))):-1!==(n=a.indexOf("Firefox"))?(u=!0,s="Firefox",o=a.substring(n+8)):(e=a.lastIndexOf(" ")+1)<(n=a.lastIndexOf("/"))&&(s=a.substring(e,n),o=a.substring(n+1),s.toLowerCase()==s.toUpperCase()&&(s=navigator.appName)),-1!==(r=o.indexOf(";"))&&(o=o.substring(0,r)),-1!==(r=o.indexOf(" "))&&(o=o.substring(0,r)),i=parseInt(""+o,10),isNaN(i)&&(o=""+parseFloat(navigator.appVersion),i=parseInt(navigator.appVersion,10)),{name:s,version:i,isIE:l,isFirefox:u,isChrome:c,isSafari:p,ios:/(iPad|iPhone|iPod)/g.test(navigator.platform),touch:"ontouchstart"in t.documentElement}}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 a(e){if(!t.querySelectorAll('script[src="'+e+'"]').length){var n=t.createElement("script");n.src=e;var r=t.getElementsByTagName("script")[0];r.parentNode.insertBefore(n,r)}}function s(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,a=e[n],s=a.parentNode,o=a.nextSibling;return r.appendChild(a),o?s.insertBefore(r,o):s.appendChild(r),r}}function l(e){for(var t=e.parentNode;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}function u(e){e&&e.parentNode.removeChild(e)}function c(e,t){e.insertBefore(t,e.firstChild)}function p(e,t){for(var n in t)e.setAttribute(n,"boolean"==typeof t[n]&&t[n]?"":t[n])}function d(e,n,r){var a=t.createElement(e);p(a,r),c(n,a)}function A(e){return e.replace(".","")}function m(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){return e?e.classList?e.classList.contains(t):new RegExp("(\\s|^)"+t+"(\\s|$)").test(e.className):!1}function y(e,n){var r=Element.prototype,a=r.matches||r.webkitMatchesSelector||r.mozMatchesSelector||r.msMatchesSelector||function(e){return-1!==[].indexOf.call(t.querySelectorAll(e),this)};return a.call(e,n)}function b(e,t,n,r){e&&h(e,t,n,!0,r)}function v(e,t,n,r){e&&h(e,t,n,!1,r)}function g(e,t,n,r,a){b(e,t,function(t){n&&n.apply(e,[t]),r.apply(e,[t])},a)}function h(e,t,n,r,a){var s=t.split(" ");if("boolean"!=typeof a&&(a=!1),e instanceof NodeList)for(var o=0;o
r;r++){var a=e[r];for(var s in a)a[s]&&a[s].constructor&&a[s].constructor===Object?(t[s]=t[s]||{},T(t[s],a[s])):t[s]=a[s]}return t}}function E(){var e={supportsFullScreen:!1,isFullScreen:function(){return!1},requestFullScreen:function(){},cancelFullScreen:function(){},fullScreenEventName:"",element:null,prefix:""},n="webkit moz o ms khtml".split(" ");if("undefined"!=typeof t.cancelFullScreen)e.supportsFullScreen=!0;else for(var r=0,a=n.length;a>r;r++){if(e.prefix=n[r],"undefined"!=typeof t[e.prefix+"CancelFullScreen"]){e.supportsFullScreen=!0;break}if("undefined"!=typeof t.msExitFullscreen&&t.msFullscreenEnabled){e.prefix="ms",e.supportsFullScreen=!0;break}}return e.supportsFullScreen&&(e.fullScreenEventName="ms"==e.prefix?"MSFullscreenChange":e.prefix+"fullscreenchange",e.isFullScreen=function(e){switch("undefined"==typeof e&&(e=t.body),this.prefix){case"":return t.fullscreenElement==e;case"moz":return t.mozFullScreenElement==e;default:return t[this.prefix+"FullscreenElement"]==e}},e.requestFullScreen=function(e){return"undefined"==typeof e&&(e=t.body),""===this.prefix?e.requestFullScreen():e[this.prefix+("ms"==this.prefix?"RequestFullscreen":"RequestFullScreen")]()},e.cancelFullScreen=function(){return""===this.prefix?t.cancelFullScreen():t[this.prefix+("ms"==this.prefix?"ExitFullscreen":"CancelFullScreen")]()},e.element=function(){return""===this.prefix?t.fullscreenElement:t[this.prefix+"FullscreenElement"]}),e}function _(){var t={supported:function(){if(!("localStorage"in e))return!1;try{e.localStorage.setItem("___test","OK");var t=e.localStorage.getItem("___test");return e.localStorage.removeItem("___test"),"OK"===t}catch(n){return!1}return!1}()};return t}function C(y,h){function T(t,n){h.debug&&e.console&&console[n?"warn":"log"](t)}function C(){return{url:h.iconUrl,external:0===h.iconUrl.indexOf("http")}}function I(){var e=[],t=C(),n=(t.external?"":t.url)+"#"+h.iconPrefix;return s(h.controls,"play-large")&&e.push('',' ',''+h.i18n.play+" "," "),e.push(''),s(h.controls,"restart")&&e.push('
',' ',''+h.i18n.restart+" "," "),s(h.controls,"rewind")&&e.push('
',' ',''+h.i18n.rewind+" "," "),s(h.controls,"play")&&e.push('
',' ',''+h.i18n.play+" "," ",'
',' ',''+h.i18n.pause+" "," "),s(h.controls,"fast-forward")&&e.push('
',' ',''+h.i18n.forward+" "," "),s(h.controls,"progress")&&(e.push('
','Seek ',' ',' ','',"0 % "+h.i18n.buffered," "),h.tooltips.seek&&e.push('00:00 '),e.push(" ")),s(h.controls,"current-time")&&e.push('
',''+h.i18n.currentTime+" ",'00:00 '," "),s(h.controls,"duration")&&e.push('
',''+h.i18n.duration+" ",'00:00 '," "),s(h.controls,"mute")&&e.push('
',' ',' ',''+h.i18n.toggleMute+" "," "),s(h.controls,"volume")&&e.push('
',''+h.i18n.volume+" ",' ',' '," "),s(h.controls,"captions")&&e.push('
',' ',' ',''+h.i18n.toggleCaptions+" "," "),s(h.controls,"fullscreen")&&e.push('
',' ',' ',''+h.i18n.toggleFullscreen+" "," "),e.push("
"),e.join("")}function P(){if(Be.supported.full&&("audio"!=Be.type||h.fullscreen.allowAudio)&&h.fullscreen.enabled){var e=M.supportsFullScreen;e||h.fullscreen.fallback&&!G()?(T((e?"Native":"Fallback")+" fullscreen enabled"),m(Be.container,h.classes.fullscreen.enabled,!0)):T("Fullscreen not supported and fallback disabled"),w(Be.buttons.fullscreen,!1),W()}}function R(){if("video"===Be.type){V(h.selectors.captions)||Be.videoContainer.insertAdjacentHTML("afterbegin",'
'),Be.usingTextTracks=!1,Be.media.textTracks&&(Be.usingTextTracks=!0);for(var e,t="",n=Be.media.childNodes,r=0;r=10||Be.browser.isFirefox&&Be.browser.version>=31)&&(T("Detected browser with known TextTrack issues - using manual fallback"),Be.usingTextTracks=!1),Be.usingTextTracks){T("TextTracks supported");for(var o=0;o ");for(var r=0;rBe.captions.length-1){Be.subcount=Be.captions.length-1;break}Be.media.currentTime.toFixed(1)>=n(Be.captions[Be.subcount][0])&&Be.media.currentTime.toFixed(1)<=r(Be.captions[Be.subcount][0])?(Be.currentCaption=Be.captions[Be.subcount][1],L(Be.currentCaption)):L()}}function O(){Be.buttons.captions&&(m(Be.container,h.classes.captions.enabled,!0),h.captions.defaultActive&&(m(Be.container,h.classes.captions.active,!0),w(Be.buttons.captions,!0)))}function H(e){return Be.container.querySelectorAll(e)}function V(e){return H(e)[0]}function G(){try{return e.self!==e.top}catch(t){return!0}}function W(){function e(e){9===e.which&&Be.isFullscreen&&(e.target!==r||e.shiftKey?e.target===n&&e.shiftKey&&(e.preventDefault(),r.focus()):(e.preventDefault(),n.focus()))}var t=H("input:not([disabled]), button:not([disabled])"),n=t[0],r=t[t.length-1];b(Be.container,"keydown",e)}function Y(e,t){if("string"==typeof t)d(e,Be.media,{src:t});else if(t.constructor===Array)for(var n=t.length-1;n>=0;n--)d(e,Be.media,t[n])}function q(){if(h.loadSprite){var e=C(),n=e.external;n||Be.browser.isIE?(T("AJAX loading external SVG sprite"+(Be.browser.isIE?" (due to IE)":"")),S(e.url,"sprite-plyr")):T("Sprite will be used as external resource directly")}var r=h.html;T("Injecting custom controls"),r||(r=I()),r=o(r,"{seektime}",h.seekTime),r=o(r,"{id}",Math.floor(1e4*Math.random()));var a;if(null!==h.selectors.controls.container&&(a=h.selectors.controls.container,"string"==typeof selector&&(a=t.querySelector(a))),a instanceof HTMLElement||(a=Be.container),a.insertAdjacentHTML("beforeend",r),h.tooltips.controls)for(var s=H([h.selectors.controls.wrapper," ",h.selectors.labels," .",h.classes.hidden].join("")),i=s.length-1;i>=0;i--){var l=s[i];m(l,h.classes.hidden,!1),m(l,h.classes.tooltip,!0)}}function X(){try{return Be.controls=V(h.selectors.controls.wrapper),Be.buttons={},Be.buttons.seek=V(h.selectors.buttons.seek),Be.buttons.play=H(h.selectors.buttons.play),Be.buttons.pause=V(h.selectors.buttons.pause),Be.buttons.restart=V(h.selectors.buttons.restart),Be.buttons.rewind=V(h.selectors.buttons.rewind),Be.buttons.forward=V(h.selectors.buttons.forward),Be.buttons.fullscreen=V(h.selectors.buttons.fullscreen),Be.buttons.mute=V(h.selectors.buttons.mute),Be.buttons.captions=V(h.selectors.buttons.captions),Be.progress={},Be.progress.container=V(h.selectors.progress.container),Be.progress.buffer={},Be.progress.buffer.bar=V(h.selectors.progress.buffer),Be.progress.buffer.text=Be.progress.buffer.bar&&Be.progress.buffer.bar.getElementsByTagName("span")[0],Be.progress.played=V(h.selectors.progress.played),Be.progress.tooltip=Be.progress.container&&Be.progress.container.querySelector("."+h.classes.tooltip),Be.volume={},Be.volume.input=V(h.selectors.volume.input),Be.volume.display=V(h.selectors.volume.display),Be.duration=V(h.selectors.duration),Be.currentTime=V(h.selectors.currentTime),Be.seekTime=H(h.selectors.seekTime),!0}catch(e){return T("It looks like there is a problem with your controls html",!0),z(!0),!1}}function j(){m(Be.container,h.selectors.container.replace(".",""),Be.supported.full)}function z(e){e?Be.media.setAttribute("controls",""):Be.media.removeAttribute("controls")}function D(e){var t=h.i18n.play;if("undefined"!=typeof h.title&&h.title.length&&(t+=", "+h.title),Be.supported.full&&Be.buttons.play)for(var n=Be.buttons.play.length-1;n>=0;n--)Be.buttons.play[n].setAttribute("aria-label",t);e instanceof HTMLElement&&e.setAttribute("title",h.i18n.frameTitle.replace("{title}",h.title))}function Q(){if(!Be.media)return T("No audio or video element found",!0),!1;if(Be.supported.full&&(m(Be.container,h.classes.type.replace("{0}",Be.type),!0),s(h.types.embed,Be.type)&&m(Be.container,h.classes.type.replace("{0}","video"),!0),m(Be.container,h.classes.stopped,h.autoplay),m(Be.container,h.classes.isIos,Be.browser.ios),m(Be.container,h.classes.isTouch,Be.browser.touch),"video"===Be.type)){var e=t.createElement("div");e.setAttribute("class",h.classes.videoWrapper),i(Be.media,e),Be.videoContainer=e}s(h.types.embed,Be.type)&&(U(),Be.embedId=null)}function U(){for(var n=t.createElement("div"),r=Be.embedId,s=Be.type+"-"+Math.floor(1e4*Math.random()),o=H('[id^="'+Be.type+'-"]'),i=o.length-1;i>=0;i--)u(o[i]);if(m(Be.media,h.classes.videoWrapper,!0),m(Be.media,h.classes.embedWrapper,!0),"youtube"===Be.type)Be.media.appendChild(n),n.setAttribute("id",s),"object"==typeof YT?$(r,n):(a(h.urls.youtube.api),e.onYouTubeReadyCallbacks=e.onYouTubeReadyCallbacks||[],e.onYouTubeReadyCallbacks.push(function(){$(r,n)}),e.onYouTubeIframeAPIReady=function(){e.onYouTubeReadyCallbacks.forEach(function(e){e()})});else if("vimeo"===Be.type){var l=t.createElement("iframe");l.loaded=!1,b(l,"load",function(){l.loaded=!0}),p(l,{src:"https://player.vimeo.com/video/"+r+"?player_id="+s+"&api=1&badge=0&byline=0&portrait=0&title=0",id:s,allowfullscreen:"",frameborder:0}),Be.supported.full?(n.appendChild(l),Be.media.appendChild(n)):Be.media.appendChild(l),"$f"in e||a(h.urls.vimeo.api);var c=e.setInterval(function(){"$f"in e&&l.loaded&&(e.clearInterval(c),J.call(l))},50)}else if("soundcloud"===Be.type){var d=t.createElement("iframe");d.loaded=!1,b(d,"load",function(){d.loaded=!0}),p(d,{src:"https://w.soundcloud.com/player/?url=https://api.soundcloud.com/tracks/"+r,id:s}),n.appendChild(d),Be.media.appendChild(n),e.SC||a(h.urls.soundcloud.api);var A=e.setInterval(function(){e.SC&&d.loaded&&(e.clearInterval(A),K.call(d))},50)}}function Z(){Be.container.plyr.embed=Be.embed,Le(),D(V("iframe"))}function $(t,n){"timer"in Be||(Be.timer={}),Be.embed=new YT.Player(n.id,{videoId:t,playerVars:{autoplay:h.autoplay?1:0,controls:Be.supported.full?0:1,rel:0,showinfo:0,iv_load_policy:3,cc_load_policy:h.captions.defaultActive?1:0,cc_lang_pref:"en",wmode:"transparent",modestbranding:1,disablekb:1,origin:"*"},events:{onError:function(e){k(Be.container,"error",!0,{code:e.data,embed:e.target})},onReady:function(t){var n=t.target;Be.media.play=function(){n.playVideo(),Be.media.paused=!1},Be.media.pause=function(){n.pauseVideo(),Be.media.paused=!0},Be.media.stop=function(){n.stopVideo(),Be.media.paused=!0},Be.media.duration=n.getDuration(),Be.media.paused=!0,Be.media.currentTime=n.getCurrentTime(),Be.media.muted=n.isMuted(),h.title=n.getVideoData().title,k(Be.media,"timeupdate"),e.clearInterval(Be.timer.buffering),Be.timer.buffering=e.setInterval(function(){Be.media.buffered=n.getVideoLoadedFraction(),k(Be.media,"progress"),1===Be.media.buffered&&(e.clearInterval(Be.timer.buffering),k(Be.media,"canplaythrough"))},200),Z(),we()},onStateChange:function(t){var n=t.target;switch(e.clearInterval(Be.timer.playing),t.data){case 0:Be.media.paused=!0,k(Be.media,"ended");break;case 1:Be.media.paused=!1,Be.media.seeking=!1,k(Be.media,"play"),k(Be.media,"playing"),Be.timer.playing=e.setInterval(function(){Be.media.currentTime=n.getCurrentTime(),k(Be.media,"timeupdate")},100);break;case 2:Be.media.paused=!0,k(Be.media,"pause")}k(Be.container,"statechange",!1,{code:t.data})}}})}function J(){Be.embed=$f(this),Be.embed.addEvent("ready",function(){Be.media.play=function(){Be.embed.api("play"),Be.media.paused=!1},Be.media.pause=function(){Be.embed.api("pause"),Be.media.paused=!0},Be.media.stop=function(){Be.embed.api("stop"),Be.media.paused=!0},Be.media.paused=!0,Be.media.currentTime=0,Z(),Be.embed.api("getCurrentTime",function(e){Be.media.currentTime=e,k(Be.media,"timeupdate")}),Be.embed.api("getDuration",function(e){Be.media.duration=e,we()}),Be.embed.addEvent("play",function(){Be.media.paused=!1,k(Be.media,"play"),k(Be.media,"playing")}),Be.embed.addEvent("pause",function(){Be.media.paused=!0,k(Be.media,"pause")}),Be.embed.addEvent("playProgress",function(e){Be.media.seeking=!1,Be.media.currentTime=e.seconds,k(Be.media,"timeupdate")}),Be.embed.addEvent("loadProgress",function(e){Be.media.buffered=e.percent,k(Be.media,"progress"),1===parseInt(e.percent)&&k(Be.media,"canplaythrough")}),Be.embed.addEvent("finish",function(){Be.media.paused=!0,k(Be.media,"ended")}),h.autoplay&&Be.embed.api("play")})}function K(){Be.embed=e.SC.Widget(this),Be.embed.bind(e.SC.Widget.Events.READY,function(){Be.media.play=function(){Be.embed.play(),Be.media.paused=!1},Be.media.pause=function(){Be.embed.pause(),Be.media.paused=!0},Be.media.stop=function(){Be.embed.seekTo(0),Be.embed.pause(),Be.media.paused=!0},Be.media.paused=!0,Be.media.currentTime=0,Z(),Be.embed.getPosition(function(e){Be.media.currentTime=e,k(Be.media,"timeupdate")}),Be.embed.getDuration(function(e){Be.media.duration=e/1e3,we()}),Be.embed.bind(e.SC.Widget.Events.PLAY,function(){Be.media.paused=!1,k(Be.media,"play"),k(Be.media,"playing")}),Be.embed.bind(e.SC.Widget.Events.PAUSE,function(){Be.media.paused=!0,k(Be.media,"pause")}),Be.embed.bind(e.SC.Widget.Events.PLAY_PROGRESS,function(e){Be.media.seeking=!1,Be.media.currentTime=e.currentPosition/1e3,k(Be.media,"timeupdate")}),Be.embed.bind(e.SC.Widget.Events.LOAD_PROGRESS,function(e){Be.media.buffered=e.loadProgress,k(Be.media,"progress"),1===parseInt(e.loadProgress)&&k(Be.media,"canplaythrough")}),Be.embed.bind(e.SC.Widget.Events.FINISH,function(){Be.media.paused=!0,k(Be.media,"ended")}),h.autoplay&&Be.embed.play()})}function ee(){"play"in Be.media&&Be.media.play()}function te(){"pause"in Be.media&&Be.media.pause()}function ne(e){e===!0?ee():e===!1?te():Be.media[Be.media.paused?"play":"pause"]()}function re(e){"number"!=typeof e&&(e=h.seekTime),se(Be.media.currentTime-e)}function ae(e){"number"!=typeof e&&(e=h.seekTime),se(Be.media.currentTime+e)}function se(e){var t=0,n=Be.media.paused,r=oe();"number"==typeof e?t=e:"object"!=typeof e||"input"!==e.type&&"change"!==e.type||(t=e.target.value/e.target.max*r),0>t?t=0:t>r&&(t=r),Te(t);try{Be.media.currentTime=t.toFixed(4)}catch(a){}if(s(h.types.embed,Be.type)){switch(Be.type){case"youtube":Be.embed.seekTo(t);break;case"vimeo":Be.embed.api("seekTo",t.toFixed(0));break;case"soundcloud":Be.embed.seekTo(1e3*t)}n&&te(),k(Be.media,"timeupdate"),Be.media.seeking=!0}T("Seeking to "+Be.media.currentTime+" seconds"),B(t)}function oe(){var e=parseInt(h.duration),t=0;return null===Be.media.duration||isNaN(Be.media.duration)||(t=Be.media.duration),isNaN(e)?t:e}function ie(){m(Be.container,h.classes.playing,!Be.media.paused),m(Be.container,h.classes.stopped,Be.media.paused),_e(Be.media.paused)}function le(){N={x:e.pageXOffset||0,y:e.pageYOffset||0}}function ue(){e.scrollTo(N.x,N.y)}function ce(e){var n=M.supportsFullScreen;e&&e.type===M.fullScreenEventName?Be.isFullscreen=M.isFullScreen(Be.container):n?(M.isFullScreen(Be.container)?M.cancelFullScreen():(le(),M.requestFullScreen(Be.container)),Be.isFullscreen=M.isFullScreen(Be.container)):(Be.isFullscreen=!Be.isFullscreen,Be.isFullscreen?(b(t,"keyup",pe),t.body.style.overflow="hidden"):(v(t,"keyup",pe),t.body.style.overflow="")),m(Be.container,h.classes.fullscreen.active,Be.isFullscreen),Be.isFullscreen?Be.container.setAttribute("tabindex","-1"):Be.container.removeAttribute("tabindex"),W(Be.isFullscreen),w(Be.buttons.fullscreen,Be.isFullscreen),k(Be.container,Be.isFullscreen?"enterfullscreen":"exitfullscreen",!0),!Be.isFullscreen&&n&&ue()}function pe(e){27===(e.which||e.charCode||e.keyCode)&&Be.isFullscreen&&ce()}function de(e){if("boolean"!=typeof e&&(e=!Be.media.muted),w(Be.buttons.mute,e),Be.media.muted=e,0===Be.media.volume&&Ae(h.volume),s(h.types.embed,Be.type)){switch(Be.type){case"youtube":Be.embed[Be.media.muted?"mute":"unMute"]();break;case"vimeo":Be.embed.api("setVolume",Be.media.muted?0:parseFloat(h.volume/h.volumeMax));break;case"soundcloud":Be.embed.setVolume(Be.media.muted?0:parseFloat(h.volume/h.volumeMax))}k(Be.media,"volumechange")}}function Ae(t){var n=h.volumeMax,r=h.volumeMin;if("undefined"==typeof t&&(t=h.volume,h.storage.enabled&&_().supported&&(t=e.localStorage.getItem(h.storage.key),e.localStorage.removeItem("plyr-volume"))),(null===t||isNaN(t))&&(t=h.volume),t>n&&(t=n),r>t&&(t=r),Be.media.volume=parseFloat(t/n),Be.volume.display&&(Be.volume.display.value=t),s(h.types.embed,Be.type)){switch(Be.type){case"youtube":Be.embed.setVolume(100*Be.media.volume);break;case"vimeo":Be.embed.api("setVolume",Be.media.volume);break;case"soundcloud":Be.embed.setVolume(Be.media.volume)}k(Be.media,"volumechange")}Be.media.muted&&t>0&&de()}function me(){var e=Be.media.muted?0:Be.media.volume*h.volumeMax;Ae(e+h.volumeStep/5)}function fe(){var e=Be.media.muted?0:Be.media.volume*h.volumeMax;Ae(e-h.volumeStep/5)}function ye(){var t=Be.media.muted?0:Be.media.volume*h.volumeMax;Be.supported.full&&(Be.volume.input&&(Be.volume.input.value=t),Be.volume.display&&(Be.volume.display.value=t)),h.storage.enabled&&_().supported&&!isNaN(t)&&e.localStorage.setItem(h.storage.key,t),m(Be.container,h.classes.muted,0===t),Be.supported.full&&Be.buttons.mute&&w(Be.buttons.mute,0===t)}function be(e){Be.supported.full&&Be.buttons.captions&&("boolean"!=typeof e&&(e=-1===Be.container.className.indexOf(h.classes.captions.active)),Be.captionsEnabled=e,w(Be.buttons.captions,Be.captionsEnabled),m(Be.container,h.classes.captions.active,Be.captionsEnabled),k(Be.container,Be.captionsEnabled?"captionsenabled":"captionsdisabled",!0))}function ve(e){var t="waiting"===e.type;clearTimeout(Be.timers.loading),Be.timers.loading=setTimeout(function(){m(Be.container,h.classes.loading,t)},t?250:0)}function ge(e){if(Be.supported.full){var t=Be.progress.played,n=0,r=oe();if(e)switch(e.type){case"timeupdate":case"seeking":n=x(Be.media.currentTime,r),"timeupdate"==e.type&&Be.buttons.seek&&(Be.buttons.seek.value=n);break;case"playing":case"progress":t=Be.progress.buffer,n=function(){var e=Be.media.buffered;return e&&e.length?x(e.end(0),r):"number"==typeof e?100*e:0}()}he(t,n)}}function he(e,t){if(Be.supported.full){if("undefined"==typeof t&&(t=0),"undefined"==typeof e){if(!Be.progress||!Be.progress.buffer)return;e=Be.progress.buffer}e instanceof HTMLElement?e.value=t:e&&(e.bar&&(e.bar.value=t),e.text&&(e.text.innerHTML=t))}}function ke(e,t){if(t){isNaN(e)&&(e=0),Be.secs=parseInt(e%60),Be.mins=parseInt(e/60%60),Be.hours=parseInt(e/60/60%60);var n=parseInt(oe()/60/60%60)>0;Be.secs=("0"+Be.secs).slice(-2),Be.mins=("0"+Be.mins).slice(-2),t.innerHTML=(n?Be.hours+":":"")+Be.mins+":"+Be.secs}}function we(){if(Be.supported.full){var e=oe()||0;!Be.duration&&h.displayDuration&&Be.media.paused&&ke(e,Be.currentTime),Be.duration&&ke(e,Be.duration),Ee()}}function xe(e){ke(Be.media.currentTime,Be.currentTime),e&&"timeupdate"==e.type&&Be.media.seeking||ge(e)}function Te(e){"number"!=typeof e&&(e=0);var t=oe(),n=x(e,t);Be.progress&&Be.progress.played&&(Be.progress.played.value=n),Be.buttons&&Be.buttons.seek&&(Be.buttons.seek.value=n)}function Ee(e){var t=oe();if(h.tooltips.seek&&Be.progress.container&&0!==t){var n=Be.progress.container.getBoundingClientRect(),r=0,a=h.classes.tooltip+"--visible";if(e)r=100/n.width*(e.pageX-n.left);else{if(!f(Be.progress.tooltip,a))return;r=Be.progress.tooltip.style.left.replace("%","")}0>r?r=0:r>100&&(r=100),ke(t/100*r,Be.progress.tooltip),Be.progress.tooltip.style.left=r+"%",e&&s(["mouseenter","mouseleave"],e.type)&&m(Be.progress.tooltip,a,"mouseenter"===e.type)}}function _e(t){if(h.hideControls&&"audio"!==Be.type){var n=0,r=!1,a=t;if("boolean"!=typeof t&&(t&&t.type?(r="enterfullscreen"===t.type,a=s(["mousemove","mouseenter","focus"],t.type),"mousemove"===t.type&&(n=2e3),"focus"===t.type&&(n=3e3)):a=!f(Be.container,h.classes.hideControls)),e.clearTimeout(Be.timers.hover),a||Be.media.paused){if(m(Be.container,h.classes.hideControls,!1),Be.media.paused)return;Be.browser.touch&&(n=3e3)}a&&Be.media.paused||(Be.timers.hover=e.setTimeout(function(){Be.controls.active&&!r||m(Be.container,h.classes.hideControls,!0)},n))}}function Ce(e){if("undefined"!=typeof e)return void Se(e);var t;switch(Be.type){case"youtube":t=Be.embed.getVideoUrl();break;case"vimeo":Be.embed.api("getVideoUrl",function(e){t=e});break;case"soundcloud":Be.embed.getCurrentSound(function(e){t=e.permalink_url});break;default:t=Be.media.currentSrc}return t||""}function Se(n){if(!("undefined"!=typeof n&&"sources"in n&&n.sources.length))return void T("Invalid source format",!0);if(te(),Te(),he(),Ne(),"youtube"===Be.type?(Be.embed.destroy(),e.clearInterval(Be.timer.buffering),e.clearInterval(Be.timer.playing)):"video"===Be.type&&Be.videoContainer&&u(Be.videoContainer),Be.embed=null,u(Be.media),"type"in n&&(Be.type=n.type,"video"===Be.type)){var r=n.sources[0];"type"in r&&s(h.types.embed,r.type)&&(Be.type=r.type)}switch(Be.supported=F(Be.type),Be.type){case"video":Be.media=t.createElement("video");break;case"audio":Be.media=t.createElement("audio");break;case"youtube":case"vimeo":case"soundcloud":Be.media=t.createElement("div"),Be.embedId=n.sources[0].src}c(Be.container,Be.media),"undefined"!=typeof n.autoplay&&(h.autoplay=n.autoplay),s(h.types.html5,Be.type)&&(h.crossorigin&&Be.media.setAttribute("crossorigin",""),h.autoplay&&Be.media.setAttribute("autoplay",""),"poster"in n&&Be.media.setAttribute("poster",n.poster),h.loop&&Be.media.setAttribute("loop","")),Be.container.className=Be.originalClassName,m(Be.container,h.classes.fullscreen.active,Be.isFullscreen),m(Be.container,h.classes.captions.active,Be.captionsEnabled),j(),s(h.types.html5,Be.type)&&Y("source",n.sources),Q(),s(h.types.html5,Be.type)&&("tracks"in n&&Y("track",n.tracks),Be.media.load(),Le(),we()),h.title=n.title,D(),Be.container.plyr.media=Be.media}function Fe(e){"video"===Be.type&&Be.media.setAttribute("poster",e)}function Ie(){function n(){var e=Be.media.paused;e?ee():te();var t=Be.buttons[e?"play":"pause"],n=Be.buttons[e?"pause":"play"];if(n=n&&n.length>1?n[n.length-1]:n[0]){var r=f(t,h.classes.tabFocus);setTimeout(function(){n.focus(),r&&(m(t,h.classes.tabFocus,!1),m(n,h.classes.tabFocus,!0))},100)}}function r(){var e=t.activeElement;e&&e!=t.body?t.querySelector&&(e=t.querySelector(":focus")):e=null;for(var n in Be.buttons){var r=Be.buttons[n];if(r instanceof NodeList)for(var a=0;a0)&&(t?fe():me()),(e.deltaY>0||e.deltaX<0)&&(t?me():fe())})}function Me(){if(b(Be.media,"timeupdate seeking",xe),b(Be.media,"timeupdate",B),b(Be.media,"durationchange loadedmetadata",we),b(Be.media,"ended",function(){"video"===Be.type&&L(),ie(),se(0),we(),"video"===Be.type&&h.showPosterOnEnd&&Be.media.load()}),b(Be.media,"progress playing",ge),b(Be.media,"volumechange",ye),b(Be.media,"play pause",ie),b(Be.media,"waiting canplay seeked",ve),h.clickToPlay&&"audio"!==Be.type){var e=V("."+h.classes.videoWrapper);if(!e)return;e.style.cursor="pointer",b(e,"click",function(){return Be.browser.touch&&!Be.media.paused?void _e(!0):void(Be.media.paused?ee():Be.media.ended?(se(),ee()):te())})}h.disableContextMenu&&b(Be.media,"contextmenu",function(e){e.preventDefault()}),b(Be.media,h.events.join(" "),function(e){k(Be.container,e.type,!0)})}function Ne(){if(s(h.types.html5,Be.type)){for(var e=Be.media.querySelectorAll("source"),t=0;t1)for(var c=0;c