/*! * @license * nanoStream H5Live Player 4.31.0 * Build from Thu Aug 21 2025 12:13:28 GMT+0200 (Mitteleuropäische Sommerzeit) * Copyright (c) 2014-2024 nanocosmos IT GmbH. All rights reserved. * http://www.nanocosmos.de * sales@nanocosmos.de * * LEGAL NOTICE: * This material is subject to the terms and conditions defined in * separate license conditions ('LICENSE.txt') * All information contained herein is, and remains the property * of nanocosmos GmbH and its suppliers if any. The intellectual and technical concepts * contained herein are proprietary to nanocosmos GmbH, and are protected by trade secret * or copyright law. Dissemination of this information or reproduction of this material * is strictly forbidden unless prior written permission is obtained from nanocosmos. * All modifications will remain property of nanocosmos. */ /*! * EventEmitter v4.2.11 - git.io/ee * Unlicense - http://unlicense.org/ * Oliver Caldwell - http://oli.me.uk/ * @preserve */ /*! * @license * SWFObject v2.3.20130521 is released under the MIT License */ !function(){var e={4216:function(e,t,n){var r,i;r=[n(8478),n(8197),n(2459),n(2437),n(9470),n(7884),n(3293)],void 0===(i=function(e,t,n,r,i,a,o){"use strict";function s(i){var a,s,c,f,E=!1,p=i.source.group,m="https://bintu.nanocosmos.de",b={profile:"player"};return new Promise((function(h,g){if(!i.source.bintu||i.source.entries&&i.source.entries.length||(i.source.entries=[{index:0,bintu:t.copy(i.source.bintu)}],i.source.h5live&&(i.source.entries[0].h5live=t.copy(i.source.h5live),delete i.source.h5live),i.source.hls&&(i.source.entries[0].hls=t.copy(i.source.hls),delete i.source.hls)),a=performance.now(),"object"==typeof p&&p.id){p.apiurl=l(p.apiurl,m);var _=new o(p.apiurl,null,null,"player");s=p.apiurl,c=p.id,_.getStreamgroup(p.id,b).then(function(t,o){try{f=o;var s,d=JSON.parse(f.responseText),l=d.id,c=d.playout,E=c.rtmp,m=c.hls,b=c.h5live,g=d.state;if(E&&!E.length&&!b||b&&!b.length)return void v(new e(r.SETUP.BINTU_STREAM_NOT_LIVE.replace("$streamid$",l),n.SETUP.BINTU_STREAM_NOT_LIVE));i.source.entries=[];var _=i.source.entries;if(b&&b.length)for(var T=0;T0&&("string"==typeof e||e instanceof String)))throw new Error('The param "apiUrl" must be of type "string" and also may not be empty string.');if(this.apiUrl=e,t&&("string"==typeof t||t instanceof String)&&(this.apiKey=t),n&&("string"==typeof n||n instanceof String)&&(this.playerKey=n),r&&("string"==typeof r||r instanceof String)){if("api"!==r&&"player"!==r)throw new Error('The param "keyMode" must be "api", "player" or undefined');this.keyMode=r}},r=t.prototype,i=function(e,t,n,r){this.method=e||"GET",this.url=t||"http://localhost:8088",this.header=n||{},this.async=r||!0,this.Send=function(e){return new Promise(function(t,n){var r=new XMLHttpRequest;for(var i in r.open(this.method,this.url,this.async),this.header)Object.prototype.hasOwnProperty.call(this.header,i)&&r.setRequestHeader(i,this.header[i]);if(r.onreadystatechange=function(){return 4===r.readyState&&200===r.status?t(r):4===r.readyState&&200!==r.status?n({error:"onstatuserror",request:r}):void 0},r.onabort=function(){return n({error:"onabort",request:r})},r.onerror=function(){return n({error:"onerror",request:r})},r.ontimeout=function(){return n({error:"ontimeout",request:r})},void 0!==e){if("string"==typeof e)try{e=JSON.parse(e)}catch(t){return e=null,n({error:"invalid json string",request:r})}if("object"==typeof e)try{e=JSON.stringify(e),r.send(e)}catch(e){return n({error:"invalid json object",request:r})}}else r.send()}.bind(this))}};function a(e){var t="";for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var r=e[n];n&&r&&(0===t.length?t+="?":t+="&",t+=n+"="+r)}return t}function o(e,t,n,r){var i={};return t="string"!=typeof t?".":t,n=isNaN(n)?10:n,r=isNaN(r)?0:parseInt(r,10),e&&"object"==typeof e&&function e(a,o,s){if(!(s>=n))for(var u in a){var d=(o?o+t:"")+u;"[object Array]"===Object.prototype.toString.call(a[u])&&0===r||("object"==typeof a[u]?e(a[u],d,s+1):i[d]=a[u].toString())}}(e,"",0),i}r.apiKey=null,r.apiUrl=null,r.playerKey=null,r.keyMode="api",r.createStream=function(e,t,n){return new Promise(function(r,a){if(!this.apiUrl)return a({error:"no api url set",request:{responseText:"no response error"}});if(!this.apiKey)return a({error:"no api key set",request:{responseText:"no response error"}});if("api"!==this.keyMode)return a({error:"wrong key mode set",request:{responseText:"no response error"}});var o=new i("POST",this.apiUrl+"/stream");o.header={Accept:"application/json","Content-Type":"application/json","X-BINTU-APIKEY":this.apiKey};var s={webrtc:!!e,transcoding:!!t};return"object"==typeof n&&"function"==typeof n.push&&n.length>0&&("string"==typeof n[0]||n[0]instanceof String)&&(s.tags=n),o.Send(s).then(r).catch(a)}.bind(this))},r.getStream=function(e,t){return new Promise(function(n,r){if(!this.apiUrl)return r({error:"no api url set",request:{responseText:"no response error"}});if(!this.apiKey&&"api"===this.keyMode)return r({error:"no api key set",request:{responseText:"no response error"}});var s=a(o(t,".",10,0)),u=new i("GET",this.apiUrl+"/stream/"+e+s);return u.header="api"===this.keyMode&&this.apiKey?{Accept:"application/json","Content-Type":"application/json","X-BINTU-APIKEY":this.apiKey}:{Accept:"application/json","Content-Type":"application/json; charset=utf-8"},u.Send().then(n).catch(r)}.bind(this))},r.getStreamgroup=function(e,t){return new Promise(function(n,r){if(!this.apiUrl)return r({error:"no api url set",request:{responseText:"no response error"}});if(!this.apiKey&&"api"===this.keyMode)return r({error:"no api key set",request:{responseText:"no response error"}});var s=a(o(t,".",10,0)),u=new i("GET",this.apiUrl+"/stream/"+e+"/group"+s);return u.header="api"===this.keyMode&&this.apiKey?{Accept:"application/json","Content-Type":"application/json","X-BINTU-APIKEY":this.apiKey}:{Accept:"application/json","Content-Type":"application/json; charset=utf-8"},u.Send().then(n).catch(r)}.bind(this))},r.getStreams=function(e){return new Promise(function(n,r){if(!this.apiUrl)return r({error:"no api url set",request:{responseText:"no response error"}});if(!this.apiKey)return r({error:"no api key set",request:{responseText:"no response error"}});var a=this.apiUrl+"/stream";e instanceof t.StreamFilter&&(a+=e.getQueryString(!1));var o=new i("GET",a);return o.header={Accept:"application/json","Content-Type":"application/json","X-BINTU-APIKEY":this.apiKey},o.Send().then(n).catch(r)}.bind(this))},r.getStreamsPublic=function(e){return new Promise(function(n,r){if(!this.apiUrl)return r({error:"no api url set",request:{responseText:"no response error"}});if(!this.playerKey)return r({error:"no player key set",request:{responseText:"no response error"}});var a=this.apiUrl+"/stream/public";e instanceof t.StreamFilter&&(a+=e.getQueryString(!0));var o=new i("GET",a);return o.header={Accept:"application/json","Content-Type":"application/json","X-BINTU-PLAYERKEY":this.playerKey},o.Send().then(n).catch(r)}.bind(this))},r.tagStream=function(e,t){return new Promise(function(n,r){if(!this.apiUrl)return r({error:"no api url set",request:{responseText:"no response error"}});if(!this.apiKey)return r({error:"no api key set",request:{responseText:"no response error"}});if("api"!==this.keyMode)return r({error:"wrong key mode set",request:{responseText:"no response error"}});if(!e)return r({error:"no stream id set"});var a=new i("PUT",this.apiUrl+"/stream/"+e+"/tag");return a.header={Accept:"application/json","Content-Type":"application/json","X-BINTU-APIKEY":this.apiKey},"object"==typeof t&&"function"==typeof t.push&&t.length>0&&("string"==typeof t[0]||t[0]instanceof String)?a.Send({tags:t}).then(n).catch(r):a.Send().then(n).catch(r)}.bind(this))},r.pushStream=function(e,t){return new Promise(function(n,r){if(!this.apiUrl)return r({error:"no api url set",request:{responseText:"no response error"}});if(!this.apiKey)return r({error:"no api key set",request:{responseText:"no response error"}});if("api"!==this.keyMode)return r({error:"wrong key mode set",request:{responseText:"no response error"}});if(!e)return r({error:"no stream id set"});var a=new i("PUT",this.apiUrl+"/stream/"+e+"/push_url");return a.header={Accept:"application/json","Content-Type":"application/json","X-BINTU-APIKEY":this.apiKey},a.Send({url:t}).then(n).catch(r)}.bind(this))},r=(t.StreamFilter=function(){this.state=this.setState(t.StreamFilter.STATE.ALL),this.tags=[]}).prototype,t.StreamFilter.STATE=Object.create({LIVE:"live",CREATED:"created",ENDED:"ended",ALL:null}),r.setState=function(e){var n;for(var r in t.StreamFilter.STATE)t.StreamFilter.STATE[r]===e&&(n=t.StreamFilter.STATE[r]);if(void 0===n)throw new Error('The param "state" must be of type "Bintu.StreamFilter.STATE"');return this.state=n,this},r.addTag=function(e){if(!(e.length>0&&("string"==typeof e||e instanceof String)))throw new Error('The param "tag" must be of type "string" and also may not be empty string.');return this.tags.push(e),this.tags=this._reduceDuplicates(this.tags),this},r.addTags=function(e){if("object"!=typeof e||"function"!=typeof e.push||!(0===e.length||e.length>0&&("string"==typeof e[0]||e[0]instanceof String)))throw new Error('The param "tags" must be of type "string array"');return this.tags=this.tags.concat(e),this.tags=this._reduceDuplicates(this.tags),this},r.getQueryString=function(e){var t="";if("object"==typeof this.tags&&"function"==typeof this.tags.push&&this.tags.length>0)for(var n=0;n0&&(t+=-1===t.indexOf("?")?"?":"&",t+="state="+this.state),t},r._reduceDuplicates=function(e){if("object"!=typeof e||"function"!=typeof e.push||!(0===e.length||e.length>0&&("string"==typeof e[0]||e[0]instanceof String)))throw new Error('The param "tags" must be of type "string array"');return e.reduce((function(e,t){return e.indexOf(t)<0&&e.push(t),e}),[])},void 0===(n=function(){return t}.apply(this,[]))||(e.exports=n)}).call(this)},6965:function(e,t){var n;void 0===(n=function(){return{create:function(){return{playback:{autoplay:!0,automute:!1,muted:!1,metadata:!1,forceTech:"",flashplayer:"",videoId:"",keepConnection:!1,allowSafariHlsFallback:!1,crossOrigin:"not-set",mediaErrorRecoveries:3,metadataLowDelay:!0,reconnect:{minDelay:2,maxDelay:10,delaySteps:10,maxRetries:10},timeouts:{loading:20,buffering:20,connecting:5},latencyControlMode:"classic",faststart:!1},source:{hls:"",h5live:{server:{websocket:"",progressive:"",hls:""},token:"",rtmp:{url:"",streamname:""},security:{token:"",jwtoken:"",expires:"",options:"",tag:""},params:{}},bintu:{apiurl:"",streamid:"",state:""},startIndex:0,options:{switch:{},adaption:{}},entries:[],defaults:{},group:{apiurl:"",id:"",startQuality:"",state:"",security:{jwtoken:""}},general:{}},events:{onReady:void 0,onPlay:void 0,onPause:void 0,onLoading:void 0,onStartBuffering:void 0,onStopBuffering:void 0,onError:void 0,onMetaData:void 0,onStats:void 0,onMute:void 0,onUnmute:void 0,onVolumeChange:void 0,onServerInfo:void 0,onStreamInfo:void 0,onStreamInfoUpdate:void 0,onWarning:void 0,onDestroy:void 0,onUpdateSourceInit:void 0,onUpdateSourceSuccess:void 0,onUpdateSourceFail:void 0,onUpdateSourceAbort:void 0,onSwitchStreamInit:void 0,onSwitchStreamSuccess:void 0,onSwitchStreamFail:void 0,onSwitchStreamAbort:void 0,onActiveVideoElementChange:void 0},tweaks:{buffer:{min:void 0,start:void 0,max:void 0,target:void 0,limit:void 0},bufferDynamic:{offsetThreshold:void 0,offsetStep:void 0,cooldownTime:void 0}}}}}}.apply(t,[]))||(e.exports=n)},1493:function(e,t){var n;void 0===(n=function(){return{create:function(){return{index:0,label:"high",tag:"high res",info:{bitrate:0,width:0,height:0,framerate:0},hls:"",h5live:{server:{websocket:"",progressive:"",hls:""},token:"",rtmp:{url:"",streamname:""},params:{},security:{token:"",jwtoken:"",expires:"",options:"",tag:""}},bintu:{apiurl:"",streamid:"",state:""}}}}}.apply(t,[]))||(e.exports=n)},828:function(e,t){var n;void 0===(n=function(){return{create:function(){return{index:"number",label:"string",tag:"string",info:{bitrate:"number",width:"number",height:"number",framerate:"number"},hls:"string",h5live:{server:{websocket:"string",progressive:"string",hls:"string"},token:"string",rtmp:{url:"string",streamname:"string"},params:"object",security:{token:"string",jwtoken:"string",expires:"string",options:"string",tag:"string"}},bintu:{apiurl:"string",streamid:"string",state:"string"}}}}}.apply(t,[]))||(e.exports=n)},5055:function(e,t,n){var r,i;r=[n(6637)],void 0===(i=function(e){return{create:function(t,n,r){var i,a={};function o(e){a[e.name]&&a[e.name].forEach((function(t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i]);n.emit(t,r)}))}return i=[],r.forEach((function(e){i.push({type:e.from,listener:o}),a[e.from]||(a[e.from]=[]),a[e.from].push(e.to)})),e.add({target:t,listeners:i}),{destroy:function(){e.remove({target:t,listeners:i}),i=null,a=null}}}}}.apply(t,r))||(e.exports=i)},1969:function(e,t,n){var r,i;r=[n(9658)],void 0===(i=function(e){"use strict";function t(){this.version=void 0,this.type=void 0}var n=t.prototype=Object.create(e.prototype);return n.setup=function(){throw new Error('"setup" must be implemented or player not initialized')},n.destroy=function(){throw new Error('"destroy" must be implemented or player not initialized')},n.play=function(){throw new Error('"play" must be implemented or player not initialized by call setup')},n.pause=function(){throw new Error('"pause" must be implemented or player not initialized by call setup')},n.mute=function(){throw new Error('"mute" must be implemented or player not initialized by call setup')},n.unmute=function(){throw new Error('"unmute" must be implemented or player not initialized by call setup')},n.setVolume=function(){throw new Error('"setVolume" must be implemented or player not initialized by call setup')},n.updateSource=function(){throw new Error('"updateSource" must be implemented or player not initialized by call setup')},n.switchStream=function(){throw new Error('"switchStream" must be implemented or player not initialized by call setup')},n.setAdaption=function(){throw new Error('"setAdaption" must be implemented or player not initialized by call setup')},t.isSupported=function(){return!1},t.supportedTechniques=[],t}.apply(t,r))||(e.exports=i)},6637:function(e,t,n){var r,i;r=[n(939)],void 0===(i=function(e){"use strict";var t=["addEventListener","addListener","on"],n=["removeEventListener","removeListener","off"];function r(e,t){for(var n=0;n=54 (Windows, MacOSX, Android), Firefox >=48 (Windows, MacOSX, Android), Microsoft Edge (Windows), Microsoft Internet Explorer 11 (at least Windows 8), Safari (MacOSX & at least iOS 10)."}}.apply(t,[]))||(e.exports=n)},166:function(e,t){var n;void 0===(n=function(){return Object.freeze({EMBED_PLAYER:'Could not embed player. Please check the path to the player in the config param "playback.flashplayer" or copy to base directory.'})}.apply(t,[]))||(e.exports=n)},8656:function(e,t){var n;void 0===(n=function(){return Object.freeze({VIDEO_DISPLAY:{CONNECTION_ERROR:"connectionError",LOADING:"loading",PLAYING:"playing",REWINDING:"rewinding",BUFFERING:"buffering",STOPPED:"stopped",DISCONNECTED:"disconnected"},NET_STREAM:{PLAY:{RESET:"NetStream.Play.Reset",UNPUBLISH_NOTIFY:"NetStream.Play.UnpublishNotify",PUBLISH_NOTIFY:"NetStream.Play.PublishNotify",PLAY:"NetStream.Play.Start",STOP:"NetStream.Play.Stop",STREAM_NOT_FOUND:"NetStream.Play.StreamNotFound"}}})}.apply(t,[]))||(e.exports=n)},9474:function(e,t){var n;void 0===(n=function(){return Object.freeze({CLASSIC:"classic",FAST_ADAPTIVE:"fastadaptive",BALANCED_ADAPTIVE:"balancedadaptive"})}.apply(t,[]))||(e.exports=n)},939:function(e,t){var n;void 0===(n=function(){return Object.freeze({NO_TARGET:"No target in config",NO_LISTENERS:"No listeners in config",NOT_DISPATCHER:"Target is not an event dispatcher",MISSING_TYPE:"Missing type in listener #%index%",MISSING_LISTENER:"Missing/invalid listener in listener #%index%"})}.apply(t,[]))||(e.exports=n)},8730:function(e,t){var n;void 0===(n=function(){return Object.freeze({MP4:"video/mp4",MP4_MS:'video/mp4; codecs="avc1.42E01E, mp4a.40.2"',HLS:"application/vnd.apple.mpegURL"})}.apply(t,[]))||(e.exports=n)},8405:function(e,t){var n;void 0===(n=function(){return Object.freeze({UNINITIALIZED:1,CONNECTING:2,OPEN:3,CLOSING:4,CLOSED:5})}.apply(t,[]))||(e.exports=n)},5493:function(e,t){var n;void 0===(n=function(){return Object.freeze({NORMAL:"normal",BUFFER:"buffer",CONNECTION_CLOSE:"connectionclose",SERVER_NOT_FOUND:"servernotfound",STREAM_NOT_FOUND:"streamnotfound",INTERACTION_REQUIRED:"interactionrequired",PLAYBACK_SUSPENDED:"playbacksuspended",PLAYBACK_ERROR:"playbackerror",RECONNECTION_IMMINENT:"reconnectionimminent",DESTROY:"destroy",VISIBILITY_HIDDEN:"visibilityhidden",NOT_ENOUGH_DATA:"notenoughdata",SOURCE_STREAM_STOPPED:"sourcestreamstopped",MEDIA_NOT_AVAILABLE:"medianotavailable"})}.apply(t,[]))||(e.exports=n)},492:function(e,t){var n;void 0===(n=function(){return Object.freeze({UNINITIALIZED:1,IDLE:2,READY:3,LOADING:4,PLAYING:5,PAUSED:6,BUFFERING:7,UNKNOWN:8,PLAYBACK_NOT_STARTED:9,PLAYBACK_SUSPENDED:10,PAUSING:11,PLAYBACK_ERROR:12,RECONNECTION_IMMINENT:13,CONNECTION_ERROR:14,DESTROYING:15,MEDIA_NOT_AVAILABLE:16,VISIBILITY_HIDDEN:17,NOT_ENOUGH_DATA:18,SOURCE_STREAM_STOPPED:19})}.apply(t,[]))||(e.exports=n)},7605:function(e,t){var n;void 0===(n=function(){return Object.freeze({HAVE_VIDEO:"haveVideo",HAVE_AUDIO:"haveAudio",VIDEO_INFO:"videoInfo",AUDIO_INFO:"audioInfo",PREROLL_DURATION:"prerollDuration",MIME_TYPE:"mimeType"})}.apply(t,[]))||(e.exports=n)},3284:function(e,t){var n;void 0===(n=function(){return Object.freeze({FLASH:"flash",NATIVE:"hls.native",H5LIVE_WSS:"h5live",H5LIVE_HLS:"h5live.hls"})}.apply(t,[]))||(e.exports=n)},2682:function(e,t){var n;void 0===(n=function(){return{CORE:"4.31.0"}}.apply(t,[]))||(e.exports=n)},728:function(e,t){var n;void 0===(n=function(){return Object.freeze({1e3:"Normal closure, meaning that the purpose for which the connection was established has been fulfilled.",1001:'An endpoint is "going away", such as a server going down or a browser having navigated away from a page.',1002:"An endpoint is terminating the connection due to a protocol error",1003:"An endpoint is terminating the connection because it has received a type of data it cannot accept (e.g., an endpoint that understands only text data MAY send this if it receives a binary message).",1004:"Reserved. The specific meaning might be defined in the future.",1005:"No status code was actually present.",1006:"Maybe no network, wrong url or server down.",1007:"An endpoint is terminating the connection because it has received data within a message that was not consistent with the type of the message (e.g., non-UTF-8 [http://tools.ietf.org/html/rfc3629] data within a text message).",1008:'An endpoint is terminating the connection because it has received a message that "violates its policy". This reason is given either if there is no other sutible reason, or if there is a need to hide specific details about the policy.',1009:"An endpoint is terminating the connection because it has received a message that is too big for it to process.",1011:"A server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request.",1015:"The connection was closed due to a failure to perform a TLS handshake (e.g., the server certificate can't be verified).",4005:"The requested source stream has been stopped.",4400:"Bad request. Maybe stream parameters are missing or malformed.",4403:"Access denied. The authentication token is missing or invalid.",4500:"The connection has been rejected due an internal server error.",4503:"The requested service is currently unavailable.",4900:"The security service has been rejected due an internal server error.",4901:"The security service denied access. The authentication token is invalid.",4903:"The security service denied access. The url is expired or a token parameter is missing (expires, token, or options).",4904:"The security service can not be found."})}.apply(t,[]))||(e.exports=n)},9374:function(e,t,n){var r,i;r=[n(8197),n(908),n(4341)],void 0===(i=function(e,t,n){return{check:function(r){var i,a;switch(r&&r.source&&r.source.defaults&&r.source.defaults.service&&(i=r.source.defaults.service),i){case t.service:a=t.preset;break;case n.service:a=n.preset}if(a){var o,s,u=r.source;if(!u||!u.h5live||u.entries&&u.entries.length||(u.entries=[{h5live:e.copy(u.h5live)}]),u&&u.entries&&u.entries.length>0)for(var d=0;d0&&r&&Object.keys(r).length)for(var o=0;o1&&(r=n[1].split("/")).length>1&&((i=r[0].split(":"))[0]=t,r[0]=i.join(":"),n[1]=r.join("/"),e=n.join("://"))}catch(e){}return e}return{apply:function(r,i){var a=function(t){var n=!1;return t&&"object"==typeof t&&Object.keys(t).length&&t[e]&&"string"==typeof t[e]&&t[e].length&&(n=t[e]),n}(r);if(a){if(i&&i.h5live&&i.h5live.server&&"object"==typeof i.h5live.server)for(var o=0;oi&&(i=e[o]),a+=e[o];return t=a/n,{min:isNaN(r)?r:r.toFixed(3),max:isNaN(i)?i:i.toFixed(3),avg:isNaN(t)?t:t.toFixed(3),count:n}}return{}}function s(e,t){for(var n in t){if(!e[n])return;Object.prototype.hasOwnProperty.call(t[n],"calcArrayStats")?i[n]=t[n].calcArrayStats?o(e[n]):e[n]:s(e[n],t[n])}}return{setStats:function(e){e&&e.data&&e.data.stats&&e.data.stats.adaptive&&(t=e.data.stats.adaptive)},getStatsFlat:function(){var e=t&&Object.keys(t).length?Object.keys(t)[0]:"";return Object.prototype.hasOwnProperty.call(a,e)?(s(t[e],a[e]),n.get(i,r,5)):n.get(t,r,5)}}}}}.apply(t,r))||(e.exports=i)},3932:function(e,t){var n;void 0===(n=function(){return{create:function(){var e=0,t=0,n=[],r={buffering_duration_current:0,buffering_duration_average:0,buffering_duration_total:0,buffering_count:0};return{start:function(){e=performance.now()},end:function(){t=performance.now()},measure:function(i,a){if(e&&t&&t>e){var o=Math.round(Math.abs(t-e))/1e3;if(t=e=0,o>=1&&o<=a.time_elapsed){for(var s in n.push(o),r.buffering_duration_current=o,r.buffering_duration_total+=o,r.buffering_count+=1,r.buffering_duration_average=Math.round(r.buffering_duration_total/r.buffering_count*1e3)/1e3,r)!/buffering_count/.test(s)&&r[s];return r}}return!1},reset:function(i,a){if(i&&a){for(t=e=0;n.length;)n.pop();var o={};for(var s in r)!/buffering_duration_current/.test(s)&&(o[s]=r[s]),r[s]=0;return o.time_played_total=a.time_played,o.time_elapsed_total=a.time_elapsed,o.time_buffering_total=o.buffering_duration_total,o}}}}}}.apply(t,[]))||(e.exports=n)},4815:function(e,t){var n;void 0===(n=function(){return{create:function(){return{measure:function(e){return function(e,t,n,r){t=t||"_";var i={};return function e(n,r){for(var a in n){var o=r+(r?t:"")+a.replace(/([a-z])([A-Z])/g,"$1_$2").toLowerCase(),s=o.split(t);o=(s=s.map((function(e){return e.substring(0,10)}))).join(t);var u=n[a];"object"==typeof u&&null!==u?e(u,o):i[o]=u}}(e,n=n||""),i}(e.data,"_","error")}}}}}.apply(t,[]))||(e.exports=n)},4245:function(e,t){var n;void 0===(n=function(){return{create:function(){return{measure:function(e){return{pause_reason:e.data.reason}}}}}}.apply(t,[]))||(e.exports=n)},2247:function(e,t){var n;void 0===(n=function(){return{create:function(){var e=0,t=0,n=0;function r(){e=performance.now()}function i(){t=performance.now(),n+=Math.abs(t-e),e=0,t=0}return{measure:function(e){r();var t,n={connecting:0,connected:0,firstFragmentReceived:0,firstFrameRendered:0,playable:0,playing:0};try{if(e.data&&e.data.stats&&"object"==typeof e.data.stats){var i=e.data.stats;for(t in n)Object.prototype.hasOwnProperty.call(i,t)&&"number"==typeof i[t]&&(n[t]=i[t])}}catch(e){}var a={};return[{start:"connecting",end:"connecting",measurement:"play_connecting",value:0},{start:"connecting",end:"connected",measurement:"play_connected",value:0},{start:"connected",end:"firstFragmentReceived",measurement:"play_first_fragment_received",value:0},{start:"firstFragmentReceived",end:"firstFrameRendered",measurement:"play_first_frame_rendered",value:0},{start:"firstFrameRendered",end:"playable",measurement:"play_playable",value:0},{start:"playable",end:"playing",measurement:"play_playing",value:0}].forEach((function(e){var t=n[e.start],r=n[e.end];r-t>=0&&(e.value=Math.floor(r-t)),a[e.measurement+"_relative"]=e.value,a[e.measurement+"_absolute"]=n[e.end]})),a.play_start_time_total=a.play_playing_absolute,a.play_faststart=e.data.faststart,a.play_preroll_duration=e.data.prerollDuration,a},setTimePlayingStateStart:r,setTimePlayingStateEnd:i,getTimePlayingStateTotal:function(){return e&&!t&&i(),Math.round(n/1e3*100)/100},resetTimePlayingStateSubtotal:function(){n=0}}}}}.apply(t,[]))||(e.exports=n)},7666:function(e,t,n){var r,i;r=[n(7080)],void 0===(i=function(e){return{create:function(){var t=e.create();return{measure:function(e){return t.get(e.data,"ready",10,!0)},flattenCodecs:function(e){var t={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n))if("video"===n||"audio"===n)for(var r="video"===n?"vc_":"ac_",i=Array.isArray(e[n].codecs)?e[n].codecs:[],a=0;a=5&&(t=e);var n=10*t,r=0,i=[],a=[],o=[],s=[],u=0,d={stats_buffer_average:0,stats_buffer_min:0,stats_buffer_max:0,stats_bitrate_average:0,stats_bitrate_min:0,stats_bitrate_max:0,stats_frame_rate_average:0,stats_frame_rate_min:0,stats_frame_rate_max:0,stats_playback_rate_average:0,stats_playback_rate_min:0,stats_playback_rate_max:0,stats_playback_rate_frequency:0,stats_buffergoal_real:0,stats_buffergoal_base:0,stats_buffergoal_min:0,stats_buffergoal_max:0,stats_quality_dropped_video_frames:0,stats_quality_dropped_video_frames_current:0,stats_quality_dropped_video_frames_ratio:0,stats_quality_dropped_video_frames_level_max:0,stats_quality_corrupted_video_frames:0,stats_quality_corrupted_video_frames_current:0,stats_quality_creation_time:0,stats_quality_total_video_frames:0,stats_measure_count:0,stats_measure_samples:n,stats_buffer_duration_delta:0};return{measure:function(e){var t={currentTime:0,playout:{start:0,end:0},buffer:{start:0,end:0,delay:{before:0,current:0,avg:0,min:0,max:0,deviation:0},update:{current:0,avg:0,min:0,max:0,deviation:0},durationDelta:0},buffergoal:{real:0,base:0,min:0,max:0},quality:{droppedVideoFrames:0,droppedVideoFramesCurrent:0,droppedVideoFramesLevel:0,corruptedVideoFrames:0,corruptedVideoFramesCurrent:0,creationTime:0,totalVideoFrames:0},bitrate:{current:0,avg:0,min:0,max:0,deviation:0},framerate:{current:0,avg:0,min:0,max:0,deviation:0},playbackrate:{current:0,avg:0,min:0,max:0,deviation:0}};e.data.stats&&"object"==typeof e.data.stats&&(t=e.data.stats);try{for(r+=1,i.push(t.buffer.delay.current),a.push(t.bitrate.current),o.push(t.framerate.current),s.push(t.playbackrate.current);i.length>n;)i.shift();for(;a.length>n;)a.shift();for(;o.length>n;)o.shift();for(;s.length>n;)s.shift();if(u=Math.max(u,t.quality.droppedVideoFramesLevel),r%n==0){var l=JSON.parse(JSON.stringify(i)).sort((function(e,t){return e-t}),0);d.stats_buffer_average=Math.round(l.reduce((function(e,t){return e+t}),0)/l.length*1e3)/1e3,d.stats_buffer_min=Math.round(1e3*l[0])/1e3,d.stats_buffer_max=Math.round(1e3*l[l.length-1])/1e3,d.stats_buffer_duration_delta=t.buffer.durationDelta;var c=JSON.parse(JSON.stringify(a)).sort((function(e,t){return e-t}),0);d.stats_bitrate_average=Math.round(c.reduce((function(e,t){return e+t}),0)/c.length/1e3),d.stats_bitrate_min=Math.round(c[0]/1e3),d.stats_bitrate_max=Math.round(c[l.length-1]/1e3);var f=JSON.parse(JSON.stringify(o)).sort((function(e,t){return e-t}),0);d.stats_frame_rate_average=Math.round(f.reduce((function(e,t){return e+t}),0)/f.length*1e3)/1e3,d.stats_frame_rate_min=f[0],d.stats_frame_rate_max=f[f.length-1];var E=JSON.parse(JSON.stringify(s)).sort((function(e,t){return e-t}),0),p=s.map((function(e,t,n){return t?e-n[t-1]:0})).filter((function(e){return 0!==e}));d.stats_playback_rate_average=Math.round(E.reduce((function(e,t){return e+t}),0)/E.length*1e3)/1e3,d.stats_playback_rate_min=E[0],d.stats_playback_rate_max=E[E.length-1],d.stats_playback_rate_frequency=Math.round(10*p.length/n*1e3)/1e3,d.stats_buffergoal_real=t.buffergoal.real,d.stats_buffergoal_base=t.buffergoal.base,d.stats_buffergoal_min=t.buffergoal.min,d.stats_buffergoal_max=t.buffergoal.max,d.stats_measure_count+=1;var m=Math.round((t.quality.droppedVideoFrames-d.stats_quality_dropped_video_frames)/(t.quality.totalVideoFrames-d.stats_quality_total_video_frames)*100)/100;return d.stats_quality_dropped_video_frames=t.quality.droppedVideoFrames,d.stats_quality_dropped_video_frames_current=t.quality.droppedVideoFramesCurrent,d.stats_quality_dropped_video_frames_ratio=m,d.stats_quality_dropped_video_frames_level_max=u,d.stats_quality_corrupted_video_frames=t.quality.corruptedVideoFrames,d.stats_quality_corrupted_video_frames_current=t.quality.corruptedVideoFramesCurrent,d.stats_quality_creation_time=t.quality.creationTime,d.stats_quality_total_video_frames=t.quality.totalVideoFrames,u=0,d}return!1}catch(e){return!1}},reset:function(){for(r=0;i.length;)i.shift();for(;a.length;)a.shift();for(;o.length;)o.shift();for(;s.length;)s.shift();for(var e in d)"stats_measure_samples"!==e&&(d[e]=0)}}}}}.apply(t,[]))||(e.exports=n)},4402:function(e,t,n){var r,i;r=[n(7080)],void 0===(i=function(e){return{create:function(){var t=e.create(),n={};return{measure:function(e){return{stream_info_has_audio:(n=e.data.streamInfo).haveAudio,stream_info_has_video:n.haveVideo,stream_info_preroll_duration:n.prerollDuration?n.prerollDuration:0,stream_info_width:n.videoInfo?n.videoInfo.width:0,stream_info_height:n.videoInfo?n.videoInfo.height:0,stream_info_frame_rate:n.videoInfo?n.videoInfo.frameRate:0,stream_info_sample_rate:n.audioInfo?n.audioInfo.sampleRate:0,stream_info_channels:n.audioInfo?n.audioInfo.channels:0,stream_info_bits_per_sample:n.audioInfo?n.audioInfo.bitsPerSample:0,connection_id:n.url.split("&cid=")[1].split("&pid=")[0]}},getFlat:function(){return t.get(n,"streamInfo",5)},reset:function(){n={}},getStreamname:function(){return void((e=n)&&Object.prototype.hasOwnProperty.call(e,"rtmp")&&Object.prototype.hasOwnProperty.call(e.rtmp,"streamname"))?n.rtmp.streamname:"";var e}}}}}.apply(t,r))||(e.exports=i)},6545:function(e,t){var n;void 0===(n=function(){return{create:function(){return{measure:function(e){return{warning_message:e.data.message}}}}}}.apply(t,[]))||(e.exports=n)},2215:function(e,t,n){var r,i;r=[n(1933),n(8818),n(8478),n(8333),n(8197),n(6627),n(9583),n(9914),n(5999),n(2556),n(7982),n(2788),n(4402),n(2381),n(2247),n(9555),n(3932),n(4245),n(4815),n(7666),n(1025),n(27),n(6545)],void 0===(i=function(e,t,n,r,i,a,o,s,u,d,l,c,f,E,p,m,b,h,g,_,T,A,S){function y(){var l,y,v,R,O,I,N,C,D,w,U,P,M,L,F,k,x,B=d.create().metrics,H={},G=r.create("NanoMetrics"),V=e,W=t,Y=n,j={},K={},z={},q={},X=0,Q="classic",J=0,$=0,Z=0,ee=a,te=1,ne=["glog1.nanocosmos.de"];function re(e){try{var t=function(e){var t=q&&q.source&&q.source.entries&&q.source.entries[X]&&q.source.entries[X].h5live?q.source.entries[X].h5live:{},n=t.server||{websocket:"",hls:"",progressive:""},r=t.rtmp&&t.rtmp.url?t.rtmp.url:"",i=function(e){var t=e.split(/\?(.+)/);return 1===t.length?t.push(""):t.pop(),t}(t.rtmp&&t.rtmp.streamname?t.rtmp.streamname:""),a=i[0],o=i[1],s=function(e,t,n){var r,i,a="";return e&&t&&(-1!==e.indexOf("bintu")||n&&n.websocket&&n.websocket.length&&-1!==n.websocket.indexOf("bintu")&&-1!==e.indexOf("localhost"))&&(i=/^[A-Za-z0-9 ]+$/,(r=t.split("-")[0]).length>4&&r.length<=6&&i.test(r))&&(a=t.split("-")[0]),a}(r,a,n),u=void 0!==K.hostname?K.hostname:"";void 0===(L=document.visibilityState)&&(L="unknown"),L=L;var d=(F=ee.isIOSDesktopMode)?"iOS":V.os;k=function(){if(!F||!V.browserVersion)return V.osVersion;var e=V.browserVersion.split("."),t=!0;if(!(e.length<=2))return"unknown";for(var n=0;n2){t=!1;break}return t?V.browserVersion:void 0}();var l={application_name:"h5live-player",application_user_id:""+B.userId,application_event_id:""+B.eventId,application_account_id:""+B.accountId,application_account_key:""+B.accountKey,message:e.name.replace(/\b\w/g,(function(e){return e.toLowerCase()})).replace(/([A-Z])/g,"_$1").toUpperCase(),severity:"info",client_ip:"",timestamp_client:(new Date).toISOString(),referrer:document.location.href,os:d,os_version:k,browser:V.browser,browser_version:V.browserVersion,player_id:y.id,player_type:y.type,player_mediaplaybackapi:y.mediaplaybackapi,player_version:y.version,player_event_name:e.name.replace(/\b\w/g,(function(e){return e.toLowerCase()})).replace(/([A-Z])/g,"_$1").toUpperCase(),server_domain:n.websocket&&n.websocket.length?n.websocket.split("//")[1].split("/")[0]:"",server_hostname:u,rtmp_url:r,rtmp_streamname:a,rtmp_streamparameter:o,connection_id:j&&j.url&&j.url.length?j.url.split("&cid=")[1].split("&pid=")[0]:"",time_played:z.currentTime?Math.round(1e3*z.currentTime)/1e3:0,time_elapsed:J>0?Math.round(performance.now()-J)/1e3:0,bintu_orga_hash:s,latency_control_mode:Q,visibility:L,player_event_count:te};for(var c in H)Object.prototype.hasOwnProperty.call(H,c)&&(l[c]=""+H[c]);return l}(e);switch(e.name){case o.READY:Q=e.data.config.latencyControlMode,t.latency_control_mode=Q,e.data.config.playback.latencyControlMode=q.playback&&q.playback.latencyControlMode?q.playback.latencyControlMode:Q,ie(w,"measure",e,t)&&(fe(!1)&&se(t,{bintu_response_time:x.responseTime}),se(t,w.flattenCodecs(W.getCodecSupport(),"")),se(t,{ready_bi_webtransport:V.isWebTransportSupported}),ae(t));break;case o.LOADING:N.reset(),I.reset(),ae(t);break;case o.STREAM_INFO:case o.STREAM_INFO_UPDATE:j=e.data.streamInfo,ie(v,"measure",e,t),ae(t);break;case o.PLAY:J=performance.now(),ie(O,"measure",e,t),fe(!1)&&se(t,{bintu_response_time:x.responseTime}),ae(t),U.resetSwitchCount();break;case o.STATS:z=e.data.stats;var n=Object.prototype.hasOwnProperty.call(z,"adaptive");n&&P.setStats(e,t),ie(I,"measure",e,t)&&(n&&se(t,P.getStatsFlat()),ae(t));break;case o.START_BUFFERING:O.setTimePlayingStateEnd(),N.start();break;case o.STOP_BUFFERING:N.end(),O.setTimePlayingStateStart(),ie(N,"measure",e,t)&&(t.message=t.player_event_name="BUFFERING",ae(t));break;case o.PAUSE:$=t.time_elapsed,Z+=$,O.setTimePlayingStateEnd();var r=O.getTimePlayingStateTotal();ie(C,"measure",e,t),ie(N,"reset",e,t),se(t,v.getFlat()),se(t,{time_playing_state_total:r,time_elapsed_total_sum:Z,entries_length:q&&Object.prototype.hasOwnProperty.call(q,"source")&&Object.prototype.hasOwnProperty.call(q.source,"entries")?q.source.entries.length:1}),se(t,U.getSwitchCountFlat()),ae(t),j={},z={},O.resetTimePlayingStateSubtotal(),U.resetSwitchCount(),Z=0,J=0;break;case o.ERROR:ie(D,"measure",e,t);var i=fe(!0);if(i)switch(e.data.code){case 5101:case 5102:case 5103:se(t,{bintu_response_time:i.responseTime,bintu_api_url:i.apiUrl,bintu_is_group:i.isGroup,bintu_id:i.id,bintu_status:i.status});break;default:se(t,{bintu_response_time:x.responseTime})}ae(t);break;case o.DESTROY:ae(t);break;case o.METADATA:case o.PLAYBACK_FINISHED:case o.MEDIA:case o.MUTE:case o.UNMUTE:case o.VOLUME_CHANGE:case o.STATE_CHANGE:break;case o.WARNING:ie(M,"measure",e,t),ae(t);break;case o.SWITCH_STREAM_INIT:ie(U,"handleEvent",e,t)&&(se(t,P.getStatsFlat()),ae(t));break;case o.SWITCH_STREAM_SUCCESS:de(e,"entry")&&ue(e.data.entry.index),$=t.time_elapsed,Z+=$,J=performance.now(),ie(U,"handleEvent",e,t)&&(se(t,v.getFlat()),se(t,{time_elapsed_total:$,time_elapsed_total_sum:Z}),ae(t),v.reset());break;case o.SWITCH_STREAM_FAIL:case o.SWITCH_STREAM_ABORT:case o.UPDATE_SOURCE_INIT:ie(U,"handleEvent",e,t)&&ae(t);break;case o.UPDATE_SOURCE_SUCCESS:de(e,"source")&&((a=e.data.source)&&(q.source=a),ue(e.data.source.startIndex)),$=t.time_elapsed,Z+=$,J=performance.now(),ie(U,"handleEvent",e,t)&&(se(t,v.getFlat()),se(t,{time_elapsed_total:$,time_elapsed_total_sum:Z}),ae(t),v.reset());break;case o.UPDATE_SOURCE_FAIL:case o.UPDATE_SOURCE_ABORT:ie(U,"handleEvent",e,t)&&ae(t);break;case o.SERVER_INFO:K=e.data.serverInfo,ie(R,"measure",e,t)&&(t.server_hostname=void 0!==K.hostname?K.hostname:"",ae(t))}}catch(e){G.debugEnabled()&&G.debug("metrics event error: "+(e.message?e.message:"exception"))}var a}function ie(e,t,n,r){var i=e[t](n,r);if(i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(r[a]=i[a]);return!0}return!1}function ae(e){G.debugEnabled()&&G.debug("send "+e.player_event_name),l.send(e.player_event_name,e),1e5===te?(te=1,G.debugEnabled()&&G.debug("playerEventCount reached 100000, reset to 1")):te+=1}function oe(){if("object"==typeof y&&"function"==typeof y.off)for(var e in o)Object.prototype.hasOwnProperty.call(o,e)&&y.off(o[e],re);l&&(l.destroy(),l=null),v=null,O=null,I=null,N=null,C=null,D=null,w=null,U=null,P=null,M=null}function se(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(e,n)||(e[n]=t[n])}function ue(e){X=isNaN(e)?0:e}function de(e,t){var n=e&&Object.prototype.hasOwnProperty.call(e,"data");return t?n&&Object.prototype.hasOwnProperty.call(e.data,t):n}function le(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function ce(e,t){if("string"===t)return function(e){return"string"!=typeof e||""===e.trim()?"unknown":e.trim()}(e);if("boolean"===t)return Boolean(e);if("number"===t){var n=Number(e);return isNaN(n)?0:n}return e}function fe(e){var t=function(e){if("object"!=typeof x||null===x)return!1;var t={apiUrl:"string",id:"string",isGroup:"boolean",responseTime:"number",status:"string"};if("number"==typeof x.status&&(x.status=x.status.toString()),e){for(var n in t)if(le(t,n)&&(x[n]=ce(x[n],t[n]),!le(x,n)))return!1;return x}if(le(x,"responseTime")){var r=x.responseTime;if("string"==typeof r&&(r=Number(r)),"number"==typeof r&&!isNaN(r))return x.responseTime=r,x}return!1}(e);return!!(t&&t.responseTime>0)&&t}return{setup:function(e,t,n){var r;G.debugEnabled()&&G.debug("setup"),y=t,q=i.copy(e),oe(),x=n,!q.source.h5live||q.source.entries&&q.source.entries.length||(q.source.entries=[{h5live:i.copy(q.source.h5live)}],delete q.source.h5live);var a=q.metrics;if(!a)throw new Y(u.METRICS_NO_OBJECT,s.SETUP.METRICS_NO_OBJECT);if("object"!=typeof a)throw new Y(u.METRICS_NOT_OBJECT,s.SETUP.METRICS_NOT_OBJECT);if(!Object.getOwnPropertyNames(a).length)throw new Y(u.METRICS_EMPTY_OBJECT,s.SETUP.METRICS_EMPTY_OBJECT);for(r in a)if(!Object.prototype.hasOwnProperty.call(a,r)||!Object.prototype.hasOwnProperty.call(B,r)||(B[r]=a[r],0===r.indexOf("customField"))){var d,L=r.split("customField");if(!(L.length>1&&0===L[0].length))throw new Y(u.METRICS_PROPERTY_INVALID.replace("$key$",r),s.SETUP.METRICS_PROPERTY_INVALID);if(d=parseInt(L[1],10),isNaN(d))throw new Y(u.METRICS_INDEX_INVALID.replace("$key$",r),s.SETUP.METRICS_INDEX_INVALID);if(d.toString()!==L[1])throw new Y(u.METRICS_INDEX_INCORRECT.replace("$key$",r),s.SETUP.METRICS_INDEX_INCORRECT);if(d<1||d>10)throw new Y(u.METRICS_INDEX_RANGE.replace("$key$",r),s.SETUP.METRICS_INDEX_RANGE);H["application_custom_field_"+L[1]]=a[r]}if(!B.accountId||!B.accountKey)throw new Y(u.METRICS_NO_CREDENTIALS,s.SETUP.METRICS_NO_CREDENTIALS);for(r in a.serverDomain&&a.serverDomain.length>0?B.serverDomain=a.serverDomain:B.serverDomain=ne[0],a)G.debugEnabled()&&G.debug("metrics config["+r+"]: "+JSON.stringify(a[r]));for(var F in v=f.create(),R=E.create(),O=p.create(),I=m.create(B.statsInterval),N=b.create(),C=h.create(),D=g.create(),w=_.create(),U=T.create(),P=A.create(),M=S.create(),l=c.create({accountId:B.accountId,accountKey:B.accountKey,serverDomain:B.serverDomain}),o)Object.prototype.hasOwnProperty.call(o,F)&&(y.off(o[F],re),y.on(o[F],re));X=q.source&&!isNaN(q.source.startIndex)&&q.source.entries&&q.source.startIndex>=0&&q.source.startIndex=400?"fail":this.status>=200?"success":"unknown";d.call(null,e,t,n)}}.bind(r,i,e),["abort","error","timeout"].forEach((function(t){r.addEventListener(t,d.bind(null,i,e,t))})),void 0!==t){if("string"==typeof t)try{t=JSON.parse(t)}catch(e){t=null}if("object"==typeof t)try{t=JSON.stringify(t),s.detailEnabled()&&s.detail("#"+i+" "+e+" send "+t),setTimeout(d.bind(null,i,e,"suspend"),5e3),r.send(t)}catch(e){d.call(null,i,"catch "+e.message)}}else r.send()}catch(e){d.call(null,i,"catch "+e.message)}},destroy:function(){for(var e in a)Object.prototype.hasOwnProperty.call(a,e)&&delete a[e]}}}}}.apply(t,r))||(e.exports=i)},7080:function(e,t){var n;void 0===(n=function(){return{create:function(){var e,t,n={},r={source:"src",options:"opt",config:"cfg",playback:"pb",entries:"entr"};function i(t,r){var a;for(var s in t)a=o(s,r),e&&Array.isArray(t[s])?i(t[s].slice(Math.max(t[s].length-e,0)),a):"object"==typeof t[s]?i(t[s],a):n[a]=t[s];return n}function a(e){return isNaN(e)&&e===e.toUpperCase()}function o(e,n){var i,o=n+"_";t&&Object.prototype.hasOwnProperty.call(r,e)&&(e=r[e]);for(var s=0;s1&&(e=1),this._setMediaElement(),this._volume=e,this._muted||this._mediaElement.SetVolume(this._volume),this._emit(m.VOLUME_CHANGE,{volume:e})},y.destroy=function(){this._setState(this.STATE.DESTROYING),this._playing&&this.pause(this.state),this._emit(m.DESTROY),this._mediaElement&&(this.pause(),document.getElementById(this._playerDivId).removeChild(this._mediaElement),this._mediaElement=null),clearTimeout(this._bufferTimeout),this.removeAllListeners()},y.updateSource=function(e){return new Promise(function(t,n){try{this._isSwitchStream&&(this._emit(m.SWITCH_STREAM_ABORT,{source:this.config.source,entry:this._getEntry(),rule:"none",tag:"",count:this._switchCount,type:"direct",id:this._isSwitchStream,reason:"superseded"}),this._isSwitchStream=!1),this._isUpdateSource&&(this._emit(m.UPDATE_SOURCE_ABORT,{source:this.config.source,entry:this._getEntry(),rule:"none",tag:"",count:this._switchCount,type:"update",id:this.isUpdateSource,reason:"superseded"}),this._isUpdateSource=!1),this._isUpdateSource=Math.round(1e11*Math.random()),this._switchCount++,setTimeout(this._emit.bind(this,m.UPDATE_SOURCE_INIT,{source:this.config.source,entry:this._getEntry(),rule:"none",options:this.config.source.options?this.config.source.options:{},tag:"",count:this._switchCount,type:"direct",id:this._isUpdateSource}),0);var r=!1;this.state!==this.STATE.PLAYING&&this.state!==this.STATE.LOADING&&this.state!==this.STATE.BUFFERING||(r=!0),this.config.source=e,!this.config.source.h5live||this.config.source.entries&&this.config.source.entries.length||(this.config.source.entries=[{h5live:f.copy(this.config.source.h5live)}]),this._setConnectionConfig(this.config.source.entries[isNaN(this.config.source.startIndex)?0:this.config.source.startIndex].h5live),this.config.source.entries.length>1&&this.config.source.options&&this.config.source.options.adaption&&this.config.source.options.adaption.rule&&"none"!==this.config.source.options.adaption.rule&&this._emitWarning("ABR is not supported with flash!"),r?this.play():(setTimeout(this._emit.bind(this,m.UPDATE_SOURCE_SUCCESS,{source:this.config.source,entry:this._getEntry(),rule:"none",tag:"",count:this._switchCount,type:"direct",id:this._isUpdateSource}),0),this._isUpdateSource=!1),t(f.copy(this.config))}catch(e){n(e)}}.bind(this))},y.switchStream=function(e){return new Promise(function(t,n){if(isNaN(e)||e<0||e>=this.config.source.entries.length)n(new c(a.PLAYER.INVALID_ENTRY_INDEX,i.PLAYER.INVALID_ENTRY_INDEX));else{this._isSwitchStream&&(this._emit(m.SWITCH_STREAM_ABORT,{source:this.config.source,entry:this._getEntry(),rule:"none",tag:"",count:this._switchCount,type:"direct",id:this._isSwitchStream,reason:"superseded"}),this._isSwitchStream=!1),this._isUpdateSource&&(this._emit(m.UPDATE_SOURCE_ABORT,{source:this.config.source,entry:this._getEntry(),rule:"none",tag:"",count:this._switchCount,type:"update",id:this.isUpdateSource,reason:"superseded"}),this._isUpdateSource=!1),this._isSwitchStream=Math.round(1e11*Math.random()),this._switchCount++,setTimeout(this._emit.bind(this,m.SWITCH_STREAM_INIT,{source:this.config.source,entry:this._getEntry(),rule:"none",options:this.config.source.options?this.config.source.options:{},tag:"",count:this._switchCount,type:"direct",id:this._isSwitchStream}),0);var r=!1;this.state!==this.STATE.PLAYING&&this.state!==this.STATE.LOADING&&this.state!==this.STATE.BUFFERING||(r=!0),this._setConnectionConfig(this.config.source.entries[e].h5live),r?this.play():(setTimeout(this._emit.bind(this,m.SWITCH_STREAM_SUCCESS,{source:this.config.source,entry:this._getEntry(),rule:"none",tag:"",count:this._switchCount,type:"direct",id:this._isSwitchStream}),0),this._isSwitchStream=!1),t(f.copy(this.config))}}.bind(this))},y.setAdaption=function(e){e&&e.rule&&"none"!==e.rule&&this._emitWarning("ABR is not supported with flash!")},y._setupVideoElement=function(){var e="nano.player.swf";void 0!==this.config.playback.flashplayer&&(e=this.config.playback.flashplayer);var t=document.createElement("div");t.setAttribute("id","flashReplace"),this._playerDiv.appendChild(t);var n={};n.id=this._mediaElementId,n.name=this._mediaElementId,n.align="middle",n.wmode="transparent",s.embedSWF(e,"flashReplace","100%","100%","9.0.0",null,{},{quality:"high",bgcolor:"#000000",allowscriptaccess:"always",allowfullscreen:"true",allowfullscreeninteractive:"true",wmode:"transparent"},n)},y._setupFinish=function(){return new Promise(function(e,t){var n=0,a=0;n=setInterval(function(){if(a++,n&&(this._mediaElement=document.getElementById(this._mediaElementId),this._mediaElement&&this._mediaElement.Start)){clearInterval(n);try{if(window._flashPlayers[this._mediaElementId]=this,this._setName(),this._mediaElement.TraceExternalFunctions(),this._setNetStream(!1),this._setConnectionConfig(this.config.source.entries[isNaN(this.config.source.startIndex)?0:this.config.source.startIndex].h5live),this.config.source.entries.length>1&&this.config.source.options&&this.config.source.options.adaption&&this.config.source.options.adaption.rule&&"none"!==this.config.source.options.adaption.rule&&this._emitWarning("ABR is not supported with flash!"),this._setPlayerConfig(this._playerDiv.offsetWidth,this._playerDiv.offsetHeight),this.config.playback.muted&&this.mute(),this.config.playback.timeouts){var o=1e3*this.config.playback.timeouts.loading,s=1e3*this.config.playback.timeouts.buffering;T=Math.max(Math.min(o,6e4),1e4),A=Math.max(Math.min(s,6e4),1e4)}this.config.type=this.type,this._setState(this.STATE.READY),this._emit(m.READY,{config:this.config}),this.config.playback.autoplay&&this.play(),e(f.copy(this.config))}catch(e){t(e)}}a>100&&(clearInterval(n),t(new c(r.EMBED_PLAYER,i.SETUP.EMBED_PLAYER)))}.bind(this),100)}.bind(this))},y._setListeners=function(e,t){for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&"function"==typeof e[n]){var r=n.replace("on",""),i=e[n];t.on(r,i)}},y._setState=function(e){this.state=e,_("nanoplayer ("+this._playerDivId+'): set state "'+this._getState()+'"',3),this._emit(m.STATE_CHANGE)},y._getState=function(){for(var e in this.STATE)if(this.STATE[e]===this.state)return e},y._emit=function(e,t){var n={};t&&t.name&&t.data?n=t:t?(n.data=t,n.name=e||"unknown"):(n.data={},n.name=e||"unknown"),n.player=this._playerDivId,n.id=this.id,n.version=this.version,n.state=this.state,"Error"===e&&n.data.code&&n.data.message&&_("nanoplayer ("+this._playerDivId+"): error "+n.data.code+" "+n.data.message,1),this.emit(n.name,n)},y._emitError=function(e,t){this._emit(m.ERROR,{code:e,message:t})},y._emitWarning=function(e){this._emit(m.WARNING,{message:e})},y._setConnectionConfig=function(e){this._setMediaElement();var t=e.rtmp,n=e.params,r=n&&n.url?n.url:t&&t.url?t.url:null,i=n&&n.stream?n.stream:t&&t.streamname?t.streamname:null;r&&i?(this.config.url=r+"/"+i,this._mediaElement.SetServerUrl(r),this._mediaElement.SetStreamName(i)):this.config.url=""},y._setPlayerConfig=function(e,t){this._setMediaElement(),this._mediaElement.SetVideoDisplayResolution(e+","+t),this._mediaElement.SetResize("false"),this._mediaElement.SetOnlyThisResolution(e+","+t)},y._setNetStream=function(e){this._setMediaElement(),this._mediaElement.UseNetstream(e?1:0)},y._setMediaElement=function(){var e=document.getElementById(this._mediaElementId);this._mediaElement=e},y._getPauseReason=function(e){var t="";if(e)switch(this.state){case this.STATE.READY:t=g.SERVER_NOT_FOUND;break;case this.STATE.LOADING:t=g.STREAM_NOT_FOUND;break;case this.STATE.BUFFERING:t=g.BUFFER;break;case this.STATE.UNKNOWN:t=g.UNKNOWN;break;case this.STATE.PLAYING:t=g.NORMAL;break;case this.STATE.DESTROYING:t=g.DESTROY;break;default:t=g.NORMAL}else t=g.NORMAL;return t},y._startIntervals=function(){this._stopIntervals(),this._onStats(!0),this._intervalEmitStats=setInterval(this._onStats.bind(this),100)},y._stopIntervals=function(){this._intervalEmitStats&&(clearInterval(this._intervalEmitStats),this._intervalEmitStats=0)},y._getEntry=function(){var e={},t=this._mediaElement.GetStreamName();return this.config.source.entries.forEach((function(n){n.h5live.rtmp.streamname===t&&(e=f.copy(n))})),e},y._onStreamInfo=function(e){_("nanoplayer ("+this._playerDivId+"): onStreamInfo",2),this._setMediaElement(),this._streamInfo=e,this._streamInfo.url="",this._streamInfo.rtmp={url:this._mediaElement.GetServerUrl(),streamname:this._mediaElement.GetStreamName()},this._isSwitchStream&&(this._emit(m.SWITCH_STREAM_SUCCESS,{source:this.config.source,entry:this._getEntry(),rule:"none",tag:"",count:this._switchCount,type:"direct",id:this._isSwitchStream}),this._isSwitchStream=!1),this._isUpdateSource&&(this._emit(m.UPDATE_SOURCE_SUCCESS,{source:this.config.source,entry:this._getEntry(),rule:"none",tag:"",count:this._switchCount,type:"update",id:this.isUpdateSource}),this._isUpdateSource=!1),this._emit(m.STREAM_INFO,{streamInfo:this._streamInfo})},y._onStats=function(e){var t=e?0:this._stats.currentTime+.1;this._stats.currentTime=t;var n="stats error";try{n=JSON.stringify(this._stats)}catch(e){}_("nanoplayer ("+this._playerDivId+"): stats - "+n,4),this._emit(m.STATS,{stats:this._stats})},y._onLoading=function(){this._isSwitchStream||this._isUpdateSource||(this._playing=!0,this._setState(this.STATE.LOADING),this._emit(m.LOADING)),this._loadingTimeout=setTimeout(function(){this._isSwitchStream&&(this._emit(m.SWITCH_STREAM_FAIL,{source:this.config.source,entry:this._getEntry(),rule:"none",tag:"",count:this._switchCount,type:"direct",id:this._isSwitchStream,code:i.STREAM.NOT_FOUND,message:"The requested stream can not be found."}),this._isSwitchStream=!1),this._isUpdateSource&&(this._emit(m.UPDATE_SOURCE_FAIL,{source:this.config.source,entry:this._getEntry(),rule:"none",tag:"",count:this._switchCount,type:"update",id:this.isUpdateSource,code:i.STREAM.NOT_FOUND,message:"The requested stream can not be found."}),this._isUpdateSource=!1),this._emitError(i.STREAM.NOT_FOUND,a.STREAM.NOT_FOUND),this.pause(this.state)}.bind(this),T)},y._onPlaying=function(){clearTimeout(this._loadingTimeout),clearTimeout(this._bufferTimeout),this.state===this.STATE.LOADING&&(this._startPlayingTimeout&&clearTimeout(this._startPlayingTimeout),this._startPlayingTimeout=setTimeout(function(){clearTimeout(this._startPlayingTimeout),this._startPlayingTimeout=0,this._setState(this.STATE.PLAYING),this._playing=!0,this.setVolume(this._volume),!this._intervalEmitStats&&this._emit(m.PLAY,{stats:{connecting:0,connected:0,firstFragmentReceived:0,firstFrameRendered:0,playable:0,playing:0}}),!this._intervalEmitStats&&this._startIntervals()}.bind(this),1e3))},y._onStartBuffering=function(){this.state=4e3&&e<5e3&&(n=r.CONNECTION_ERROR)}return n}function U(e){-1!==Object.keys(h).indexOf(e)&&(h[e]=Date.now())}function P(e,t){if(t=isNaN(t)?2:parseInt(t,10),"object"==typeof e){for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var r=e[n];if("object"==typeof r&&null!==r)if(Array.isArray(r))for(var i=0;i tweaking"),U(h.target-h.start),P()):m.debugEnabled()&&m.debug("start higher then limit -> tweaking denied");break;case"low":m.debugEnabled()&&m.debug("just low, no tweaking necessary")}}},{type:u.CONFIG,listener:function(e){var r;if((p=n.mustUseHLS||e.data.config.playback.allowSafariHlsFallback&&n.canUseHLS)||i.add({target:c,listeners:N}),e.data.config.playback.latencyControlMode)for(var u in a)Object.prototype.hasOwnProperty.call(a,u)&&a[u]===e.data.config.playback.latencyControlMode&&(_=a[u]);e.data.config.tweaks&&(e.data.config.tweaks.buffer&&((r=s.validateBuffer(e.data.config.tweaks.buffer)).success?(h=t.copy(e.data.config.tweaks.buffer),g=t.copy(h),R=!0):c.emit(l.BUFFER_TWEAKS_ERROR,{code:o.PLAYER.BUFFER_CONFIG_INVALID,message:r.reason})),e.data.config.tweaks.bufferDynamic&&!p&&_===a.CLASSIC&&((r=s.validateBuffer(e.data.config.tweaks.bufferDynamic,"dynamic")).success?(T=e.data.config.tweaks.bufferDynamic.offsetThreshold,A=e.data.config.tweaks.bufferDynamic.offsetStep,S=e.data.config.tweaks.bufferDynamic.cooldownTime):c.emit(l.BUFFER_TWEAKS_ERROR,{code:o.PLAYER.BUFFER_CONFIG_INVALID,message:r.reason}))),P()}},{type:d.CREATED,listener:w},{type:d.UPDATED,listener:function(e){w(e)}}],I=[{type:u.PLAY_STATS,listener:function(e){var t=e.data.stats.buffer.delay.current;t&&E.add(t),!v&&n.isTridentBrowser&&t>2&&(h.target=t,h.limit=h.target+1.5,P()),v=!0}},{type:u.BUFFERING,listener:function(){D(!0);var e=((new Date).getTime()-y)/1e3;-1!==y&&eg.start?(h.start-g.start1&&("update"===e.data.type?S.shift():S.pop()),"update"===e.data.type?c.emit(r.UPDATE_SOURCE_FAIL,{source:p.source,entry:p.entry,rule:p.rule,tag:e.data.tag,count:e.data.count,code:e.data.code,message:e.data.message,type:e.data.type,id:e.data.id}):c.emit(r.SWITCH_STREAM_FAIL,{source:p.source,entry:p.entry,rule:p.rule,tag:e.data.tag,count:e.data.count,code:e.data.code,message:e.data.message,type:e.data.type,id:e.data.id}),e.data.code===d.NETWORK.SOURCE_TIMEOUT&&V(p),_.debugEnabled()&&_.debug("set updating to false in onUpdateSourceFail"),H(!1),O&&!C&&(L(!0),M())}},{type:i.UPDATE_SOURCE_ABORT,listener:function(e){var t=!1;S.length>1&&("update"===e.data.type?S.shift():S.pop()),"superseded"===e.data.reason&&m&&(t=!0),"update"===e.data.type?"equalsource"===e.data.reason?c.emit(r.UPDATE_SOURCE_SUCCESS,{source:p.source,entry:p.entry,rule:p.rule,tag:e.data.tag,count:e.data.count,type:e.data.type,id:e.data.id}):c.emit(r.UPDATE_SOURCE_ABORT,{source:t?m.source:p.source,entry:t?m.entry:p.entry,rule:t?m.rule:p.rule,tag:e.data.tag,count:e.data.count,reason:e.data.reason,type:e.data.type,id:e.data.id}):c.emit(r.SWITCH_STREAM_ABORT,{source:I?e.data.source:p.source,entry:I?e.data.entry:p.entry,rule:I?e.data.rule:p.rule,tag:e.data.tag,count:e.data.count,reason:"equalsource"===e.data.reason?"equal":e.data.reason,type:e.data.type,id:e.data.id}),"recover"===e.data.reason?m?(_.debugEnabled()&&_.debug("set updating to updatingPrevious in onUpdateSourceAbort"),H(m),G(!1)):(_.debugEnabled()&&_.debug("recover abort without updatePrevious, do nothing"),_.debugEnabled()&&_.debug("updating in abort is "+JSON.stringify(p))):t?G(!1):(_.debugEnabled()&&_.debug("set updating to false in onUpdateSourceAbort"),H(!1))}},{type:i.CONFIG,listener:function(e){E=e.data.config,f=E.id,R=E.playback.metadata,O=E.playback.keepConnection,C=E.playback.autoplay,I=t.mustUseHLS||E.playback.allowSafariHlsFallback&&t.canUseHLS,N=E.playback.faststart}},{type:i.STREAM_SWITCH,listener:function(e){var t=e.data.entry,n=e.data.options;if("init"===e.data.type){for(;S.length;)S.pop();return F(t.h5live),void(O&&M())}w+=1,n.tag=n.tag||"",n.count=w,"update"===e.data.type?c.emit(r.UPDATE_SOURCE_INIT,{source:e.data.source,entry:t,rule:e.data.rule,options:n,tag:n.tag,count:n.count,type:e.data.type,id:e.data.id}):c.emit(r.SWITCH_STREAM_INIT,{source:e.data.source,entry:t,rule:e.data.rule,options:n,tag:n.tag,count:n.count,type:e.data.type,id:e.data.id}),D?"update"===e.data.type?c.emit(r.UPDATE_SOURCE_ABORT,{source:e.data.source,entry:t,rule:e.data.rule,reason:"frequency",tag:n.tag,count:n.count,type:e.data.type,id:e.data.id}):c.emit(r.SWITCH_STREAM_ABORT,{source:e.data.source,entry:t,rule:e.data.rule,reason:"frequency",tag:n.tag,count:n.count,type:e.data.type,id:e.data.id}):!I||!p||"update"!==p.type&&"recover"!==p.type||"update"===e.data.type?(D=!0,setTimeout((function(){D=!1}),500),p&&G(p),_.debugEnabled()&&_.debug("set updating to e.data in onStreamSwitch"),H(e.data),"update"===e.data.type?_.debugEnabled()&&_.debug("update source: "+JSON.stringify(e.data.source)):_.debugEnabled()&&_.debug("switch stream: "+JSON.stringify(t)),S.length>1&&S.pop(),F(t.h5live),C||O&&!I&&!C?(_.debugEnabled()&&_.debug("connect to new source without terminating the old one"),e.data.options.forcePlay&&!C&&(C=!0),M(e.data)):(S.shift(),_.debugEnabled()&&_.debug("replaced source"),P({data:{tag:e.data.options.tag,count:w,type:e.data.type,id:e.data.id}}))):c.emit(r.SWITCH_STREAM_ABORT,{source:e.data.source,entry:t,rule:e.data.rule,reason:"recover"===p.type?"recover":"updateProgress",tag:n.tag,count:n.count,type:e.data.type,id:e.data.id})}},{type:i.API_PLAY,listener:function(){if(_.debugEnabled()&&_.debug("api play"),C=!0,O?(_.debugEnabled()&&_.debug("send network play"),c.emit(r.NETWORK_PLAY)):M(p&&p.options.forcePlay?p:void 0),I){var e=k("hls").url;c.emit(r.VIDEO_SOURCE,{src:e,type:l.HLS})}}},{type:i.API_PAUSE,listener:function(){_.debugEnabled()&&_.debug("api pause"),C=!1,(!O||p)&&L(),I&&c.emit(r.VIDEO_SOURCE,{src:"",type:l.HLS})}},{type:i.APPLICATION_STATE_CHANGE,listener:function(e){switch(e.data.state){case u.PAUSED:p&&P({data:{tag:p.options.tag,count:p.options.count,type:p.type,id:p.id}})}}},{type:i.CAN_PLAY,listener:function(){p&&I&&(_.debugEnabled()&&_.debug("updating onCanPlay is "+JSON.stringify(p)),clearTimeout(g),P({data:{tag:p.options.tag,count:p.options.count,type:p.type,id:p.id}}))}}];function P(e){S.length>1&&S.shift(),b&&b.id===e.data.id&&(_.debugEnabled()&&_.debug("set updating to updatingTimeoutObject in onUpdateSourceSuccess"),H(b),V(null)),"update"===e.data.type?c.emit(r.UPDATE_SOURCE_SUCCESS,{source:p.source,entry:p.entry,rule:p.rule,tag:e.data.tag,count:e.data.count,type:e.data.type,id:e.data.id}):c.emit(r.SWITCH_STREAM_SUCCESS,{source:p.source,entry:p.entry,rule:p.rule,tag:e.data.tag,count:e.data.count,type:e.data.type,id:e.data.id}),_.debugEnabled()&&_.debug("set updating to false in onUpdateSourceSuccess"),H(!1),clearTimeout(g)}function M(e){var t,n,i=e?S.length-1:0;if(R||S[i].security||!I){x(!C,"paused"),x(R&&I,"metastreamonly"),x(!R&&!!S[i].security&&I,"checkandclose"),x(e?e.faststart:N,"faststart"),t=(n=k("websocket",i)).url;var a=e?r.NETWORK_UPDATE_SOURCE:r.CONNECT;_.debugEnabled()&&_.debug("connect to: "+t,1),c.emit(a,{url:t,config:n,update:e||!1,reconnect:E.playback.reconnect,timeouts:E.playback.timeouts}),I||c.emit(r.URL,{url:t})}I&&(x(e?e.faststart:N,"faststart"),t=(n=k("hls")).url,c.emit(r.URL,{url:t}),c.emit(r.VIDEO_SOURCE,{src:t,type:l.HLS}))}function L(e){_.debugEnabled()&&_.debug("disconnecting"),c.emit(r.DISCONNECT,{silent:!!e})}function F(e){var n=e.rtmp,i=e.params;T.initConfig().setServer(e.server).setToken(e.token).setQueryParams(i).setSecurity(e.security),T.connectionConfig.server.websocket.length||T.connectionConfig.server.hls.length||c.emit(r.NO_SERVER_ERROR),"object"==typeof n&&n.url&&n.url.length&&n.streamname&&n.streamname.length||i?T.setRtmp(n):c.emit(r.MISSING_RTMP_ERROR),(t.isIOSDesktopMode||t.isIOS)&&T.addQueryParam("os","ios"),S.push(T.connectionConfig)}function k(e,t){var n=void 0!==typeof t&&t>-1&&void 0!==typeof S[t]?t:S.length-1,r=S[n];return A.initURL(r,e).processConfigFlags(y).processConfigQuery(f).processSecurity().buildConnectionURL(),A.connectionConfig}function x(e,t){!0===e&&void 0===y[t]?y[t]=!0:!1===e&&y[t]&&delete y[t]}function B(e){for(var t in s)if(Object.prototype.hasOwnProperty.call(s,t)&&s[t]===e)return t}function H(e){_.debugEnabled()&&_.debug("set updating to "+JSON.stringify(e)+" from "+JSON.stringify(p)),p=e}function G(e){_.debugEnabled()&&_.debug("set updatingPrevious to "+JSON.stringify(e)+" from "+JSON.stringify(m)),m=e}function V(e){_.debugEnabled()&&_.debug("set updatingTimeoutObject to "+JSON.stringify(e)+" from "+JSON.stringify(b)),b=e}return _.debugEnabled()&&_.debug("init"),n.add({target:c,listeners:U}),{destroy:function(){n.remove({target:c,listeners:U})}}}}}.apply(t,r))||(e.exports=i)},3445:function(e,t,n){var r,i;r=[n(8333),n(6627),n(1933),n(9474),n(7146),n(561),n(4813)],void 0===(i=function(e,t,n,r,i,a,o){return{create:function(s,u){var d,l,c,f,E,p,m=e.create("AdjustControllerAdapter"),b={default:i,fastadaptive:a,balancedadaptive:a},h="balancedadaptive";return m.debugEnabled()&&m.debug("init"),c=u.playback.latencyControlMode,f=t.isTridentBrowser,E=n.isManagedMediaSourceH264Supported&&t.isIOS,p=t.mustUseHLS||u.playback.allowSafariHlsFallback&&t.canUseHLS,l="default",c!==r.FAST_ADAPTIVE||f?c!==r.BALANCED_ADAPTIVE||f||(l=h):E||p?(l=h,c=r.BALANCED_ADAPTIVE):l="fastadaptive",m.debugEnabled()&&m.debug("use adjustController type "+l),s.emit(o.CONTROL_MODE_SET,{latencyControlMode:c}),d=b[l].create(s,c),{calcBufferGoal:function(e){return d.calcBufferGoal(e)},destroy:function(){d.destroy(),d=null}}}}}.apply(t,r))||(e.exports=i)},561:function(e,t,n){var r,i;r=[n(8333),n(6637),n(492),n(9474),n(4234)],void 0===(i=function(e,t,n,r,i){return{create:function(a,o){var s,u=e.create("AdaptiveAdjustController"),d={real:0,base:0,min:0,max:0},l=0,c=0,f=0,E=0,p=0,m=1e3,b=0,h=0,g=0,_=0,T=.998,A=0,S=0,y={fastadaptive:{minClamp:.3,range:.4},balancedadaptive:{minClamp:.5,range:.7}},v=[{type:i.APPLICATION_STATE_CHANGE,listener:function(e){switch(e.data.state){case n.PAUSED:l=0,c=0,f=0,E=0,p=0,m=1e3,b=0,h=0,g=0,_=0;break;case n.BUFFERING:case n.PLAYING:}}},{type:i.BUFFER_TWEAKS_CREATED,listener:function(e){s=e.data.tweaks.buffer,d.base||(d.base=s.start),d.min=Math.max(s.min+.1+.125*(s.min-.2),A),d.max=d.min+S}}];return u.debugEnabled()&&u.debug("init"),t.add({target:a,listeners:v}),Object.prototype.hasOwnProperty.call(y,o)||(o=r.FAST_ADAPTIVE,u.debugEnabled()&&u.debug("use default mode fast")),A=y[o].minClamp,S=y[o].range,u.debugEnabled()&&u.debug("use mode "+o),{destroy:function(){t.remove({target:a,listeners:v})},calcBufferGoal:function(e){if(f=e.stats.buffer.end,E=window.performance.now(),_<8)d.base=d.min,_++;else{l&&c&&(p=p*T+(1e3*(f-l)-(E-c)),m=Math.min(m,p)*T,b=Math.max(b,p)*T,h=(b-m)/2,g=Math.max(Math.abs(m),Math.abs(h))),c=E,l=f;var t=s.min+Math.abs(2*g)/1e3;t=Math.min(d.max,t),t=Math.max(d.min,t),t=Math.round(100*t)/100,d.base=t}return d}}}}}.apply(t,r))||(e.exports=i)},7146:function(e,t,n){var r,i;r=[n(8333),n(6637),n(492),n(5337),n(4234)],void 0===(i=function(e,t,n,r,i){return{create:function(r){var a,o=e.create("DefaultAdjustController"),s={real:0,base:0,min:0,max:0},u=[{type:i.APPLICATION_STATE_CHANGE,listener:function(e){switch(e.data.state){case n.PAUSED:case n.BUFFERING:case n.PLAYING:}}},{type:i.BUFFER_TWEAKS_CREATED,listener:function(e){a=e.data.tweaks.buffer,s.base||(s.base=a.target)}}];return o.debugEnabled()&&o.debug("init"),t.add({target:r,listeners:u}),{destroy:function(){t.remove({target:r,listeners:u})},calcBufferGoal:function(){return s}}}}}.apply(t,r))||(e.exports=i)},4842:function(e,t,n){var r,i;r=[n(8333),n(492),n(6637),n(4234)],void 0===(i=function(e,t,n,r){return{create:function(i,a){var o,s,u,d,l,c,f=e.create("HLSDefaultConservativeLatencyController"),E=0,p=0,m=1,b=[{type:r.APPLICATION_STATE_CHANGE,listener:function(e){switch(e.data.state){case t.PLAYING:break;case t.PAUSED:g()}}},{type:r.BUFFER_TWEAKS_CREATED,listener:function(e){s=e.data.tweaks.buffer}}];function h(e){var t=0;return e&&c?(t=(window.performance.now()-c)/1e3,c=0):e||c||(c=window.performance.now()),t}function g(){E=0}return f.debugEnabled()&&f.debug("init"),g(),n.add({target:i,listeners:b}),{checkLatency:function(e,t){o=e.stats,m=o.playbackrate.current,u=t.base,l=1,p=o.buffer.delay.avg;var n=Math.abs(m-1)<1e-6;if(d=u+0,E=o.buffer.end>E+.1?o.buffer.end:E,s.limit=p||s.min+.2>=p)&&!n){var r=h(!0);r&&f.debugEnabled()&&f.debug("normalize speed after "+r.toFixed(2)+" seconds",2),l=1,a.setRate(m,l)}return d},destroy:function(){n.remove({target:i,listeners:b}),a.destroy(),a=null}}}}}.apply(t,r))||(e.exports=i)},9076:function(e,t,n){var r,i;r=[n(8333),n(492),n(6637),n(4234)],void 0===(i=function(e,t,n,r){return{create:function(i,a){var o,s,u,d,l,c,f,E=e.create("HLSWebkitProgressiveLatencyController"),p=0,m=0,b=1,h=0,g=[{type:r.APPLICATION_STATE_CHANGE,listener:function(e){switch(e.data.state){case t.PLAYING:break;case t.PAUSED:T()}}},{type:r.BUFFER_TWEAKS_CREATED,listener:function(e){s=e.data.tweaks.buffer}}];function _(e){var t=0;return e&&f?(t=(window.performance.now()-f)/1e3,f=0):e||f||(f=window.performance.now()),t}function T(){p=0,clearTimeout(c),c=0}return E.debugEnabled()&&E.debug("init"),T(),n.add({target:i,listeners:g}),{checkLatency:function(e,t){o=e.stats,b=o.playbackrate.current,u=t.base,l=1,m=o.buffer.delay.avg;var n=Math.abs(b-1)<1e-6;if(h=Math.round(1e3*(n?o.buffer.delay.max-m:m-o.buffer.delay.min))/1e3,d=u+h,p=o.buffer.end>p+.1?o.buffer.end:p,s.limit=m||s.min+.05>=m)&&!n){var i=_(!0);i&&E.debugEnabled()&&E.debug("normalize speed after "+i.toFixed(2)+" seconds",2),l=1,a.setRate(b,l)}return d},destroy:function(){n.remove({target:i,listeners:g})}}}}}.apply(t,r))||(e.exports=i)},3184:function(e,t,n){var r,i;r=[n(8333),n(492),n(6637),n(4234)],void 0===(i=function(e,t,n,r){return{create:function(i,a){var o,s,u,d,l,c,f,E=e.create("WSSChromiumProgressiveLatencyController"),p=0,m=0,b=1,h=0,g=0,_=[{type:r.APPLICATION_STATE_CHANGE,listener:function(e){switch(e.data.state){case t.PLAYING:break;case t.PAUSED:S()}}},{type:r.BUFFER_TWEAKS_CREATED,listener:function(e){s=e.data.tweaks.buffer}}];function T(e){var t=0;return e&&f?(t=(window.performance.now()-f)/1e3,f=0):e||f||(f=window.performance.now()),t}function A(){return 1===b}function S(){p=0,clearTimeout(c),c=0}return E.debugEnabled()&&E.debug("init"),S(),n.add({target:i,listeners:_}),{checkLatency:function(e,t){if(o=e.stats,b=o.playbackrate.current,h=o.currentTime,u=t.base,l=1,m=o.buffer.delay.avg,g=Math.round(1e3*(+A()?o.buffer.delay.max-m:m-o.buffer.delay.min))/1e3,d=u+g,p=o.buffer.end>p+.1?o.buffer.end:p,s.max0}(o))E.debug("max buffer reached, seeking to goal..."),a.setSeek(h,p-u);else if(s.limit=m&&1!==b){var r=T(!0);r&&E.debugEnabled()&&E.debug("normalize speed after "+r.toFixed(2)+" seconds",2),l=1,a.setRate(b,l)}return d},destroy:function(){n.remove({target:i,listeners:_}),a.destroy(),a=null}}}}}.apply(t,r))||(e.exports=i)},2531:function(e,t,n){var r,i;r=[n(8333),n(492),n(6637),n(4234)],void 0===(i=function(e,t,n,r){return{create:function(i,a){var o,s,u,d,l,c,f=e.create("WSSDefaultConservativeLatencyController"),E=0,p=0,m=1,b=0,h=[{type:r.APPLICATION_STATE_CHANGE,listener:function(e){switch(e.data.state){case t.PLAYING:break;case t.PAUSED:_()}}},{type:r.BUFFER_TWEAKS_CREATED,listener:function(e){s=e.data.tweaks.buffer}}];function g(e){var t=0;return e&&c?(t=(window.performance.now()-c)/1e3,c=0):e||c||(c=window.performance.now()),t}function _(){E=0}return f.debugEnabled()&&f.debug("init"),_(),n.add({target:i,listeners:h}),{checkLatency:function(e,t){if(o=e.stats,m=o.playbackrate.current,b=o.currentTime,u=t.base,l=1,p=o.buffer.delay.avg,d=u+0,E=o.buffer.end>E+.1?o.buffer.end:E,s.max0}(o))f.debug("max buffer reached, seeking to goal..."),a.setSeek(b,E-u);else if(s.limit=p&&1!==m){var n=g(!0);n&&f.debugEnabled()&&f.debug("normalize speed after "+n.toFixed(2)+" seconds",2),l=1,a.setRate(m,l)}return d},destroy:function(){n.remove({target:i,listeners:h}),a.destroy(),a=null}}}}}.apply(t,r))||(e.exports=i)},8538:function(e,t,n){var r,i;r=[n(8333),n(492),n(6637),n(4234)],void 0===(i=function(e,t,n,r){return{create:function(i,a){var o,s,u,d,l,c,f,E,p,m=e.create("WSSFirefoxProgressiveLatencyController"),b=0,h=0,g=1,_=0,T=0,A=0,S=0,y=!1,v=!1,R=1,O=0,I=6e4,N=[{type:r.APPLICATION_STATE_CHANGE,listener:function(e){switch(e.data.state){case t.PLAYING:break;case t.PAUSED:F()}}},{type:r.BUFFER_TWEAKS_CREATED,listener:function(e){s=e.data.tweaks.buffer}},{type:r.FRAME_DROP,listener:function(e){var t=e.data.type;switch(m.debugEnabled()&&m.debug("framedrop event with type "+t),t){case"extreme":case"high":case"medium":v?m.debugEnabled()&&m.debug("frame drop handle blocked"):(m.debugEnabled()&&m.debug("frame drop handle unblocked, starting"),U(!0,"framedrop event with type "+t),y?(m.debugEnabled()&&m.debug("frame drop handle still activated, restart cooldown timeout"),P()):(m.debugEnabled()&&m.debug("set buffer goal to buffer goal max"),T=d,m.debugEnabled()&&m.debug("check framedrop cooldown factor timeout"),S?(m.debugEnabled()&&m.debug("framedrop cooldown factor timeout is running, clearing"),L(),R<=4?(m.debugEnabled()&&m.debug("framedrop cooldown factor lower or 4, multiply"),R*=2,m.debugEnabled()&&m.debug("new framedrop cooldown factor is "+R.toString())):m.debugEnabled()&&m.debug("framedrop cooldown factor still at max ("+R.toString()+"), do nothing")):m.debugEnabled()&&m.debug("framedrop cooldown factor timeout is not running, use current factor ("+R.toString()+")")))}}}];function C(e){var t=0;return e&&E?(t=(window.performance.now()-E)/1e3,E=0):e||E||(E=window.performance.now()),t}function D(){return 1===g}function w(){return g>1}function U(e,t){m.debugEnabled()&&m.debug("set framedrop blocked to "+e.toString()+" from handle: '"+t+"'"),e?v=!0:(v=!1,P())}function P(){M(),L(),m.debugEnabled()&&m.debug("set framedrop cooldown timeout with "+(I*R/1e3).toString()+" s"),A=setTimeout((function(){m.debugEnabled()&&m.debug("framedrop cooldown timeout reached, set handle to inactive"),M(),y=!1,L(),m.debugEnabled()&&m.debug("set framedrop cooldown factor timeout with "+(I*R/1e3).toString()+" s"),S=setTimeout((function(){m.debugEnabled()&&m.debug("framedrop cooldown factor timeout reached, check for decrease cooldown factor"),L(),R>1?(m.debugEnabled()&&m.debug("framedrop cooldown factor higher 1, divide"),R/=2,m.debugEnabled()&&m.debug("new framedrop cooldown factor is "+R.toString())):m.debugEnabled()&&m.debug("framedrop cooldown factor still at min ("+R.toString()+"), do nothing")}),I*R)}),I*R)}function M(){m.debugEnabled()&&m.debug("clear framedrop cooldown timeout and set to 0"),clearTimeout(A),A=0}function L(){m.debugEnabled()&&m.debug("clear framedrop cooldown factor timeout and set to 0"),clearTimeout(S),S=0}function F(){b=0,clearTimeout(f),f=0,clearTimeout(A),A=0,clearTimeout(S),S=0,y=!1,v=!1,R=1}return m.debugEnabled()&&m.debug("init"),F(),n.add({target:i,listeners:N}),{checkLatency:function(e,t){if(o=e.stats,g=o.playbackrate.current,_=o.currentTime,u=t.base,d=t.max,c=1,h=o.buffer.delay.avg,O=Math.round(1e3*(w()?o.buffer.delay.max-h:h-o.buffer.delay.min))/1e3,v||y||(T*=.998),l=Math.max(u,T)+O,b=o.buffer.end>b+.1?o.buffer.end:b,s.max0}(o))v&&U(!1,"over buffer max"),m.debug("max buffer reached, seeking to goal..."),a.setSeek(_,b-u);else if(s.limit=h&&w()?((p=C(!0))&&m.debugEnabled()&&m.debug("normalize speed after "+p.toFixed(2)+" seconds"),c=1,a.setRate(g,c)):v&&y&&l<=h+.1?((p=C(!0))&&m.debugEnabled()&&m.debug("normalize speed after "+p.toFixed(2)+" seconds"),m.debugEnabled()&&m.debug("normalize speed after reached bufferGoalReal again after frame drop"),v&&U(!1,"buffer target reached after framedrop"),c=1,a.setRate(g,c)):v&&!y&&(m.debugEnabled()&&m.debug("slow speed to reach bufferGoalReal after frame drop"),C(),c=.97,a.setRate(g,c),y=!0);return l},destroy:function(){n.remove({target:i,listeners:N}),a.destroy(),a=null}}}}}.apply(t,r))||(e.exports=i)},9321:function(e,t,n){var r,i;r=[n(8333),n(492),n(6637),n(4234)],void 0===(i=function(e,t,n,r){return{create:function(i,a){var o,s,u,d,l=e.create("WSSTridentConservativeLatencyController"),c=0,f=0,E=0,p=[{type:r.APPLICATION_STATE_CHANGE,listener:function(e){switch(e.data.state){case t.PLAYING:break;case t.PAUSED:m()}}},{type:r.BUFFER_TWEAKS_CREATED,listener:function(e){s=e.data.tweaks.buffer}}];function m(){c=0}return l.debugEnabled()&&l.debug("init"),m(),n.add({target:i,listeners:p}),{checkLatency:function(e,t){return o=e.stats,E=o.currentTime,u=t.base,f=o.buffer.delay.avg,d=u+0,c=o.buffer.end>c+.1?o.buffer.end:c,s.max0}(o)?(l.debug("max buffer reached, seeking to goal..."),a.setSeek(E,c-u)):s.limitE+.1?o.buffer.end:E,s.max0}(o))f.debug("max buffer reached, seeking to goal..."),a.setSeek(b,E-u);else if(s.limit=p||s.min+.05>=p)&&!n){var r=g(!0);r&&f.debugEnabled()&&f.debug("normalize speed after "+r.toFixed(2)+" seconds",2),l=1,a.setRate(m,l)}return d},destroy:function(){n.remove({target:i,listeners:h}),a.destroy(),a=null}}}}}.apply(t,r))||(e.exports=i)},4422:function(e,t,n){var r,i;r=[n(8333),n(492),n(6637),n(4234)],void 0===(i=function(e,t,n,r){return{create:function(i,a){var o,s,u,d,l,c,f,E=e.create("WSSWebkitProgressiveLatencyController"),p=0,m=0,b=1,h=0,g=0,_=[{type:r.APPLICATION_STATE_CHANGE,listener:function(e){switch(e.data.state){case t.PLAYING:break;case t.PAUSED:A()}}},{type:r.BUFFER_TWEAKS_CREATED,listener:function(e){s=e.data.tweaks.buffer}}];function T(e){var t=0;return e&&f?(t=(window.performance.now()-f)/1e3,f=0):e||f||(f=window.performance.now()),t}function A(){p=0,clearTimeout(c),c=0}return E.debugEnabled()&&E.debug("init"),A(),n.add({target:i,listeners:_}),{checkLatency:function(e,t){o=e.stats,b=o.playbackrate.current,h=o.currentTime,u=t.base,l=1,m=o.buffer.delay.avg;var n=Math.abs(b-1)<1e-6;if(g=Math.round(1e3*(n?o.buffer.delay.max-m:m-o.buffer.delay.min))/1e3,d=u+g,p=o.buffer.end>p+.1?o.buffer.end:p,s.max0}(o))E.debug("max buffer reached, seeking to goal..."),a.setSeek(h,p-u);else if(s.limit=m||s.min+.05>=m)&&!n){var i=T(!0);i&&E.debugEnabled()&&E.debug("normalize speed after "+i.toFixed(2)+" seconds",2),l=1,a.setRate(b,l)}return d},destroy:function(){n.remove({target:i,listeners:_})}}}}}.apply(t,r))||(e.exports=i)},4813:function(e,t){var n;void 0===(n=function(){var e="adjustControllerAdapter.";return{BASE:e,CONTROL_MODE_SET:e+"controlModeSet"}}.apply(t,[]))||(e.exports=n)},1148:function(e,t){var n;void 0===(n=function(){var e="adjustLatencyHandler.";return{BASE:e,SEEK:e+"seek",RATE:e+"rate"}}.apply(t,[]))||(e.exports=n)},4234:function(e,t){var n;void 0===(n=function(){var e="latencyManager.";return{BASE:e,BUFFER_TWEAKS_CREATED:e+"bufferTweaksCreated",FRAME_DROP:e+"frameDrop",RANDOM_ACCESS_POINT:e+"randomAccessPoint",TIME_OFFSET:e+"timeOffset",CONFIG:e+"config",PLAY_STATS:e+"playStats",APPLICATION_STATE_CHANGE:e+"applicationStateChange",DOCUMENT_VISIBLE:e+"documentVisible",DOCUMENT_HIDDEN:e+"documentHidden"}}.apply(t,[]))||(e.exports=n)},2158:function(e,t){var n;void 0===(n=function(){var e="liveController.";return{BASE:e,BUFFER_GOAL_STATS:e+"bufferGoalStats"}}.apply(t,[]))||(e.exports=n)},4285:function(e,t,n){var r,i;r=[n(8333),n(6627),n(9474),n(8930),n(2531),n(2395),n(9321),n(3184),n(8538),n(4422),n(4842),n(9076)],void 0===(i=function(e,t,n,r,i,a,o,s,u,d,l,c){return{create:function(f,E){var p,m,b,h,g,_,T,A,S=e.create("LatencyControllerAdapter"),y={wssdefaultconservative:i,wsswebkitconservative:a,wsstridentconservative:o,wsschromiumprogressive:s,wssfirefoxprogressive:u,wsswebkitprogressive:d,hlsdefaultconservative:l,hlswebkitprogressive:c},v="wssdefaultconservative",R="wsswebkitconservative",O="wsstridentconservative",I="hlsdefaultconservative",N="wsschromiumprogressive",C="wssfirefoxprogressive",D="wsswebkitprogressive",w="hlswebkitprogressive";return S.debugEnabled()&&S.debug("init"),g=t.mustUseHLS||E.playback.allowSafariHlsFallback&&t.canUseHLS,h=E.playback.latencyControlMode,_=t.isTridentBrowser,T=t.isWebkitBrowser,A=t.isFirefox,b=r.create(f),m=_?O:h===n.FAST_ADAPTIVE||h===n.BALANCED_ADAPTIVE?T&&g?w:T?D:A?C:N:T&&g?I:T?R:v,S.debugEnabled()&&S.debug("use latencyController type "+m),p=y[m].create(f,b),{checkLatency:function(e,t){return p.checkLatency(e,t)},destroy:function(){p.destroy(),p=null,b.destroy(),b=null},seek:function(e,t){return b.setSeek(e,t)}}}}}.apply(t,r))||(e.exports=i)},7831:function(e,t,n){var r,i;r=[n(8333),n(9658),n(5055),n(2450),n(3937),n(3019),n(4234),n(1148),n(4813),n(2158),n(8449)],void 0===(i=function(e,t,n,r,i,a,o,s,u,d,l){"use strict";return{create:function(c){var f,E,p=new t,m=e.create("LatencyManager"),b=[],h=[{from:s.SEEK,to:i.SEEK},{from:s.RATE,to:i.RATE},{from:d.BUFFER_GOAL_STATS,to:i.BUFFER_GOAL_STATS},{from:u.CONTROL_MODE_SET,to:i.CONTROL_MODE_SET}],g=[{from:a.BUFFER_TWEAKS_CREATED,to:o.BUFFER_TWEAKS_CREATED},{from:a.FRAME_DROP,to:o.FRAME_DROP},{from:a.RANDOM_ACCESS_POINT,to:o.RANDOM_ACCESS_POINT},{from:a.TIME_OFFSET,to:o.TIME_OFFSET},{from:a.CONFIG,to:o.CONFIG},{from:a.PLAY_STATS,to:o.PLAY_STATS},{from:a.APPLICATION_STATE_CHANGE,to:o.APPLICATION_STATE_CHANGE},{from:r.VISIBLE,to:o.DOCUMENT_VISIBLE},{from:r.HIDDEN,to:o.DOCUMENT_HIDDEN}];return m.debugEnabled()&&m.debug("init"),f=n.create(c,p,g),E=n.create(p,c,h),b.push(l.create(p)),{destroy:function(){for(f.destroy(),f=null,E.destroy(),E=null;b.length;)b.pop().destroy()}}}}}.apply(t,r))||(e.exports=i)},8449:function(e,t,n){var r,i;r=[n(8333),n(492),n(6637),n(4234),n(2158),n(3445),n(4285),n(6631)],void 0===(i=function(e,t,n,r,i,a,o,s){return{create:function(u){var d,l,c,f,E,p=e.create("LiveController"),m=[{type:r.APPLICATION_STATE_CHANGE,listener:function(e){switch(n.remove({target:u,listeners:b}),e.data.state){case t.LOADING:case t.PLAYING:case t.BUFFERING:n.add({target:u,listeners:b})}}},{type:r.CONFIG,listener:function(e){c=a.create(u,e.data.config),f=o.create(u,e.data.config),E=s.create(u,f,e.data.config)}}],b=[{type:r.PLAY_STATS,listener:function(e){d=e.data,E.disable(),(l=c.calcBufferGoal(d)).real=f.checkLatency(d,l),u.emit(i.BUFFER_GOAL_STATS,{real:Math.round(100*l.real)/100,base:Math.round(100*l.base)/100,min:Math.round(100*l.min)/100,max:Math.round(100*l.max)/100}),E.update(d,l),E.enable()}}];return p.debugEnabled()&&p.debug("init"),n.add({target:u,listeners:m}),{destroy:function(){n.remove({target:u,listeners:m}),c.destroy(),f.destroy(),E.destroy()}}}}}.apply(t,r))||(e.exports=i)},8930:function(e,t,n){var r,i;r=[n(8333),n(6627),n(492),n(6637),n(4234),n(1148)],void 0===(i=function(e,t,n,r,i,a){return{create:function(o){var s=e.create("AdjustLatencyHandler"),u=[],d=0,l=[{type:i.APPLICATION_STATE_CHANGE,listener:function(e){switch(e.data.state){case n.PLAYING:break;case n.PAUSED:c()}}},{type:i.RANDOM_ACCESS_POINT,listener:function(e){for(u.push(e.data.onRandomAccessPoint.streamTime/1e3+d/1e3);u.length>10;)u.shift()}},{type:i.TIME_OFFSET,listener:function(e){d=e.data.offset}}];function c(){for(;u.length;)u.shift();d=0}return s.debugEnabled()&&s.debug("init"),c(),r.add({target:o,listeners:l}),{setSeek:function(e,n){s.debugEnabled()&&s.debug("should seeking to "+n),t.isTridentBrowser&&(n=function(e,t){for(var n=0;ne&&u[n]<=t)return u[n];return-1}(e,n),s.debugEnabled()&&s.debug("seeking to RAP "+n)),n>=0&&(s.debugEnabled()&&s.debug("seeking to "+n),o.emit(a.SEEK,{position:n}))},setRate:function(e,t){Math.abs(e.toFixed(3)-t)>0&&(s.debugEnabled()&&s.debug("set rate to "+t),o.emit(a.RATE,{rate:t}))},destroy:function(){c(),r.remove({target:o,listeners:l})}}}}}.apply(t,r))||(e.exports=i)},6631:function(e,t,n){var r,i;r=[n(8333),n(6627),n(492),n(6637),n(4234)],void 0===(i=function(e,t,n,r,i){return{create:function(a,o,s){var u,d,l,c,f,E,p=e.create("VisibilityLatencyHandler"),m=0,b=t.mustUseHLS||s.playback.allowSafariHlsFallback&&t.canUseHLS,h=!0,g=!0,_=0,T=[150,500,2e3,4e3,6e3],A=[{type:i.APPLICATION_STATE_CHANGE,listener:function(e){switch(u=e.data.state){case n.PLAYING:h=!0;break;case n.PAUSED:h=!1}}},{type:i.DOCUMENT_HIDDEN,listener:S},{type:i.DOCUMENT_VISIBLE,listener:S}];function S(e){c=e.name===i.DOCUMENT_HIDDEN,p.debug(c?"hidden":"visible"),O(d)&&I()?y(c):p.debug("seek is not allowed or possible")}function y(e){if(!h&&!e&&!g)return p.debug("handling visibility skipped, saved for later"),void(g=!0);if(e)R(),E=performance.now(),m=d.buffer.delay.avg,p.debug("stored bufferValue hidden state: "+m);else{var t=performance.now()-E;p.debug("checking latency on visibility handler"),t<1e3&&(_=1),v(m+.15)}}function v(e){_>=5?R():(f&&clearTimeout(f),f=setTimeout((function(){if(p.debug("latencyCheckpointIndex: "+_),p.debug("bufferThreshold: "+e),p.debug("buffer delay: "+d.buffer.delay.avg),!O(d)||!I())return p.debug("seek is not allowed or possible"),void R();d.buffer.delay.avg>e&&(p.debug("visibility seek done"),o.seek(d.currentTime,d.buffer.end-l.base),v(e))}),T[_]),_++)}function R(){h=!0,_=0,clearTimeout(f),m=0,E=0}function O(e){return e&&!isNaN(e.currentTime)&&e.currentTime>0}function I(){return!b&&l&&d.duration&&!isNaN(d.duration.current)&&u!==n.PAUSED}return p.debugEnabled()&&p.debug("init"),r.add({target:a,listeners:A}),{destroy:function(){r.remove({target:a,listeners:A}),R()},disable:function(){h=!1},enable:function(){h=!0,g&&(p.debug("handling previously skipped event"),y(c),g=!1)},update:function(e,t){d=e.stats,l=t}}}}}.apply(t,r))||(e.exports=i)},9665:function(e,t,n){var r,i;r=[n(8333),n(6627),n(6637),n(3778),n(3890),n(492),n(3019),n(7771),n(1683)],void 0===(i=function(e,t,n,r,i,a,o,s,u){return{create:function(d,l){var c,f,E,p,m,b,h,g,_,T,A,S,y,v=e.create("MetaData"),R=0,O=[{type:o.APPLICATION_STATE_CHANGE,listener:function(e){switch(e.data.state){case a.LOADING:N(),n.add({target:d,listeners:I});break;case a.PAUSING:n.remove({target:d,listeners:I})}}},{type:o.TIME_OFFSET,listener:function(e){R=e.data.offset}},{type:o.STREAM_INFO,listener:function(){N()}},{type:s.UPDATE_SOURCE_SUCCESS,listener:function(){N()}},{type:s.SWITCH_STREAM_SUCCESS,listener:function(){N()}}],I=[{type:o.META_DATA,listener:function(e){v.debugEnabled()&&v.debug("onMetaData");var t,n,a=e.data[e.data.eventType];if(1===a.chunkIndex)"function"==typeof p.message.push&&0!==p.message.length&&d.emit(u.ERROR,{code:r.STREAM.METADATA_STILL_PROCESSING,message:i.STREAM.METADATA_STILL_PROCESSING}),E=!0,t=c&&f?T+A+.25:a.streamTime+R/1e3,n=isNaN(n)?3:parseInt(n,10),S=Math.floor(t*Math.pow(10,n))/Math.pow(10,n),y=a.handlerName,p={handlerName:y,streamTime:S,message:[]};else{if(0===p.message.length||"function"!=typeof p.message.push)return void(E&&(d.emit(u.ERROR,{code:r.STREAM.METADATA_NO_START_INDEX,message:i.STREAM.METADATA_NO_START_INDEX}),E=!1,p.message=[]));if(!E)return}if(p.message.push(a.message),p.message.length!==a.chunkIndex)E&&(d.emit(u.ERROR,{code:r.STREAM.METADATA_WRONG_INDEX,message:i.STREAM.METADATA_WRONG_INDEX}),E=!1,p.message=[]);else if(a.chunkCount-a.chunkIndex==0)try{g=p.message.join(""),y=p.handlerName,v.debugEnabled()&&v.debug("handlerName="+y+", metaData="+g),g=JSON.parse(g),p.message=g,_={handlerName:p.handlerName,streamTime:p.streamTime,message:p.message},m.push(_)}catch(e){d.emit(u.ERROR,{code:r.STREAM.METADATA_INVALID_JSON,message:i.STREAM.METADATA_INVALID_JSON})}}},{type:o.PLAY_STATS,listener:function(e){for(T=e.data.stats.currentTime,A=e.data.stats.buffer.delay.current;m.length;)(h=m.shift()).streamTime<=T?d.emit(u.RECEIVED,h):b.push(h);for(;b.length;)m.push(b.shift())}}];function N(){T=0,A=0,E=!0,p={handlerName:"",streamTime:0,serverTime:0,diffTime:0,message:[]},m=[],b=[]}return v.debugEnabled()&&v.debug("init"),c=t.mustUseHLS||l.playback.allowSafariHlsFallback&&t.canUseHLS,f=l.playback.metadataLowDelay,n.add({target:d,listeners:O}),{destroy:function(){n.remove({target:d,listeners:O})}}}}}.apply(t,r))||(e.exports=i)},6701:function(e,t,n){var r,i;r=[n(6637),n(8333),n(4762),n(708),n(5739),n(7844),n(6627)],void 0===(i=function(e,t,n,r,i,a,o){return{create:function(r){var s=t.create("Adaptive.AdaptionController"),u=!1,d={},l=[{type:n.CONFIG,listener:function(e){var t=e.data.config.source.options.adaption.rule,n=e.data.config.source.options.adaption;u=o.mustUseHLS||e.data.config.playback.allowSafariHlsFallback&&o.canUseHLS,n.useHLS=u,f(t)}},{type:n.UPDATE_SOURCE,listener:function(e){var t=e.data.source.options.adaption.rule,n=e.data.source.options.adaption;n.useHLS=u,f(t)}},{type:n.SWITCH_STREAM,listener:function(e){"direct"===e.data.type&&f("none")}},{type:n.SET_ADAPTION,listener:function(e){var t=e.data.adaption.rule,n=e.data.adaption;n.useHLS=u,f(t)}}],c={deviationOfMean:i,deviationOfMean2:a};function f(e,t){for(var n in d){const t=d[n];n!==e?(s.debugEnabled()&&s.debug("component disabled: "+n),t.disable()):(s.debugEnabled()&&s.debug("component enabled: "+n),t.enable())}}return function(){for(var t in s.debugEnabled()&&s.debug("initialize"),e.add({target:r,listeners:l}),c)d[t]=c[t].create(r)}(),{destroy:function(){for(var t in d)d[t].destroy();e.remove({target:r,listeners:l})}}}}}.apply(t,r))||(e.exports=i)},708:function(e,t){var n;void 0===(n=function(){var e="adaptionController.";return{BASE:e,SWITCH_SUGGESTION:e+"switchSuggestion"}}.apply(t,[]))||(e.exports=n)},8134:function(e,t){var n;void 0===(n=function(){var e="ressourceController.";return{BASE:e,STATS:e+"stats",BUFFERING:e+"buffering",INITIAL_SWITCH_UP:e+"initialSwitchUp",STREAM_INFO:e+"streamInfo",STREAM_QUALITY:e+"streamQuality",PAUSED:e+"paused",BUFFERING_LONG:e+"longBuffering"}}.apply(t,[]))||(e.exports=n)},3049:function(e,t,n){var r,i;r=[n(6637),n(8333),n(8197),n(4762),n(8134),n(3349),n(6400)],void 0===(i=function(e,t,n,r,i,a,o){return{create:function(n){var i=t.create("Adaptive.RessourceController"),s=[],u=[{type:r.CONFIG,listener:function(e){l(e.data.config.source.options.adaption.rule,e.data.config.source.options.adaption)}},{type:r.UPDATE_SOURCE,listener:function(e){l(e.data.source.options.adaption.rule,e.data.source.options.adaption)}},{type:r.SWITCH_STREAM,listener:function(e){"direct"===e.data.type&&l("none")}},{type:r.SET_ADAPTION,listener:function(e){l(e.data.adaption.rule,e.data.adaption)}}],d={deviationOfMean:a,deviationOfMean2:o};function l(e,t){for(;s.length;)s.pop().destroy();Object.prototype.hasOwnProperty.call(d,e)&&s.push(d[e].create(n,t))}return i.debugEnabled()&&i.debug("initialize"),e.add({target:n,listeners:u}),{destroy:function(){for(;s.length;)s.pop().destroy();e.remove({target:n,listeners:u})}}}}}.apply(t,r))||(e.exports=i)},7844:function(e,t,n){var r,i;r=[n(6637),n(8333),n(4762),n(708),n(8134),n(4035)],void 0===(i=function(e,t,n,r,i,a){return{create:function(o){var s,u,d=t.create("Adaptive.DeviationOfMean2.Adaption"),l=!0,c=!1,f=void 0,E=!1,p=0,m=!1,b=!1,h=!1,g=[{type:n.UPDATE_SOURCE_SUCCESS,listener:R},{type:n.UPDATE_SOURCE_FAIL,listener:O},{type:n.UPDATE_SOURCE_ABORT,listener:O},{type:n.SWITCH_STREAM_SUCCESS,listener:R},{type:n.SWITCH_STREAM_FAIL,listener:O},{type:n.SWITCH_STREAM_ABORT,listener:O},{type:n.LOADED_DATA,listener:function(){d.debugEnabled()&&d.debug("onLoadedData"),b=!0}},{type:n.TIME_OFFSET,listener:function(){d.debugEnabled()&&d.debug("onFirstFragmentRendered"),h=!0}},{type:i.STATS,listener:function(e){f&&(m||R(!1),function(e){if(!l){d.debugEnabled()&&d.debug("making switch suggestion allowed");var t,n,i=e.buffer.delay.bufferDelaysStandardDeviationsDev.length;d.debugEnabled()&&d.debug("bufferDelaysStandardDeviationsLength >= 5 && !wasAbortedHighest ?"),i>=5&&!N()&&(d.debugEnabled()&&d.debug("bufferDelaysStandardDeviationsLength >= 5 && !wasAbortedHighest !"),t=S(e.buffer.delay.bufferDelaysStandardDeviationsDev,5),n=S(e.buffer.delay.bufferDelaysArithmeticMeans,5),d.debugEnabled()&&d.debug("bufferDevationAboveValue && bufferCurrentHasMinimumValue ?"),function(e,t){d.debugEnabled()&&d.debug("bufferDevationAboveValue with limit 0.045");for(var n=!0,r=0;r<=e.length-1;r++)if(!T(e[r],.045)){n=!1;break}return n}(t)&&function(e,t){for(var n=!1,r=0;r<=e.length-1;r++)if(_(e[r],.5)){n=!0;break}return n}(n)&&(d.debugEnabled()&&d.debug("make suggestion to switch down"),y(!0),v(r.SWITCH_SUGGESTION,{suggestion:"down"}))),d.debugEnabled()&&d.debug("bufferDelaysStandardDeviationsLength >= 8 && !wasAbortedLowest ?"),i>=8&&!C()&&(d.debugEnabled()&&d.debug("bufferDelaysStandardDeviationsLength >= 8 && !wasAbortedLowest !"),function(e,t){d.debugEnabled()&&d.debug("bufferDevationBelowValue with limit 0.016");for(var n=!0,r=0;r<=e.length-1;r++)if(!_(e[r],.016)){n=!1;break}return n}(t=S(e.buffer.delay.bufferDelaysStandardDeviationsDev,8))&&(d.debugEnabled()&&d.debug("make suggestion to switch up"),y(!0),v(r.SWITCH_SUGGESTION,{suggestion:"up"})))}}(e.data.deviationOfMean2))}},{type:i.BUFFERING,listener:function(e){f&&(function(e){var t,n=e.data.startBufferings.length;l||N()||(d.debugEnabled()&&d.debug("evaluating buffering events allowed"),n>=2&&(d.debugEnabled()&&d.debug("startBufferingsLength "+n),t=S(e.data.startBufferings,3),d.debugEnabled()&&d.debug("startBufferingsCutOffLength >= 3 && isCriticalEventHistory ?"),t.length>=3&&A(t,10)?(d.debugEnabled()&&d.debug("startBufferingsCutOffLength >= 3 && isCriticalEventHistory !"),y(!0),v(r.SWITCH_SUGGESTION,{suggestion:"down",priority:1})):t.length>=2&&(t=S(e.data.startBufferings,2),d.debugEnabled()&&d.debug("startBufferingsCutOffLength >= 2 && isCriticalEventHistory ?"),A(t,10)&&(d.debugEnabled()&&d.debug("startBufferingsCutOffLength >= 2 && isCriticalEventHistory !"),y(!0),v(r.SWITCH_SUGGESTION,{suggestion:"down",priority:0})))))}(e),I())}},{type:i.STREAM_INFO,listener:function(){f&&R(!1)}},{type:i.STREAM_QUALITY,listener:function(e){f&&(p=e.data.streamQuality.timestamp.standardDeviation,d.debugEnabled()&&d.debug("serverStandardDeviation "+p))}},{type:i.PAUSED,listener:function(){f&&(D(),I())}},{type:i.BUFFERING_LONG,listener:function(){f&&(d.debugEnabled()&&d.debug("onBufferingLong"),y(!0),v(r.SWITCH_SUGGESTION,{suggestion:"down",priority:1}))}},{type:a.SUGGESTION_ABORT,listener:function(e){f&&(D(e.data.reason),O())}}];function _(e,t){return et}function A(e,t){d.debugEnabled()&&d.debug("isCriticalEventHistory with allowedTimeDifferenceSeconds "+t);var n=e.length;return function(e,t,n){return(t-e)/1e30?e.slice(Math.max(n-t,0),n):[]}function y(e){d.debug((e?"allow":"deny")+" prediction"),e?(d.debugEnabled()&&d.debug("deny prediction"),clearTimeout(u),u=0,l=!0):u?d.debugEnabled()&&d.debug("allow prediction already in timeout"):(d.debugEnabled()&&d.debug("allow prediction in 3 seconds"),u=setTimeout((function(){d.debugEnabled()&&d.debug("allow prediction after timeout"),l=!1,u=0}),3e3))}function v(e,t){d.debugEnabled()&&d.debug("make suggestion to switch "+t.suggestion+(t.priority?" with priority "+t.priority:" without priority")),o.emit(e,t)}function R(e){f&&(d.debugEnabled()&&d.debug("success"),c||e||(m=!0,s&&clearTimeout(s),s=setTimeout((function(){d.debugEnabled()&&d.debug("initialSwitchUpTimeout elapsed"),(b||h)&&(d.debugEnabled()&&d.debug("initialSwitchUpTimeout to switch up"),y(!0),v(r.SWITCH_SUGGESTION,{suggestion:"up"}),h=!1,b=!1)}),5e3)),D(),y(!1))}function O(){f&&(d.debugEnabled()&&d.debug("error"),y(!1),I())}function I(){d.debugEnabled()&&d.debug("destroy initial switch up"),clearTimeout(s),c=!0}function N(){return"highest"===E}function C(){return"lowest"===E}function D(e){(E=e||!1)?d.debugEnabled()&&d.debug("aborted with reason: "+E):d.debugEnabled()&&d.debug("reset abort reason"),C()&&I()}return d.debugEnabled()&&d.debug("initialize"),e.add({target:o,listeners:g}),{destroy:function(){e.remove({target:o,listeners:g})},enable:function(){f=!0,d.debugEnabled()&&d.debug("enable initial switch up"),m=!1,c=!1,clearTimeout(s)},disable:function(){f=!1,I()}}}}}.apply(t,r))||(e.exports=i)},6400:function(e,t,n){var r,i;r=[n(492),n(6637),n(8333),n(5337),n(4762),n(8134)],void 0===(i=function(e,t,n,r,i,a){return{create:function(o){var s,u,d,l,c,f,E,p=n.create("Adaptive.DeviationOfMean2.Ressource"),m=!1,b=[],h=[],g=[],_=[],T=[{type:i.APPLICATION_STATE_CHANGE,listener:function(t){for(s||p.debugEnabled()&&p.debug("initial player state"),(s=t.data.state)===e.PAUSED&&"playbackrestart"!==t.data.reason&&(v(),o.emit(a.PAUSED,{paused:{}})),s===e.PLAYING&&h.length&&h[h.length-1].state===e.LOADING&&(p.debugEnabled()&&p.debug("setRessourceBlockTimeout from playing"),S());h.length>100;)h.shift();h.push({state:s,timestamp:performance.now()}),l&&R()}},{type:i.PLAY_STATS,listener:function(e){var t,n;m||(c.add(e.data.stats.buffer.delay.current),c.count%10==0&&(f.add(c.arithmetic),E.add(f.values[f.values.length-1]),g.add(E.deviation),_.add(g.deviation),t=c,(n=u.adaptive.buffer.delay).avg=t.arithmetic,n.min=t.minimum,n.max=t.maximum,n.deviation=t.deviation,n.samples=t.values.length,n.count=t.count,n.bufferDelaysArithmeticMeans=f.values,n.bufferDelaysStandardDeviations=g.values,n.bufferDelaysStandardDeviationsDev=_.values,o.emit(a.STATS,{deviationOfMean2:u.adaptive})))}},{type:i.BUFFERING,listener:function(t){for(p.debugEnabled()&&p.debug("push startBuffering!"),b.push({event:t.data,timestamp:performance.now()});b.length>10;)b.shift();m?p.debugEnabled()&&p.debug("block emit startBuffering!"):(p.debugEnabled()&&p.debug("emit startBuffering!"),o.emit(a.BUFFERING,{startBufferings:b})),p.debugEnabled()&&p.debug("setBufferingLongTimeout"),R(),l=setTimeout((function(){p.debugEnabled()&&p.debug("setBufferingLongTimeout fired"),s===e.BUFFERING?(p.debugEnabled()&&p.debug("setBufferingLongTimeout fired and still in buffering state"),o.emit(a.BUFFERING_LONG)):p.debugEnabled()&&p.debug("setBufferingLongTimeout fired and not in buffering state")}),3e3)}},{type:i.STREAM_INFO,listener:function(){o.emit(a.STREAM_INFO,{streamInfo:{}}),v()}},{type:i.STREAM_QUALITY,listener:function(e){o.emit(a.STREAM_QUALITY,{streamQuality:e.data.onStreamQuality})}},{type:i.UPDATE_SOURCE_SUCCESS,listener:A},{type:i.SWITCH_STREAM_SUCCESS,listener:A}];function A(){p.debugEnabled()&&p.debug("setRessourceBlockTimeout from success"),S()}function S(){p.debugEnabled()&&p.debug("setRessourceBlockTimeout"),y(!0),clearTimeout(d),d=setTimeout((function(){p.debugEnabled()&&p.debug("setRessourceBlockTimeout fired"),y(!1),s===e.BUFFERING?(p.debugEnabled()&&p.debug("setRessourceBlockTimeout fired but in buffering state"),o.emit(a.BUFFERING,{startBufferings:b})):(p.debugEnabled()&&p.debug("setRessourceBlockTimeout fired & not in buffering state"),v())}),2e3)}function y(e){p.debugEnabled()&&p.debug("setRessourceBlock "+(e?"true":"false")),m=e}function v(){for(p.debugEnabled()&&p.debug("reset stats"),u={adaptive:{buffer:{delay:{samples:0,frequency:1,avg:0,min:0,max:0,deviation:0,count:0}}}},f=r.create(20,1),E=r.create(10,1),c=r.create(10,1),g=r.create(10,1),_=r.create(10,1);b.length;)b.pop()}function R(){p.debugEnabled()&&p.debug("clearBufferingLongTimeout"),clearTimeout(l),l=0}return p.debugEnabled()&&p.debug("initialize"),v(),t.add({target:o,listeners:T}),{destroy:function(){t.remove({target:o,listeners:T})}}}}}.apply(t,r))||(e.exports=i)},5739:function(e,t,n){var r,i;r=[n(6637),n(8333),n(4762),n(708),n(8134),n(4035)],void 0===(i=function(e,t,n,r,i,a){return{create:function(o,s){var u,d,l=t.create("Adaptive.DeviationOfMean.Adaption"),c=!0,f=s&&s.useHLS?.035:.02,E=!1,p=void 0,m=!1,b=0,h=!1,g=!1,_=!1,T=[{type:n.UPDATE_SOURCE_SUCCESS,listener:I},{type:n.UPDATE_SOURCE_FAIL,listener:N},{type:n.UPDATE_SOURCE_ABORT,listener:N},{type:n.SWITCH_STREAM_SUCCESS,listener:I},{type:n.SWITCH_STREAM_FAIL,listener:N},{type:n.SWITCH_STREAM_ABORT,listener:N},{type:n.LOADED_DATA,listener:function(){l.debugEnabled()&&l.debug("onLoadedData"),g=!0}},{type:n.TIME_OFFSET,listener:function(){l.debugEnabled()&&l.debug("onFirstFragmentRendered"),_=!0}},{type:i.STATS,listener:function(e){p&&(h||I(!0),function(e){if(l.debugEnabled()&&l.debug("make switch suggestion ?"),!c){l.debugEnabled()&&l.debug("making switch suggestion allowed");var t,n,i=e.buffer.delay.bufferDelaysStandardDeviations.length;l.debugEnabled()&&l.debug("bufferDelaysStandardDeviationsLength >= 5 && !wasAbortedHighest ?"),i>=5&&!D()&&(l.debugEnabled()&&l.debug("bufferDelaysStandardDeviationsLength >= 5 && !wasAbortedHighest !"),t=v(e.buffer.delay.bufferDelaysStandardDeviations,5),n=v(e.buffer.delay.bufferDelaysArithmeticMeans,5),l.debugEnabled()&&l.debug("bufferDevationAboveValue && bufferCurrentHasMinimumValue ?"),function(e,t){l.debugEnabled()&&l.debug("bufferDevationAboveValue with limit 0.075");for(var n=!0,r=0;r<=e.length-1;r++)if(!S(e[r],.075)){n=!1;break}return n}(t)&&function(e,t){l.debugEnabled()&&l.debug("bufferCurrentHasMinimumValue with limit 0.5");for(var n=!1,r=0;r<=e.length-1;r++)if(A(e[r],.5)){n=!0;break}return n}(n)&&(l.debugEnabled()&&l.debug("bufferDevationAboveValue && bufferCurrentHasMinimumValue !"),l.debugEnabled()&&l.debug("make suggestion to switch down"),R(!0),O(r.SWITCH_SUGGESTION,{suggestion:"down"}))),l.debugEnabled()&&l.debug("bufferDelaysStandardDeviationsLength >= 8 && !wasAbortedLowest ?"),i>=8&&!w()&&(l.debugEnabled()&&l.debug("bufferDelaysStandardDeviationsLength >= 8 && !wasAbortedLowest !"),t=v(e.buffer.delay.bufferDelaysStandardDeviations,8),l.debugEnabled()&&l.debug("bufferDevationBelowValue ?"),function(e,t){l.debugEnabled()&&l.debug("bufferDevationBelowValue with limit "+t);for(var n=!0,r=0;r<=e.length-1;r++)if(!A(e[r],t)){n=!1;break}return n}(t,f)&&(l.debugEnabled()&&l.debug("bufferDevationBelowValue !"),l.debugEnabled()&&l.debug("make suggestion to switch up"),R(!0),O(r.SWITCH_SUGGESTION,{suggestion:"up"})))}}(e.data.deviationOfMean))}},{type:i.BUFFERING,listener:function(e){p&&(function(e){var t,n=e.data.startBufferings.length;l.debugEnabled()&&l.debug("evaluate buffering events ?"),c||D()||(l.debugEnabled()&&l.debug("evaluating buffering events allowed"),n>=2&&(l.debugEnabled()&&l.debug("startBufferingsLength "+n),t=v(e.data.startBufferings,3),l.debugEnabled()&&l.debug("startBufferingsCutOffLength >= 3 && isCriticalEventHistory ?"),t.length>=3&&y(t,10)?(l.debugEnabled()&&l.debug("startBufferingsCutOffLength >= 3 && isCriticalEventHistory !"),R(!0),O(r.SWITCH_SUGGESTION,{suggestion:"down",priority:1})):t.length>=2&&(t=v(e.data.startBufferings,2),l.debugEnabled()&&l.debug("startBufferingsCutOffLength >= 2 && isCriticalEventHistory ?"),y(t,10)&&(l.debugEnabled()&&l.debug("startBufferingsCutOffLength >= 2 && isCriticalEventHistory !"),R(!0),O(r.SWITCH_SUGGESTION,{suggestion:"down",priority:0})))))}(e),C())}},{type:i.STREAM_INFO,listener:function(){p&&I(!0)}},{type:i.STREAM_QUALITY,listener:function(e){p&&(b=e.data.streamQuality.timestamp.standardDeviation,l.debugEnabled()&&l.debug("serverStandardDeviation "+b))}},{type:i.PAUSED,listener:function(){p&&(U(),C())}},{type:i.BUFFERING_LONG,listener:function(){p&&(l.debugEnabled()&&l.debug("onBufferingLong"),R(!0),O(r.SWITCH_SUGGESTION,{suggestion:"down",priority:1}))}},{type:a.SUGGESTION_ABORT,listener:function(e){p&&(U(e.data.reason),N())}}];function A(e,t){return et}function y(e,t){l.debugEnabled()&&l.debug("isCriticalEventHistory with allowedTimeDifferenceSeconds "+t);var n=e.length;return function(e,t,n){return(t-e)/1e30?e.slice(Math.max(n-t,0),n):[]}function R(e){l.debug((e?"allow":"deny")+" prediction"),e?(l.debugEnabled()&&l.debug("deny prediction"),clearTimeout(d),d=0,c=!0):d?l.debugEnabled()&&l.debug("allow prediction already in timeout"):(l.debugEnabled()&&l.debug("allow prediction in 3 seconds"),d=setTimeout((function(){l.debugEnabled()&&l.debug("allow prediction after timeout"),c=!1,d=0}),3e3))}function O(e,t){l.debugEnabled()&&l.debug("make suggestion to switch "+t.suggestion+(t.priority?" with priority "+t.priority:" without priority")),o.emit(e,t)}function I(e){p&&(l.debugEnabled()&&l.debug("success"),E||e||(h=!0,u&&clearTimeout(u),u=setTimeout((function(){l.debugEnabled()&&l.debug("initialSwitchUpTimeout elapsed"),(g||_)&&(l.debugEnabled()&&l.debug("initialSwitchUpTimeout to switch up"),R(!0),O(r.SWITCH_SUGGESTION,{suggestion:"up"}),_=!1,g=!1)}),5e3)),U(),R(!1))}function N(){p&&(l.debugEnabled()&&l.debug("error"),R(!1),C())}function C(){l.debugEnabled()&&l.debug("destroy initial switch up"),clearTimeout(u),E=!0}function D(){return"highest"===m}function w(){return"lowest"===m}function U(e){(m=e||!1)?l.debugEnabled()&&l.debug("aborted with reason: "+m):l.debugEnabled()&&l.debug("reset abort reason"),w()&&C()}return l.debugEnabled()&&l.debug("initialize"),e.add({target:o,listeners:T}),{destroy:function(){e.remove({target:o,listeners:T})},enable:function(){p=!0,l.debugEnabled()&&l.debug("reset initial switch up"),h=!1,E=!1,clearTimeout(u)},disable:function(){p=!1,C()}}}}}.apply(t,r))||(e.exports=i)},3349:function(e,t,n){var r,i;r=[n(492),n(6637),n(8333),n(8197),n(5337),n(4762),n(8134)],void 0===(i=function(e,t,n,r,i,a,o){return{create:function(r){var s,u,d,l,c,f,E,p=n.create("Adaptive.DeviationOfMean.Ressource"),m=!1,b=[],h=[],g=[],_=[{type:a.APPLICATION_STATE_CHANGE,listener:function(t){for(s||p.debugEnabled()&&p.debug("initial player state"),(s=t.data.state)===e.PAUSED&&"playbackrestart"!==t.data.reason&&(y(),r.emit(o.PAUSED,{paused:{}})),s===e.PLAYING&&h.length&&h[h.length-1].state===e.LOADING&&(p.debugEnabled()&&p.debug("setRessourceBlockTimeout from playing"),A());h.length>100;)h.shift();h.push({state:s,timestamp:performance.now()}),l&&v()}},{type:a.PLAY_STATS,listener:function(e){var t,n;m||(c.add(e.data.stats.buffer.delay.current),c.count%10==0&&(f.add(c.arithmetic),E.add(f.values[f.values.length-1]),g.add(E.deviation),t=c,(n=u.adaptive.buffer.delay).avg=t.arithmetic,n.min=t.minimum,n.max=t.maximum,n.deviation=t.deviation,n.samples=t.values.length,n.count=t.count,n.bufferDelaysArithmeticMeans=f.values,n.bufferDelaysStandardDeviations=g.values,r.emit(o.STATS,{deviationOfMean:u.adaptive})))}},{type:a.BUFFERING,listener:function(t){for(p.debugEnabled()&&p.debug("push startBuffering!"),b.push({event:t.data,timestamp:performance.now()});b.length>10;)b.shift();m?p.debugEnabled()&&p.debug("block emit startBuffering!"):(p.debugEnabled()&&p.debug("emit startBuffering!"),r.emit(o.BUFFERING,{startBufferings:b})),p.debugEnabled()&&p.debug("setBufferingLongTimeout"),v(),l=setTimeout((function(){p.debugEnabled()&&p.debug("setBufferingLongTimeout fired"),s===e.BUFFERING?(p.debugEnabled()&&p.debug("setBufferingLongTimeout fired and still in buffering state"),r.emit(o.BUFFERING_LONG)):p.debugEnabled()&&p.debug("setBufferingLongTimeout fired and not in buffering state")}),3e3)}},{type:a.STREAM_INFO,listener:function(){r.emit(o.STREAM_INFO,{streamInfo:{}}),y()}},{type:a.STREAM_QUALITY,listener:function(e){r.emit(o.STREAM_QUALITY,{streamQuality:e.data.onStreamQuality})}},{type:a.UPDATE_SOURCE_SUCCESS,listener:T},{type:a.SWITCH_STREAM_SUCCESS,listener:T}];function T(){p.debugEnabled()&&p.debug("setRessourceBlockTimeout from success"),A()}function A(){p.debugEnabled()&&p.debug("setRessourceBlockTimeout"),S(!0),clearTimeout(d),d=setTimeout((function(){p.debugEnabled()&&p.debug("setRessourceBlockTimeout fired"),S(!1),s===e.BUFFERING?(p.debugEnabled()&&p.debug("setRessourceBlockTimeout fired but in buffering state"),r.emit(o.BUFFERING,{startBufferings:b})):(p.debugEnabled()&&p.debug("setRessourceBlockTimeout fired & not in buffering state"),y())}),2e3)}function S(e){p.debugEnabled()&&p.debug("setRessourceBlock "+(e?"true":"false")),m=e}function y(){for(p.debugEnabled()&&p.debug("reset stats"),u={adaptive:{buffer:{delay:{samples:0,frequency:1,avg:0,min:0,max:0,deviation:0,count:0}}}},f=i.create(20,1),E=i.create(10,1),c=i.create(10,1),g=i.create(20,1);b.length;)b.pop()}function v(){p.debugEnabled()&&p.debug("clearBufferingLongTimeout"),clearTimeout(l),l=0}return p.debugEnabled()&&p.debug("initialize"),y(),t.add({target:r,listeners:_}),{destroy:function(){t.remove({target:r,listeners:_})}}}}}.apply(t,r))||(e.exports=i)},4762:function(e,t){var n;void 0===(n=function(){var e="sourceManager.";return{BASE:e,SERVER_INFO:e+"serverInfo",STREAM_INFO:e+"streamInfo",STREAM_INFO_UPDATE:e+"streamInfoUpdate",STREAM_QUALITY:e+"streamQuality",STREAM_FRAGMENT:e+"streamFragment",RANDOM_ACCESS_POINT:e+"randomAccessPoint",STREAM_URL:e+"streamUrl",CONFIG:e+"config",PLAYING:e+"playing",BUFFERING:e+"buffering",PLAY_STATS:e+"playStats",APPLICATION_STATE_CHANGE:e+"applicationStateChange",UPDATE_SOURCE:e+"updateSource",UPDATE_SOURCE_INIT:e+"updateSourceInit",UPDATE_SOURCE_SUCCESS:e+"updateSourceSuccess",UPDATE_SOURCE_FAIL:e+"updateSourceFail",UPDATE_SOURCE_ABORT:e+"updateSourceAbort",SWITCH_STREAM:e+"switchStream",SWITCH_STREAM_INIT:e+"switchStreamInit",SWITCH_STREAM_SUCCESS:e+"switchStreamSuccess",SWITCH_STREAM_FAIL:e+"switchStreamFail",SWITCH_STREAM_ABORT:e+"switchStreamAbort",SET_ADAPTION:e+"setAdaption",LOADED_DATA:e+"loadedData",TIME_OFFSET:e+"timeOffset",PUBLIC_EVENT:e+"publicEvent"}}.apply(t,[]))||(e.exports=n)},4035:function(e,t){var n;void 0===(n=function(){var e="switchController.";return{BASE:e,STREAM_SWITCH:e+"streamSwitch",SUGGESTION_ABORT:e+"suggestionAbort"}}.apply(t,[]))||(e.exports=n)},8307:function(e,t,n){var r,i;r=[n(8333),n(9658),n(6627),n(8197),n(6637),n(5055),n(164),n(3019),n(8983),n(7771),n(4762),n(708),n(8134),n(4035),n(6701),n(3049),n(4122)],void 0===(i=function(e,t,n,r,i,a,o,s,u,d,l,c,f,E,p,m,b){"use strict";return{create:function(n){var r,i,c=new t,h=e.create("SourceManager"),g=[],_=[{from:f.STATS,to:o.STATS},{from:E.STREAM_SWITCH,to:o.STREAM_SWITCH}],T=[{from:s.CONFIG,to:l.CONFIG},{from:s.PLAY_STATS,to:l.PLAY_STATS},{from:s.FRAME_DROP,to:l.FRAME_DROP},{from:s.RANDOM_ACCESS_POINT,to:l.RANDOM_ACCESS_POINT},{from:s.STREAM_QUALITY,to:l.STREAM_QUALITY},{from:s.APPLICATION_STATE_CHANGE,to:l.APPLICATION_STATE_CHANGE},{from:s.UPDATE_SOURCE,to:l.UPDATE_SOURCE},{from:s.SWITCH_STREAM,to:l.SWITCH_STREAM},{from:s.PUBLIC_EVENT,to:l.PUBLIC_EVENT},{from:s.BUFFERING,to:l.BUFFERING},{from:s.SET_ADAPTION,to:l.SET_ADAPTION},{from:s.LOADED_DATA,to:l.LOADED_DATA},{from:s.TIME_OFFSET,to:l.TIME_OFFSET},{from:d.SERVER_INFO,to:l.SERVER_INFO},{from:d.UPDATE_SOURCE_INIT,to:l.UPDATE_SOURCE_INIT},{from:d.UPDATE_SOURCE_SUCCESS,to:l.UPDATE_SOURCE_SUCCESS},{from:d.UPDATE_SOURCE_FAIL,to:l.UPDATE_SOURCE_FAIL},{from:d.UPDATE_SOURCE_ABORT,to:l.UPDATE_SOURCE_ABORT},{from:d.SWITCH_STREAM_INIT,to:l.SWITCH_STREAM_INIT},{from:d.SWITCH_STREAM_SUCCESS,to:l.SWITCH_STREAM_SUCCESS},{from:d.SWITCH_STREAM_FAIL,to:l.SWITCH_STREAM_FAIL},{from:d.SWITCH_STREAM_ABORT,to:l.SWITCH_STREAM_ABORT},{from:u.CREATED,to:l.STREAM_INFO},{from:u.UPDATED,to:l.STREAM_INFO_UPDATE}];return h.debugEnabled()&&h.debug("init"),r=a.create(n,c,T),i=a.create(c,n,_),g.push(b.create(c)),g.push(p.create(c)),g.push(m.create(c)),{destroy:function(){for(r.destroy(),r=null,i.destroy(),i=null;g.length;)g.pop().destroy()}}}}}.apply(t,r))||(e.exports=i)},4122:function(e,t,n){var r,i;r=[n(6637),n(8333),n(8197),n(492),n(4762),n(4035),n(708)],void 0===(i=function(e,t,n,r,i,a,o){return{create:function(s){var u,d,l,c,f,E,p,m,b,h,g,_,T,A,S,y,v,R,O,I,N=t.create("SwitchRequestController"),C={},D=0,w=!1,U={},P=0,M=!1,L=0,F=0,k=[],x=0,B=60,H=120,G=null,V=!1,W=0,Y=!1,j=[{type:i.CONFIG,listener:function(e){var t;K(e.data.config.source),t=e.data.config.playback,l=t.faststart,z("init")}},{type:i.SWITCH_STREAM,listener:function(e){if("recover"===e.data.type){for(var t=0;t-1&&(f=e.data.index,"direct"===(w=e.data.type)&&(u.options.adaption.rule="none"),z(w))}},{type:i.UPDATE_SOURCE,listener:function(e){K(e.data.source),z(w="update")}},{type:i.APPLICATION_STATE_CHANGE,listener:function(e){switch(d||N.debugEnabled()&&N.debug("initial player state"),d=e.data.state){case r.PAUSED:ne()}}},{type:i.UPDATE_SOURCE_SUCCESS,listener:function(){w=!1,ne()}},{type:i.UPDATE_SOURCE_FAIL,listener:function(){w=!1}},{type:i.UPDATE_SOURCE_ABORT,listener:function(){w=!1}},{type:i.SWITCH_STREAM_INIT,listener:function(e){var t=e.data.tag;N.debugEnabled()&&N.debug('stream switch init with tag "'+t+'"')}},{type:i.SWITCH_STREAM_SUCCESS,listener:function(e){delete U[e.data.id];var t=e.data.tag,n=t.split(" streamSwitch "),r=e.data.type;"down"===r&&(M=!0,L=X()),"up"===r&&(F=X(),k.push(F)),N.debugEnabled()&&N.debug('stream switch success with tag "'+t+'"'),N.debugEnabled()&&N.debug("switch with id "+n[1]+" was successful, switch index changed from "+c+" to "+C[n[1]]),q(C[n[1]]),w=!1,ne()}},{type:i.SWITCH_STREAM_FAIL,listener:function(e){delete U[e.data.id];var t=e.data.tag,n=t.split(" streamSwitch ");N.debugEnabled()&&N.debug('stream switch fail with tag "'+t+'"'),N.debugEnabled()&&N.debug("switch with id "+n[1]+" has been failed with code "+e.data.code+", switch index stays at "+c),w=!1,G=e.data.entry.index,R=e.data.type,ee("switchStreamFailCount"),N.debugEnabled()&&N.debug("switchStreamFailCount: "+W)}},{type:i.SWITCH_STREAM_ABORT,listener:function(e){delete U[e.data.id];var t=e.data.tag,n=t.split(" streamSwitch ");N.debugEnabled()&&N.debug('stream switch abort with tag "'+t+'"'),N.debugEnabled()&&N.debug("switch with id "+n[1]+" has been aborted"+(e.data&&e.data.reason?" with reason '"+e.data.reason+"'":"")+", switch index stays at "+c),w=!1}},{type:i.SET_ADAPTION,listener:function(e){u.options.adaption=e.data.adaption}},{type:o.SWITCH_SUGGESTION,listener:function(e){var t,n=(t=e.data.suggestion,N.debugEnabled()&&N.debug("lastFailedSwitchID: "+G+", nextStreamIndex: "+f),(null===G||G===f)&&t===R||(ne(),!1));if(N.debugEnabled()&&N.debug("suggest stream to switch "+e.data.suggestion),N.debugEnabled()&&N.debug("current stream has index "+c+" of "+(E-1)),w&&(!e.data.priority||e.data.priority&&1!==e.data.priority))N.debugEnabled()&&N.debug("switch already initialized, abort"),ie("initialized");else if(w&&f===E-1&&e.data.priority)N.debugEnabled()&&N.debug("switch with priority to highest index already initialized, abort"),ie("initialized");else if((W>=3||1===W&&x>0)&&n)!function(){if(V||Y){if(V&&Y){ie("switch fail timeout in progress");var e=X()-y,t=J()-e;N.debugEnabled()&&N.debug("switchSuggestionTime "+P.toFixed(2)+"; timeout in sec: "+p+"; time left in sec: "+t.toFixed(2))}}else!function(){Y=!0;var e=J();N.debugEnabled()&&N.debug("timeout value based on retryCooldownCounter: "+e),y=X(),ie("switch fail timeout started"),ee("retryCooldownCounter"),v=setTimeout((function(){te(),V=!1}),1e3*e)}()}();else{if(w=void 0,e.data.suggestion)if("down"===e.data.suggestion)cL?"up":"down";var r=P-b;if(0===c)N.debugEnabled()&&N.debug("suggest to switch up but lowest index reached, abort"),ie("lowest"),V=!1;else if(M&&r=0&&ec;n--)if(t[n])return n}(d,l):function(e,t){N.debugEnabled()&&N.debug("findUpSwitchCandidate upwards from startIndex: "+e);for(var n=e;n>=0;n--)if(t[n])return n}(d,l);return N.debugEnabled()&&N.debug("indexCandidate: "+m),m}function J(){if(m=X(),O=p,Y){if(V)p=O;else switch(x){case 0:$(30);break;case 1:$(60);break;case 2:default:$(90)}return p}if(m(O<=B?B:I+60));if(V)p=O;else if(F>0&&!V)if(t<30&&e<=I+10)$(_&&(F-_||F-T>0)&&(S>60&&S<180||A<300)?240:H);else if(!V&&n&&r)switch(O){case 30:case B:$(30);break;case H:$(B);break;case 240:$(H)}else $(B);else $(B);return p}function $(e){p=e,I=30===e?B:e,V=!0,N.debugEnabled()&&N.debug("applied timeout: "+e),240===p?T=X():p===H&&(_=X())}function Z(e,t){return e-t}function ee(e){if(null===G||G===f)switch(e){case"switchStreamFailCount":W++;break;case"retryCooldownCounter":x++}}function te(){W=0,Y=!1}function ne(){v&&(clearTimeout(v),v=null),te(),x=0}function re(){P=0,L=0,F=0,b=0,M=!1,V=!1,k=[],I=0,te(),x=0,N.debugEnabled()&&N.debug("reset time values")}function ie(e){s.emit(a.SUGGESTION_ABORT,{reason:e})}return N.debugEnabled()&&N.debug("initialize"),e.add({target:s,listeners:j}),{destroy:function(){e.remove({target:s,listeners:j})}}}}}.apply(t,r))||(e.exports=i)},5620:function(e,t,n){var r,i;r=[n(4556),n(8333),n(6627),n(6637),n(492),n(3019),n(519),n(8983)],void 0===(i=function(e,t,n,r,i,a,o,s){return{create:function(u){var d,l,c,f=t.create("StartupStatsCollector"),E=[],p=E[0]="connecting",m=E[1]="connected",b=E[2]="firstFragmentReceived",h=E[3]="firstFrameRendered",g=E[4]="playable",_=E[5]="playing",T={},A=null,S=!1,y=0,v=!1,R=[{type:a.APPLICATION_STATE_CHANGE,listener:function(e){switch(l=e.data.state){case i.LOADING:w(),r.add({target:u,listeners:d?C:O});break;default:w(),r.remove({target:u,listeners:d?C:O})}}},{type:a.CONFIG,listener:function(e){c=e.data.config.id,d=n.mustUseHLS||e.data.config.playback.allowSafariHlsFallback&&n.canUseHLS,v=e.data.config.playback.keepConnection,!d&&(O=O.concat(v?N:I)),S=e.data.config.playback.faststart}},{type:s.CREATED,listener:function(e){y=e.data.streamInfo.prerollDuration?e.data.streamInfo.prerollDuration:0}}],O=[{type:a.STREAM_FRAGMENT,listener:L},{type:a.LOADED_DATA,listener:F},{type:a.CAN_PLAY_THROUGH,listener:k},{type:a.PLAYING,listener:x}],I=[{type:a.NETWORK_CONNECTING,listener:P},{type:a.NETWORK_CONNECTED,listener:M}],N=[{type:a.NETWORK_PLAY,listener:P},{type:a.NETWORK_PLAY,listener:M}],C=[{type:a.PLAY,listener:P},{type:a.DURATION_CHANGE,listener:M},{type:a.LOADED_META_DATA,listener:L},{type:a.LOADED_DATA,listener:F},{type:a.CAN_PLAY_THROUGH,listener:k},{type:a.PLAYING,listener:x}];function D(t){if(l===i.LOADING)if(f.debugEnabled()&&f.debug("enabled, should set stat: "+t),-1===T[t])for(var n=function(e){for(var t=[],n=E.indexOf(e);n>=0;)-1===T[E[n]]&&(e!==_||e===_&&-1!==[b,h,g].indexOf(A))?(t.unshift(E[n]),n--):n=-1;return t.length&&(A=e),f.debugEnabled()&&f.debug(t.length?'valid labels are "'+t.join('", "')+'"':"no valid labels found"),t}(t),r=0,a=n.length;r0;e--)(T[E[e]]10;)l.shift()}},{type:r.TIME_OFFSET,listener:function(e){f=e.data.offset}},{type:i.FRAME_DROP,listener:function(e){var t;d.debugEnabled()&&d.debug("frame drop"),d.debugEnabled()&&d.debug(JSON.stringify(e.data)),"extreme"!==e.data.type||c||u!==o.PLAYING||(d.debugEnabled()&&d.debug("visible and extreme frame drop detected (edge)"),d.debugEnabled()&&d.debug("try seeking to last RAP to get stable playback"),t=l.length?l[l.length-1]:0,d.debugEnabled()&&d.debug("seeking to "+t),s.emit(n.SEEK,{position:t}))}}],p=[{type:a.VIEWPORT_VISIBLE,listener:m},{type:a.VIEWPORT_HIDDEN,listener:m}];function m(e){c=e.name!==a.VIEWPORT_VISIBLE,d.debugEnabled()&&d.debug("viewport changed to "+(c?"hidden":"visible"))}function b(){for(;l.length;)l.shift();f=0}return d.debugEnabled()&&d.debug("initialize"),b(),t.add({target:s,listeners:E}),t.add({target:s,listeners:p}),{destroy:function(){t.remove({target:s,listeners:E}),t.remove({target:s,listeners:p})}}}}}.apply(t,r))||(e.exports=i)},2885:function(e,t,n){var r,i;r=[n(8333),n(6627),n(6637),n(5698),n(291),n(5980),n(492)],void 0===(i=function(e,t,n,r,i,a,o){return{create:function(s){var u,d,l=.3,c=e.create("GapHandler"),f=0,E=0,p=[{type:r.APPLICATION_STATE_CHANGE,listener:function(e){u=e.data.state,n.remove({target:s,listeners:m}),(t.isTridentBrowser&&u===o.PLAYING||!t.isTridentBrowser&&u!==o.BUFFERING&&u!==o.PAUSED)&&(f=0,n.add({target:s,listeners:m}))}}],m=[{type:a.PRIVATE_MEDIA_STATS,listener:function(e){if(function(e){return e&&e.length>0}(e.data.mediaStats.buffered)){var t=e.data.mediaStats.buffered,n=e.data.mediaStats.exactCurrentTime,r=h(n,t),a=function(e,t){for(var n=0;t&&nt.end(n)&&er&&g(t,a)>l&&b(n,t,A)?(m=!0,_="next",T=t.start(a)):a>r&&o>a&&g(t,a)l&&b(n,t,A)?(m=!0,_="last",T=t.start(o)):a===r&&g(t,o)>l&&function(e,t){return t&&e=t.end(h(e,t))}function h(e,t){for(var n=0;t&&n20;)oe[n].pop();if(h===n)switch(u){case s.SEEKING:ae===c.MEDIA.HLS_BUFFER_UNDERRUN&&$e(!0),e.emit(d,a);break;case s.SEEKED:ae===c.MEDIA.HLS_BUFFER_UNDERRUN&&Ze(!0),e.emit(d,a);break;case s.CAN_PLAY:if(ae===c.MEDIA.HLS_BUFFER_UNDERRUN){if(Ae(W[n])&&(m.debugEnabled()&&m.debug("video paused at can play in recovery on current media element"),m.debugEnabled()&&m.debug("call raw play"),ce(W[n],{data:{hlsended:!0}},!1)),te&&V[0].currentTime>i.currentTime&&i.currentTime<1)return $e(!1),Ze(!1),m.debugEnabled()&&m.debug("pause because seek back during buffer recovery detected"),fe(W[h],{data:{error:!0}},!0),m.debugEnabled()&&m.debug("switch stream to recover after seek back during buffering"),void e.emit(o.SWITCH_STREAM,{index:P,type:"recover"});m.debugEnabled()&&m.debug("now wait for progress for completion"),Qe(!0)}J||(!b||K||!Y)&&b||(e.emit(d,a),(J=!0)&&m.debugEnabled()&&m.debug("initialized true - onMediaElementEvent CAN_PLAY on currentMediaElementIndex: "+h),Ue()),et(!(!K||!re));break;case s.PROGRESS:ae&&!K&&ae===c.MEDIA.HLS_BUFFER_UNDERRUN&&$&&(Ae(W[n])||(m.debugEnabled()&&m.debug("video not paused & wait for progress in recovery on current media element"),ee&&!te?m.debugEnabled()&&m.debug("ongoing seek, wait for seeked in next progress"):ee&&te?(m.debugEnabled()&&m.debug("media error "+ae+" recovered in progress after seek"),$e(!1),Ze(!1),e.emit(o.MEDIA_ERROR_RECOVERED,{data:{code:ae}}),qe(!1),Qe(!1),m.debugEnabled()&&m.debug("merge pending time offset after seeked"),Ye(!0),je()):ee||te||(m.debugEnabled()&&m.debug("media error "+ae+" recovered in progress without seek"),e.emit(o.MEDIA_ERROR_RECOVERED,{data:{code:ae}}),qe(!1),Qe(!1),je()))),e.emit(d,a);break;case s.PAUSE:ae===c.MEDIA.HLS_BUFFER_UNDERRUN&&m.debugEnabled()&&m.debug("pause event during recovery of 3101"),e.emit(d,a);break;default:e.emit(d,a)}else if(n===C&&C!==h&&Y)switch(m.debugEnabled()&&m.debug("onMediaElementEvent switchMediaElementIndex: "+C),u){case s.PLAY:case s.DURATION_CHANGE:case s.LOADED_META_DATA:case s.LOADED_DATA:e.emit(d,a);break;case s.CAN_PLAY:m.debugEnabled()&&m.debug("onMediaElementEvent CAN_PLAY on switchMediaElementIndex: "+C),J||(m.debugEnabled()&&m.debug("onMediaElementEvent emit CAN_PLAY"),e.emit(d,a),(J=!0)&&m.debugEnabled()&&m.debug("initialized true - onMediaElementEvent CAN_PLAY on switchMediaElementIndex: "+C));break;case s.CAN_PLAY_THROUGH:m.debugEnabled()&&m.debug("onMediaElementEvent CAN_PLAY_THROUGH on switchMediaElementIndex: "+C),z&&(m.debugEnabled()&&m.debug("onMediaElementEvent CAN_PLAY_THROUGH wait for progress"),Je(!0),e.emit(d,a));break;case s.PROGRESS:m.debugEnabled()&&m.debug("onMediaElementEvent PROGRESS on switchMediaElementIndex: "+C),z&&Z&&(m.debugEnabled()&&m.debug("onMediaElementEvent PROGRESS call mediaElementSwitch"),Je(!1),function(){if(b&&void 0!==C&&z)if(m.debugEnabled()&&m.debug("switch mediaElement after successfull "+(He()?"updateSource":"switchStream")),ue)m.debugEnabled()&&m.debug("there is a lock on media element switch, skipping the execution");else{m.debugEnabled()&&m.debug("starting to complete switch"),tt(!0),we();var e=Pe.bind(this,W[C]),t=ve.bind(this,W[C]);r.performInSyncedUIBehavior(e,t,150).then((function(){try{m.debugEnabled()&&m.debug("switch mediaElement UI preparation is done"),ke(),tt(!1)}catch(e){m.debugEnabled()&&m.debug("error in performInSyncedUIBehavior success calback")}})).catch((function(){try{m.debugEnabled()&&m.debug("switch mediaElement UI preparation is failed"),ke(),tt(!1)}catch(e){m.debugEnabled()&&m.debug("error in performInSyncedUIBehavior catch calback")}}))}}());break;case s.PLAYING:e.emit(d,a)}}}function le(){m.debugEnabled()&&m.debug("unmute index: "+h);for(var e=0;e2;)V.shift();V.push(y),e.emit(s.TIME_UPDATE,y)}function De(){(v=Te(W[h])).quality=me(W[h]),e.emit(s.QUALITY_UPDATE,v)}function we(){A&&(clearTimeout(A),A=0)}function Ue(){m.debugEnabled()&&m.debug("reset switch variables"),C=void 0,(J=!0)&&m.debugEnabled()&&m.debug("initialized true - resetSwitchVariables"),K=!1,z=!1,U=void 0,L=void 0}function Pe(e){e&&e.showOnTop()}function Me(e,t){e&&e.setSource({source:t?I:O})}function Le(e){e&&e.setType({type:N})}function Fe(e){var t,r,i,a;if(b&&ye(e)&&Object.prototype.hasOwnProperty.call(e.data,"entry"))if(i=e.data.entry.index,t=k?"update"===k.type:He(),r="update"===e.data.type,m.debugEnabled()&&m.debug((r?"updateSourceInit":"switchStreamInit")+" with entryIndex: "+i),ie)m.debugEnabled()&&m.debug((r?"updating":"switching")+" is disabled, abort");else{if(!r&&ae&&"recover"!==e.data.type)return m.debugEnabled()&&m.debug("abort switch attempt during recovery"),(a=n.copy(e.data)).reason="recover",void Be(a);if(K&&(!t||t&&r)||k&&(!t||t&&r))m.debugEnabled()&&m.debug("abort ongoing "+(t?"update":"switch")+" process"),(a=n.copy(k||U)).reason="superseded",Be(a),we(),k?k=void 0:(fe(W[C],void 0,!0),Ue());else if(K&&t&&!r||k&&t&&!r)return void(m.debugEnabled()&&m.debug("ongoing updateSource process!"));r||P!==i||"recover"===e.data.type?(m.debugEnabled()&&m.debug("new "+(r?"update":"switch")),z?(m.debugEnabled()&&m.debug("do not handle switch, still ongoing switch!"),m.debugEnabled()&&m.debug("add to queue!"),k=e.data):(m.debugEnabled()&&m.debug("handle switch without ongoing"),Ge(e.data,i,r))):(m.debugEnabled()&&m.debug("abort switch attempt on equal index"),(a=n.copy(e.data)).reason="equalsource",Ue(),we(),Be(a)),ie=!0,setTimeout((function(){ie=!1}),500)}}function ke(){m.debugEnabled()&&m.debug("starting to swap media elements"),ge(W[C]),_e(W[h]),Ve(C),be(W[h])&&(j=be(W[h]).muted),Ee(W[h]),j?Ee(W[C]):pe(W[C]),ae&&(m.debugEnabled()&&m.debug("media error "+ae+" recovered in switch success"),e.emit(o.MEDIA_ERROR_RECOVERED,{data:{code:ae}}),qe(!1)),se||We(),Ye(!0),je(),m.debugEnabled()&&m.debug("handle switch pause on currentMediaElementIndex: "+h),fe(W[h],void 0,!0),he(W[C],q),h=C,k?(z=!1,function(){if(k){var e="update"===k.type,t=k.entry.index,r=n.copy(k);k=void 0,m.debugEnabled()&&m.debug("handleQueuedSwitch"),Ge(r,t,e,!0)}}()):Ue()}function xe(){if(void 0!==C&&C!==h&&K&&!z){var t=n.copy(U);fe(W[C],void 0,!0),He()&&(ze(void 0),e.emit(o.UPDATE_SOURCE_TIMEOUT,{code:c.STREAM.MEDIA_NOT_AVAILABLE,message:f.STREAM.MEDIA_NOT_AVAILABLE})),k=void 0,Ue(),function(t){e.emit(o.UPDATE_SOURCE_FAIL,{tag:t.options.tag,count:t.options.count,code:c.NETWORK.SOURCE_TIMEOUT,message:f.NETWORK.SOURCE_TIMEOUT,type:t.type,id:t.id})}(t)}}function Be(t){setTimeout((function(){e.emit(o.UPDATE_SOURCE_ABORT,{source:t.source,entry:t.entry,rule:t.rule,reason:t.reason,tag:t.tag,count:t.count,type:t.type,id:t.id})}),0)}function He(){return U&&Object.prototype.hasOwnProperty.call(U,"type")&&"update"===U.type}function Ge(e,t,n,r){C=h?0:1,m.debugEnabled()&&m.debug("mediaElementPrepareSwitch on switchMediaElementIndex: "+C),(J=!1)&&m.debugEnabled()&&m.debug("initialized true - mediaElementPrepareSwitch"),K=!0,U=e,n?(S=U.source.startIndex,L=S,r&&(Me(W[C],S),Le(W[C]),b||Se(W[C]),b&&K&&Ee(W[C]),ce(W[C],void 0,!0),Re(),Oe(),O.length&&(m.debugEnabled()&&m.debug("add time update interval for play stats"),Ie(),void 0!==me(W[C])&&(m.debugEnabled()&&m.debug("add quality update interval"),Ne())))):Y&&(C=h?0:1,L=t,r&&(Me(W[C],t),Le(W[C]),b||Se(W[C]),b&&K&&Ee(W[C]),ce(W[C],void 0,!0))),Y&&function(e){A&&we();var t=e&&Object.prototype.hasOwnProperty.call(e,"options")&&Object.prototype.hasOwnProperty.call(e.options,"timeout")?1e3*e.options.timeout:1e4;A=setTimeout((function(){xe()}),t)}(U)}function Ve(t){for(var n=W.map((function(e){return e.getVideoElement()})),r=0;r=.5?.2:0}},{type:s.PLAY,listener:function(e){f.debugEnabled()&&f.debug("on play"),setTimeout((function(){-1===_&&e.data.external&&!e.data.invalidState&&(h?g=!0:w())}),10)}},{type:a.RECOVER,listener:function(){f.debugEnabled()&&f.debug("media error recover"),c=!0}},{type:a.RECOVERED,listener:function(){f.debugEnabled()&&f.debug("media error recovered"),c=!1}}],C=[{type:o.PRIVATE_MEDIA_STATS,listener:function(e){if(!(p=e.data.mediaStats).buffered||!p.buffered.length)return f.detailEnabled()&&f.detail("no data in play stats"),void(h&&g&&isFinite(p.duration)&&(g=!1,w()));var n=p.exactCurrentTime;F(A,n,5);var r=L(A),a=p.buffered,o=function(e,n){for(var r=0;e&&r=n-1e-6||t.isTridentBrowser&&n<=.3&&e.start(r)<=5&&e.end(r)-e.start(r)>.2)return r;return-1}(a,n),u={startRange:a.start(a.length-1),endRange:a.end(a.length-1),rangeLength:a.end(a.length-1)-a.start(a.length-1),rangeIndex:o,hasRangeIndex:-1!==o,bufferedPartsCount:a.length},l=h&&!m?u.endRange-n:p.bufferDelay;F(S,p.bufferEnd,5);var N=L(S),C={currentTime:n,bufferDelayCurrent:l,hasEnoughToStart:l>=E.buffer.start-O,hasEnoughToResume:l>=E.buffer.start-I,hasEnoughPrerollToStart:l>=v-(E.buffer.start-O-E.buffer.min),hasStartHigherPreroll:E.buffer.start-O>v,hasEnoughToPlay:l>E.buffer.min,bufferLength:p.bufferEnd-p.bufferStart,bothCurrentTimeAndBufferEndNotMoving:r&&N,currentTimeNotMoving:r,bufferEndNotMoving:N};null===function(e,n){var r=null;return!h&&!e.hasRangeIndex&&!m&&n.bufferLength>.45?(r=Math.min(e.startRange+.3,e.endRange),P(t.isTridentBrowser?0:r,"seek to range: "+e.startRange+" < "+r+" > "+e.endRange+", currentTime: "+n.currentTime)):!h&&!m&&t.isFirefox&&e.bufferedPartsCount>1&&e.rangeIndex!==e.bufferedPartsCount-1&&e.rangeLength>.3&&P(r=e.startRange,"seek to startable range start: "+r),r}(u,C)&&(function(e,n,r,i){if(-1===_&&n.hasEnoughToStart&&(e.hasRangeIndex||h)){f.debugEnabled()&&f.debug("start buffer of "+(r.buffer.start-O)+" reached");var a=!h&&t.isSafari,o=a&&n.currentTime<.2;if(!v||v&&n.hasStartHigherPreroll){if(f.debugEnabled()&&f.debug(" start buffer case"),o)return P(_=.3,"initial safari stream startTime set to "+_+", seeking",!0),!0;_=n.currentTime,f.debugEnabled()&&f.debug("default stream startTime set to "+_)}else if(v&&n.hasEnoughPrerollToStart&&!n.hasStartHigherPreroll&&(f.debugEnabled()&&f.debug("preroll buffer of "+v+" reached"),P(_=a?i.bufferEnd-.15:v-(r.buffer.start-r.buffer.min),"initial preroll stream startTime set to "+_+", seeking",!0),a))return!0}}(u,C,E,p)||function(e,t){b&&R&&(!m&&e.hasEnoughToStart||m&&e.hasEnoughToResume&&!e.bufferEndNotMoving)&&-1!==_&&(f.debugEnabled()&&f.debug("on operatePlayback : starting stream at "+_+" with latency "+e.bufferDelayCurrent),d.emit(s.PLAY,{external:!1,buffer:!0}),b=!1,m&&(f.debugEnabled()&&f.debug("on operatePlayback : resuming playback, emitting playbackStarted"),d.emit(i.PLAYBACK_STARTED))),b||(!m&&-1!==_&&_1&&(f.debugEnabled()&&f.debug("useHLS: buffer higher 1 at start"),e.currentTime<.5&&P(1,"useHLS: maybe preroll detected, seek to 1"))),m&&T&&(f.debugEnabled()&&f.debug("on operatePlayback : starting playback, emitting playbackStarted with stats"),d.emit(i.PLAYBACK_STARTED,T)),e.currentTime>E.buffer.start&&!c&&(!e.hasEnoughToPlay||m&&e.bothCurrentTimeAndBufferEndNotMoving)&&(y?(y=!1,b=!0,f.debugEnabled()&&f.debug("pausing to buffer during playback"),M(),U()):y=!0))}(C,p))}}];function D(e){v=e.data.streamInfo.prerollDuration?e.data.streamInfo.prerollDuration:0,R=!0}function w(){f.debugEnabled()&&f.debug("pausing to raise buffer at start"),U()}function U(){d.emit(s.PAUSE,{external:!1,buffer:!0})}function P(e,t,n){f.warnEnabled()&&f.warn(t),d.emit(s.SEEK,{position:e,fast:!0===n})}function M(){d.emit(i.BUFFERING)}function L(e){var t=!0;if(e.length){for(var n=e[0],r=1;r0,t.haveAudio=void 0!==b.audioTracks&&b.audioTracks.length>0,t.videoWidth=b.videoWidth,t.videoHeight=b.videoHeight}S.detailEnabled()&&S.detail(e.type+" - (index: "+l+", paused: "+W()+", currentTime: "+t.currentTime+", latency: "+((t.useDuration?t.duration:t.buffered.length?t.buffered.end(t.buffered.length-1):0)-t.currentTime)+")"),(!c||e.type!==a.CAN_PLAY||c&&e.type===a.CAN_PLAY&&!R)&&s.emit("mediaElementProxy."+e.type,t)}function F(){var e=b&&"function"==typeof b.getBoundingClientRect?b.getBoundingClientRect():{top:0,left:0,bottom:0,right:0},t=window.innerHeight||document.documentElement.clientHeight,n=window.innerWidth||document.documentElement.clientWidth,r=e.top<=t&&e.top+e.height>=0,i=e.left<=n&&e.left+e.width>=0,a=r&&i;a!==A&&(S.debugEnabled()&&S.debug("viewport changed to "+(a?"visible":"hidden")),A=a,s.emit(a?o.VIEWPORT_VISIBLE:o.VIEWPORT_HIDDEN,k()))}function k(){return{currentTime:b.currentTime,buffered:b.buffered,played:b.played,playbackRate:b.playbackRate,index:l,duration:b.duration,useDuration:c&&Number.isFinite(b.duration)&&b.duration<4e6,paused:b.paused}}function x(){S.debugEnabled()&&S.debug("iOS11 detected, using iframe hack");var e={name:"h5live-iframe-"+l,frameBorder:0,scrolling:"no",style:{cssText:"z-index: 0;width: 100%;height: 100%;position: absolute;display: none;top: 0;left: 0;"},h5liveIndex:l,h5liveActive:!1};g||(g=d.querySelector('iframe[name="'+e.name+'"]')),g&&g.name===e.name&&(g.contentDocument&&g.contentDocument.body&&g.contentDocument.body.firstChild&&g.contentDocument.body.removeChild(g.contentDocument.body.firstChild),g.removeEventListener("load",B),g.parentNode&&g.parentNode.removeChild(g),g=null),H(g=document.createElement("iframe"),e),g.addEventListener("load",B),d.appendChild(g)}function B(e){var t=e.target.contentDocument.body;t&&(H(t,{style:{height:"100%",width:"100%",overflow:"hidden",position:"absolute",margin:"0",padding:"0"}}),t.firstChild||(t.appendChild(b),r.remove({target:b,listeners:N}),r.add({target:b,listeners:N})))}function H(e,t){Object.keys(t).forEach((function(n){"object"!=typeof t[n]?e[n]=t[n]:Object.keys(t[n]).forEach((function(r){e[n][r]=t[n][r]}))}))}function G(e){e&&Object.prototype.hasOwnProperty.call(e,"source")&&(h.src=e.source)}function V(){b&&b.load()}function W(){return b?b.paused:void 0}function Y(e,t){e.h5liveActive=t}function j(e,t,n){return!!e&&"object"==typeof e.data&&e.data[t]===n}return function(){var e=[a.TIME_UPDATE];for(var t in a)Object.prototype.hasOwnProperty.call(a,t)&&-1===e.indexOf(a[t])&&N.push({type:a[t],listener:L})}(),function(){var e={id:u,autoplay:!1,controls:!1,playsInline:!0,muted:f,volume:1,style:{backgroundColor:"transparent"},h5liveIndex:l,h5liveActive:!1};switch(m){case"anonymous":case"use-credentials":e.crossOrigin=m}t.mustUseHLS&&(e.style.width="100vw",e.style.height="100vh"),(b=document.getElementById(u))&&(b.disableRemotePlayback=!0),y=!!b,S.debugEnabled()&&S.debug("using "+(y?"external ":"generated ")+"video element"),y?(T=b.parentNode,_=b.style.cssText,b.style.cssText=""):(b=document.createElement("video"))&&(b.disableRemotePlayback=!0),H(b,e)}(),h=document.createElement("source"),b.appendChild(h),t.mustUseHLS?x():(S.debugEnabled()&&S.debug("appending video to container"),d.appendChild(b),r.add({target:b,listeners:N}),t.isTridentBrowser&&(["scroll","resize"].forEach((function(e){window.addEventListener&&window.addEventListener(e,F,!1),window.attachEvent&&window.attachEvent("on"+e,F)})),F())),{destroy:function(){C()},play:U,pause:P,loadVideo:V,setSource:G,setType:function(e){b&&e&&(b.type=e)},setVolume:function(e){b&&!isNaN(e)&&e>=0&&e<=1&&b.volume!==e&&(S.debugEnabled()&&S.debug("set volume: "+e),b.volume=e)},setMute:D,setUnmute:w,setRate:M,destroyVideo:C,seek:function(e){if(b&&e&&e.data&&!isNaN(e.data.position)&&e.data.position>=0){var t=Math.round(1e6*e.data.position)/1e6;S.debugEnabled()&&S.debug("seek to: "+e.data.position+" (rounded: "+t+"), from: "+b.currentTime),e.data.fast&&void 0!==b.fastSeek?b.fastSeek(t):b.currentTime=t}},getVideoPlaybackQuality:function(){return b&&"function"==typeof b.getVideoPlaybackQuality?b.getVideoPlaybackQuality():void 0},getVideoElement:function(){return b||void 0},getMediaElementPayload:k,show:function(){g&&(g.style.display="block",g.style.zIndex="1",Y(g,!0)),b&&(b.style.display="block",b.style.zIndex="1",Y(b,!0))},hide:function(){g&&(g.style.display="block",g.style.zIndex="0",Y(g,!1)),b&&(b.style.display="block",b.style.zIndex="0",Y(b,!1))},getIndex:function(){return l},setIndex:function(e){l=e},showOnTop:function(){S.debugEnabled()&&S.debug("show index "+l+" on top"),g?(g.style.display="block",g.style.zIndex=I):b&&(b.style.display="block",b.style.zIndex=I)},isShownOnTop:function(){var e=!1;return g?e=g.style.zIndex===I:b&&(e=b.style.zIndex===I),e},unlock:function(){O?S.debugEnabled()&&S.debug("skip check because is unlocked"):(S.debugEnabled()&&S.debug("2nd vid try unlock with silent play attempt"),U({data:{unlocked:!0}}))},getVideoPausedState:W}}}}.apply(t,r))||(e.exports=i)},232:function(e,t,n){var r,i;r=[n(6637),n(8333),n(6627),n(492),n(5698),n(5997),n(2653),n(5980)],void 0===(i=function(e,t,n,r,i,a,o,s){return{create:function(u){var d,l,c,f,E,p,m,b=t.create("MediaElementStatsCreator"),h=[],g=!1,_=!1,T=!1,A=!1,S=[{type:i.APPLICATION_STATE_CHANGE,listener:function(t){switch(c=t.data.state){case r.PAUSED:b.debugEnabled()&&b.debug("remove stats listener"),e.remove({target:u,listeners:y});break;case r.PLAYING:break;case r.LOADING:I(),b.debugEnabled()&&b.debug("hls: add stats listener"),f&&e.add({target:u,listeners:y})}}},{type:i.CONFIG,listener:function(e){f=n.mustUseHLS||e.data.config.playback.allowSafariHlsFallback&&n.canUseHLS}}],y=[{type:a.TIME_UPDATE,listener:function(e){m!==e.data.index&&(b.debugEnabled()&&b.debug("new mediaElementIndex, changed from "+m+" to "+e.data.index),m=e.data.index);var t,n,i=e.data.played.length-1,a=e.data.buffered.length-1,o=e.data.currentTime;if(E=o,e.data.timeOffset&&(p=e.data.timeOffset,E+=p.currentTime),c!==r.PLAYING&&c!==r.BUFFERING||0!==E?E=c===r.LOADING?0:E:b.detailEnabled()&&b.detail("playing but currentTime = 0"),0===E&&b.detailEnabled()&&b.detail("currentTime = 0"),i>=0&&(d.playedStart=0,d.playedEnd=o),a>=0){var s=e.data.buffered.start(a),u=e.data.buffered.end(a),S=e.data.duration?e.data.duration:0;if(n=u,2===(t=h).length&&t.shift(),t.push(n),!function(e){var t=!0;if(e.length){for(var n=e[0],r=1;r=y)t=!1,f.debugEnabled()&&f.debug("media error with code "+e+" recoverable, but recover threshold "+y+" reached within "+(p?(Math.floor(performance.now())-h[0])/1e3:0)+" seconds, trigger error");else{for(t=!0,h.push(Math.floor(performance.now()));h[h.length-1]-h[0]>6e4;)h.shift();p=h.length,m++;var n=6e4-(h[p-1]-h[0]),r=y-p;f.debugEnabled()&&f.debug("recovering from media error "+e+", recovery "+p+"/"+y+" within the last 60 seconds ("+m+" total)"),f.debugEnabled()&&f.debug(r+(r<=1?" recoveries":" recovery")+" allowed within remaining time of "+n/1e3+" seconds"),F(),b=setTimeout(I,1e4),c.emit(s.RECOVER,{count:p,max:y,total:m,code:e,remainingTime:n,reconnect:!!E.reconnect})}return t})(E.code)||(f.debugEnabled()&&f.debug('trigger "'+s.ERROR+'" with translated code '+E.code+' and message "'+E.message+'"'),c.emit(s.ERROR,E))}function O(e){f.debugEnabled()&&f.debug("recovery succeed from error "+e.data.code),F(),c.emit(s.RECOVERED,{data:{code:e.data.code}})}function I(){F(),f.debugEnabled()&&f.debug("recovery failed from error with translated code "+E.code+' and message "'+E.message+'"'),setTimeout(N,200)}function N(){c.emit(s.ERROR,E)}function C(){f.debugEnabled()&&f.debug("inSwitch has length "+_.length);var e=!1;return _.length&&(e=!0),e}function D(){f.debugEnabled()&&f.debug("inUpdate has length "+T.length);var e=!1;return T.length&&(e=!0),e}function w(){f.debugEnabled()&&f.debug("check if switch or update");var e=!1;return C()?(f.debugEnabled()&&f.debug("still in switch"),e=!0):D()&&(f.debugEnabled()&&f.debug("still in update"),e=!0),e}function U(e,t){var n=!1;return C()?(f.debugEnabled()&&f.debug("still in switch, queue error with transformed code "+t),function(e,t){f.debugEnabled()&&f.debug("media error with code "+t+'" queued during ongoing switch or update'),A||c.emit(s.QUEUED,{code:t}),A=e}(e,t),n=!0):D()&&(f.debugEnabled()&&f.debug("still in update, do nothing"),n=!0),n}function P(e){return"recover"===e}function M(){f.debugEnabled()&&f.debug("check queued media error"),w()?f.debugEnabled()&&f.debug("abort queued check, still ongoing switch or update"):A&&!S&&(f.debugEnabled()&&f.debug("set timeout for handling queued media error again"),S=setTimeout((function(){f.debugEnabled()&&f.debug("timeout fired queued media error"),clearTimeout(S),S=0,R(A),L()}),250))}function L(){A=null,c.emit(s.UNQUEUED)}function F(){clearTimeout(b),b=0}function k(e,t){return e.push(t),e}function x(e,t){for(var n=0;n