From b3303347aac895c43bb38af635ffb4b8953998af Mon Sep 17 00:00:00 2001 From: Amo Wu Date: Wed, 26 Oct 2016 10:34:11 +0800 Subject: [PATCH 01/11] prevent setup quality --- src/js/plyr.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/js/plyr.js b/src/js/plyr.js index da9bb6aea..64de080bc 100644 --- a/src/js/plyr.js +++ b/src/js/plyr.js @@ -2953,6 +2953,10 @@ sources = Array.prototype.slice.call(_getElements('source')), tracks = Array.prototype.slice.call(_getElements('track')); + if (_inArray(config.controls, 'quality') === false) { + return; + } + // Pause current playback if (isPlaying) { _pause(); @@ -4081,7 +4085,6 @@ plyr.init = true; // Switch video quality - var quality = _findInQuality(plyr.storage.quality); if (quality) { _setQuality(quality); From e7c80c52cf811bb9cde688ad5a26c4c1c0d2358f Mon Sep 17 00:00:00 2001 From: Amo Wu Date: Wed, 26 Oct 2016 13:57:40 +0800 Subject: [PATCH 02/11] refactor building captions menu item --- src/js/plyr.js | 77 +++++++++++++++++++++++++++++++++++--------------- 1 file changed, 54 insertions(+), 23 deletions(-) diff --git a/src/js/plyr.js b/src/js/plyr.js index 64de080bc..766bc989c 100644 --- a/src/js/plyr.js +++ b/src/js/plyr.js @@ -978,29 +978,6 @@ '
  • ', '', - '
  • ' - ); - - var tracks = plyr.media.textTracks; - for (var i = 0; i < tracks.length; i++) { - html.push( - '
  • ', - '', - '
  • ' - ); - } - - html.push( - '
  • ', - '', '
  • ', '', '', // End of .plyr__menu__secondary @@ -1563,6 +1540,8 @@ if (_inArray(config.controls, 'captions')) { var captionMenuButton = getMenuButton('captions'); plyr.currentCaptionLabel = new DataBind(captionMenuButton, 'textContent', config.i18n.disableCaptions); + // Inject caption menu item + _buildCaptionControl(); } // Binding quality value for menu @@ -3121,6 +3100,57 @@ return sources; } + // Build caption menu items + function _buildCaptionControl() { + var i, + buttons = _getElements('li > button[data-plyr=captions]'); + + // Remove exist captions menu items + for (i=0; i ul', + ul = _getElement(query), + html = []; + + var tracks = plyr.media.textTracks, + j; + for (j = 0; j < tracks.length; j++) { + var hasCaption = ((plyr.storage.captionsEnabled === true || plyr.storage.captionsEnabled === undefined) && j === 0); + html.push( + '
  • ', + '', + '
  • ' + ); + // Update menu button text + if (hasCaption) { + plyr.currentCaptionLabel.change(tracks[j].label); + } + } + + html.push( + '
  • ', + '', + '
  • ' + ); + + // To string + html = html.join(''); + + // Inser HTML + ul.insertAdjacentHTML('beforeend', html); + } + // Build quality menu items function _buildQualityControl() { var HD_RESOLUTION = 720, @@ -3264,6 +3294,7 @@ // If not null or undefined, parse it if (!_is.undefined(source)) { _updateSource(source); + _buildCaptionControl(); _buildQualityControl(); return; } From 51274563d2fe752e732c09e0bac6255f6624e6d3 Mon Sep 17 00:00:00 2001 From: Amo Wu Date: Wed, 26 Oct 2016 13:58:28 +0800 Subject: [PATCH 03/11] fix captions can't initial --- src/js/plyr.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/plyr.js b/src/js/plyr.js index 766bc989c..ea5ba00bd 100644 --- a/src/js/plyr.js +++ b/src/js/plyr.js @@ -2571,7 +2571,7 @@ // Toggle captions function _toggleCaptions(show) { // If there's no full support, or there's no caption toggle - if (!plyr.supported.full || !plyr.buttons.captions) { + if (!plyr.supported.full || !_inArray(config.controls, 'captions')) { return; } From e2f1a016ce6d26c96b17a0780162ddd4eb411ae7 Mon Sep 17 00:00:00 2001 From: Amo Wu Date: Wed, 26 Oct 2016 13:59:56 +0800 Subject: [PATCH 04/11] improve code comments --- src/js/plyr.js | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/src/js/plyr.js b/src/js/plyr.js index ea5ba00bd..16b816e20 100644 --- a/src/js/plyr.js +++ b/src/js/plyr.js @@ -942,6 +942,7 @@ '
      ' ); + // Captions menu button if (_inArray(config.controls, 'captions')) { html.push( '
    • ', @@ -951,6 +952,7 @@ ); } + // Speeds menu button if (_inArray(config.controls, 'speed')) { html.push( '
    • ', @@ -960,6 +962,7 @@ ); } + // Qualities menu button if (_inArray(config.controls, 'quality')) { html.push( '
    • ', @@ -971,8 +974,11 @@ html.push( '
    ', - '', // End of .plyr__menu__primary + '' // End of .plyr__menu__primary + ); + // Captions menu item + html.push( '', // End of .plyr__menu__secondary + '' // End of .plyr__menu__secondary + ); + // Speeds menu item + html.push( '', // End of .plyr__menu__secondary + '' // End of .plyr__menu__secondary + ); + // Qualities menu item + html.push( '"),r(A.controls,"play-large")&&e.push('"),e.push('
    '),r(A.controls,"progress")&&(e.push('
    ','','','','','',"0% "+A.i18n.buffered,""),A.tooltips.seek&&e.push('00:00'),e.push("","
    ")),e.push('
    ','
    '),r(A.controls,"restart")&&e.push('"),r(A.controls,"rewind")&&e.push('"),r(A.controls,"play")&&e.push('",'"),r(A.controls,"fast-forward")&&e.push('"),r(A.controls,"current-time")&&e.push('',''+A.i18n.currentTime+"",'00:00',""),r(A.controls,"duration")&&e.push('',''+A.i18n.duration+"",'00:00',""),e.push("
    ",'
    '),r(A.controls,"mute")&&e.push('"),r(A.controls,"volume")&&e.push('','",'','',""),r(A.controls,"settings")){e.push('
    ','",'","
    ")}return r(A.controls,"zoom")&&e.push('"),r(A.controls,"fullscreen")&&e.push('"),e.push("
    ","
    "),e.join("")}function O(){q.string(A.selectors.zoom.container)&&(rt.zoomContainer=t.querySelector(A.selectors.zoom.container)),q.htmlElement(rt.zoomContainer)||(rt.zoomContainer=rt.container),"audio"!==rt.type&&A.zoom.enabled&&(p(rt.zoomContainer,A.classes.zoom.enabled,!0),rt.buttons&&rt.buttons.zoom&&_(rt.buttons.zoom,!1))}function j(){if(rt.supported.full&&(q.string(A.selectors.fullscreen.container)&&(rt.fullscreenContainer=t.querySelector(A.selectors.fullscreen.container)),q.htmlElement(rt.fullscreenContainer)||(rt.fullscreenContainer=rt.container),("audio"!==rt.type||A.fullscreen.allowAudio)&&A.fullscreen.enabled)){var e=N.fullscreen;e||A.fullscreen.fallback&&!U()?(it((e?"Native":"Fallback")+" fullscreen enabled"),p(rt.fullscreenContainer,A.classes.fullscreen.enabled,!0)):it("Fullscreen not supported and fallback disabled"),rt.buttons&&rt.buttons.fullscreen&&_(rt.buttons.fullscreen,!1),Z()}}function V(e){q.event(e)&&(e=e.target),e.activeCues[0]&&"text"in e.activeCues[0]?R(e.activeCues[0].getCueAsHTML()):R()}function D(){if("video"===rt.type){Y(A.selectors.captions)||rt.videoContainer.insertAdjacentHTML("afterbegin",'
    '),rt.usingTextTracks=!1,rt.media.textTracks&&(rt.usingTextTracks=!0);var e="",t=Se();if(rt.captionExists=!0,0===t.length?(rt.captionExists=!1,it("No caption track found")):A.captions.selectedIndex+1>t.length?(rt.captionExists=!1,it("Caption index out of bound")):(P(rt.media,"captionselected",!0,t[A.captions.selectedIndex]),e=t[A.captions.selectedIndex].src,it("Caption track found; URI: "+e)),rt.captionExists){var n=rt.media.textTracks;if([].forEach.call(n,function(e){v(e,"cuechange",V),e.mode="hidden"}),B(rt),(rt.browser.isIE&&rt.browser.version>=10||rt.browser.isFirefox&&rt.browser.version>=31)&&(it("Detected browser with known TextTrack issues - using manual fallback"),rt.usingTextTracks=!1),rt.usingTextTracks){it("TextTracks supported");var a=n[A.captions.selectedIndex];"captions"!==a.kind&&"subtitles"!==a.kind||(g(a,"cuechange",V),a.activeCues&&a.activeCues.length>0&&V(a))}else if(it("TextTracks not supported so rendering captions manually"),rt.currentCaption="",rt.captions=[],""!==e){var r=new XMLHttpRequest;r.onreadystatechange=function(){if(4===r.readyState)if(200===r.status){var e,t=[],n=r.responseText,a="\r\n";n.indexOf(a+a)===-1&&(a=n.indexOf("\r\r")!==-1?"\r":"\n"),t=n.split(a+a);for(var o=0;o ");for(var a=0;art.captions.length-1){rt.subcount=rt.captions.length-1;break}rt.media.currentTime.toFixed(1)>=n(rt.captions[rt.subcount][0])&&rt.media.currentTime.toFixed(1)<=a(rt.captions[rt.subcount][0])?(rt.currentCaption=rt.captions[rt.subcount][1],R(rt.currentCaption)):R()}}function B(){if(rt.buttons.captions){p(rt.container,A.classes.captions.enabled,!0);var e=rt.storage.captionsEnabled;if(q["boolean"](e)||(e=A.captions.defaultActive),e){p(rt.container,A.classes.captions.active,!0),_(rt.buttons.captions,!0);var t=Ie(A.captions.selectedIndex);t&&rt.currentCaptionLabel.change(t.label)}else rt.currentCaptionLabel.change(A.i18n.disableCaptions)}}function W(e){return rt.container.querySelectorAll(e)}function Y(e){return W(e)[0]}function U(){try{return e.self!==e.top}catch(t){return!0}}function Z(){function e(e){9===e.which&&rt.isFullscreen&&(e.target!==a||e.shiftKey?e.target===n&&e.shiftKey&&(e.preventDefault(),a.focus()):(e.preventDefault(),n.focus()))}var t=W("input:not([disabled]), button:not([disabled])"),n=t[0],a=t[t.length-1];g(rt.container,"keydown",e)}function X(e,t){if(q.string(t))c(e,rt.media,{src:t});else if(t.constructor===Array)for(var n=t.length-1;n>=0;n--)c(e,rt.media,t[n])}function J(){function e(e){var n="#plyr-settings-{id}-{setting}-toggle .plyr__menu__btn__value",a=n.replace("{id}",s).replace("{setting}",e),r=t.querySelector(a);return r}if(A.loadSprite){var n=L();n.absolute?(it("AJAX loading absolute SVG sprite"+(rt.browser.isIE?" (due to IE)":"")),T(n.url,"sprite-plyr")):it("Sprite will be used as external resource directly")}var a=A.html,s=Math.floor(1e4*Math.random());rt.controlsId=s,it("Injecting custom controls"),a||(a=z()),a=o(a,"{seektime}",A.seekTime),a=o(a,"{id}",s);var i;if(q.string(A.selectors.controls.container)&&(i=t.querySelector(A.selectors.controls.container)),q.htmlElement(i)||(i=rt.container),i.insertAdjacentHTML("beforeend",a),A.tooltips.controls)for(var l=W([A.selectors.controls.wrapper," ",A.selectors.labels," .",A.classes.hidden].join("")),u=l.length-1;u>=0;u--){var c=l[u];p(c,A.classes.hidden,!1),p(c,A.classes.tooltip,!0)}if(r(A.controls,"speed")){var d=e("speed");rt.currentSpeed=new DataBind(d,"textContent",A.defaultSpeed,"{value}×")}if(r(A.controls,"captions")){var m=e("captions");rt.currentCaptionLabel=new DataBind(m,"textContent",A.i18n.disableCaptions)}if(r(A.controls,"quality")){var f=e("quality");rt.currentQualityLabel=new DataBind(f,"textContent",Re()),Ye()}}function $(){try{return rt.controls=Y(A.selectors.controls.wrapper),rt.buttons={},rt.buttons.seek=Y(A.selectors.buttons.seek),rt.buttons.play=W(A.selectors.buttons.play),rt.buttons.pause=Y(A.selectors.buttons.pause),rt.buttons.restart=Y(A.selectors.buttons.restart),rt.buttons.rewind=Y(A.selectors.buttons.rewind),rt.buttons.forward=Y(A.selectors.buttons.forward),rt.buttons.zoom=Y(A.selectors.buttons.zoom),rt.buttons.fullscreen=Y(A.selectors.buttons.fullscreen),rt.buttons.settings=Y(A.selectors.buttons.settings),rt.buttons.mute=Y(A.selectors.buttons.mute),rt.buttons.captions=Y(A.selectors.buttons.captions),rt.progress={},rt.progress.container=Y(A.selectors.progress.container),rt.progress.buffer={},rt.progress.buffer.bar=Y(A.selectors.progress.buffer),rt.progress.buffer.text=rt.progress.buffer.bar&&rt.progress.buffer.bar.getElementsByTagName("span")[0],rt.progress.played=Y(A.selectors.progress.played),rt.progress.tooltip=rt.progress.container&&rt.progress.container.querySelector("."+A.classes.tooltip),rt.volume={},rt.volume.input=Y(A.selectors.volume.input),rt.volume.display=Y(A.selectors.volume.display),rt.duration=Y(A.selectors.duration),rt.currentTime=Y(A.selectors.currentTime),rt.seekTime=W(A.selectors.seekTime),!0}catch(e){return lt("It looks like there is a problem with your controls HTML"),K(!0),!1}}function G(){p(rt.container,A.selectors.container.replace(".",""),rt.supported.full)}function K(e){e&&r(A.types.html5,rt.type)?rt.media.setAttribute("controls",""):rt.media.removeAttribute("controls")}function Q(e){var t=A.i18n.play;if(q.string(A.title)&&A.title.length&&(t+=", "+A.title,rt.container.setAttribute("aria-label",A.title)),rt.supported.full&&rt.buttons.play)for(var n=rt.buttons.play.length-1;n>=0;n--)rt.buttons.play[n].setAttribute("aria-label",t);q.htmlElement(e)&&e.setAttribute("title",A.i18n.frameTitle.replace("{title}",A.title))}function ee(){var t=null;rt.storage={},N.storage&&A.storage.enabled&&(e.localStorage.removeItem("plyr-volume"),t=e.localStorage.getItem(A.storage.key),t&&(/^\d+(\.\d+)?$/.test(t)?te({volume:parseFloat(t)}):rt.storage=JSON.parse(t)))}function te(t){N.storage&&A.storage.enabled&&(x(rt.storage,t),e.localStorage.setItem(A.storage.key,JSON.stringify(rt.storage)))}function ne(){if(!rt.media)return void lt("No media element found!");if(rt.supported.full&&(p(rt.container,A.classes.type.replace("{0}",rt.type),!0),r(A.types.embed,rt.type)&&p(rt.container,A.classes.type.replace("{0}","video"),!0),p(rt.container,A.classes.pip.enabled,N.pip(rt)),p(rt.container,A.classes.stopped,A.autoplay),p(rt.ontainer,A.classes.isIos,rt.browser.isIos),p(rt.container,A.classes.isTouch,rt.browser.isTouch),"video"===rt.type)){var e=t.createElement("div");e.setAttribute("class",A.classes.videoWrapper),s(rt.media,e),rt.videoContainer=e}r(A.types.embed,rt.type)&&ae()}function ae(){for(var n=t.createElement("div"),r=rt.embedId,o=rt.type+"-"+Math.floor(1e4*Math.random()),s=W('[id^="'+rt.type+'-"]'),l=s.length-1;l>=0;l--)i(s[l]);if(p(rt.media,A.classes.videoWrapper,!0),p(rt.media,A.classes.embedWrapper,!0),"youtube"===rt.type)rt.media.appendChild(n),n.setAttribute("id",o),q.object(e.YT)?oe(r,n):(a(A.urls.youtube.api),e.onYouTubeReadyCallbacks=e.onYouTubeReadyCallbacks||[],e.onYouTubeReadyCallbacks.push(function(){oe(r,n)}),e.onYouTubeIframeAPIReady=function(){e.onYouTubeReadyCallbacks.forEach(function(e){e()})});else if("vimeo"===rt.type)if(rt.supported.full?rt.media.appendChild(n):n=rt.media,n.setAttribute("id",o),q.object(e.Vimeo))se(r,n);else{a(A.urls.vimeo.api);var c=e.setInterval(function(){q.object(e.Vimeo)&&(e.clearInterval(c),se(r,n))},50)}else if("soundcloud"===rt.type){var d=t.createElement("iframe");d.loaded=!1,g(d,"load",function(){d.loaded=!0}),u(d,{src:"https://w.soundcloud.com/player/?url=https://api.soundcloud.com/tracks/"+r,id:o}),n.appendChild(d),rt.media.appendChild(n),e.SC||a(A.urls.soundcloud.api);var m=e.setInterval(function(){e.SC&&d.loaded&&(e.clearInterval(m),ie.call(d))},50)}}function re(){rt.supported.full&&(tt(),nt()),Q(Y("iframe"))}function oe(t,n){rt.embed=new e.YT.Player(n.id,{videoId:t,playerVars:{autoplay:A.autoplay?1:0,controls:rt.supported.full?0:1,rel:0,showinfo:0,iv_load_policy:3,cc_load_policy:A.captions.defaultActive?1:0,cc_lang_pref:"en",wmode:"transparent",modestbranding:1,disablekb:1,origin:"*"},events:{onError:function(e){P(rt.container,"error",!0,{code:e.data,embed:e.target})},onReady:function(t){var n=t.target;rt.media.play=function(){n.playVideo(),rt.media.paused=!1},rt.media.pause=function(){n.pauseVideo(),rt.media.paused=!0},rt.media.stop=function(){n.stopVideo(),rt.media.paused=!0},rt.media.duration=n.getDuration(),rt.media.paused=!0,rt.media.currentTime=0,rt.media.muted=n.isMuted(),A.title=n.getVideoData().title,rt.supported.full&&rt.media.querySelector("iframe").setAttribute("tabindex","-1"),re(),P(rt.media,"timeupdate"),P(rt.media,"durationchange"),e.clearInterval(ot.buffering),ot.buffering=e.setInterval(function(){rt.media.buffered=n.getVideoLoadedFraction(),(null===rt.media.lastBuffered||rt.media.lastBuffereda&&(t=a),Oe(t);try{rt.media.currentTime=t.toFixed(4)}catch(o){}if(r(A.types.embed,rt.type)){switch(rt.type){case"youtube":rt.embed.seekTo(t);break;case"vimeo":rt.embed.setCurrentTime(t.toFixed(0));break;case"soundcloud":rt.embed.seekTo(1e3*t)}n&&ue(),P(rt.media,"timeupdate"),rt.media.seeking=!0}it("Seeking to "+rt.media.currentTime+" seconds"),H(t)}function ye(){var e=parseInt(A.duration),t=0;return null===rt.media.duration||isNaN(rt.media.duration)||(t=rt.media.duration),isNaN(e)?t:e}function be(){p(rt.container,A.classes.playing,!rt.media.paused),p(rt.container,A.classes.stopped,rt.media.paused),Ue(rt.media.paused)}function ge(){I={x:e.pageXOffset||0,y:e.pageYOffset||0}}function ve(){e.scrollTo(I.x,I.y)}function he(e){rt.isZoom=!rt.isZoom,p(rt.zoomContainer,A.classes.zoom.active,rt.isZoom),t.body.style.overflow=rt.isZoom?"hidden":"",rt.buttons&&rt.buttons.zoom&&_(rt.buttons.zoom,rt.isZoom),P(rt.container,rt.isZoom?"enterzoom":"exitzoom",!0)}function _e(e){var n=N.fullscreen;if(n){if(!e||e.type!==S.eventType)return S.isFullScreen(rt.fullscreenContainer)?S.cancelFullScreen():(ge(),S.requestFullScreen(rt.fullscreenContainer)),void(rt.isFullscreen=S.isFullScreen(rt.fullscreenContainer));rt.isFullscreen=S.isFullScreen(rt.fullscreenContainer)}else rt.isFullscreen=!rt.isFullscreen,t.body.style.overflow=rt.isFullscreen?"hidden":"";p(rt.fullscreenContainer,A.classes.fullscreen.active,rt.isFullscreen),Z(rt.isFullscreen),rt.buttons&&rt.buttons.fullscreen&&_(rt.buttons.fullscreen,rt.isFullscreen),P(rt.container,rt.isFullscreen?"enterfullscreen":"exitfullscreen",!0),!rt.isFullscreen&&n&&ve()}function ke(e){if(q["boolean"](e)||(e=!rt.media.muted),_(rt.buttons.mute,e),rt.media.muted=e,0===rt.media.volume&&xe(A.volume),r(A.types.embed,rt.type)){switch(rt.type){case"youtube":rt.embed[rt.media.muted?"mute":"unMute"]();break;case"vimeo":case"soundcloud":rt.embed.setVolume(rt.media.muted?0:parseFloat(A.volume/A.volumeMax))}P(rt.media,"volumechange")}}function xe(e){var t=A.volumeMax,n=A.volumeMin;if(q.undefined(e)&&(e=rt.storage.volume),(null===e||isNaN(e))&&(e=A.volume),e>t&&(e=t),e0&&ke()}function we(e){var t=rt.media.muted?0:rt.media.volume*A.volumeMax;q.number(e)||(e=A.volumeStep),xe(t+e)}function Te(e){var t=rt.media.muted?0:rt.media.volume*A.volumeMax;q.number(e)||(e=A.volumeStep),xe(t-e)}function Ce(){var e=rt.media.muted?0:rt.media.volume*A.volumeMax;rt.supported.full&&(rt.volume.input&&(rt.volume.input.value=e),rt.volume.display&&(rt.volume.display.value=e)),te({volume:e}),p(rt.container,A.classes.muted,0===e),rt.supported.full&&rt.buttons.mute&&_(rt.buttons.mute,0===e)}function Ae(e){if(rt.supported.full&&rt.buttons.captions){q["boolean"](e)||(e=rt.container.className.indexOf(A.classes.captions.active)===-1),rt.captionsEnabled=e,_(rt.buttons.captions,rt.captionsEnabled),p(rt.container,A.classes.captions.active,rt.captionsEnabled),P(rt.container,rt.captionsEnabled?"captionsenabled":"captionsdisabled",!0),te({captionsEnabled:rt.captionsEnabled});var t=Ie(A.captions.selectedIndex);e&&t?rt.currentCaptionLabel.change(t.label):rt.currentCaptionLabel.change(A.i18n.disableCaptions)}}function Ee(e){A.captions.selectedIndex=e,R(),D()}function Se(){for(var e,t=[],n=0,a=rt.media.childNodes,r=0;r0;rt.secs=("0"+rt.secs).slice(-2),rt.mins=("0"+rt.mins).slice(-2),t.innerHTML=(n?rt.hours+":":"")+rt.mins+":"+rt.secs}}function Le(){if(rt.supported.full){var e=ye()||0;!rt.duration&&A.displayDuration&&rt.media.paused&&Me(e,rt.currentTime),rt.duration&&Me(e,rt.duration),je()}}function ze(e){Me(rt.media.currentTime,rt.currentTime),e&&"timeupdate"===e.type&&rt.media.seeking||Ne(e)}function Oe(e){q.number(e)||(e=0);var t=ye(),n=k(e,t);rt.progress&&rt.progress.played&&(rt.progress.played.value=n),rt.buttons&&rt.buttons.seek&&(rt.buttons.seek.value=n)}function je(e){var t=ye();if(A.tooltips.seek&&rt.progress.container&&0!==t){var n=rt.progress.container.getBoundingClientRect(),a=0,o=A.classes.tooltip+"--visible";if(e)a=100/n.width*(e.pageX-n.left);else{if(!m(rt.progress.tooltip,o))return;a=rt.progress.tooltip.style.left.replace("%","")}a<0?a=0:a>100&&(a=100),Me(t/100*a,rt.progress.tooltip),rt.progress.tooltip.style.left=a+"%",e&&r(["mouseenter","mouseleave"],e.type)&&p(rt.progress.tooltip,o,"mouseenter"===e.type); -}}function Ve(e){q.undefined(e)&&(e=rt.storage.speed||A.defaultSpeed),me(e)}function De(e){var t=!rt.media.paused,n=rt.media.currentTime,a=Array.prototype.slice.call(W("source")),r=Array.prototype.slice.call(W("track"));t&&ue();var o=We(a,e);Xe({type:"video",title:rt.media.title,poster:0===n?rt.media.poster:"",tracks:r.map(function(e){return{kind:e.kind,label:e.label,srclang:e.srclang,src:e.src,"default":e["default"]}}),sources:o.map(function(e){return{src:e.src,type:e.type,label:e.getAttribute("label"),res:e.getAttribute("res")}})});var s=function(e){0!==n&&fe(n),t&&le(),P(rt.media,"qualitychanged"),b(rt.media,"canplay",s,!1)};g(rt.media,"canplay",s),rt.currentQualityLabel.change(e),te({quality:e})}function Re(){var e=Array.prototype.slice.call(W("source"));return e.length?e[0].hasAttribute("label")?e[0].getAttribute("label"):void lt(" label attribute not found"):void lt(" not found")}function He(e){var t=Array.prototype.slice.call(W("source")),n=t.filter(function(t){return t.getAttribute("label")===e});if(n.length)return n[0].getAttribute("label");var a=Be();return a?a.label:null}function Be(){function e(e,t){return e-t}var t=Array.prototype.slice.call(W("source")),n=rt.media.clientHeight;if(0!==t.length){var a=t.map(function(e){return e.getAttribute("res")}).sort(e),r=Math.min([n].concat(a).sort(e).indexOf(n),a.length-1),o=a[r],s=t.filter(function(e){return e.getAttribute("res")===o})[0];return{label:s.getAttribute("label"),res:+s.getAttribute("res")}}}function We(e,t){if(!e.length)return e;var n,a=-1;for(n=0;n-1))return e;var o=e.splice(a,1);return e.unshift(o[0]),e}function Ye(){var e,t=720,n=W("li > button[data-plyr=quality]");for(e=0;e ul",r=Y(a),o=[];Array.prototype.slice.call(W("source")).map(function(e){return{label:e.getAttribute("label"),res:+e.getAttribute("res")}}).sort(function(e,t){return e.res&&t.res?t.res-e.res:0}).forEach(function(e,n){var a=He(rt.storage.quality);a&&(o.push("
  • ",'","
  • "))}),o=o.join(""),r.insertAdjacentHTML("beforeend",o)}function Ue(t){if(A.hideControls&&"audio"!==rt.type){var n=0,a=!1,o=!1,s=t,i=m(rt.container,A.classes.loading);if(q["boolean"](t)||(t&&t.type?(a="enterfullscreen"===t.type,o="enterzoom"===t.type,s=r(["mousemove","touchstart","mouseenter","focus"],t.type),r(["mousemove","touchmove"],t.type)&&(n=2e3),"focus"===t.type&&(n=3e3)):s=m(rt.container,A.classes.hideControls)),e.clearTimeout(ot.hover),s||rt.media.paused||i){if(p(rt.container,A.classes.hideControls,!1),rt.media.paused||i)return;rt.browser.isTouch&&(n=3e3)}s&&rt.media.paused||(ot.hover=e.setTimeout(function(){(!rt.controls.pressed&&!rt.controls.hover||a||o)&&p(rt.container,A.classes.hideControls,!0)},n))}}function Ze(e,t){if(t){var n=rt.storage.quality||Be().label;e.sources=We(e.sources,n)}if(!q.undefined(e))return Xe(e),void Ye();var a;switch(rt.type){case"youtube":a=rt.embed.getVideoUrl();break;case"vimeo":rt.embed.getVideoUrl.then(function(e){a=e});break;case"soundcloud":rt.embed.getCurrentSound(function(e){a=e.permalink_url});break;default:a=rt.media.currentSrc}return a||""}function Xe(e){function n(){if(rt.embed=null,i(rt.media),"video"===rt.type&&rt.videoContainer&&i(rt.videoContainer),rt.container&&rt.container.removeAttribute("class"),"type"in e&&(rt.type=e.type,"video"===rt.type)){var n=e.sources[0];"type"in n&&r(A.types.embed,n.type)&&(rt.type=n.type)}switch(rt.supported=C(rt.type),rt.type){case"video":rt.media=t.createElement("video");break;case"audio":rt.media=t.createElement("audio");break;case"youtube":case"vimeo":case"soundcloud":rt.media=t.createElement("div"),rt.embedId=e.sources[0].src}l(rt.container,rt.media),q["boolean"](e.autoplay)&&(A.autoplay=e.autoplay),r(A.types.html5,rt.type)&&(A.crossorigin&&rt.media.setAttribute("crossorigin",""),A.autoplay&&rt.media.setAttribute("autoplay",""),"poster"in e&&rt.media.setAttribute("poster",e.poster),A.loop&&rt.media.setAttribute("loop","")),p(rt.zoomContainer,A.classes.zoom.active,rt.isZoom),p(rt.fullscreenContainer,A.classes.fullscreen.active,rt.isFullscreen),p(rt.container,A.classes.captions.active,rt.captionsEnabled),G(),r(A.types.html5,rt.type)&&X("source",e.sources),ne(),r(A.types.html5,rt.type)&&("tracks"in e&&X("track",e.tracks),rt.media.load()),(r(A.types.html5,rt.type)||r(A.types.embed,rt.type)&&!rt.supported.full)&&(tt(),nt()),A.title=e.title,Q()}return q.object(e)&&"sources"in e&&e.sources.length?(p(rt.container,A.classes.ready,!1),ue(),Oe(),Pe(),Ke(),void Qe(n,!1)):void lt("Invalid source format")}function Je(e){"video"===rt.type&&rt.media.setAttribute("poster",e)}function $e(){function n(){var e=ce(),t=rt.buttons[e?"play":"pause"],n=rt.buttons[e?"pause":"play"];if(n=n&&n.length>1?n[n.length-1]:n[0]){var a=m(t,A.classes.tabFocus);setTimeout(function(){n.focus(),a&&(p(t,A.classes.tabFocus,!1),p(n,A.classes.tabFocus,!0))},100)}}function a(){var e=t.activeElement;return e=e&&e!==t.body?t.querySelector(":focus"):null}function o(e){return e.keyCode?e.keyCode:e.which}function s(e){for(var t in rt.buttons){var n=rt.buttons[t];if(q.nodeList(n))for(var a=0;a0)&&(t?Te(n):we(n)),(e.deltaY>0||e.deltaX<0)&&(t?we(n):Te(n))})}function Ge(){if(g(rt.media,"timeupdate seeking",ze),g(rt.media,"timeupdate",H),g(rt.media,"durationchange loadedmetadata",Le),g(rt.media,"ended",function(){"video"===rt.type&&A.showPosterOnEnd&&("video"===rt.type&&R(),fe(),rt.media.load())}),g(rt.media,"progress playing",Ne),g(rt.media,"volumechange",Ce),g(rt.media,"play pause ended",be),g(rt.media,"waiting canplay seeked",qe),A.clickToPlay&&"audio"!==rt.type){var e=Y("."+A.classes.videoWrapper);if(!e)return;e.style.cursor="pointer",g(e,"click",function(){A.hideControls&&rt.browser.isTouch&&!rt.media.paused||(rt.media.paused?le():rt.media.ended?(fe(),le()):ue())})}A.disableContextMenu&&g(rt.media,"contextmenu",function(e){e.preventDefault()}),g(rt.media,A.events.concat(["keyup","keydown"]).join(" "),function(e){P(rt.container,e.type,!0)})}function Ke(){if(r(A.types.html5,rt.type)){for(var e=rt.media.querySelectorAll("source"),t=0;t=0;n--){var a=n>0?t.cloneNode(!0):t,r=e[n],o=r.parentNode,s=r.nextSibling;return a.appendChild(r),s?o.insertBefore(a,s):o.appendChild(a),a}}function i(e){e&&e.parentNode.removeChild(e)}function l(e,t){e.insertBefore(t,e.firstChild)}function u(e,t){for(var n in t)e.setAttribute(n,q["boolean"](t[n])&&t[n]?"":t[n])}function c(e,n,a){var r=t.createElement(e);u(r,a),l(n,r)}function d(e){return e.replace(".","")}function p(e,t,n){if(e)if(e.classList)e.classList[n?"add":"remove"](t);else{var a=(" "+e.className+" ").replace(/\s+/g," ").replace(" "+t+" ","");e.className=a+(n?" "+t:"")}}function m(e,t){return!!e&&(e.classList?e.classList.contains(t):new RegExp("(\\s|^)"+t+"(\\s|$)").test(e.className))}function f(e,n){var a=Element.prototype,r=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.msMatchesSelector||function(e){return[].indexOf.call(t.querySelectorAll(e),this)!==-1};return r.call(e,n)}function y(e,t,n,a,r){g(e,t,function(t){n&&n.apply(e,[t]),a.apply(e,[t])},r)}function b(e,t,n,a,r){var o=t.split(" ");if(q["boolean"](r)||(r=!1),e instanceof NodeList)for(var s=0;s
    "),r(A.controls,"play-large")&&e.push('"),e.push('
    '),r(A.controls,"progress")&&(e.push('
    ','','','','','',"0% "+A.i18n.buffered,""),A.tooltips.seek&&e.push('00:00'),e.push("","
    ")),e.push('
    ','
    '),r(A.controls,"restart")&&e.push('"),r(A.controls,"rewind")&&e.push('"),r(A.controls,"play")&&e.push('",'"),r(A.controls,"fast-forward")&&e.push('"),r(A.controls,"current-time")&&e.push('',''+A.i18n.currentTime+"",'00:00',""),r(A.controls,"duration")&&e.push('',''+A.i18n.duration+"",'00:00',""),e.push("
    ",'
    '),r(A.controls,"mute")&&e.push('"),r(A.controls,"volume")&&e.push('','",'','',""),r(A.controls,"settings")&&(e.push('
    ','",'","
    ")),r(A.controls,"zoom")&&e.push('"),r(A.controls,"fullscreen")&&e.push('"),e.push("
    ","
    "),e.join("")}function O(){q.string(A.selectors.zoom.container)&&(ot.zoomContainer=t.querySelector(A.selectors.zoom.container)),q.htmlElement(ot.zoomContainer)||(ot.zoomContainer=ot.container),"audio"!==ot.type&&A.zoom.enabled&&(p(ot.zoomContainer,A.classes.zoom.enabled,!0),ot.buttons&&ot.buttons.zoom&&_(ot.buttons.zoom,!1))}function j(){if(ot.supported.full&&(q.string(A.selectors.fullscreen.container)&&(ot.fullscreenContainer=t.querySelector(A.selectors.fullscreen.container)),q.htmlElement(ot.fullscreenContainer)||(ot.fullscreenContainer=ot.container),("audio"!==ot.type||A.fullscreen.allowAudio)&&A.fullscreen.enabled)){var e=N.fullscreen;e||A.fullscreen.fallback&&!U()?(lt((e?"Native":"Fallback")+" fullscreen enabled"),p(ot.fullscreenContainer,A.classes.fullscreen.enabled,!0)):lt("Fullscreen not supported and fallback disabled"),ot.buttons&&ot.buttons.fullscreen&&_(ot.buttons.fullscreen,!1),Z()}}function V(e){q.event(e)&&(e=e.target),e.activeCues[0]&&"text"in e.activeCues[0]?R(e.activeCues[0].getCueAsHTML()):R()}function D(){if("video"===ot.type){Y(A.selectors.captions)||ot.videoContainer.insertAdjacentHTML("afterbegin",'
    '),ot.usingTextTracks=!1,ot.media.textTracks&&(ot.usingTextTracks=!0);var e="",t=Se();if(ot.captionExists=!0,0===t.length?(ot.captionExists=!1,lt("No caption track found")):A.captions.selectedIndex+1>t.length?(ot.captionExists=!1,lt("Caption index out of bound")):(M(ot.media,"captionselected",!0,t[A.captions.selectedIndex]),e=t[A.captions.selectedIndex].src,lt("Caption track found; URI: "+e)),ot.captionExists){var n=ot.media.textTracks;if([].forEach.call(n,function(e){v(e,"cuechange",V),e.mode="hidden"}),B(ot),(ot.browser.isIE&&ot.browser.version>=10||ot.browser.isFirefox&&ot.browser.version>=31)&&(lt("Detected browser with known TextTrack issues - using manual fallback"),ot.usingTextTracks=!1),ot.usingTextTracks){lt("TextTracks supported");var a=n[A.captions.selectedIndex];"captions"!==a.kind&&"subtitles"!==a.kind||(g(a,"cuechange",V),a.activeCues&&a.activeCues.length>0&&V(a))}else if(lt("TextTracks not supported so rendering captions manually"),ot.currentCaption="",ot.captions=[],""!==e){var r=new XMLHttpRequest;r.onreadystatechange=function(){if(4===r.readyState)if(200===r.status){var e,t=[],n=r.responseText,a="\r\n";n.indexOf(a+a)===-1&&(a=n.indexOf("\r\r")!==-1?"\r":"\n"),t=n.split(a+a);for(var o=0;o ");for(var a=0;aot.captions.length-1){ot.subcount=ot.captions.length-1;break}ot.media.currentTime.toFixed(1)>=n(ot.captions[ot.subcount][0])&&ot.media.currentTime.toFixed(1)<=a(ot.captions[ot.subcount][0])?(ot.currentCaption=ot.captions[ot.subcount][1],R(ot.currentCaption)):R()}}function B(){if(ot.buttons.captions){p(ot.container,A.classes.captions.enabled,!0);var e=ot.storage.captionsEnabled;if(q["boolean"](e)||(e=A.captions.defaultActive),e){p(ot.container,A.classes.captions.active,!0),_(ot.buttons.captions,!0);var t=Ie(A.captions.selectedIndex);t&&ot.currentCaptionLabel.change(t.label)}else ot.currentCaptionLabel.change(A.i18n.disableCaptions)}}function W(e){return ot.container.querySelectorAll(e)}function Y(e){return W(e)[0]}function U(){try{return e.self!==e.top}catch(t){return!0}}function Z(){function e(e){9===e.which&&ot.isFullscreen&&(e.target!==a||e.shiftKey?e.target===n&&e.shiftKey&&(e.preventDefault(),a.focus()):(e.preventDefault(),n.focus()))}var t=W("input:not([disabled]), button:not([disabled])"),n=t[0],a=t[t.length-1];g(ot.container,"keydown",e)}function X(e,t){if(q.string(t))c(e,ot.media,{src:t});else if(t.constructor===Array)for(var n=t.length-1;n>=0;n--)c(e,ot.media,t[n])}function J(){function e(e){var n="#plyr-settings-{id}-{setting}-toggle .plyr__menu__btn__value",a=n.replace("{id}",s).replace("{setting}",e),r=t.querySelector(a);return r}if(A.loadSprite){var n=L();n.absolute?(lt("AJAX loading absolute SVG sprite"+(ot.browser.isIE?" (due to IE)":"")),T(n.url,"sprite-plyr")):lt("Sprite will be used as external resource directly")}var a=A.html,s=Math.floor(1e4*Math.random());ot.controlsId=s,lt("Injecting custom controls"),a||(a=z()),a=o(a,"{seektime}",A.seekTime),a=o(a,"{id}",s);var i;if(q.string(A.selectors.controls.container)&&(i=t.querySelector(A.selectors.controls.container)),q.htmlElement(i)||(i=ot.container),i.insertAdjacentHTML("beforeend",a),A.tooltips.controls)for(var l=W([A.selectors.controls.wrapper," ",A.selectors.labels," .",A.classes.hidden].join("")),u=l.length-1;u>=0;u--){var c=l[u];p(c,A.classes.hidden,!1),p(c,A.classes.tooltip,!0)}if(r(A.controls,"speed")){var d=e("speed");ot.currentSpeed=new DataBind(d,"textContent",A.defaultSpeed,"{value}×")}if(r(A.controls,"captions")){var m=e("captions");ot.currentCaptionLabel=new DataBind(m,"textContent",A.i18n.disableCaptions),Ye()}if(r(A.controls,"quality")){var f=e("quality");ot.currentQualityLabel=new DataBind(f,"textContent",Re()),Ue()}}function $(){try{return ot.controls=Y(A.selectors.controls.wrapper),ot.buttons={},ot.buttons.seek=Y(A.selectors.buttons.seek),ot.buttons.play=W(A.selectors.buttons.play),ot.buttons.pause=Y(A.selectors.buttons.pause),ot.buttons.restart=Y(A.selectors.buttons.restart),ot.buttons.rewind=Y(A.selectors.buttons.rewind),ot.buttons.forward=Y(A.selectors.buttons.forward),ot.buttons.zoom=Y(A.selectors.buttons.zoom),ot.buttons.fullscreen=Y(A.selectors.buttons.fullscreen),ot.buttons.settings=Y(A.selectors.buttons.settings),ot.buttons.mute=Y(A.selectors.buttons.mute),ot.buttons.captions=Y(A.selectors.buttons.captions),ot.progress={},ot.progress.container=Y(A.selectors.progress.container),ot.progress.buffer={},ot.progress.buffer.bar=Y(A.selectors.progress.buffer),ot.progress.buffer.text=ot.progress.buffer.bar&&ot.progress.buffer.bar.getElementsByTagName("span")[0],ot.progress.played=Y(A.selectors.progress.played),ot.progress.tooltip=ot.progress.container&&ot.progress.container.querySelector("."+A.classes.tooltip),ot.volume={},ot.volume.input=Y(A.selectors.volume.input),ot.volume.display=Y(A.selectors.volume.display),ot.duration=Y(A.selectors.duration),ot.currentTime=Y(A.selectors.currentTime),ot.seekTime=W(A.selectors.seekTime),!0}catch(e){return ut("It looks like there is a problem with your controls HTML"),K(!0),!1}}function G(){p(ot.container,A.selectors.container.replace(".",""),ot.supported.full)}function K(e){e&&r(A.types.html5,ot.type)?ot.media.setAttribute("controls",""):ot.media.removeAttribute("controls")}function Q(e){var t=A.i18n.play;if(q.string(A.title)&&A.title.length&&(t+=", "+A.title,ot.container.setAttribute("aria-label",A.title)),ot.supported.full&&ot.buttons.play)for(var n=ot.buttons.play.length-1;n>=0;n--)ot.buttons.play[n].setAttribute("aria-label",t);q.htmlElement(e)&&e.setAttribute("title",A.i18n.frameTitle.replace("{title}",A.title))}function ee(){var t=null;ot.storage={},N.storage&&A.storage.enabled&&(e.localStorage.removeItem("plyr-volume"),t=e.localStorage.getItem(A.storage.key),t&&(/^\d+(\.\d+)?$/.test(t)?te({volume:parseFloat(t)}):ot.storage=JSON.parse(t)))}function te(t){N.storage&&A.storage.enabled&&(x(ot.storage,t),e.localStorage.setItem(A.storage.key,JSON.stringify(ot.storage)))}function ne(){if(!ot.media)return void ut("No media element found!");if(ot.supported.full&&(p(ot.container,A.classes.type.replace("{0}",ot.type),!0),r(A.types.embed,ot.type)&&p(ot.container,A.classes.type.replace("{0}","video"),!0),p(ot.container,A.classes.pip.enabled,N.pip(ot)),p(ot.container,A.classes.stopped,A.autoplay),p(ot.ontainer,A.classes.isIos,ot.browser.isIos),p(ot.container,A.classes.isTouch,ot.browser.isTouch),"video"===ot.type)){var e=t.createElement("div");e.setAttribute("class",A.classes.videoWrapper),s(ot.media,e),ot.videoContainer=e}r(A.types.embed,ot.type)&&ae()}function ae(){for(var n=t.createElement("div"),r=ot.embedId,o=ot.type+"-"+Math.floor(1e4*Math.random()),s=W('[id^="'+ot.type+'-"]'),l=s.length-1;l>=0;l--)i(s[l]);if(p(ot.media,A.classes.videoWrapper,!0),p(ot.media,A.classes.embedWrapper,!0),"youtube"===ot.type)ot.media.appendChild(n),n.setAttribute("id",o),q.object(e.YT)?oe(r,n):(a(A.urls.youtube.api),e.onYouTubeReadyCallbacks=e.onYouTubeReadyCallbacks||[],e.onYouTubeReadyCallbacks.push(function(){oe(r,n)}),e.onYouTubeIframeAPIReady=function(){e.onYouTubeReadyCallbacks.forEach(function(e){e()})});else if("vimeo"===ot.type)if(ot.supported.full?ot.media.appendChild(n):n=ot.media,n.setAttribute("id",o),q.object(e.Vimeo))se(r,n);else{a(A.urls.vimeo.api);var c=e.setInterval(function(){q.object(e.Vimeo)&&(e.clearInterval(c),se(r,n))},50)}else if("soundcloud"===ot.type){var d=t.createElement("iframe");d.loaded=!1,g(d,"load",function(){d.loaded=!0}),u(d,{src:"https://w.soundcloud.com/player/?url=https://api.soundcloud.com/tracks/"+r,id:o}),n.appendChild(d),ot.media.appendChild(n),e.SC||a(A.urls.soundcloud.api);var m=e.setInterval(function(){e.SC&&d.loaded&&(e.clearInterval(m),ie.call(d))},50)}}function re(){ot.supported.full&&(nt(),at()),Q(Y("iframe"))}function oe(t,n){ot.embed=new e.YT.Player(n.id,{videoId:t,playerVars:{autoplay:A.autoplay?1:0,controls:ot.supported.full?0:1,rel:0,showinfo:0,iv_load_policy:3,cc_load_policy:A.captions.defaultActive?1:0,cc_lang_pref:"en",wmode:"transparent",modestbranding:1,disablekb:1,origin:"*"},events:{onError:function(e){M(ot.container,"error",!0,{code:e.data,embed:e.target})},onReady:function(t){var n=t.target;ot.media.play=function(){n.playVideo(),ot.media.paused=!1},ot.media.pause=function(){n.pauseVideo(),ot.media.paused=!0},ot.media.stop=function(){n.stopVideo(),ot.media.paused=!0},ot.media.duration=n.getDuration(),ot.media.paused=!0,ot.media.currentTime=0,ot.media.muted=n.isMuted(),A.title=n.getVideoData().title,ot.supported.full&&ot.media.querySelector("iframe").setAttribute("tabindex","-1"),re(),M(ot.media,"timeupdate"),M(ot.media,"durationchange"),e.clearInterval(st.buffering),st.buffering=e.setInterval(function(){ot.media.buffered=n.getVideoLoadedFraction(),(null===ot.media.lastBuffered||ot.media.lastBuffereda&&(t=a),Oe(t);try{ot.media.currentTime=t.toFixed(4)}catch(o){}if(r(A.types.embed,ot.type)){switch(ot.type){case"youtube":ot.embed.seekTo(t);break;case"vimeo":ot.embed.setCurrentTime(t.toFixed(0));break;case"soundcloud":ot.embed.seekTo(1e3*t)}n&&ue(),M(ot.media,"timeupdate"),ot.media.seeking=!0}lt("Seeking to "+ot.media.currentTime+" seconds"),H(t)}function ye(){var e=parseInt(A.duration),t=0;return null===ot.media.duration||isNaN(ot.media.duration)||(t=ot.media.duration),isNaN(e)?t:e}function be(){p(ot.container,A.classes.playing,!ot.media.paused),p(ot.container,A.classes.stopped,ot.media.paused),Ze(ot.media.paused)}function ge(){I={x:e.pageXOffset||0,y:e.pageYOffset||0}}function ve(){e.scrollTo(I.x,I.y)}function he(e){ot.isZoom=!ot.isZoom,p(ot.zoomContainer,A.classes.zoom.active,ot.isZoom),t.body.style.overflow=ot.isZoom?"hidden":"",ot.buttons&&ot.buttons.zoom&&_(ot.buttons.zoom,ot.isZoom),M(ot.container,ot.isZoom?"enterzoom":"exitzoom",!0)}function _e(e){var n=N.fullscreen;if(n){if(!e||e.type!==S.eventType)return S.isFullScreen(ot.fullscreenContainer)?S.cancelFullScreen():(ge(),S.requestFullScreen(ot.fullscreenContainer)),void(ot.isFullscreen=S.isFullScreen(ot.fullscreenContainer));ot.isFullscreen=S.isFullScreen(ot.fullscreenContainer)}else ot.isFullscreen=!ot.isFullscreen,t.body.style.overflow=ot.isFullscreen?"hidden":"";p(ot.fullscreenContainer,A.classes.fullscreen.active,ot.isFullscreen),Z(ot.isFullscreen),ot.buttons&&ot.buttons.fullscreen&&_(ot.buttons.fullscreen,ot.isFullscreen),M(ot.container,ot.isFullscreen?"enterfullscreen":"exitfullscreen",!0),!ot.isFullscreen&&n&&ve()}function ke(e){if(q["boolean"](e)||(e=!ot.media.muted),_(ot.buttons.mute,e),ot.media.muted=e,0===ot.media.volume&&xe(A.volume),r(A.types.embed,ot.type)){switch(ot.type){case"youtube":ot.embed[ot.media.muted?"mute":"unMute"]();break;case"vimeo":case"soundcloud":ot.embed.setVolume(ot.media.muted?0:parseFloat(A.volume/A.volumeMax))}M(ot.media,"volumechange")}}function xe(e){var t=A.volumeMax,n=A.volumeMin;if(q.undefined(e)&&(e=ot.storage.volume),(null===e||isNaN(e))&&(e=A.volume),e>t&&(e=t),e0&&ke()}function we(e){var t=ot.media.muted?0:ot.media.volume*A.volumeMax;q.number(e)||(e=A.volumeStep),xe(t+e)}function Te(e){var t=ot.media.muted?0:ot.media.volume*A.volumeMax;q.number(e)||(e=A.volumeStep),xe(t-e)}function Ce(){var e=ot.media.muted?0:ot.media.volume*A.volumeMax;ot.supported.full&&(ot.volume.input&&(ot.volume.input.value=e),ot.volume.display&&(ot.volume.display.value=e)),te({volume:e}),p(ot.container,A.classes.muted,0===e),ot.supported.full&&ot.buttons.mute&&_(ot.buttons.mute,0===e)}function Ae(e){if(ot.supported.full&&r(A.controls,"captions")){q["boolean"](e)||(e=ot.container.className.indexOf(A.classes.captions.active)===-1),ot.captionsEnabled=e,_(ot.buttons.captions,ot.captionsEnabled),p(ot.container,A.classes.captions.active,ot.captionsEnabled),M(ot.container,ot.captionsEnabled?"captionsenabled":"captionsdisabled",!0),te({captionsEnabled:ot.captionsEnabled});var t=Ie(A.captions.selectedIndex);e&&t?ot.currentCaptionLabel.change(t.label):ot.currentCaptionLabel.change(A.i18n.disableCaptions)}}function Ee(e){A.captions.selectedIndex=e,R(),D()}function Se(){for(var e,t=[],n=0,a=ot.media.childNodes,r=0;r0;ot.secs=("0"+ot.secs).slice(-2),ot.mins=("0"+ot.mins).slice(-2),t.innerHTML=(n?ot.hours+":":"")+ot.mins+":"+ot.secs}}function Le(){if(ot.supported.full){var e=ye()||0;!ot.duration&&A.displayDuration&&ot.media.paused&&Pe(e,ot.currentTime),ot.duration&&Pe(e,ot.duration),je()}}function ze(e){Pe(ot.media.currentTime,ot.currentTime),e&&"timeupdate"===e.type&&ot.media.seeking||Ne(e)}function Oe(e){q.number(e)||(e=0);var t=ye(),n=k(e,t);ot.progress&&ot.progress.played&&(ot.progress.played.value=n),ot.buttons&&ot.buttons.seek&&(ot.buttons.seek.value=n)}function je(e){var t=ye();if(A.tooltips.seek&&ot.progress.container&&0!==t){var n=ot.progress.container.getBoundingClientRect(),a=0,o=A.classes.tooltip+"--visible";if(e)a=100/n.width*(e.pageX-n.left);else{if(!m(ot.progress.tooltip,o))return;a=ot.progress.tooltip.style.left.replace("%","")}a<0?a=0:a>100&&(a=100),Pe(t/100*a,ot.progress.tooltip),ot.progress.tooltip.style.left=a+"%",e&&r(["mouseenter","mouseleave"],e.type)&&p(ot.progress.tooltip,o,"mouseenter"===e.type)}}function Ve(e){q.undefined(e)&&(e=ot.storage.speed||A.defaultSpeed),me(e)}function De(e){var t=!ot.media.paused,n=ot.media.currentTime,a=Array.prototype.slice.call(W("source")),o=Array.prototype.slice.call(W("track"));if(r(A.controls,"quality")!==!1){t&&ue();var s=We(a,e);Je({type:"video",title:ot.media.title,poster:0===n?ot.media.poster:"",tracks:o.map(function(e){return{kind:e.kind,label:e.label,srclang:e.srclang,src:e.src,"default":e["default"] +}}),sources:s.map(function(e){return{src:e.src,type:e.type,label:e.getAttribute("label"),res:e.getAttribute("res")}})});var i=function(e){0!==n&&fe(n),t&&le(),M(ot.media,"qualitychanged"),b(ot.media,"canplay",i,!1)};g(ot.media,"canplay",i),ot.currentQualityLabel.change(e),te({quality:e})}}function Re(){var e=Array.prototype.slice.call(W("source"));return e.length?e[0].hasAttribute("label")?e[0].getAttribute("label"):void ut(" label attribute not found"):void ut(" not found")}function He(e){var t=Array.prototype.slice.call(W("source")),n=t.filter(function(t){return t.getAttribute("label")===e});if(n.length)return n[0].getAttribute("label");var a=Be();return a?a.label:null}function Be(){function e(e,t){return e-t}var t=Array.prototype.slice.call(W("source")),n=ot.media.clientHeight;if(0!==t.length){var a=t.map(function(e){return e.getAttribute("res")}).sort(e),r=Math.min([n].concat(a).sort(e).indexOf(n),a.length-1),o=a[r],s=t.filter(function(e){return e.getAttribute("res")===o})[0];return{label:s.getAttribute("label"),res:+s.getAttribute("res")}}}function We(e,t){if(!e.length)return e;var n,a=-1;for(n=0;n-1))return e;var o=e.splice(a,1);return e.unshift(o[0]),e}function Ye(){var e,t=W("li > button[data-plyr=captions]");for(e=0;e ul",r=Y(a),o=[],s=ot.media.textTracks;for(n=0;n",'",""),i&&ot.currentCaptionLabel.change(s[n].label)}o.push("
  • ",'","
  • "),o=o.join(""),r.insertAdjacentHTML("beforeend",o)}function Ue(){var e,t=720,n=W("li > button[data-plyr=quality]");for(e=0;e ul",r=Y(a),o=[];Array.prototype.slice.call(W("source")).map(function(e){return{label:e.getAttribute("label"),res:+e.getAttribute("res")}}).sort(function(e,t){return e.res&&t.res?t.res-e.res:0}).forEach(function(e,n){var a=He(ot.storage.quality);a&&(o.push("
  • ",'","
  • "))}),o=o.join(""),r.insertAdjacentHTML("beforeend",o)}function Ze(t){if(A.hideControls&&"audio"!==ot.type){var n=0,a=!1,o=!1,s=t,i=m(ot.container,A.classes.loading);if(q["boolean"](t)||(t&&t.type?(a="enterfullscreen"===t.type,o="enterzoom"===t.type,s=r(["mousemove","touchstart","mouseenter","focus"],t.type),r(["mousemove","touchmove"],t.type)&&(n=2e3),"focus"===t.type&&(n=3e3)):s=m(ot.container,A.classes.hideControls)),e.clearTimeout(st.hover),s||ot.media.paused||i){if(p(ot.container,A.classes.hideControls,!1),ot.media.paused||i)return;ot.browser.isTouch&&(n=3e3)}s&&ot.media.paused||(st.hover=e.setTimeout(function(){(!ot.controls.pressed&&!ot.controls.hover||a||o)&&p(ot.container,A.classes.hideControls,!0)},n))}}function Xe(e,t){if(t){var n=ot.storage.quality||Be().label;e.sources=We(e.sources,n)}if(!q.undefined(e))return Je(e),Ye(),void Ue();var a;switch(ot.type){case"youtube":a=ot.embed.getVideoUrl();break;case"vimeo":ot.embed.getVideoUrl.then(function(e){a=e});break;case"soundcloud":ot.embed.getCurrentSound(function(e){a=e.permalink_url});break;default:a=ot.media.currentSrc}return a||""}function Je(e){function n(){if(ot.embed=null,i(ot.media),"video"===ot.type&&ot.videoContainer&&i(ot.videoContainer),ot.container&&ot.container.removeAttribute("class"),"type"in e&&(ot.type=e.type,"video"===ot.type)){var n=e.sources[0];"type"in n&&r(A.types.embed,n.type)&&(ot.type=n.type)}switch(ot.supported=C(ot.type),ot.type){case"video":ot.media=t.createElement("video");break;case"audio":ot.media=t.createElement("audio");break;case"youtube":case"vimeo":case"soundcloud":ot.media=t.createElement("div"),ot.embedId=e.sources[0].src}l(ot.container,ot.media),q["boolean"](e.autoplay)&&(A.autoplay=e.autoplay),r(A.types.html5,ot.type)&&(A.crossorigin&&ot.media.setAttribute("crossorigin",""),A.autoplay&&ot.media.setAttribute("autoplay",""),"poster"in e&&ot.media.setAttribute("poster",e.poster),A.loop&&ot.media.setAttribute("loop","")),p(ot.zoomContainer,A.classes.zoom.active,ot.isZoom),p(ot.fullscreenContainer,A.classes.fullscreen.active,ot.isFullscreen),p(ot.container,A.classes.captions.active,ot.captionsEnabled),G(),r(A.types.html5,ot.type)&&X("source",e.sources),ne(),r(A.types.html5,ot.type)&&("tracks"in e&&X("track",e.tracks),ot.media.load()),(r(A.types.html5,ot.type)||r(A.types.embed,ot.type)&&!ot.supported.full)&&(nt(),at()),A.title=e.title,Q()}return q.object(e)&&"sources"in e&&e.sources.length?(p(ot.container,A.classes.ready,!1),ue(),Oe(),Me(),Qe(),void et(n,!1)):void ut("Invalid source format")}function $e(e){"video"===ot.type&&ot.media.setAttribute("poster",e)}function Ge(){function n(){var e=ce(),t=ot.buttons[e?"play":"pause"],n=ot.buttons[e?"pause":"play"];if(n=n&&n.length>1?n[n.length-1]:n[0]){var a=m(t,A.classes.tabFocus);setTimeout(function(){n.focus(),a&&(p(t,A.classes.tabFocus,!1),p(n,A.classes.tabFocus,!0))},100)}}function a(){var e=t.activeElement;return e=e&&e!==t.body?t.querySelector(":focus"):null}function o(e){return e.keyCode?e.keyCode:e.which}function s(e){for(var t in ot.buttons){var n=ot.buttons[t];if(q.nodeList(n))for(var a=0;a0)&&(t?Te(n):we(n)),(e.deltaY>0||e.deltaX<0)&&(t?we(n):Te(n))})}function Ke(){if(g(ot.media,"timeupdate seeking",ze),g(ot.media,"timeupdate",H),g(ot.media,"durationchange loadedmetadata",Le),g(ot.media,"ended",function(){"video"===ot.type&&A.showPosterOnEnd&&("video"===ot.type&&R(),fe(),ot.media.load())}),g(ot.media,"progress playing",Ne),g(ot.media,"volumechange",Ce),g(ot.media,"play pause ended",be),g(ot.media,"waiting canplay seeked",qe),A.clickToPlay&&"audio"!==ot.type){var e=Y("."+A.classes.videoWrapper);if(!e)return;e.style.cursor="pointer",g(e,"click",function(){A.hideControls&&ot.browser.isTouch&&!ot.media.paused||(ot.media.paused?le():ot.media.ended?(fe(),le()):ue())})}A.disableContextMenu&&g(ot.media,"contextmenu",function(e){e.preventDefault()}),g(ot.media,A.events.concat(["keyup","keydown"]).join(" "),function(e){M(ot.container,e.type,!0)})}function Qe(){if(r(A.types.html5,ot.type)){for(var e=ot.media.querySelectorAll("source"),t=0;t Date: Mon, 7 Nov 2016 13:13:40 +0800 Subject: [PATCH 10/11] fix caption -> captions --- src/js/plyr.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/js/plyr.js b/src/js/plyr.js index dab08b4df..75bdc11eb 100644 --- a/src/js/plyr.js +++ b/src/js/plyr.js @@ -3136,7 +3136,7 @@ '
  • ', '', '
  • ' ); @@ -3151,7 +3151,7 @@ '', '' @@ -3744,7 +3744,7 @@ // Handle menu item if (!_is.htmlElement(target)) { var settingsObj = { - 'data-plyr-caption': _toggleCaptionIndex, + 'data-plyr-captions': _toggleCaptionIndex, 'data-plyr-speed': _speed, 'data-plyr-quality': _setQuality }; From 98f861b69ffbef73d6d751005e92b5c659a83eb0 Mon Sep 17 00:00:00 2001 From: Amo Wu Date: Mon, 7 Nov 2016 13:14:02 +0800 Subject: [PATCH 11/11] build dist --- dist/plyr.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/plyr.js b/dist/plyr.js index e8a74f57b..dad5af7e7 100644 --- a/dist/plyr.js +++ b/dist/plyr.js @@ -1,2 +1,2 @@ !function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=t(e,document):"function"==typeof define&&define.amd?define([],function(){return t(e,document)}):e.plyr=t(e,document)}("undefined"!=typeof window?window:this,function(e,t){"use strict";function n(){var e,n,a,r=navigator.userAgent,o=navigator.appName,s=""+parseFloat(navigator.appVersion),i=parseInt(navigator.appVersion,10),l=!1,u=!1,c=!1,d=!1;return navigator.appVersion.indexOf("Windows NT")!==-1&&navigator.appVersion.indexOf("rv:11")!==-1?(l=!0,o="IE",s="11"):(n=r.indexOf("MSIE"))!==-1?(l=!0,o="IE",s=r.substring(n+5)):(n=r.indexOf("Chrome"))!==-1?(c=!0,o="Chrome",s=r.substring(n+7)):(n=r.indexOf("Safari"))!==-1?(d=!0,o="Safari",s=r.substring(n+7),(n=r.indexOf("Version"))!==-1&&(s=r.substring(n+8))):(n=r.indexOf("Firefox"))!==-1?(u=!0,o="Firefox",s=r.substring(n+8)):(e=r.lastIndexOf(" ")+1)<(n=r.lastIndexOf("/"))&&(o=r.substring(e,n),s=r.substring(n+1),o.toLowerCase()===o.toUpperCase()&&(o=navigator.appName)),(a=s.indexOf(";"))!==-1&&(s=s.substring(0,a)),(a=s.indexOf(" "))!==-1&&(s=s.substring(0,a)),i=parseInt(""+s,10),isNaN(i)&&(s=""+parseFloat(navigator.appVersion),i=parseInt(navigator.appVersion,10)),{name:o,version:i,isIE:l,isFirefox:u,isChrome:c,isSafari:d,isIos:/(iPad|iPhone|iPod)/g.test(navigator.platform),isTouch:"ontouchstart"in t.documentElement}}function a(e){if(!t.querySelectorAll('script[src="'+e+'"]').length){var n=t.createElement("script");n.src=e;var a=t.getElementsByTagName("script")[0];a.parentNode.insertBefore(n,a)}}function r(e,t){return Array.prototype.indexOf&&e.indexOf(t)!==-1}function o(e,t,n){return e.replace(new RegExp(t.replace(/([.*+?\^=!:${}()|\[\]\/\\])/g,"\\$1"),"g"),n)}function s(e,t){e.length||(e=[e]);for(var n=e.length-1;n>=0;n--){var a=n>0?t.cloneNode(!0):t,r=e[n],o=r.parentNode,s=r.nextSibling;return a.appendChild(r),s?o.insertBefore(a,s):o.appendChild(a),a}}function i(e){e&&e.parentNode.removeChild(e)}function l(e,t){e.insertBefore(t,e.firstChild)}function u(e,t){for(var n in t)e.setAttribute(n,q["boolean"](t[n])&&t[n]?"":t[n])}function c(e,n,a){var r=t.createElement(e);u(r,a),l(n,r)}function d(e){return e.replace(".","")}function p(e,t,n){if(e)if(e.classList)e.classList[n?"add":"remove"](t);else{var a=(" "+e.className+" ").replace(/\s+/g," ").replace(" "+t+" ","");e.className=a+(n?" "+t:"")}}function m(e,t){return!!e&&(e.classList?e.classList.contains(t):new RegExp("(\\s|^)"+t+"(\\s|$)").test(e.className))}function f(e,n){var a=Element.prototype,r=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.msMatchesSelector||function(e){return[].indexOf.call(t.querySelectorAll(e),this)!==-1};return r.call(e,n)}function y(e,t,n,a,r){g(e,t,function(t){n&&n.apply(e,[t]),a.apply(e,[t])},r)}function b(e,t,n,a,r){var o=t.split(" ");if(q["boolean"](r)||(r=!1),e instanceof NodeList)for(var s=0;s
    "),r(A.controls,"play-large")&&e.push('"),e.push('
    '),r(A.controls,"progress")&&(e.push('
    ','','','','','',"0% "+A.i18n.buffered,""),A.tooltips.seek&&e.push('00:00'),e.push("","
    ")),e.push('
    ','
    '),r(A.controls,"restart")&&e.push('"),r(A.controls,"rewind")&&e.push('"),r(A.controls,"play")&&e.push('",'"),r(A.controls,"fast-forward")&&e.push('"),r(A.controls,"current-time")&&e.push('',''+A.i18n.currentTime+"",'00:00',""),r(A.controls,"duration")&&e.push('',''+A.i18n.duration+"",'00:00',""),e.push("
    ",'
    '),r(A.controls,"mute")&&e.push('"),r(A.controls,"volume")&&e.push('','",'','',""),r(A.controls,"settings")&&(e.push('
    ','",'","
    ")),r(A.controls,"zoom")&&e.push('"),r(A.controls,"fullscreen")&&e.push('"),e.push("
    ","
    "),e.join("")}function O(){q.string(A.selectors.zoom.container)&&(ot.zoomContainer=t.querySelector(A.selectors.zoom.container)),q.htmlElement(ot.zoomContainer)||(ot.zoomContainer=ot.container),"audio"!==ot.type&&A.zoom.enabled&&(p(ot.zoomContainer,A.classes.zoom.enabled,!0),ot.buttons&&ot.buttons.zoom&&_(ot.buttons.zoom,!1))}function j(){if(ot.supported.full&&(q.string(A.selectors.fullscreen.container)&&(ot.fullscreenContainer=t.querySelector(A.selectors.fullscreen.container)),q.htmlElement(ot.fullscreenContainer)||(ot.fullscreenContainer=ot.container),("audio"!==ot.type||A.fullscreen.allowAudio)&&A.fullscreen.enabled)){var e=N.fullscreen;e||A.fullscreen.fallback&&!U()?(lt((e?"Native":"Fallback")+" fullscreen enabled"),p(ot.fullscreenContainer,A.classes.fullscreen.enabled,!0)):lt("Fullscreen not supported and fallback disabled"),ot.buttons&&ot.buttons.fullscreen&&_(ot.buttons.fullscreen,!1),Z()}}function V(e){q.event(e)&&(e=e.target),e.activeCues[0]&&"text"in e.activeCues[0]?R(e.activeCues[0].getCueAsHTML()):R()}function D(){if("video"===ot.type){Y(A.selectors.captions)||ot.videoContainer.insertAdjacentHTML("afterbegin",'
    '),ot.usingTextTracks=!1,ot.media.textTracks&&(ot.usingTextTracks=!0);var e="",t=Se();if(ot.captionExists=!0,0===t.length?(ot.captionExists=!1,lt("No caption track found")):A.captions.selectedIndex+1>t.length?(ot.captionExists=!1,lt("Caption index out of bound")):(M(ot.media,"captionselected",!0,t[A.captions.selectedIndex]),e=t[A.captions.selectedIndex].src,lt("Caption track found; URI: "+e)),ot.captionExists){var n=ot.media.textTracks;if([].forEach.call(n,function(e){v(e,"cuechange",V),e.mode="hidden"}),B(ot),(ot.browser.isIE&&ot.browser.version>=10||ot.browser.isFirefox&&ot.browser.version>=31)&&(lt("Detected browser with known TextTrack issues - using manual fallback"),ot.usingTextTracks=!1),ot.usingTextTracks){lt("TextTracks supported");var a=n[A.captions.selectedIndex];"captions"!==a.kind&&"subtitles"!==a.kind||(g(a,"cuechange",V),a.activeCues&&a.activeCues.length>0&&V(a))}else if(lt("TextTracks not supported so rendering captions manually"),ot.currentCaption="",ot.captions=[],""!==e){var r=new XMLHttpRequest;r.onreadystatechange=function(){if(4===r.readyState)if(200===r.status){var e,t=[],n=r.responseText,a="\r\n";n.indexOf(a+a)===-1&&(a=n.indexOf("\r\r")!==-1?"\r":"\n"),t=n.split(a+a);for(var o=0;o ");for(var a=0;aot.captions.length-1){ot.subcount=ot.captions.length-1;break}ot.media.currentTime.toFixed(1)>=n(ot.captions[ot.subcount][0])&&ot.media.currentTime.toFixed(1)<=a(ot.captions[ot.subcount][0])?(ot.currentCaption=ot.captions[ot.subcount][1],R(ot.currentCaption)):R()}}function B(){if(ot.buttons.captions){p(ot.container,A.classes.captions.enabled,!0);var e=ot.storage.captionsEnabled;if(q["boolean"](e)||(e=A.captions.defaultActive),e){p(ot.container,A.classes.captions.active,!0),_(ot.buttons.captions,!0);var t=Ie(A.captions.selectedIndex);t&&ot.currentCaptionLabel.change(t.label)}else ot.currentCaptionLabel.change(A.i18n.disableCaptions)}}function W(e){return ot.container.querySelectorAll(e)}function Y(e){return W(e)[0]}function U(){try{return e.self!==e.top}catch(t){return!0}}function Z(){function e(e){9===e.which&&ot.isFullscreen&&(e.target!==a||e.shiftKey?e.target===n&&e.shiftKey&&(e.preventDefault(),a.focus()):(e.preventDefault(),n.focus()))}var t=W("input:not([disabled]), button:not([disabled])"),n=t[0],a=t[t.length-1];g(ot.container,"keydown",e)}function X(e,t){if(q.string(t))c(e,ot.media,{src:t});else if(t.constructor===Array)for(var n=t.length-1;n>=0;n--)c(e,ot.media,t[n])}function J(){function e(e){var n="#plyr-settings-{id}-{setting}-toggle .plyr__menu__btn__value",a=n.replace("{id}",s).replace("{setting}",e),r=t.querySelector(a);return r}if(A.loadSprite){var n=L();n.absolute?(lt("AJAX loading absolute SVG sprite"+(ot.browser.isIE?" (due to IE)":"")),T(n.url,"sprite-plyr")):lt("Sprite will be used as external resource directly")}var a=A.html,s=Math.floor(1e4*Math.random());ot.controlsId=s,lt("Injecting custom controls"),a||(a=z()),a=o(a,"{seektime}",A.seekTime),a=o(a,"{id}",s);var i;if(q.string(A.selectors.controls.container)&&(i=t.querySelector(A.selectors.controls.container)),q.htmlElement(i)||(i=ot.container),i.insertAdjacentHTML("beforeend",a),A.tooltips.controls)for(var l=W([A.selectors.controls.wrapper," ",A.selectors.labels," .",A.classes.hidden].join("")),u=l.length-1;u>=0;u--){var c=l[u];p(c,A.classes.hidden,!1),p(c,A.classes.tooltip,!0)}if(r(A.controls,"speed")){var d=e("speed");ot.currentSpeed=new DataBind(d,"textContent",A.defaultSpeed,"{value}×")}if(r(A.controls,"captions")){var m=e("captions");ot.currentCaptionLabel=new DataBind(m,"textContent",A.i18n.disableCaptions),Ye()}if(r(A.controls,"quality")){var f=e("quality");ot.currentQualityLabel=new DataBind(f,"textContent",Re()),Ue()}}function $(){try{return ot.controls=Y(A.selectors.controls.wrapper),ot.buttons={},ot.buttons.seek=Y(A.selectors.buttons.seek),ot.buttons.play=W(A.selectors.buttons.play),ot.buttons.pause=Y(A.selectors.buttons.pause),ot.buttons.restart=Y(A.selectors.buttons.restart),ot.buttons.rewind=Y(A.selectors.buttons.rewind),ot.buttons.forward=Y(A.selectors.buttons.forward),ot.buttons.zoom=Y(A.selectors.buttons.zoom),ot.buttons.fullscreen=Y(A.selectors.buttons.fullscreen),ot.buttons.settings=Y(A.selectors.buttons.settings),ot.buttons.mute=Y(A.selectors.buttons.mute),ot.buttons.captions=Y(A.selectors.buttons.captions),ot.progress={},ot.progress.container=Y(A.selectors.progress.container),ot.progress.buffer={},ot.progress.buffer.bar=Y(A.selectors.progress.buffer),ot.progress.buffer.text=ot.progress.buffer.bar&&ot.progress.buffer.bar.getElementsByTagName("span")[0],ot.progress.played=Y(A.selectors.progress.played),ot.progress.tooltip=ot.progress.container&&ot.progress.container.querySelector("."+A.classes.tooltip),ot.volume={},ot.volume.input=Y(A.selectors.volume.input),ot.volume.display=Y(A.selectors.volume.display),ot.duration=Y(A.selectors.duration),ot.currentTime=Y(A.selectors.currentTime),ot.seekTime=W(A.selectors.seekTime),!0}catch(e){return ut("It looks like there is a problem with your controls HTML"),K(!0),!1}}function G(){p(ot.container,A.selectors.container.replace(".",""),ot.supported.full)}function K(e){e&&r(A.types.html5,ot.type)?ot.media.setAttribute("controls",""):ot.media.removeAttribute("controls")}function Q(e){var t=A.i18n.play;if(q.string(A.title)&&A.title.length&&(t+=", "+A.title,ot.container.setAttribute("aria-label",A.title)),ot.supported.full&&ot.buttons.play)for(var n=ot.buttons.play.length-1;n>=0;n--)ot.buttons.play[n].setAttribute("aria-label",t);q.htmlElement(e)&&e.setAttribute("title",A.i18n.frameTitle.replace("{title}",A.title))}function ee(){var t=null;ot.storage={},N.storage&&A.storage.enabled&&(e.localStorage.removeItem("plyr-volume"),t=e.localStorage.getItem(A.storage.key),t&&(/^\d+(\.\d+)?$/.test(t)?te({volume:parseFloat(t)}):ot.storage=JSON.parse(t)))}function te(t){N.storage&&A.storage.enabled&&(x(ot.storage,t),e.localStorage.setItem(A.storage.key,JSON.stringify(ot.storage)))}function ne(){if(!ot.media)return void ut("No media element found!");if(ot.supported.full&&(p(ot.container,A.classes.type.replace("{0}",ot.type),!0),r(A.types.embed,ot.type)&&p(ot.container,A.classes.type.replace("{0}","video"),!0),p(ot.container,A.classes.pip.enabled,N.pip(ot)),p(ot.container,A.classes.stopped,A.autoplay),p(ot.ontainer,A.classes.isIos,ot.browser.isIos),p(ot.container,A.classes.isTouch,ot.browser.isTouch),"video"===ot.type)){var e=t.createElement("div");e.setAttribute("class",A.classes.videoWrapper),s(ot.media,e),ot.videoContainer=e}r(A.types.embed,ot.type)&&ae()}function ae(){for(var n=t.createElement("div"),r=ot.embedId,o=ot.type+"-"+Math.floor(1e4*Math.random()),s=W('[id^="'+ot.type+'-"]'),l=s.length-1;l>=0;l--)i(s[l]);if(p(ot.media,A.classes.videoWrapper,!0),p(ot.media,A.classes.embedWrapper,!0),"youtube"===ot.type)ot.media.appendChild(n),n.setAttribute("id",o),q.object(e.YT)?oe(r,n):(a(A.urls.youtube.api),e.onYouTubeReadyCallbacks=e.onYouTubeReadyCallbacks||[],e.onYouTubeReadyCallbacks.push(function(){oe(r,n)}),e.onYouTubeIframeAPIReady=function(){e.onYouTubeReadyCallbacks.forEach(function(e){e()})});else if("vimeo"===ot.type)if(ot.supported.full?ot.media.appendChild(n):n=ot.media,n.setAttribute("id",o),q.object(e.Vimeo))se(r,n);else{a(A.urls.vimeo.api);var c=e.setInterval(function(){q.object(e.Vimeo)&&(e.clearInterval(c),se(r,n))},50)}else if("soundcloud"===ot.type){var d=t.createElement("iframe");d.loaded=!1,g(d,"load",function(){d.loaded=!0}),u(d,{src:"https://w.soundcloud.com/player/?url=https://api.soundcloud.com/tracks/"+r,id:o}),n.appendChild(d),ot.media.appendChild(n),e.SC||a(A.urls.soundcloud.api);var m=e.setInterval(function(){e.SC&&d.loaded&&(e.clearInterval(m),ie.call(d))},50)}}function re(){ot.supported.full&&(nt(),at()),Q(Y("iframe"))}function oe(t,n){ot.embed=new e.YT.Player(n.id,{videoId:t,playerVars:{autoplay:A.autoplay?1:0,controls:ot.supported.full?0:1,rel:0,showinfo:0,iv_load_policy:3,cc_load_policy:A.captions.defaultActive?1:0,cc_lang_pref:"en",wmode:"transparent",modestbranding:1,disablekb:1,origin:"*"},events:{onError:function(e){M(ot.container,"error",!0,{code:e.data,embed:e.target})},onReady:function(t){var n=t.target;ot.media.play=function(){n.playVideo(),ot.media.paused=!1},ot.media.pause=function(){n.pauseVideo(),ot.media.paused=!0},ot.media.stop=function(){n.stopVideo(),ot.media.paused=!0},ot.media.duration=n.getDuration(),ot.media.paused=!0,ot.media.currentTime=0,ot.media.muted=n.isMuted(),A.title=n.getVideoData().title,ot.supported.full&&ot.media.querySelector("iframe").setAttribute("tabindex","-1"),re(),M(ot.media,"timeupdate"),M(ot.media,"durationchange"),e.clearInterval(st.buffering),st.buffering=e.setInterval(function(){ot.media.buffered=n.getVideoLoadedFraction(),(null===ot.media.lastBuffered||ot.media.lastBuffereda&&(t=a),Oe(t);try{ot.media.currentTime=t.toFixed(4)}catch(o){}if(r(A.types.embed,ot.type)){switch(ot.type){case"youtube":ot.embed.seekTo(t);break;case"vimeo":ot.embed.setCurrentTime(t.toFixed(0));break;case"soundcloud":ot.embed.seekTo(1e3*t)}n&&ue(),M(ot.media,"timeupdate"),ot.media.seeking=!0}lt("Seeking to "+ot.media.currentTime+" seconds"),H(t)}function ye(){var e=parseInt(A.duration),t=0;return null===ot.media.duration||isNaN(ot.media.duration)||(t=ot.media.duration),isNaN(e)?t:e}function be(){p(ot.container,A.classes.playing,!ot.media.paused),p(ot.container,A.classes.stopped,ot.media.paused),Ze(ot.media.paused)}function ge(){I={x:e.pageXOffset||0,y:e.pageYOffset||0}}function ve(){e.scrollTo(I.x,I.y)}function he(e){ot.isZoom=!ot.isZoom,p(ot.zoomContainer,A.classes.zoom.active,ot.isZoom),t.body.style.overflow=ot.isZoom?"hidden":"",ot.buttons&&ot.buttons.zoom&&_(ot.buttons.zoom,ot.isZoom),M(ot.container,ot.isZoom?"enterzoom":"exitzoom",!0)}function _e(e){var n=N.fullscreen;if(n){if(!e||e.type!==S.eventType)return S.isFullScreen(ot.fullscreenContainer)?S.cancelFullScreen():(ge(),S.requestFullScreen(ot.fullscreenContainer)),void(ot.isFullscreen=S.isFullScreen(ot.fullscreenContainer));ot.isFullscreen=S.isFullScreen(ot.fullscreenContainer)}else ot.isFullscreen=!ot.isFullscreen,t.body.style.overflow=ot.isFullscreen?"hidden":"";p(ot.fullscreenContainer,A.classes.fullscreen.active,ot.isFullscreen),Z(ot.isFullscreen),ot.buttons&&ot.buttons.fullscreen&&_(ot.buttons.fullscreen,ot.isFullscreen),M(ot.container,ot.isFullscreen?"enterfullscreen":"exitfullscreen",!0),!ot.isFullscreen&&n&&ve()}function ke(e){if(q["boolean"](e)||(e=!ot.media.muted),_(ot.buttons.mute,e),ot.media.muted=e,0===ot.media.volume&&xe(A.volume),r(A.types.embed,ot.type)){switch(ot.type){case"youtube":ot.embed[ot.media.muted?"mute":"unMute"]();break;case"vimeo":case"soundcloud":ot.embed.setVolume(ot.media.muted?0:parseFloat(A.volume/A.volumeMax))}M(ot.media,"volumechange")}}function xe(e){var t=A.volumeMax,n=A.volumeMin;if(q.undefined(e)&&(e=ot.storage.volume),(null===e||isNaN(e))&&(e=A.volume),e>t&&(e=t),e0&&ke()}function we(e){var t=ot.media.muted?0:ot.media.volume*A.volumeMax;q.number(e)||(e=A.volumeStep),xe(t+e)}function Te(e){var t=ot.media.muted?0:ot.media.volume*A.volumeMax;q.number(e)||(e=A.volumeStep),xe(t-e)}function Ce(){var e=ot.media.muted?0:ot.media.volume*A.volumeMax;ot.supported.full&&(ot.volume.input&&(ot.volume.input.value=e),ot.volume.display&&(ot.volume.display.value=e)),te({volume:e}),p(ot.container,A.classes.muted,0===e),ot.supported.full&&ot.buttons.mute&&_(ot.buttons.mute,0===e)}function Ae(e){if(ot.supported.full&&r(A.controls,"captions")){q["boolean"](e)||(e=ot.container.className.indexOf(A.classes.captions.active)===-1),ot.captionsEnabled=e,_(ot.buttons.captions,ot.captionsEnabled),p(ot.container,A.classes.captions.active,ot.captionsEnabled),M(ot.container,ot.captionsEnabled?"captionsenabled":"captionsdisabled",!0),te({captionsEnabled:ot.captionsEnabled});var t=Ie(A.captions.selectedIndex);e&&t?ot.currentCaptionLabel.change(t.label):ot.currentCaptionLabel.change(A.i18n.disableCaptions)}}function Ee(e){A.captions.selectedIndex=e,R(),D()}function Se(){for(var e,t=[],n=0,a=ot.media.childNodes,r=0;r0;ot.secs=("0"+ot.secs).slice(-2),ot.mins=("0"+ot.mins).slice(-2),t.innerHTML=(n?ot.hours+":":"")+ot.mins+":"+ot.secs}}function Le(){if(ot.supported.full){var e=ye()||0;!ot.duration&&A.displayDuration&&ot.media.paused&&Pe(e,ot.currentTime),ot.duration&&Pe(e,ot.duration),je()}}function ze(e){Pe(ot.media.currentTime,ot.currentTime),e&&"timeupdate"===e.type&&ot.media.seeking||Ne(e)}function Oe(e){q.number(e)||(e=0);var t=ye(),n=k(e,t);ot.progress&&ot.progress.played&&(ot.progress.played.value=n),ot.buttons&&ot.buttons.seek&&(ot.buttons.seek.value=n)}function je(e){var t=ye();if(A.tooltips.seek&&ot.progress.container&&0!==t){var n=ot.progress.container.getBoundingClientRect(),a=0,o=A.classes.tooltip+"--visible";if(e)a=100/n.width*(e.pageX-n.left);else{if(!m(ot.progress.tooltip,o))return;a=ot.progress.tooltip.style.left.replace("%","")}a<0?a=0:a>100&&(a=100),Pe(t/100*a,ot.progress.tooltip),ot.progress.tooltip.style.left=a+"%",e&&r(["mouseenter","mouseleave"],e.type)&&p(ot.progress.tooltip,o,"mouseenter"===e.type)}}function Ve(e){q.undefined(e)&&(e=ot.storage.speed||A.defaultSpeed),me(e)}function De(e){var t=!ot.media.paused,n=ot.media.currentTime,a=Array.prototype.slice.call(W("source")),o=Array.prototype.slice.call(W("track"));if(r(A.controls,"quality")!==!1){t&&ue();var s=We(a,e);Je({type:"video",title:ot.media.title,poster:0===n?ot.media.poster:"",tracks:o.map(function(e){return{kind:e.kind,label:e.label,srclang:e.srclang,src:e.src,"default":e["default"] -}}),sources:s.map(function(e){return{src:e.src,type:e.type,label:e.getAttribute("label"),res:e.getAttribute("res")}})});var i=function(e){0!==n&&fe(n),t&&le(),M(ot.media,"qualitychanged"),b(ot.media,"canplay",i,!1)};g(ot.media,"canplay",i),ot.currentQualityLabel.change(e),te({quality:e})}}function Re(){var e=Array.prototype.slice.call(W("source"));return e.length?e[0].hasAttribute("label")?e[0].getAttribute("label"):void ut(" label attribute not found"):void ut(" not found")}function He(e){var t=Array.prototype.slice.call(W("source")),n=t.filter(function(t){return t.getAttribute("label")===e});if(n.length)return n[0].getAttribute("label");var a=Be();return a?a.label:null}function Be(){function e(e,t){return e-t}var t=Array.prototype.slice.call(W("source")),n=ot.media.clientHeight;if(0!==t.length){var a=t.map(function(e){return e.getAttribute("res")}).sort(e),r=Math.min([n].concat(a).sort(e).indexOf(n),a.length-1),o=a[r],s=t.filter(function(e){return e.getAttribute("res")===o})[0];return{label:s.getAttribute("label"),res:+s.getAttribute("res")}}}function We(e,t){if(!e.length)return e;var n,a=-1;for(n=0;n-1))return e;var o=e.splice(a,1);return e.unshift(o[0]),e}function Ye(){var e,t=W("li > button[data-plyr=captions]");for(e=0;e ul",r=Y(a),o=[],s=ot.media.textTracks;for(n=0;n",'",""),i&&ot.currentCaptionLabel.change(s[n].label)}o.push("
  • ",'","
  • "),o=o.join(""),r.insertAdjacentHTML("beforeend",o)}function Ue(){var e,t=720,n=W("li > button[data-plyr=quality]");for(e=0;e ul",r=Y(a),o=[];Array.prototype.slice.call(W("source")).map(function(e){return{label:e.getAttribute("label"),res:+e.getAttribute("res")}}).sort(function(e,t){return e.res&&t.res?t.res-e.res:0}).forEach(function(e,n){var a=He(ot.storage.quality);a&&(o.push("
  • ",'","
  • "))}),o=o.join(""),r.insertAdjacentHTML("beforeend",o)}function Ze(t){if(A.hideControls&&"audio"!==ot.type){var n=0,a=!1,o=!1,s=t,i=m(ot.container,A.classes.loading);if(q["boolean"](t)||(t&&t.type?(a="enterfullscreen"===t.type,o="enterzoom"===t.type,s=r(["mousemove","touchstart","mouseenter","focus"],t.type),r(["mousemove","touchmove"],t.type)&&(n=2e3),"focus"===t.type&&(n=3e3)):s=m(ot.container,A.classes.hideControls)),e.clearTimeout(st.hover),s||ot.media.paused||i){if(p(ot.container,A.classes.hideControls,!1),ot.media.paused||i)return;ot.browser.isTouch&&(n=3e3)}s&&ot.media.paused||(st.hover=e.setTimeout(function(){(!ot.controls.pressed&&!ot.controls.hover||a||o)&&p(ot.container,A.classes.hideControls,!0)},n))}}function Xe(e,t){if(t){var n=ot.storage.quality||Be().label;e.sources=We(e.sources,n)}if(!q.undefined(e))return Je(e),Ye(),void Ue();var a;switch(ot.type){case"youtube":a=ot.embed.getVideoUrl();break;case"vimeo":ot.embed.getVideoUrl.then(function(e){a=e});break;case"soundcloud":ot.embed.getCurrentSound(function(e){a=e.permalink_url});break;default:a=ot.media.currentSrc}return a||""}function Je(e){function n(){if(ot.embed=null,i(ot.media),"video"===ot.type&&ot.videoContainer&&i(ot.videoContainer),ot.container&&ot.container.removeAttribute("class"),"type"in e&&(ot.type=e.type,"video"===ot.type)){var n=e.sources[0];"type"in n&&r(A.types.embed,n.type)&&(ot.type=n.type)}switch(ot.supported=C(ot.type),ot.type){case"video":ot.media=t.createElement("video");break;case"audio":ot.media=t.createElement("audio");break;case"youtube":case"vimeo":case"soundcloud":ot.media=t.createElement("div"),ot.embedId=e.sources[0].src}l(ot.container,ot.media),q["boolean"](e.autoplay)&&(A.autoplay=e.autoplay),r(A.types.html5,ot.type)&&(A.crossorigin&&ot.media.setAttribute("crossorigin",""),A.autoplay&&ot.media.setAttribute("autoplay",""),"poster"in e&&ot.media.setAttribute("poster",e.poster),A.loop&&ot.media.setAttribute("loop","")),p(ot.zoomContainer,A.classes.zoom.active,ot.isZoom),p(ot.fullscreenContainer,A.classes.fullscreen.active,ot.isFullscreen),p(ot.container,A.classes.captions.active,ot.captionsEnabled),G(),r(A.types.html5,ot.type)&&X("source",e.sources),ne(),r(A.types.html5,ot.type)&&("tracks"in e&&X("track",e.tracks),ot.media.load()),(r(A.types.html5,ot.type)||r(A.types.embed,ot.type)&&!ot.supported.full)&&(nt(),at()),A.title=e.title,Q()}return q.object(e)&&"sources"in e&&e.sources.length?(p(ot.container,A.classes.ready,!1),ue(),Oe(),Me(),Qe(),void et(n,!1)):void ut("Invalid source format")}function $e(e){"video"===ot.type&&ot.media.setAttribute("poster",e)}function Ge(){function n(){var e=ce(),t=ot.buttons[e?"play":"pause"],n=ot.buttons[e?"pause":"play"];if(n=n&&n.length>1?n[n.length-1]:n[0]){var a=m(t,A.classes.tabFocus);setTimeout(function(){n.focus(),a&&(p(t,A.classes.tabFocus,!1),p(n,A.classes.tabFocus,!0))},100)}}function a(){var e=t.activeElement;return e=e&&e!==t.body?t.querySelector(":focus"):null}function o(e){return e.keyCode?e.keyCode:e.which}function s(e){for(var t in ot.buttons){var n=ot.buttons[t];if(q.nodeList(n))for(var a=0;a0)&&(t?Te(n):we(n)),(e.deltaY>0||e.deltaX<0)&&(t?we(n):Te(n))})}function Ke(){if(g(ot.media,"timeupdate seeking",ze),g(ot.media,"timeupdate",H),g(ot.media,"durationchange loadedmetadata",Le),g(ot.media,"ended",function(){"video"===ot.type&&A.showPosterOnEnd&&("video"===ot.type&&R(),fe(),ot.media.load())}),g(ot.media,"progress playing",Ne),g(ot.media,"volumechange",Ce),g(ot.media,"play pause ended",be),g(ot.media,"waiting canplay seeked",qe),A.clickToPlay&&"audio"!==ot.type){var e=Y("."+A.classes.videoWrapper);if(!e)return;e.style.cursor="pointer",g(e,"click",function(){A.hideControls&&ot.browser.isTouch&&!ot.media.paused||(ot.media.paused?le():ot.media.ended?(fe(),le()):ue())})}A.disableContextMenu&&g(ot.media,"contextmenu",function(e){e.preventDefault()}),g(ot.media,A.events.concat(["keyup","keydown"]).join(" "),function(e){M(ot.container,e.type,!0)})}function Qe(){if(r(A.types.html5,ot.type)){for(var e=ot.media.querySelectorAll("source"),t=0;t label attribute not found"):void ut(" not found")}function He(e){var t=Array.prototype.slice.call(W("source")),n=t.filter(function(t){return t.getAttribute("label")===e});if(n.length)return n[0].getAttribute("label");var a=Be();return a?a.label:null}function Be(){function e(e,t){return e-t}var t=Array.prototype.slice.call(W("source")),n=ot.media.clientHeight;if(0!==t.length){var a=t.map(function(e){return e.getAttribute("res")}).sort(e),r=Math.min([n].concat(a).sort(e).indexOf(n),a.length-1),o=a[r],s=t.filter(function(e){return e.getAttribute("res")===o})[0];return{label:s.getAttribute("label"),res:+s.getAttribute("res")}}}function We(e,t){if(!e.length)return e;var n,a=-1;for(n=0;n-1))return e;var o=e.splice(a,1);return e.unshift(o[0]),e}function Ye(){var e,t=W("li > button[data-plyr=captions]");for(e=0;e ul",r=Y(a),o=[],s=ot.media.textTracks;for(n=0;n",'",""),i&&ot.currentCaptionLabel.change(s[n].label)}o.push("
  • ",'","
  • "),o=o.join(""),r.insertAdjacentHTML("beforeend",o)}function Ue(){var e,t=720,n=W("li > button[data-plyr=quality]");for(e=0;e ul",r=Y(a),o=[];Array.prototype.slice.call(W("source")).map(function(e){return{label:e.getAttribute("label"),res:+e.getAttribute("res")}}).sort(function(e,t){return e.res&&t.res?t.res-e.res:0}).forEach(function(e,n){var a=He(ot.storage.quality);a&&(o.push("
  • ",'","
  • "))}),o=o.join(""),r.insertAdjacentHTML("beforeend",o)}function Ze(t){if(A.hideControls&&"audio"!==ot.type){var n=0,a=!1,o=!1,s=t,i=m(ot.container,A.classes.loading);if(q["boolean"](t)||(t&&t.type?(a="enterfullscreen"===t.type,o="enterzoom"===t.type,s=r(["mousemove","touchstart","mouseenter","focus"],t.type),r(["mousemove","touchmove"],t.type)&&(n=2e3),"focus"===t.type&&(n=3e3)):s=m(ot.container,A.classes.hideControls)),e.clearTimeout(st.hover),s||ot.media.paused||i){if(p(ot.container,A.classes.hideControls,!1),ot.media.paused||i)return;ot.browser.isTouch&&(n=3e3)}s&&ot.media.paused||(st.hover=e.setTimeout(function(){(!ot.controls.pressed&&!ot.controls.hover||a||o)&&p(ot.container,A.classes.hideControls,!0)},n))}}function Xe(e,t){if(t){var n=ot.storage.quality||Be().label;e.sources=We(e.sources,n)}if(!q.undefined(e))return Je(e),Ye(),void Ue();var a;switch(ot.type){case"youtube":a=ot.embed.getVideoUrl();break;case"vimeo":ot.embed.getVideoUrl.then(function(e){a=e});break;case"soundcloud":ot.embed.getCurrentSound(function(e){a=e.permalink_url});break;default:a=ot.media.currentSrc}return a||""}function Je(e){function n(){if(ot.embed=null,i(ot.media),"video"===ot.type&&ot.videoContainer&&i(ot.videoContainer),ot.container&&ot.container.removeAttribute("class"),"type"in e&&(ot.type=e.type,"video"===ot.type)){var n=e.sources[0];"type"in n&&r(A.types.embed,n.type)&&(ot.type=n.type)}switch(ot.supported=C(ot.type),ot.type){case"video":ot.media=t.createElement("video");break;case"audio":ot.media=t.createElement("audio");break;case"youtube":case"vimeo":case"soundcloud":ot.media=t.createElement("div"),ot.embedId=e.sources[0].src}l(ot.container,ot.media),q["boolean"](e.autoplay)&&(A.autoplay=e.autoplay),r(A.types.html5,ot.type)&&(A.crossorigin&&ot.media.setAttribute("crossorigin",""),A.autoplay&&ot.media.setAttribute("autoplay",""),"poster"in e&&ot.media.setAttribute("poster",e.poster),A.loop&&ot.media.setAttribute("loop","")),p(ot.zoomContainer,A.classes.zoom.active,ot.isZoom),p(ot.fullscreenContainer,A.classes.fullscreen.active,ot.isFullscreen),p(ot.container,A.classes.captions.active,ot.captionsEnabled),G(),r(A.types.html5,ot.type)&&X("source",e.sources),ne(),r(A.types.html5,ot.type)&&("tracks"in e&&X("track",e.tracks),ot.media.load()),(r(A.types.html5,ot.type)||r(A.types.embed,ot.type)&&!ot.supported.full)&&(nt(),at()),A.title=e.title,Q()}return q.object(e)&&"sources"in e&&e.sources.length?(p(ot.container,A.classes.ready,!1),ue(),Oe(),Me(),Qe(),void et(n,!1)):void ut("Invalid source format")}function $e(e){"video"===ot.type&&ot.media.setAttribute("poster",e)}function Ge(){function n(){var e=ce(),t=ot.buttons[e?"play":"pause"],n=ot.buttons[e?"pause":"play"];if(n=n&&n.length>1?n[n.length-1]:n[0]){var a=m(t,A.classes.tabFocus);setTimeout(function(){n.focus(),a&&(p(t,A.classes.tabFocus,!1),p(n,A.classes.tabFocus,!0))},100)}}function a(){var e=t.activeElement;return e=e&&e!==t.body?t.querySelector(":focus"):null}function o(e){return e.keyCode?e.keyCode:e.which}function s(e){for(var t in ot.buttons){var n=ot.buttons[t];if(q.nodeList(n))for(var a=0;a0)&&(t?Te(n):we(n)),(e.deltaY>0||e.deltaX<0)&&(t?we(n):Te(n))})}function Ke(){if(g(ot.media,"timeupdate seeking",ze),g(ot.media,"timeupdate",H),g(ot.media,"durationchange loadedmetadata",Le),g(ot.media,"ended",function(){"video"===ot.type&&A.showPosterOnEnd&&("video"===ot.type&&R(),fe(),ot.media.load())}),g(ot.media,"progress playing",Ne),g(ot.media,"volumechange",Ce),g(ot.media,"play pause ended",be),g(ot.media,"waiting canplay seeked",qe),A.clickToPlay&&"audio"!==ot.type){var e=Y("."+A.classes.videoWrapper);if(!e)return;e.style.cursor="pointer",g(e,"click",function(){A.hideControls&&ot.browser.isTouch&&!ot.media.paused||(ot.media.paused?le():ot.media.ended?(fe(),le()):ue())})}A.disableContextMenu&&g(ot.media,"contextmenu",function(e){e.preventDefault()}),g(ot.media,A.events.concat(["keyup","keydown"]).join(" "),function(e){M(ot.container,e.type,!0)})}function Qe(){if(r(A.types.html5,ot.type)){for(var e=ot.media.querySelectorAll("source"),t=0;t