(function(u,p){"use strict";typeof module=="object"&&typeof module.exports=="object"?module.exports=p(u,document):typeof define=="function"&&define.amd?define([],function(){return p(u,document)}):u.plyr=p(u,document)})(typeof window!="undefined"?window:this,function(u,p){"use strict";function D(){var r,t,s,l=navigator.userAgent,d=navigator.appName,m=""+parseFloat(navigator.appVersion),x=parseInt(navigator.appVersion,10),k=!1,T=!1,R=!1,q=!1;return navigator.appVersion.indexOf("Windows NT")!==-1&&navigator.appVersion.indexOf("rv:11")!==-1?(k=!0,d="IE",m="11"):(t=l.indexOf("MSIE"))!==-1?(k=!0,d="IE",m=l.substring(t+5)):(t=l.indexOf("Chrome"))!==-1?(R=!0,d="Chrome",m=l.substring(t+7)):(t=l.indexOf("Safari"))!==-1?(q=!0,d="Safari",m=l.substring(t+7),(t=l.indexOf("Version"))!==-1&&(m=l.substring(t+8))):(t=l.indexOf("Firefox"))!==-1?(T=!0,d="Firefox",m=l.substring(t+8)):(r=l.lastIndexOf(" ")+1)<(t=l.lastIndexOf("/"))&&(d=l.substring(r,t),m=l.substring(t+1),d.toLowerCase()===d.toUpperCase()&&(d=navigator.appName)),(s=m.indexOf(";"))!==-1&&(m=m.substring(0,s)),(s=m.indexOf(" "))!==-1&&(m=m.substring(0,s)),x=parseInt(""+m,10),isNaN(x)&&(m=""+parseFloat(navigator.appVersion),x=parseInt(navigator.appVersion,10)),{name:d,version:x,isIE:k,isFirefox:T,isChrome:R,isSafari:q,isIos:/(iPad|iPhone|iPod)/g.test(navigator.platform),isIphone:/(iPhone|iPod)/g.test(navigator.userAgent),isTouch:"ontouchstart"in p.documentElement}}function re(r,t){var s=r.media;if(r.type==="video")switch(t){case"video/webm":return!(!s.canPlayType||!s.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/no/,""));case"video/mp4":return!(!s.canPlayType||!s.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"').replace(/no/,""));case"video/ogg":return!(!s.canPlayType||!s.canPlayType('video/ogg; codecs="theora"').replace(/no/,""))}else if(r.type==="audio")switch(t){case"audio/mpeg":return!(!s.canPlayType||!s.canPlayType("audio/mpeg;").replace(/no/,""));case"audio/ogg":return!(!s.canPlayType||!s.canPlayType('audio/ogg; codecs="vorbis"').replace(/no/,""));case"audio/wav":return!(!s.canPlayType||!s.canPlayType('audio/wav; codecs="1"').replace(/no/,""))}return!1}function de(r){if(!p.querySelectorAll('script[src="'+r+'"]').length){var t=p.createElement("script");t.src=r;var s=p.getElementsByTagName("script")[0];s.parentNode.insertBefore(t,s)}}function v(r,t){return Array.prototype.indexOf&&r.indexOf(t)!==-1}function Fe(r,t,s){return r.replace(new RegExp(t.replace(/([.*+?\^=!:${}()|\[\]\/\\])/g,"\\$1"),"g"),s)}function Ae(r,t){r.length||(r=[r]);for(var s=r.length-1;s>=0;s--){var l=s>0?t.cloneNode(!0):t,d=r[s],m=d.parentNode,x=d.nextSibling;return l.appendChild(d),x?m.insertBefore(l,x):m.appendChild(l),l}}function X(r){r&&r.parentNode.removeChild(r)}function Ie(r,t){r.insertBefore(t,r.firstChild)}function Ne(r,t){for(var s in t)r.setAttribute(s,i.boolean(t[s])&&t[s]?"":t[s])}function Pe(r,t,s){var l=p.createElement(r);Ne(l,s),Ie(t,l)}function Ge(r){return r.replace(".","")}function g(r,t,s){if(r)if(r.classList)r.classList[s?"add":"remove"](t);else{var l=(" "+r.className+" ").replace(/\s+/g," ").replace(" "+t+" ","");r.className=l+(s?" "+t:"")}}function W(r,t){return!!r&&(r.classList?r.classList.contains(t):new RegExp("(\\s|^)"+t+"(\\s|$)").test(r.className))}function Me(r,t){var s=Element.prototype,l=s.matches||s.webkitMatchesSelector||s.mozMatchesSelector||s.msMatchesSelector||function(d){return[].indexOf.call(p.querySelectorAll(d),this)!==-1};return l.call(r,t)}function V(r,t,s,l,d){h(r,t,function(m){s&&s.apply(r,[m]),l.apply(r,[m])},d)}function Oe(r,t,s,l,d){var m=t.split(" ");if(i.boolean(d)||(d=!1),r instanceof NodeList)for(var x=0;x','',''+t.i18n.play+"",""),n.push('
'),v(t.controls,"restart")&&n.push('"),v(t.controls,"rewind")&&n.push('"),v(t.controls,"play")&&n.push('",'"),v(t.controls,"fast-forward")&&n.push('"),v(t.controls,"progress")&&(n.push('','','','','',"0% "+t.i18n.buffered,""),t.tooltips.seek&&n.push('00:00'),n.push("")),v(t.controls,"current-time")&&n.push('',''+t.i18n.currentTime+"",'00:00',""),v(t.controls,"duration")&&n.push('',''+t.i18n.duration+"",'00:00',""),v(t.controls,"mute")&&n.push('"),v(t.controls,"volume")&&n.push('','",'','',""),v(t.controls,"captions")&&n.push('"),v(t.controls,"fullscreen")&&n.push('"),n.push("
"),n.join("")}function x(){if(e.supported.full&&(e.type!=="audio"||t.fullscreen.allowAudio)&&t.fullscreen.enabled){var n=O.supportsFullScreen;n||t.fullscreen.fallback&&!fe()?(N((n?"Native":"Fallback")+" fullscreen enabled"),g(e.container,t.classes.fullscreen.enabled,!0)):N("Fullscreen not supported and fallback disabled"),e.buttons&&e.buttons.fullscreen&&$(e.buttons.fullscreen,!1),Q()}}function k(){if(e.type==="video"){w(t.selectors.captions)||e.videoContainer.insertAdjacentHTML("afterbegin",'
'),e.usingTextTracks=!1,e.media.textTracks&&(e.usingTextTracks=!0);for(var n,a="",o=e.media.childNodes,c=0;c=10||e.browser.isFirefox&&e.browser.version>=31)&&(N("Detected browser with known TextTrack issues - using manual fallback"),e.usingTextTracks=!1),e.usingTextTracks){N("TextTracks supported");for(var C=0;C ");for(var _=0;_e.captions.length-1){e.subcount=e.captions.length-1;break}e.media.currentTime.toFixed(1)>=o(e.captions[e.subcount][0])&&e.media.currentTime.toFixed(1)<=c(e.captions[e.subcount][0])?(e.currentCaption=e.captions[e.subcount][1],T(e.currentCaption)):T()}}function q(){if(e.buttons.captions){g(e.container,t.classes.captions.enabled,!0);var n=e.storage.captionsEnabled;i.boolean(n)||(n=t.captions.defaultActive),n&&(g(e.container,t.classes.captions.active,!0),$(e.buttons.captions,!0))}}function P(n){return e.container.querySelectorAll(n)}function w(n){return P(n)[0]}function fe(){try{return u.self!==u.top}catch(n){return!0}}function Q(){function n(f){f.which===9&&e.isFullscreen&&(f.target!==c||f.shiftKey?f.target===o&&f.shiftKey&&(f.preventDefault(),c.focus()):(f.preventDefault(),o.focus()))}var a=P("input:not([disabled]), button:not([disabled])"),o=a[0],c=a[a.length-1];h(e.container,"keydown",n)}function H(n,a){if(i.string(a))Pe(n,e.media,{src:a});else if(a.constructor===Array)for(var o=a.length-1;o>=0;o--)Pe(n,e.media,a[o])}function Y(){if(t.loadSprite){var n=d();n.absolute?(N("AJAX loading absolute SVG sprite"+(e.browser.isIE?" (due to IE)":"")),je(n.url,"sprite-plyr")):N("Sprite will be used as external resource directly")}var a=t.html;N("Injecting custom controls"),a||(a=m()),a=Fe(a,"{seektime}",t.seekTime),a=Fe(a,"{id}",Math.floor(1e4*Math.random()));var o;if(i.string(t.selectors.controls.container)&&(o=p.querySelector(t.selectors.controls.container)),i.htmlElement(o)||(o=e.container),o.insertAdjacentHTML("beforeend",a),t.tooltips.controls)for(var c=P([t.selectors.controls.wrapper," ",t.selectors.labels," .",t.classes.hidden].join("")),f=c.length-1;f>=0;f--){var S=c[f];g(S,t.classes.hidden,!1),g(S,t.classes.tooltip,!0)}}function ye(){try{return e.controls=w(t.selectors.controls.wrapper),e.buttons={},e.buttons.seek=w(t.selectors.buttons.seek),e.buttons.play=P(t.selectors.buttons.play),e.buttons.pause=w(t.selectors.buttons.pause),e.buttons.restart=w(t.selectors.buttons.restart),e.buttons.rewind=w(t.selectors.buttons.rewind),e.buttons.forward=w(t.selectors.buttons.forward),e.buttons.fullscreen=w(t.selectors.buttons.fullscreen),e.buttons.mute=w(t.selectors.buttons.mute),e.buttons.captions=w(t.selectors.buttons.captions),e.progress={},e.progress.container=w(t.selectors.progress.container),e.progress.buffer={},e.progress.buffer.bar=w(t.selectors.progress.buffer),e.progress.buffer.text=e.progress.buffer.bar&&e.progress.buffer.bar.getElementsByTagName("span")[0],e.progress.played=w(t.selectors.progress.played),e.progress.tooltip=e.progress.container&&e.progress.container.querySelector("."+t.classes.tooltip),e.volume={},e.volume.input=w(t.selectors.volume.input),e.volume.display=w(t.selectors.volume.display),e.duration=w(t.selectors.duration),e.currentTime=w(t.selectors.currentTime),e.seekTime=P(t.selectors.seekTime),!0}catch(n){return te("It looks like there is a problem with your controls HTML"),oe(!0),!1}}function z(){g(e.container,t.selectors.container.replace(".",""),e.supported.full)}function oe(n){n&&v(t.types.html5,e.type)?e.media.setAttribute("controls",""):e.media.removeAttribute("controls")}function be(n){var a=t.i18n.play;if(i.string(t.title)&&t.title.length&&(a+=", "+t.title,e.container.setAttribute("aria-label",t.title)),e.supported.full&&e.buttons.play)for(var o=e.buttons.play.length-1;o>=0;o--)e.buttons.play[o].setAttribute("aria-label",a);i.htmlElement(n)&&n.setAttribute("title",t.i18n.frameTitle.replace("{title}",t.title))}function tt(){var n=null;e.storage={},Re.supported&&t.storage.enabled&&(u.localStorage.removeItem("plyr-volume"),n=u.localStorage.getItem(t.storage.key),n&&(/^\d+(\.\d+)?$/.test(n)?ve({volume:parseFloat(n)}):e.storage=JSON.parse(n)))}function ve(n){Re.supported&&t.storage.enabled&&(ae(e.storage,n),u.localStorage.setItem(t.storage.key,JSON.stringify(e.storage)))}function qe(){if(!e.media)return void te("No media element found!");if(e.supported.full&&(g(e.container,t.classes.type.replace("{0}",e.type),!0),v(t.types.embed,e.type)&&g(e.container,t.classes.type.replace("{0}","video"),!0),g(e.container,t.classes.stopped,t.autoplay),g(e.ontainer,t.classes.isIos,e.browser.isIos),g(e.container,t.classes.isTouch,e.browser.isTouch),e.type==="video")){var n=p.createElement("div");n.setAttribute("class",t.classes.videoWrapper),Ae(e.media,n),e.videoContainer=n}v(t.types.embed,e.type)&&nt()}function nt(){var n,a=p.createElement("div"),o=e.type+"-"+Math.floor(1e4*Math.random());switch(e.type){case"youtube":n=Ke(e.embedId);break;case"vimeo":n=Qe(e.embedId);break;default:n=e.embedId}for(var c=P('[id^="'+e.type+'-"]'),f=c.length-1;f>=0;f--)X(c[f]);if(g(e.media,t.classes.videoWrapper,!0),g(e.media,t.classes.embedWrapper,!0),e.type==="youtube")e.media.appendChild(a),a.setAttribute("id",o),i.object(u.YT)?De(n,a):(de(t.urls.youtube.api),u.onYouTubeReadyCallbacks=u.onYouTubeReadyCallbacks||[],u.onYouTubeReadyCallbacks.push(function(){De(n,a)}),u.onYouTubeIframeAPIReady=function(){u.onYouTubeReadyCallbacks.forEach(function(_){_()})});else if(e.type==="vimeo")if(e.supported.full?e.media.appendChild(a):a=e.media,a.setAttribute("id",o),i.object(u.Vimeo))He(n,a);else{de(t.urls.vimeo.api);var S=u.setInterval(function(){i.object(u.Vimeo)&&(u.clearInterval(S),He(n,a))},50)}else if(e.type==="soundcloud"){var C=p.createElement("iframe");C.loaded=!1,h(C,"load",function(){C.loaded=!0}),Ne(C,{src:"https://w.soundcloud.com/player/?url=https://api.soundcloud.com/tracks/"+n,id:o}),a.appendChild(C),e.media.appendChild(a),u.SC||de(t.urls.soundcloud.api);var I=u.setInterval(function(){u.SC&&C.loaded&&(u.clearInterval(I),rt.call(C))},50)}}function ge(){e.supported.full&&(_e(),Ce()),be(w("iframe"))}function De(n,a){e.embed=new u.YT.Player(a.id,{videoId:n,playerVars:{autoplay:t.autoplay?1:0,controls:e.supported.full?0:1,rel:0,showinfo:0,iv_load_policy:3,cc_load_policy:t.captions.defaultActive?1:0,cc_lang_pref:"en",wmode:"transparent",modestbranding:1,disablekb:1,origin:"*"},events:{onError:function(o){s(e.container,"error",!0,{code:o.data,embed:o.target})},onReady:function(o){var c=o.target;e.media.play=function(){c.playVideo(),e.media.paused=!1},e.media.pause=function(){c.pauseVideo(),e.media.paused=!0},e.media.stop=function(){c.stopVideo(),e.media.paused=!0},e.media.duration=c.getDuration(),e.media.paused=!0,e.media.currentTime=0,e.media.muted=c.isMuted(),t.title=c.getVideoData().title,e.supported.full&&e.media.querySelector("iframe").setAttribute("tabindex","-1"),ge(),s(e.media,"timeupdate"),s(e.media,"durationchange"),u.clearInterval(M.buffering),M.buffering=u.setInterval(function(){e.media.buffered=c.getVideoLoadedFraction(),(e.media.lastBuffered===null||e.media.lastBufferedc&&(a=c),$e(a);try{e.media.currentTime=a.toFixed(4)}catch(f){}if(v(t.types.embed,e.type)){switch(e.type){case"youtube":e.embed.seekTo(a);break;case"vimeo":e.embed.setCurrentTime(a.toFixed(0));break;case"soundcloud":e.embed.seekTo(1e3*a)}o&&G(),s(e.media,"timeupdate"),e.media.seeking=!0,s(e.media,"seeking")}N("Seeking to "+e.media.currentTime+" seconds"),R(a)}function B(){var n=parseInt(t.duration),a=0;return e.media.duration===null||isNaN(e.media.duration)||(a=e.media.duration),isNaN(n)?a:n}function We(){g(e.container,t.classes.playing,!e.media.paused),g(e.container,t.classes.stopped,e.media.paused),ee(e.media.paused)}function at(){me={x:u.pageXOffset||0,y:u.pageYOffset||0}}function st(){u.scrollTo(me.x,me.y)}function E(n){var a=O.supportsFullScreen;if(a){if(!n||n.type!==O.fullScreenEventName)return O.isFullScreen(e.container)?O.cancelFullScreen():(at(),O.requestFullScreen(e.container)),void(e.isFullscreen=O.isFullScreen(e.container));e.isFullscreen=O.isFullScreen(e.container)}else e.isFullscreen=!e.isFullscreen,p.body.style.overflow=e.isFullscreen?"hidden":"";g(e.container,t.classes.fullscreen.active,e.isFullscreen),Q(e.isFullscreen),e.buttons&&e.buttons.fullscreen&&$(e.buttons.fullscreen,e.isFullscreen),s(e.container,e.isFullscreen?"enterfullscreen":"exitfullscreen",!0),!e.isFullscreen&&a&&st()}function ie(n){if(i.boolean(n)||(n=!e.media.muted),$(e.buttons.mute,n),e.media.muted=n,e.media.volume===0&&K(t.volume),v(t.types.embed,e.type)){switch(e.type){case"youtube":e.embed[e.media.muted?"mute":"unMute"]();break;case"vimeo":case"soundcloud":e.embed.setVolume(e.media.muted?0:parseFloat(t.volume/t.volumeMax))}s(e.media,"volumechange")}}function K(n){var a=t.volumeMax,o=t.volumeMin;if(i.undefined(n)&&(n=e.storage.volume),(n===null||isNaN(n))&&(n=t.volume),n>a&&(n=a),n0&&ie()}function xe(n){var a=e.media.muted?0:e.media.volume*t.volumeMax;i.number(n)||(n=t.volumeStep),K(a+n)}function Te(n){var a=e.media.muted?0:e.media.volume*t.volumeMax;i.number(n)||(n=t.volumeStep),K(a-n)}function Ye(){var n=e.media.muted?0:e.media.volume*t.volumeMax;e.supported.full&&(e.volume.input&&(e.volume.input.value=n),e.volume.display&&(e.volume.display.value=n)),ve({volume:n}),g(e.container,t.classes.muted,n===0),e.supported.full&&e.buttons.mute&&$(e.buttons.mute,n===0)}function Se(n){e.supported.full&&e.buttons.captions&&(i.boolean(n)||(n=e.container.className.indexOf(t.classes.captions.active)===-1),e.captionsEnabled=n,$(e.buttons.captions,e.captionsEnabled),g(e.container,t.classes.captions.active,e.captionsEnabled),s(e.container,e.captionsEnabled?"captionsenabled":"captionsdisabled",!0),ve({captionsEnabled:e.captionsEnabled}))}function ot(n){var a=n.type==="waiting";clearTimeout(M.loading),M.loading=setTimeout(function(){g(e.container,t.classes.loading,a),ee(a)},a?250:0)}function Be(n){if(e.supported.full){var a=e.progress.played,o=0,c=B();if(n)switch(n.type){case"timeupdate":case"seeking":if(e.controls.pressed)return;o=pe(e.media.currentTime,c),n.type==="timeupdate"&&e.buttons.seek&&(e.buttons.seek.value=o);break;case"playing":case"progress":a=e.progress.buffer,o=function(){var f=e.media.buffered;return f&&f.length?pe(f.end(0),c):i.number(f)?100*f:0}()}Ue(a,o)}}function Ue(n,a){if(e.supported.full){if(i.undefined(a)&&(a=0),i.undefined(n)){if(!e.progress||!e.progress.buffer)return;n=e.progress.buffer}i.htmlElement(n)?n.value=a:n&&(n.bar&&(n.bar.value=a),n.text&&(n.text.innerHTML=a))}}function le(n,a){if(a){isNaN(n)&&(n=0),e.secs=parseInt(n%60),e.mins=parseInt(n/60%60),e.hours=parseInt(n/60/60%60);var o=parseInt(B()/60/60%60)>0;e.secs=("0"+e.secs).slice(-2),e.mins=("0"+e.mins).slice(-2),a.innerHTML=(o?e.hours+":":"")+e.mins+":"+e.secs}}function it(){if(e.supported.full){var n=B()||0;!e.duration&&t.displayDuration&&e.media.paused&&le(n,e.currentTime),e.duration&&le(n,e.duration),Je()}}function Xe(n){le(e.media.currentTime,e.currentTime),n&&n.type==="timeupdate"&&e.media.seeking||Be(n)}function $e(n){i.number(n)||(n=0);var a=B(),o=pe(n,a);e.progress&&e.progress.played&&(e.progress.played.value=o),e.buttons&&e.buttons.seek&&(e.buttons.seek.value=o)}function Je(n){var a=B();if(t.tooltips.seek&&e.progress.container&&a!==0){var o=e.progress.container.getBoundingClientRect(),c=0,f=t.classes.tooltip+"--visible";if(n)c=100/o.width*(n.pageX-o.left);else{if(!W(e.progress.tooltip,f))return;c=e.progress.tooltip.style.left.replace("%","")}c<0?c=0:c>100&&(c=100),le(a/100*c,e.progress.tooltip),e.progress.tooltip.style.left=c+"%",n&&v(["mouseenter","mouseleave"],n.type)&&g(e.progress.tooltip,f,n.type==="mouseenter")}}function ee(n){if(t.hideControls&&e.type!=="audio"){var a=0,o=!1,c=n,f=W(e.container,t.classes.loading);if(i.boolean(n)||(n&&n.type?(o=n.type==="enterfullscreen",c=v(["mousemove","touchstart","mouseenter","focus"],n.type),v(["mousemove","touchmove"],n.type)&&(a=2e3),n.type==="focus"&&(a=3e3)):c=W(e.container,t.classes.hideControls)),u.clearTimeout(M.hover),c||e.media.paused||f){if(g(e.container,t.classes.hideControls,!1),e.media.paused||f)return;e.browser.isTouch&&(a=3e3)}c&&e.media.paused||(M.hover=u.setTimeout(function(){(!e.controls.pressed&&!e.controls.hover||o)&&g(e.container,t.classes.hideControls,!0)},a))}}function lt(n){if(!i.undefined(n))return void ut(n);var a;switch(e.type){case"youtube":a=e.embed.getVideoUrl();break;case"vimeo":e.embed.getVideoUrl.then(function(o){a=o});break;case"soundcloud":e.embed.getCurrentSound(function(o){a=o.permalink_url});break;default:a=e.media.currentSrc}return a||""}function ut(n){function a(){if(e.embed=null,X(e.media),e.type==="video"&&e.videoContainer&&X(e.videoContainer),e.container&&e.container.removeAttribute("class"),"type"in n&&(e.type=n.type,e.type==="video")){var o=n.sources[0];"type"in o&&v(t.types.embed,o.type)&&(e.type=o.type)}switch(e.supported=se(e.type),e.type){case"video":e.media=p.createElement("video");break;case"audio":e.media=p.createElement("audio");break;case"youtube":case"vimeo":case"soundcloud":e.media=p.createElement("div"),e.embedId=n.sources[0].src}Ie(e.container,e.media),i.boolean(n.autoplay)&&(t.autoplay=n.autoplay),v(t.types.html5,e.type)&&(t.crossorigin&&e.media.setAttribute("crossorigin",""),t.autoplay&&e.media.setAttribute("autoplay",""),"poster"in n&&e.media.setAttribute("poster",n.poster),t.loop&&e.media.setAttribute("loop","")),g(e.container,t.classes.fullscreen.active,e.isFullscreen),g(e.container,t.classes.captions.active,e.captionsEnabled),z(),v(t.types.html5,e.type)&&H("source",n.sources),qe(),v(t.types.html5,e.type)&&("tracks"in n&&H("track",n.tracks),e.media.load()),(v(t.types.html5,e.type)||v(t.types.embed,e.type)&&!e.supported.full)&&(_e(),Ce()),t.title=n.title,be()}return i.object(n)&&"sources"in n&&n.sources.length?(g(e.container,t.classes.ready,!1),G(),$e(),Ue(),mt(),void ze(a,!1)):void te("Invalid source format")}function ct(n){e.type==="video"&&e.media.setAttribute("poster",n)}function dt(){function n(){var y=he(),A=e.buttons[y?"play":"pause"],b=e.buttons[y?"pause":"play"];if(b=b&&b.length>1?b[b.length-1]:b[0]){var F=W(A,t.classes.tabFocus);setTimeout(function(){b.focus(),F&&(g(A,t.classes.tabFocus,!1),g(b,t.classes.tabFocus,!0))},100)}}function a(){var y=p.activeElement;return y=y&&y!==p.body?p.querySelector(":focus"):null}function o(y){return y.keyCode?y.keyCode:y.which}function c(y){for(var A in e.buttons){var b=e.buttons[A];if(i.nodeList(b))for(var F=0;F0)&&(A?Te(b):xe(b)),(y.deltaY>0||y.deltaX<0)&&(A?xe(b):Te(b))})}function pt(){if(h(e.media,"timeupdate seeking",Xe),h(e.media,"timeupdate",R),h(e.media,"durationchange loadedmetadata",it),h(e.media,"ended",function(){e.type==="video"&&t.showPosterOnEnd&&(e.type==="video"&&T(),j(),e.media.load())}),h(e.media,"progress playing",Be),h(e.media,"volumechange",Ye),h(e.media,"play pause ended",We),h(e.media,"waiting canplay seeked",ot),t.clickToPlay&&e.type!=="audio"){var n=w("."+t.classes.videoWrapper);if(!n)return;n.style.cursor="pointer",h(n,"click",function(){t.hideControls&&e.browser.isTouch&&!e.media.paused||(e.media.paused?Z():e.media.ended?(j(),Z()):G())})}t.disableContextMenu&&h(e.media,"contextmenu",function(a){a.preventDefault()}),h(e.media,t.events.concat(["keyup","keydown"]).join(" "),function(a){s(e.container,a.type,!0)})}function mt(){if(v(t.types.html5,e.type)){for(var n=e.media.querySelectorAll("source"),a=0;a=10&&(T=!0);break;case"soundcloud":k=!0,T=!s&&!d;break;default:k=m&&x,T=k&&!s}return{basic:k,full:T}}function et(r,t){function s(q,P){W(P,J.classes.hook)||l.push({target:q,media:P})}var l=[],d=[],m=[J.selectors.html5,J.selectors.embed].join(",");if(i.string(r)?r=p.querySelectorAll(r):i.htmlElement(r)?r=[r]:i.nodeList(r)||i.array(r)||i.string(r)||(i.undefined(t)&&i.object(r)&&(t=r),r=p.querySelectorAll(m)),i.nodeList(r)&&(r=Array.prototype.slice.call(r)),!se().basic||!r.length)return!1;for(var x=0;x