ezuikit-flv 1.0.0-alpha.0 → 1.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/index.js +2 -3
  3. package/package.json +2 -7
package/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * screenfull
4
4
  * v5.1.0 - 2020-12-24
5
5
  * (c) Sindre Sorhus; MIT License
6
- */!function(e){!function(){var t="undefined"!=typeof window&&void 0!==window.document?window.document:{},i=e.exports,r=function(){for(var e,i=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],r=0,n=i.length,s={};r<n;r++)if((e=i[r])&&e[1]in t){for(r=0;r<e.length;r++)s[i[0][r]]=e[r];return s}return!1}(),n={change:r.fullscreenchange,error:r.fullscreenerror},s={request:function(e,i){return new Promise(function(n,s){var o=function(){this.off("change",o),n()}.bind(this);this.on("change",o);var a=(e=e||t.documentElement)[r.requestFullscreen](i);a instanceof Promise&&a.then(o).catch(s)}.bind(this))},exit:function(){return new Promise(function(e,i){if(this.isFullscreen){var n=function(){this.off("change",n),e()}.bind(this);this.on("change",n);var s=t[r.exitFullscreen]();s instanceof Promise&&s.then(n).catch(i)}else e()}.bind(this))},toggle:function(e,t){return this.isFullscreen?this.exit():this.request(e,t)},onchange:function(e){this.on("change",e)},onerror:function(e){this.on("error",e)},on:function(e,i){var r=n[e];r&&t.addEventListener(r,i,!1)},off:function(e,i){var r=n[e];r&&t.removeEventListener(r,i,!1)},raw:r};r?(Object.defineProperties(s,{isFullscreen:{get:function(){return Boolean(t[r.fullscreenElement])}},element:{enumerable:!0,get:function(){return t[r.fullscreenElement]}},isEnabled:{enumerable:!0,get:function(){return Boolean(t[r.fullscreenEnabled])}}}),i?e.exports=s:window.screenfull=s):i?e.exports={isEnabled:!1}:window.screenfull={isEnabled:!1}}()}(W);var Q=j(W.exports);function z(){}function H(e=""){const t=e.split(","),i=atob(t[1]),r=t[0].replace("data:","").replace(";base64","");let n=i.length;const s=new Uint8Array(n);for(;n--;)s[n]=i.charCodeAt(n);return new File([s],"file",{type:r})}function q(){return(new Date).getTime()}function $(e,t,i){if(e)return"object"==typeof t&&Object.keys(t).forEach((i=>{$(e,i,t[i])})),e.style[t]=i,e}function X(){return performance&&"function"==typeof performance.now?performance.now():Date.now()}function Y(e){let t=0,i=X();return r=>{t+=r;const n=X(),s=n-i;s>=1e3&&(e(t/s*1e3),i=n,t=0)}}function Z(){return/iphone|ipod|android.*mobile|windows.*phone|blackberry.*mobile/i.test(window.navigator.userAgent.toLowerCase())}function K(){return Q.isFullscreen}function J(e){return null==e}function ee(e){return!J(e)}function te(e){const t=e||window.event;return t.target||t.srcElement}(()=>{try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(e instanceof WebAssembly.Module)return new WebAssembly.Instance(e)instanceof WebAssembly.Instance}}catch(e){}})();class ie{constructor(){}on(e,t,i){const r=this.e||(this.e={});return(r[e]||(r[e]=[])).push({fn:t,ctx:i}),this}once(e,t,i){const r=this;function n(...s){r.off(e,n),t.apply(i,s)}return n._=t,this.on(e,n,i)}emit(e,...t){const i=((this.e||(this.e={}))[e]||[]).slice();for(let e=0;e<i.length;e+=1)i[e].fn.apply(i[e].ctx,t);return this}off(e,t){const i=this.e||(this.e={});if(!e)return Object.keys(i).forEach((e=>{delete i[e]})),void delete this.e;const r=i[e],n=[];if(r&&t)for(let e=0,i=r.length;e<i;e+=1)r[e].fn!==t&&r[e].fn._!==t&&n.push(r[e]);return n.length?i[e]=n:delete i[e],this}}let re=class extends ie{constructor(){super(),this.init=!1}resetInit(){this.init=!1,this.videoInfo={width:"",height:"",encType:"",encTypeCode:""}}destroy(){this.resetInit(),this.player.$container.removeChild(this.$videoElement),this.off()}updateVideoInfo(e){e.encTypeCode&&(this.videoInfo.encType=D[e.encTypeCode]),e.width&&(this.videoInfo.width=e.width),e.height&&(this.videoInfo.height=e.height),this.videoInfo.encType&&this.videoInfo.height&&this.videoInfo.width&&!this.init&&(this.player.emit(w.videoInfo,this.videoInfo),this.init=!0)}play(){}pause(){}clearView(){}};const ne="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof global&&global.global===global?global:void 0;function se(e,t,i){const r=new XMLHttpRequest;r.open("GET",e),r.responseType="blob",r.onload=function(){le(r.response,t,i)},r.onerror=function(){},r.send()}function oe(e){const t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch(e){}return t.status>=200&&t.status<=299}function ae(e){try{e.dispatchEvent(new MouseEvent("click"))}catch(t){const i=document.createEvent("MouseEvents");i.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(i)}}const he=ne.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent);var le="object"!=typeof window||window!==ne?function(){}:"download"in HTMLAnchorElement.prototype&&!he?function(e,t,i){const r=ne.URL||ne.webkitURL,n=document.createElementNS("http://www.w3.org/1999/xhtml","a");t=t||e.name||"download",n.download=t,n.rel="noopener","string"==typeof e?(n.href=e,n.origin!==location.origin?oe(n.href)?se(e,t,i):ae(n,n.target="_blank"):ae(n)):(n.href=r.createObjectURL(e),setTimeout((function(){r.revokeObjectURL(n.href)}),4e4),setTimeout((function(){ae(n)}),0))}:"msSaveOrOpenBlob"in navigator?function(e,t,i){if(t=t||e.name||"download","string"==typeof e)if(oe(e))se(e,t,i);else{const t=document.createElement("a");t.href=e,t.target="_blank",setTimeout((function(){ae(t)}))}else navigator.msSaveOrOpenBlob(function(e,t){return void 0===t?t={autoBom:!1}:"object"!=typeof t&&(t={autoBom:!t}),t.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob([String.fromCharCode(65279),e],{type:e.type}):e}(e,i),t)}:function(e,t,i,r){if((r=r||open("","_blank"))&&(r.document.title=r.document.body.innerText="downloading..."),"string"==typeof e)return se(e,t,i);const n="application/octet-stream"===e.type,s=/constructor/i.test(ne.HTMLElement)||ne.safari,o=/CriOS\/[\d]+/.test(navigator.userAgent);if((o||n&&s||he)&&"undefined"!=typeof FileReader){const t=new FileReader;t.onloadend=function(){let e=t.result;e=o?e:e.replace(/^data:[^;]*;/,"data:attachment/file;"),r?r.location.href=e:location=e,r=null},t.readAsDataURL(e)}else{const t=ne.URL||ne.webkitURL,i=t.createObjectURL(e);r?r.location=i:location.href=i,r=null,setTimeout((function(){t.revokeObjectURL(i)}),4e4)}};class de extends re{constructor(e){super(),this.player=e;const t=document.createElement("canvas");t.style.position="absolute",t.style.top=0,t.style.left=0,this.$videoElement=t,e.$container.appendChild(this.$videoElement),this.context2D=null,this.contextGl=null,this.contextGlRender=null,this.contextGlDestroy=null,this.bitmaprenderer=null,this.renderType=null,this.videoInfo={width:"",height:"",encType:""},this._initCanvasRender(),this.player.debug.log("CanvasVideo","init")}destroy(){super.destroy(),this.contextGl&&(this.contextGl=null),this.context2D&&(this.context2D=null),this.contextGlRender&&(this.contextGlDestroy&&this.contextGlDestroy(),this.contextGlDestroy=null,this.contextGlRender=null),this.bitmaprenderer&&(this.bitmaprenderer=null),this.renderType=null,this.player.debug.log("CanvasVideoLoader","destroy")}_initContextGl(){this.contextGl=function(e){let t=null;const i=["webgl","experimental-webgl","moz-webgl","webkit-3d"];let r=0;for(;!t&&r<i.length;){const n=i[r];try{const i={preserveDrawingBuffer:!0};t=e.getContext(n,i)}catch(e){t=null}t&&"function"==typeof t.getParameter||(t=null),++r}return t}(this.$videoElement);const e=((e,t)=>{var i=["attribute vec4 vertexPos;","attribute vec4 texturePos;","varying vec2 textureCoord;","void main()","{","gl_Position = vertexPos;","textureCoord = texturePos.xy;","}"].join("\n"),r=["precision highp float;","varying highp vec2 textureCoord;","uniform sampler2D ySampler;","uniform sampler2D uSampler;","uniform sampler2D vSampler;","const mat4 YUV2RGB = mat4","(","1.1643828125, 0, 1.59602734375, -.87078515625,","1.1643828125, -.39176171875, -.81296875, .52959375,","1.1643828125, 2.017234375, 0, -1.081390625,","0, 0, 0, 1",");","void main(void) {","highp float y = texture2D(ySampler, textureCoord).r;","highp float u = texture2D(uSampler, textureCoord).r;","highp float v = texture2D(vSampler, textureCoord).r;","gl_FragColor = vec4(y, u, v, 1) * YUV2RGB;","}"].join("\n");t&&e.pixelStorei(e.UNPACK_ALIGNMENT,1);var n=e.createShader(e.VERTEX_SHADER);e.shaderSource(n,i),e.compileShader(n),e.getShaderParameter(n,e.COMPILE_STATUS);var s=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(s,r),e.compileShader(s),e.getShaderParameter(s,e.COMPILE_STATUS);var o=e.createProgram();e.attachShader(o,n),e.attachShader(o,s),e.linkProgram(o),e.getProgramParameter(o,e.LINK_STATUS),e.useProgram(o);var a=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,a),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,1,-1,1,1,-1,-1,-1]),e.STATIC_DRAW);var h=e.getAttribLocation(o,"vertexPos");e.enableVertexAttribArray(h),e.vertexAttribPointer(h,2,e.FLOAT,!1,0,0);var l=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,l),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,0,0,0,1,1,0,1]),e.STATIC_DRAW);var d=e.getAttribLocation(o,"texturePos");function u(t,i){var r=e.createTexture();return e.bindTexture(e.TEXTURE_2D,r),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.bindTexture(e.TEXTURE_2D,null),e.uniform1i(e.getUniformLocation(o,t),i),r}e.enableVertexAttribArray(d),e.vertexAttribPointer(d,2,e.FLOAT,!1,0,0);var A=u("ySampler",0),c=u("uSampler",1),p=u("vSampler",2);return{render:function(t,i,r,n,s){e.viewport(0,0,t,i),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,A),e.texImage2D(e.TEXTURE_2D,0,e.LUMINANCE,t,i,0,e.LUMINANCE,e.UNSIGNED_BYTE,r),e.activeTexture(e.TEXTURE1),e.bindTexture(e.TEXTURE_2D,c),e.texImage2D(e.TEXTURE_2D,0,e.LUMINANCE,t/2,i/2,0,e.LUMINANCE,e.UNSIGNED_BYTE,n),e.activeTexture(e.TEXTURE2),e.bindTexture(e.TEXTURE_2D,p),e.texImage2D(e.TEXTURE_2D,0,e.LUMINANCE,t/2,i/2,0,e.LUMINANCE,e.UNSIGNED_BYTE,s),e.drawArrays(e.TRIANGLE_STRIP,0,4)},destroy:function(){try{e.deleteProgram(o),e.deleteBuffer(a),e.deleteBuffer(l),e.deleteTexture(A),e.deleteTexture(c),e.deleteTexture(p)}catch(e){}}}})(this.contextGl,this.player._opt.openWebglAlignment);this.contextGlRender=e.render,this.contextGlDestroy=e.destroy}_initContext2D(){this.context2D=this.$videoElement.getContext("2d")}_initCanvasRender(){this.player._opt.useWCS&&!this._supportOffscreen()?(this.renderType=M,this._initContext2D()):this._supportOffscreen()?(this.renderType=F,this._bindOffscreen()):(this.renderType=P,this._initContextGl())}_supportOffscreen(){return"function"==typeof this.$videoElement.transferControlToOffscreen&&this.player._opt.useOffscreen}_bindOffscreen(){this.bitmaprenderer=this.$videoElement.getContext("bitmaprenderer")}initCanvasViewSize(){this.$videoElement.width=this.videoInfo.width,this.$videoElement.height=this.videoInfo.height,this.resize()}render(e){switch(this.player.videoTimestamp=e.ts,this.renderType){case F:this.bitmaprenderer.transferFromImageBitmap(e.buffer);break;case P:this.contextGlRender(this.$videoElement.width,this.$videoElement.height,e.output[0],e.output[1],e.output[2]);break;case M:this.context2D.drawImage(e.videoFrame,0,0,this.$videoElement.width,this.$videoElement.height),(t=e.videoFrame).close?t.close():t.destroy&&t.destroy()}var t}screenshot(e,t,i,r){e=e||q(),r=r||O.download;const n={png:"image/png",jpeg:"image/jpeg",webp:"image/webp"};let s=.92;!n[t]&&O[t]&&(r=t,t="png",i=void 0),"string"==typeof i&&(r=i,i=void 0),void 0!==i&&(s=Number(i));const o=this.$videoElement.toDataURL(n[t]||n.png,s);if(r===O.base64)return o;{const t=H(o);if(r===O.blob)return t;r===O.download&&le(t,e)}}clearView(){switch(this.renderType){case F:(function(e,t){const i=document.createElement("canvas");return i.width=e,i.height=t,window.createImageBitmap(i,0,0,e,t)})(this.$videoElement.width,this.$videoElement.height).then((e=>{this.bitmaprenderer.transferFromImageBitmap(e)}));break;case P:this.contextGl.clear(this.contextGl.COLOR_BUFFER_BIT);break;case M:this.context2D.clearRect(0,0,this.$videoElement.width,this.$videoElement.height)}}resize(){this.player.debug.log("canvasVideo","resize");const e=this.player._opt,t=this.player.width,i=this.player.height;let r=this.$videoElement.width,n=this.$videoElement.height;const s=e.rotate,o=(t-r)/2,a=(i-n)/2;270!==s&&90!==s||(r=this.$videoElement.height,n=this.$videoElement.width);const h=t/r,l=i/n;let d=h>l?l:h;e.scaleMode!==x.auto&&h!==l&&(d=h+","+l),e.scaleMode===x.fullAuto&&(d=h>l?h:l);let u="scale("+d+")";s&&(u+=" rotate("+s+"deg)"),this.$videoElement.style.transform=u,this.$videoElement.style.left=o+"px",this.$videoElement.style.top=a+"px"}}class ue extends ie{constructor(e){super(),this.bufferList=[],this.player=e,this.scriptNode=null,this.hasInitScriptNode=!1,this.audioContextChannel=null,this.audioContext=new(window.AudioContext||window.webkitAudioContext),this.gainNode=this.audioContext.createGain();const t=this.audioContext.createBufferSource();t.buffer=this.audioContext.createBuffer(1,1,22050),t.connect(this.audioContext.destination),t.noteOn?t.noteOn(0):t.start(0),this.audioBufferSourceNode=t,this.mediaStreamAudioDestinationNode=this.audioContext.createMediaStreamDestination(),this.audioEnabled(!0),this.gainNode.gain.value=0,this.playing=!1,this.audioSyncVideoOption={diff:null},this.audioInfo={encType:"",channels:"",sampleRate:""},this.init=!1,this.hasAudio=!1,this.on(w.videoSyncAudio,(e=>{this.audioSyncVideoOption=e})),this.player.debug.log("AudioContext","init")}resetInit(){this.init=!1,this.audioInfo={encType:"",channels:"",sampleRate:""}}destroy(){this.closeAudio(),this.resetInit(),this.audioContext.close(),this.audioContext=null,this.gainNode=null,this.hasAudio=!1,this.playing=!1,this.scriptNode&&(this.scriptNode.onaudioprocess=z,this.scriptNode=null),this.audioBufferSourceNode=null,this.mediaStreamAudioDestinationNode=null,this.hasInitScriptNode=!1,this.audioSyncVideoOption={diff:null},this.off(),this.player.debug.log("AudioContext","destroy")}updateAudioInfo(e){e.encTypeCode&&(this.audioInfo.encType=B[e.encTypeCode]),e.channels&&(this.audioInfo.channels=e.channels),e.sampleRate&&(this.audioInfo.sampleRate=e.sampleRate),this.audioInfo.sampleRate&&this.audioInfo.channels&&this.audioInfo.encType&&!this.init&&(this.player.emit(w.audioInfo,this.audioInfo),this.init=!0)}get isPlaying(){return this.playing}get isMute(){return 0===this.gainNode.gain.value}get volume(){return this.gainNode.gain.value}get bufferSize(){return this.bufferList.length}initScriptNode(){if(this.playing=!0,this.hasInitScriptNode)return;const e=this.audioInfo.channels,t=this.audioContext.createScriptProcessor(1024,0,e);t.onaudioprocess=t=>{const i=t.outputBuffer;if(this.bufferList.length&&this.playing){if(!this.player._opt.useWCS&&!this.player._opt.useMSE&&this.player._opt.wasmDecodeAudioSyncVideo){if(this.audioSyncVideoOption.diff>U)return void this.player.debug.warn("AudioContext",`audioSyncVideoOption more than diff :${this.audioSyncVideoOption.diff}, waiting`);if(this.audioSyncVideoOption.diff<-1e3){this.player.debug.warn("AudioContext",`audioSyncVideoOption less than diff :${this.audioSyncVideoOption.diff}, dropping`);let e=this.bufferList.shift();for(;e.ts-this.player.videoTimestamp<-1e3&&this.bufferList.length>0;)e=this.bufferList.shift();if(0===this.bufferList.length)return}}if(0===this.bufferList.length)return;const t=this.bufferList.shift();t&&t.ts&&(this.player.audioTimestamp=t.ts);for(let r=0;r<e;r++){const e=t.buffer[r],n=i.getChannelData(r);for(let t=0;t<1024;t++)n[t]=e[t]||0}}},t.connect(this.gainNode),this.scriptNode=t,this.gainNode.connect(this.audioContext.destination),this.gainNode.connect(this.mediaStreamAudioDestinationNode),this.hasInitScriptNode=!0}mute(e){e?(this.isMute||this.player.emit(w.mute,e),this.setVolume(0),this.clear()):(this.isMute&&this.player.emit(w.mute,e),this.setVolume(.5))}setVolume(e){e=parseFloat(e).toFixed(2),isNaN(e)||(this.audioEnabled(!0),e=function(e,t,i){return Math.max(Math.min(e,Math.max(t,i)),Math.min(t,i))}(e,0,1),this.gainNode.gain.value=e,this.gainNode.gain.setValueAtTime(e,this.audioContext.currentTime),this.player.emit(w.volumechange,this.player.volume))}closeAudio(){this.hasInitScriptNode&&(this.scriptNode&&this.scriptNode.disconnect(this.gainNode),this.gainNode&&this.gainNode.disconnect(this.audioContext.destination),this.gainNode&&this.gainNode.disconnect(this.mediaStreamAudioDestinationNode)),this.clear()}audioEnabled(e){e?"suspended"===this.audioContext.state&&this.audioContext.resume():"running"===this.audioContext.state&&this.audioContext.suspend()}isStateRunning(){return"running"===this.audioContext.state}isStateSuspended(){return"suspended"===this.audioContext.state}clear(){this.bufferList=[]}play(e,t){this.isMute||(this.hasAudio=!0,this.bufferList.push({buffer:e,ts:t}),this.bufferList.length>20&&(this.player.debug.warn("AudioContext",`bufferList is large: ${this.bufferList.length}`),this.bufferList.length>50&&this.bufferList.shift()))}pause(){this.audioSyncVideoOption={diff:null},this.playing=!1,this.clear()}resume(){this.playing=!0}}class Ae{constructor(e){return new(Ae.getLoaderFactory())(e)}static getLoaderFactory(){return ue}}class ce extends ie{constructor(e){super(),this.player=e,this.playing=!1,this.abortController=new AbortController,this.streamRate=Y((t=>{e.emit(w.kBps,(t/1024).toFixed(2))})),e.debug.log("FetchStream","init")}destroy(){this.abort(),this.off(),this.streamRate=null,this.player.debug.log("FetchStream","destroy")}fetchStream(e,t={}){const{demux:i}=this.player;this.player._times.streamStart=q();const r=Object.assign({signal:this.abortController.signal},{headers:t.headers||{}});fetch(e,r).then((e=>{const t=e.body.getReader();this.emit(w.streamSuccess);const r=()=>{t.read().then((({done:e,value:t})=>{e?i.close():(this.streamRate&&this.streamRate(t.byteLength),i.dispatch(t),r())})).catch((e=>{i.close();const t=e.toString();-1===t.indexOf(N)&&-1===t.indexOf(V)&&e.name!==G&&(this.abort(),this.emit(R.fetchError,e),this.player.emit(w.error,R.fetchError))}))};r()})).catch((e=>{"AbortError"!==e.name&&(i.close(),this.abort(),this.emit(R.fetchError,e),this.player.emit(w.error,R.fetchError))}))}abort(){this.abortController&&(this.abortController.abort(),this.abortController=null)}}class pe extends ie{constructor(e){super(),this.player=e,this.socket=null,this.socketStatus=C,this.wsUrl=null,this.streamRate=Y((t=>{e.emit(w.kBps,(t/1024).toFixed(2))})),e.debug.log("WebsocketLoader","init")}destroy(){this.socket&&(this.socket.close(1e3,"Client disconnecting"),this.socket=null),this.socketStatus=C,this.streamRate=null,this.wsUrl=null,this.off(),this.player.debug.log("websocketLoader","destroy")}_createWebSocket(){const e=this.player,{debug:t,events:{proxy:i},demux:r}=e;this.socket=new WebSocket(this.wsUrl),this.socket.binaryType="arraybuffer",i(this.socket,"open",(()=>{this.emit(w.streamSuccess),t.log("websocketLoader","socket open"),this.socketStatus=k})),i(this.socket,"message",(e=>{this.streamRate&&this.streamRate(e.data.byteLength),this._handleMessage(e.data)})),i(this.socket,"close",(()=>{t.log("websocketLoader","socket close"),this.emit(w.streamEnd),this.socketStatus=I})),i(this.socket,"error",(e=>{t.log("websocketLoader","socket error"),this.emit(R.websocketError,e),this.player.emit(w.error,R.websocketError),this.socketStatus=L,r.close(),t.log("websocketLoader","socket error:",e)}))}_handleMessage(e){const{demux:t}=this.player;t?t.dispatch(e):this.player.debug.warn("websocketLoader","websocket handle message demux is null")}fetchStream(e,t){this.player._times.streamStart=q(),this.wsUrl=e,this._createWebSocket()}}class fe{constructor(e){return new(fe.getLoaderFactory(e._opt.protocol))(e)}static getLoaderFactory(e){return e===i?ce:e===t?pe:void 0}}class me{constructor(e){this.player=e,this.decoderWorker=new Worker(e._opt.decoder),this._initDecoderWorker(),e.debug.log("decoderWorker","init")}destroy(){this.decoderWorker.postMessage({cmd:b}),this.decoderWorker.terminate(),this.decoderWorker=null,this.player.debug.log("decoderWorker","destroy")}_initDecoderWorker(){const{debug:e,events:{proxy:t}}=this.player;this.decoderWorker.onmessage=t=>{const i=t.data;switch(i.cmd){case o:e.log("decoderWorker","onmessage:",o),this.player.loaded||this.player.emit(w.load),this.player.emit(w.decoderWorkerInit),this._initWork();break;case A:e.log("decoderWorker","onmessage:",A,i.code),this.player._times.decodeStart||(this.player._times.decodeStart=q()),this.player.video.updateVideoInfo({encTypeCode:i.code});break;case u:e.log("decoderWorker","onmessage:",u,i.code),this.player.audio&&this.player.audio.updateAudioInfo({encTypeCode:i.code});break;case a:if(e.log("decoderWorker","onmessage:",a,`width:${i.w},height:${i.h}`),this.player.video.updateVideoInfo({width:i.w,height:i.h}),!this.player._opt.openWebglAlignment&&i.w/2%4!=0)return void this.player.emit(R.webglAlignmentError);this.player.video.initCanvasViewSize();break;case d:e.log("decoderWorker","onmessage:",d,`channels:${i.channels},sampleRate:${i.sampleRate}`),this.player.audio&&(this.player.audio.updateAudioInfo(i),this.player.audio.initScriptNode(i));break;case h:this.player.handleRender(),this.player.video.render(i),this.player.emit(w.timeUpdate,i.ts),this.player.updateStats({fps:!0,ts:i.ts,buf:i.delay}),this.player._times.videoStart||(this.player._times.videoStart=q(),this.player.handlePlayToRenderTimes());break;case l:this.player.playing&&this.player.audio&&this.player.audio.play(i.buffer,i.ts);break;case c:i.message&&-1!==i.message.indexOf(p)&&this.player.emitError(R.wasmDecodeError);break;default:this.player[i.cmd]&&this.player[i.cmd](i)}}}_initWork(){const e={debug:this.player._opt.debug,useOffscreen:this.player._opt.useOffscreen,useWCS:this.player._opt.useWCS,videoBuffer:this.player._opt.videoBuffer,videoBufferDelay:this.player._opt.videoBufferDelay,openWebglAlignment:this.player._opt.openWebglAlignment};this.decoderWorker.postMessage({cmd:y,opt:JSON.stringify(e),sampleRate:this.player.audio&&this.player.audio.audioContext.sampleRate||0})}decodeVideo(e,t,i){const r={type:m,ts:Math.max(t,0),isIFrame:i};this.decoderWorker.postMessage({cmd:v,buffer:e,options:r},[e.buffer])}decodeAudio(e,t){this.player._opt.useWCS||this.player._opt.useMSE?this._decodeAudioNoDelay(e,t):this._decodeAudio(e,t)}_decodeAudio(e,t){const i={type:f,ts:Math.max(t,0)};this.decoderWorker.postMessage({cmd:v,buffer:e,options:i},[e.buffer])}_decodeAudioNoDelay(e,t){this.decoderWorker.postMessage({cmd:E,buffer:e,ts:Math.max(t,0)},[e.buffer])}updateWorkConfig(e){this.decoderWorker.postMessage({cmd:S,key:e.key,value:e.value})}}class _e extends ie{constructor(e){super(),this.player=e,this.stopId=null,this.firstTimestamp=null,this.startTimestamp=null,this.delay=-1,this.bufferList=[],this.dropping=!1,this.initInterval()}destroy(){this.stopId&&(clearInterval(this.stopId),this.stopId=null),this.firstTimestamp=null,this.startTimestamp=null,this.delay=-1,this.bufferList=[],this.dropping=!1,this.off(),this.player.debug.log("CommonDemux","destroy")}getDelay(e){if(!e)return-1;if(this.firstTimestamp){if(e){const t=Date.now()-this.startTimestamp,i=e-this.firstTimestamp;this.delay=t>=i?t-i:i-t}}else this.firstTimestamp=e,this.startTimestamp=Date.now(),this.delay=-1;return this.delay}resetDelay(){this.firstTimestamp=null,this.startTimestamp=null,this.delay=-1,this.dropping=!1}initInterval(){this.player.debug.log("common dumex","init Interval");const e=()=>{let e;const t=this.player._opt.videoBuffer,i=this.player._opt.videoBufferDelay;if(this.bufferList.length)if(this.dropping){for(e=this.bufferList.shift(),e.type===f&&0===e.payload[1]&&this._doDecoderDecode(e);!e.isIFrame&&this.bufferList.length;)e=this.bufferList.shift(),e.type===f&&0===e.payload[1]&&this._doDecoderDecode(e);e.isIFrame&&this.getDelay(e.ts)<=Math.min(t,200)&&(this.dropping=!1,this._doDecoderDecode(e))}else e=this.bufferList[0],-1===this.getDelay(e.ts)?(this.bufferList.shift(),this._doDecoderDecode(e)):this.delay>t+i?(this.resetDelay(),this.dropping=!0):(e=this.bufferList[0],this.getDelay(e.ts)>t&&(this.bufferList.shift(),this._doDecoderDecode(e)))};e(),this.stopId=setInterval(e,10)}_doDecode(e,t,i,r,n){const s=this.player,o={ts:i,cts:n,type:t,isIFrame:!1};s._opt.useWCS&&!s._opt.useOffscreen?(t===m&&(o.isIFrame=r),this.pushBuffer(e,o)):t===m?s.decoderWorker&&s.decoderWorker.decodeVideo(e,i,r):t===f&&s._opt.hasAudio&&s.decoderWorker&&s.decoderWorker.decodeAudio(e,i)}_doDecoderDecode(e){const t=this.player;e.type===f?t._opt.hasAudio&&t.decoderWorker&&t.decoderWorker.decodeAudio(e.payload,e.ts):e.type}pushBuffer(e,t){t.type===f?this.bufferList.push({ts:t.ts,payload:e,type:f}):t.type===m&&this.bufferList.push({ts:t.ts,cts:t.cts,payload:e,type:m,isIFrame:t.isIFrame})}close(){}}class ge extends _e{constructor(e){super(e),this.input=this._inputFlv(),this.flvDemux=this.dispatchFlvData(this.input),e.debug.log("FlvDemux","init")}destroy(){super.destroy(),this.input=null,this.flvDemux=null,this.player.debug.log("FlvDemux","destroy")}dispatch(e){this.flvDemux(e)}*_inputFlv(){yield 9;const e=new ArrayBuffer(4),t=new Uint8Array(e),i=new Uint32Array(e),r=this.player;for(;;){t[3]=0;const e=yield 15,n=e[4];t[0]=e[7],t[1]=e[6],t[2]=e[5];const s=i[0];t[0]=e[10],t[1]=e[9],t[2]=e[8];let o=i[0];16777215===o&&(t[3]=e[11],o=i[0]);const a=yield s;switch(n){case _:r._opt.hasAudio&&(r.updateStats({abps:a.byteLength}),a.byteLength>0&&this._doDecode(a,f,o));break;case g:if(r._times.demuxStart||(r._times.demuxStart=q()),r._opt.hasVideo){r.updateStats({vbps:a.byteLength});const e=a[0]>>4==1;if(a.byteLength>0){i[0]=a[4],i[1]=a[3],i[2]=a[2],i[3]=0;const t=i[0];this._doDecode(a,m,o,e,t)}}}}}dispatchFlvData(e){let t=e.next(),i=null;return r=>{let n=new Uint8Array(r);if(i){const e=new Uint8Array(i.length+n.length);e.set(i),e.set(n,i.length),n=e,i=null}for(;n.length>=t.value;){const i=n.slice(t.value);t=e.next(n.slice(0,t.value)),n=i}n.length>0&&(i=n)}}close(){this.input&&this.input.return(null)}}class ye extends _e{constructor(e){super(e),e.debug.log("M7sDemux","init")}destroy(){super.destroy(),this.player.debug.log("M7sDemux","destroy"),this.player=null}dispatch(e){const t=this.player,i=new DataView(e),r=i.getUint8(0),n=i.getUint32(1,!1);switch(r){case f:if(t._opt.hasAudio){const i=new Uint8Array(e,5);t.updateStats({abps:i.byteLength}),i.byteLength>0&&this._doDecode(i,r,n)}break;case m:if(t._opt.hasVideo)if(t._times.demuxStart||(t._times.demuxStart=q()),i.byteLength>5){const s=new Uint8Array(e,5),o=i.getUint8(5)>>4==1;t.updateStats({vbps:s.byteLength}),s.byteLength>0&&this._doDecode(s,r,n,o)}else this.player.debug.warn("M7sDemux","dispatch","dv byteLength is",i.byteLength)}}}class ve{constructor(e){return new(ve.getLoaderFactory(e._opt.demuxType))(e)}static getLoaderFactory(e){return e===n?ye:e===r?ge:void 0}}const Ee=()=>"undefined"!=typeof navigator&&parseFloat((""+(/CPU.*OS ([0-9_]{3,4})[0-9_]{0,1}|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent)||[0,""])[1]).replace("undefined","3_2").replace("_",".").replace("_",""))<10&&!window.MSStream,be=()=>"wakeLock"in navigator;class Se{constructor(e){if(this.player=e,this.enabled=!1,be()){this._wakeLock=null;const e=()=>{null!==this._wakeLock&&"visible"===document.visibilityState&&this.enable()};document.addEventListener("visibilitychange",e),document.addEventListener("fullscreenchange",e)}else Ee()?this.noSleepTimer=null:(this.noSleepVideo=document.createElement("video"),this.noSleepVideo.setAttribute("title","No Sleep"),this.noSleepVideo.setAttribute("playsinline",""),this._addSourceToVideo(this.noSleepVideo,"webm","data:video/webm;base64,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"),this._addSourceToVideo(this.noSleepVideo,"mp4","data:video/mp4;base64,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"),this.noSleepVideo.addEventListener("loadedmetadata",(()=>{this.noSleepVideo.duration<=1?this.noSleepVideo.setAttribute("loop",""):this.noSleepVideo.addEventListener("timeupdate",(()=>{this.noSleepVideo.currentTime>.5&&(this.noSleepVideo.currentTime=Math.random())}))})))}_addSourceToVideo(e,t,i){const r=document.createElement("source");r.src=i,r.type=`video/${t}`,e.appendChild(r)}get isEnabled(){return this.enabled}enable(){const e=this.player.debug;if(be())return navigator.wakeLock.request("screen").then((t=>{this._wakeLock=t,this.enabled=!0,e.log("wakeLock","Wake Lock active."),this._wakeLock.addEventListener("release",(()=>{e.log("wakeLock","Wake Lock released.")}))})).catch((t=>{throw this.enabled=!1,e.error("wakeLock",`${t.name}, ${t.message}`),t}));if(Ee())return this.disable(),this.noSleepTimer=window.setInterval((()=>{document.hidden||(window.location.href=window.location.href.split("#")[0],window.setTimeout(window.stop,0))}),15e3),this.enabled=!0,Promise.resolve();return this.noSleepVideo.play().then((e=>(this.enabled=!0,e))).catch((e=>{throw this.enabled=!1,e}))}disable(){const e=this.player.debug;be()?(this._wakeLock&&this._wakeLock.release(),this._wakeLock=null):Ee()?this.noSleepTimer&&(e.warn("wakeLock","NoSleep now disabled for older iOS devices."),window.clearInterval(this.noSleepTimer),this.noSleepTimer=null):this.noSleepVideo.pause(),this.enabled=!1}}class we{constructor(e){this.log=(t,...i)=>{e._opt.debug&&console.log(`[${t}]`,...i)},this.warn=(t,...i)=>{e._opt.debug&&console.warn(`[${t}]`,...i)},this.error=(e,...t)=>{console.error(`[${e}]`,...t)}}}class Te{constructor(e){this.destroys=[],this.proxy=this.proxy.bind(this),this.master=e}proxy(e,t,i,r={}){if(!e)return;if(Array.isArray(t))return t.map((t=>this.proxy(e,t,i,r)));e.addEventListener(t,i,r);const n=()=>e.removeEventListener(t,i,r);return this.destroys.push(n),n}destroy(){this.master.debug&&this.master.debug.log("Events","destroy"),this.destroys.forEach((e=>e()))}}class Re{constructor(e){this.player=e,((e,t)=>{const{events:{proxy:i}}=e,r=document.createElement("object");r.setAttribute("aria-hidden","true"),r.setAttribute("tabindex",-1),r.type="text/html",r.data="about:blank",$(r,{display:"block",position:"absolute",top:"0",left:"0",height:"100%",width:"100%",overflow:"hidden",pointerEvents:"none",zIndex:"-1"});let n=e.width,s=e.height;i(r,"load",(()=>{i(r.contentDocument.defaultView,"resize",(()=>{e.width===n&&e.height===s||(n=e.width,s=e.height,e.emit(w.resize),a())}))})),e.$container.appendChild(r),e.on(w.destroy,(()=>{e.$container.removeChild(r)}));const o=i=>{const r=!0===(n=i)||!1===n?i:e.fullscreen;var n;$(t.$fullscreenExit,"display",r?"flex":"none"),$(t.$fullscreen,"display",r?"none":"flex")},a=()=>{Z()&&t.$controls&&e._opt.useWebFullScreen&&setTimeout((()=>{if(e.fullscreen){const i=e.height/2-e.width+19,r=e.height/2-19;t.$controls.style.transform=`translateX(${-i}px) translateY(-${r}px) rotate(-90deg)`}else t.$controls.style.transform="translateX(0) translateY(0) rotate(0)"}),10)};try{Q.on("change",o),e.events.destroys.push((()=>{Q.off("change",o)}))}catch(e){}e.on(w.webFullscreen,(e=>{o(e),a()}))})(e,this)}}class Ce extends ie{constructor(e,t,i){var r;super(),this.$container=e,this._opt=t,this.debug=new we(this),this._loading=!1,this._playing=!1,this._hasLoaded=!1,this._checkHeartTimeout=null,this._checkLoadingTimeout=null,this._checkStatsInterval=null,this._startBpsTime=null,this._isPlayingBeforePageHidden=!1,this._stats={buf:0,fps:0,abps:0,vbps:0,ts:0},this._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},this._videoTimestamp=0,this._audioTimestamp=0,r=this,Object.defineProperty(r,"rect",{get:()=>{const e=r.$container.getBoundingClientRect();return e.width=Math.max(e.width,r.$container.clientWidth),e.height=Math.max(e.height,r.$container.clientHeight),e}}),["bottom","height","left","right","top","width"].forEach((e=>{Object.defineProperty(r,e,{get:()=>r.rect[e]})})),this.events=new Te(this),this.video=new i(this),(e=>{try{const t=t=>{te(t)===e.$container&&(e.emit(T.fullscreen,e.fullscreen),e.fullscreen?e._opt.useMSE&&e.resize():e.resize())};Q.on("change",t),e.events.destroys.push((()=>{Q.off("change",t)}))}catch(e){}if(e.on(w.decoderWorkerInit,(()=>{e.debug.log("player","has loaded"),e.loaded=!0})),e.on(w.play,(()=>{e.loading=!1})),e.on(w.fullscreen,(t=>{if(t)try{Q.request(e.$container).then((()=>{})).catch((t=>{Z()&&e._opt.useWebFullScreen&&(e.webFullscreen=!0)}))}catch(t){Z()&&e._opt.useWebFullScreen&&(e.webFullscreen=!0)}else try{Q.exit().then((()=>{e.webFullscreen&&(e.webFullscreen=!1)})).catch((()=>{e.webFullscreen=!1}))}catch(t){e.webFullscreen=!1}})),Z()&&e.on(w.webFullscreen,(t=>{t?e.$container.classList.add("flv-fullscreen-web"):e.$container.classList.remove("flv-fullscreen-web"),e.emit(T.fullscreen,e.fullscreen)})),e.on(w.resize,(()=>{e.video&&e.video.resize()})),e._opt.debug){const t=[w.timeUpdate];Object.keys(w).forEach((i=>{e.on(w[i],(r=>{t.includes(i)||e.debug.log("player events",w[i],r)}))})),Object.keys(R).forEach((t=>{e.on(R[t],(i=>{e.debug.log("player event error",R[t],i)}))}))}})(this),(e=>{const{_opt:t,debug:i,events:{proxy:r}}=e;t.supportDblclickFullscreen&&r(e.$container,"dblclick",(t=>{const i=te(t).nodeName.toLowerCase();"canvas"!==i&&"video"!==i||(e.fullscreen=!e.fullscreen)})),r(document,"visibilitychange",(()=>{t.hiddenAutoPause&&(i.log("visibilitychange",document.visibilityState,e._isPlayingBeforePageHidden),"visible"===document.visibilityState?e._isPlayingBeforePageHidden&&e.play():(e._isPlayingBeforePageHidden=e.playing,e.playing&&e.pause()))})),r(window,"fullscreenchange",(()=>{null!==e.keepScreenOn&&"visible"===document.visibilityState&&e.enableWakeLock&&e.enableWakeLock()}))})(this),this.control=new Re(this)}}class ke{static get JS_ERROR(){return"js_error"}static get RESOURCE_ERROR(){return"resource_error"}static get VUE_ERROR(){return"vue_error"}static get PROMISE_ERROR(){return"promise_error"}static get AJAX_ERROR(){return"ajax_error"}static get CONSOLE_INFO(){return"console_info"}static get CONSOLE_WARN(){return"console_warn"}static get CONSOLE_ERROR(){return"console_error"}static get CROSS_SCRIPT_ERROR(){return"cross_srcipt_error"}static get UNKNOW_ERROR(){return"unknow_error"}static get PERFORMANCE(){return"performance"}static get BUSINESS(){return"business"}}class Ie{static get ERROR(){return"Error"}static get WARN(){return"Warning"}static get INFO(){return"Info"}}class Le{static get FETCH(){return"fetch"}static get DEFAULT(){return"default"}}var Oe=function(){var e="undefined"!=typeof self?self:this,t=e||{},i={navigator:void 0!==e.navigator?e.navigator:{},infoMap:{engine:["WebKit","Trident","Gecko","Presto"],browser:["Safari","Chrome","Edge","IE","Firefox","Firefox Focus","Chromium","Opera","Vivaldi","Yandex","Arora","Lunascape","QupZilla","Coc Coc","Kindle","Iceweasel","Konqueror","Iceape","SeaMonkey","Epiphany","360","360SE","360EE","UC","QQBrowser","QQ","Baidu","Maxthon","Sogou","LBBROWSER","2345Explorer","TheWorld","XiaoMi","Quark","Qiyu","Wechat","Taobao","Alipay","Weibo","Douban","Suning","iQiYi"],os:["Windows","Linux","Mac OS","Android","Ubuntu","FreeBSD","Debian","iOS","Windows Phone","BlackBerry","MeeGo","Symbian","Chrome OS","WebOS"],device:["Mobile","Tablet","iPad"]}},r={getMatchMap:function(e){return{Trident:e.indexOf("Trident")>-1||e.indexOf("NET CLR")>-1,Presto:e.indexOf("Presto")>-1,WebKit:e.indexOf("AppleWebKit")>-1,Gecko:e.indexOf("Gecko/")>-1,Safari:e.indexOf("Safari")>-1,Chrome:e.indexOf("Chrome")>-1||e.indexOf("CriOS")>-1,IE:e.indexOf("MSIE")>-1||e.indexOf("Trident")>-1,Edge:e.indexOf("Edge")>-1,Firefox:e.indexOf("Firefox")>-1||e.indexOf("FxiOS")>-1,"Firefox Focus":e.indexOf("Focus")>-1,Chromium:e.indexOf("Chromium")>-1,Opera:e.indexOf("Opera")>-1||e.indexOf("OPR")>-1,Vivaldi:e.indexOf("Vivaldi")>-1,Yandex:e.indexOf("YaBrowser")>-1,Arora:e.indexOf("Arora")>-1,Lunascape:e.indexOf("Lunascape")>-1,QupZilla:e.indexOf("QupZilla")>-1,"Coc Coc":e.indexOf("coc_coc_browser")>-1,Kindle:e.indexOf("Kindle")>-1||e.indexOf("Silk/")>-1,Iceweasel:e.indexOf("Iceweasel")>-1,Konqueror:e.indexOf("Konqueror")>-1,Iceape:e.indexOf("Iceape")>-1,SeaMonkey:e.indexOf("SeaMonkey")>-1,Epiphany:e.indexOf("Epiphany")>-1,360:e.indexOf("QihooBrowser")>-1||e.indexOf("QHBrowser")>-1,"360EE":e.indexOf("360EE")>-1,"360SE":e.indexOf("360SE")>-1,UC:e.indexOf("UC")>-1||e.indexOf(" UBrowser")>-1,QQBrowser:e.indexOf("QQBrowser")>-1,QQ:e.indexOf("QQ/")>-1,Baidu:e.indexOf("Baidu")>-1||e.indexOf("BIDUBrowser")>-1,Maxthon:e.indexOf("Maxthon")>-1,Sogou:e.indexOf("MetaSr")>-1||e.indexOf("Sogou")>-1,LBBROWSER:e.indexOf("LBBROWSER")>-1,"2345Explorer":e.indexOf("2345Explorer")>-1,TheWorld:e.indexOf("TheWorld")>-1,XiaoMi:e.indexOf("MiuiBrowser")>-1,Quark:e.indexOf("Quark")>-1,Qiyu:e.indexOf("Qiyu")>-1,Wechat:e.indexOf("MicroMessenger")>-1,Taobao:e.indexOf("AliApp(TB")>-1,Alipay:e.indexOf("AliApp(AP")>-1,Weibo:e.indexOf("Weibo")>-1,Douban:e.indexOf("com.douban.frodo")>-1,Suning:e.indexOf("SNEBUY-APP")>-1,iQiYi:e.indexOf("IqiyiApp")>-1,Windows:e.indexOf("Windows")>-1,Linux:e.indexOf("Linux")>-1||e.indexOf("X11")>-1,"Mac OS":e.indexOf("Macintosh")>-1,Android:e.indexOf("Android")>-1||e.indexOf("Adr")>-1,Ubuntu:e.indexOf("Ubuntu")>-1,FreeBSD:e.indexOf("FreeBSD")>-1,Debian:e.indexOf("Debian")>-1,"Windows Phone":e.indexOf("IEMobile")>-1||e.indexOf("Windows Phone")>-1,BlackBerry:e.indexOf("BlackBerry")>-1||e.indexOf("RIM")>-1,MeeGo:e.indexOf("MeeGo")>-1,Symbian:e.indexOf("Symbian")>-1,iOS:e.indexOf("like Mac OS X")>-1,"Chrome OS":e.indexOf("CrOS")>-1,WebOS:e.indexOf("hpwOS")>-1,Mobile:e.indexOf("Mobi")>-1||e.indexOf("iPh")>-1||e.indexOf("480")>-1,Tablet:e.indexOf("Tablet")>-1||e.indexOf("Nexus 7")>-1,iPad:e.indexOf("iPad")>-1}},matchInfoMap:function(e){var t=i.navigator.userAgent||{},n=r.getMatchMap(t);for(var s in i.infoMap)for(var o=0;o<i.infoMap[s].length;o++){var a=i.infoMap[s][o];n[a]&&(e[s]=a)}},getOS:function(){return r.matchInfoMap(this),this.os},getOSVersion:function(){var e=this,t=i.navigator.userAgent||{};e.osVersion="";var r={Windows:function(){var e=t.replace(/^.*Windows NT ([\d.]+);.*$/,"$1");return{6.4:"10",6.3:"8.1",6.2:"8",6.1:"7","6.0":"Vista",5.2:"XP",5.1:"XP","5.0":"2000"}[e]||e},Android:function(){return t.replace(/^.*Android ([\d.]+);.*$/,"$1")},iOS:function(){return t.replace(/^.*OS ([\d_]+) like.*$/,"$1").replace(/_/g,".")},Debian:function(){return t.replace(/^.*Debian\/([\d.]+).*$/,"$1")},"Windows Phone":function(){return t.replace(/^.*Windows Phone( OS)? ([\d.]+);.*$/,"$2")},"Mac OS":function(){return t.replace(/^.*Mac OS X ([\d_]+).*$/,"$1").replace(/_/g,".")},WebOS:function(){return t.replace(/^.*hpwOS\/([\d.]+);.*$/,"$1")}};return r[e.os]&&(e.osVersion=r[e.os](),e.osVersion==t&&(e.osVersion="")),e.osVersion},getOrientationStatu:function(){return window.matchMedia("(orientation: portrait)").matches?"竖屏":"横屏"},getDeviceType:function(){var e=this;return e.device="PC",r.matchInfoMap(e),e.device},getNetwork:function(){return navigator&&navigator.connection&&navigator.connection.effectiveType},getLanguage:function(){var e;return this.language=((e=(i.navigator.browserLanguage||i.navigator.language).split("-"))[1]&&(e[1]=e[1].toUpperCase()),e.join("_")),this.language},createFingerprint:function(e){var t=document.createElement("canvas"),i=t.getContext("2d"),r=e||window.location.host;i.textBaseline="top",i.font="14px 'Arial'",i.textBaseline="tencent",i.fillStyle="#f60",i.fillRect(125,1,62,20),i.fillStyle="#069",i.fillText(r,2,15),i.fillStyle="rgba(102, 204, 0, 0.7)",i.fillText(r,4,17);var n=t.toDataURL().replace("data:image/png;base64,",""),s=function(e){var t,i,r,n="";for(t=0,i=(e+="").length;t<i;t++)n+=(r=e.charCodeAt(t).toString(16)).length<2?"0"+r:r;return n}(atob(n).slice(-16,-12));return s},getBrowserInfo:function(){var e=this;r.matchInfoMap(e);var n=i.navigator.userAgent||{},s=function(e,t){var r=i.navigator.mimeTypes;for(var n in r)if(r[n][e]==t)return!0;return!1},o=r.getMatchMap(n),a=!1;if(t.chrome){var h=n.replace(/^.*Chrome\/([\d]+).*$/,"$1");h>36&&t.showModalDialog?a=!0:h>45&&(a=s("type","application/vnd.chromium.remoting-viewer"))}if(o.Baidu&&o.Opera&&(o.Baidu=!1),o.Mobile&&(o.Mobile=!(n.indexOf("iPad")>-1)),a&&(s("type","application/gameplugin")||i.navigator&&void 0===i.navigator.connection.saveData?o["360SE"]=!0:o["360EE"]=!0),o.IE||o.Edge)switch(window.screenTop-window.screenY){case 71:case 74:case 99:case 75:case 74:case 105:break;case 102:o["360EE"]=!0;break;case 104:o["360SE"]=!0}var l={Safari:function(){return n.replace(/^.*Version\/([\d.]+).*$/,"$1")},Chrome:function(){return n.replace(/^.*Chrome\/([\d.]+).*$/,"$1").replace(/^.*CriOS\/([\d.]+).*$/,"$1")},IE:function(){return n.replace(/^.*MSIE ([\d.]+).*$/,"$1").replace(/^.*rv:([\d.]+).*$/,"$1")},Edge:function(){return n.replace(/^.*Edge\/([\d.]+).*$/,"$1")},Firefox:function(){return n.replace(/^.*Firefox\/([\d.]+).*$/,"$1").replace(/^.*FxiOS\/([\d.]+).*$/,"$1")},"Firefox Focus":function(){return n.replace(/^.*Focus\/([\d.]+).*$/,"$1")},Chromium:function(){return n.replace(/^.*Chromium\/([\d.]+).*$/,"$1")},Opera:function(){return n.replace(/^.*Opera\/([\d.]+).*$/,"$1").replace(/^.*OPR\/([\d.]+).*$/,"$1")},Vivaldi:function(){return n.replace(/^.*Vivaldi\/([\d.]+).*$/,"$1")},Yandex:function(){return n.replace(/^.*YaBrowser\/([\d.]+).*$/,"$1")},Arora:function(){return n.replace(/^.*Arora\/([\d.]+).*$/,"$1")},Lunascape:function(){return n.replace(/^.*Lunascape[\/\s]([\d.]+).*$/,"$1")},QupZilla:function(){return n.replace(/^.*QupZilla[\/\s]([\d.]+).*$/,"$1")},"Coc Coc":function(){return n.replace(/^.*coc_coc_browser\/([\d.]+).*$/,"$1")},Kindle:function(){return n.replace(/^.*Version\/([\d.]+).*$/,"$1")},Iceweasel:function(){return n.replace(/^.*Iceweasel\/([\d.]+).*$/,"$1")},Konqueror:function(){return n.replace(/^.*Konqueror\/([\d.]+).*$/,"$1")},Iceape:function(){return n.replace(/^.*Iceape\/([\d.]+).*$/,"$1")},SeaMonkey:function(){return n.replace(/^.*SeaMonkey\/([\d.]+).*$/,"$1")},Epiphany:function(){return n.replace(/^.*Epiphany\/([\d.]+).*$/,"$1")},360:function(){return n.replace(/^.*QihooBrowser\/([\d.]+).*$/,"$1")},"360SE":function(){return{63:"10.0",55:"9.1",45:"8.1",42:"8.0",31:"7.0",21:"6.3"}[n.replace(/^.*Chrome\/([\d]+).*$/,"$1")]||""},"360EE":function(){return{69:"11.0",63:"9.5",55:"9.0",50:"8.7",30:"7.5"}[n.replace(/^.*Chrome\/([\d]+).*$/,"$1")]||""},Maxthon:function(){return n.replace(/^.*Maxthon\/([\d.]+).*$/,"$1")},QQBrowser:function(){return n.replace(/^.*QQBrowser\/([\d.]+).*$/,"$1")},QQ:function(){return n.replace(/^.*QQ\/([\d.]+).*$/,"$1")},Baidu:function(){return n.replace(/^.*BIDUBrowser[\s\/]([\d.]+).*$/,"$1")},UC:function(){return n.replace(/^.*UC?Browser\/([\d.]+).*$/,"$1")},Sogou:function(){return n.replace(/^.*SE ([\d.X]+).*$/,"$1").replace(/^.*SogouMobileBrowser\/([\d.]+).*$/,"$1")},LBBROWSER:function(){return{57:"6.5",49:"6.0",46:"5.9",42:"5.3",39:"5.2",34:"5.0",29:"4.5",21:"4.0"}[navigator.userAgent.replace(/^.*Chrome\/([\d]+).*$/,"$1")]||""},"2345Explorer":function(){return n.replace(/^.*2345Explorer\/([\d.]+).*$/,"$1")},TheWorld:function(){return n.replace(/^.*TheWorld ([\d.]+).*$/,"$1")},XiaoMi:function(){return n.replace(/^.*MiuiBrowser\/([\d.]+).*$/,"$1")},Quark:function(){return n.replace(/^.*Quark\/([\d.]+).*$/,"$1")},Qiyu:function(){return n.replace(/^.*Qiyu\/([\d.]+).*$/,"$1")},Wechat:function(){return n.replace(/^.*MicroMessenger\/([\d.]+).*$/,"$1")},Taobao:function(){return n.replace(/^.*AliApp\(TB\/([\d.]+).*$/,"$1")},Alipay:function(){return n.replace(/^.*AliApp\(AP\/([\d.]+).*$/,"$1")},Weibo:function(){return n.replace(/^.*weibo__([\d.]+).*$/,"$1")},Douban:function(){return n.replace(/^.*com.douban.frodo\/([\d.]+).*$/,"$1")},Suning:function(){return n.replace(/^.*SNEBUY-APP([\d.]+).*$/,"$1")},iQiYi:function(){return n.replace(/^.*IqiyiVersion\/([\d.]+).*$/,"$1")}};return e.browserVersion="",l[e.browser]&&(e.browserVersion=l[e.browser](),e.browserVersion==n&&(e.browserVersion="")),"Edge"==e.browser&&(e.engine="EdgeHTML"),"Chrome"==e.browser&&parseInt(e.browserVersion)>27&&(e.engine="Blink"),"Opera"==e.browser&&parseInt(e.browserVersion)>12&&(e.engine="Blink"),"Yandex"==e.browser&&(e.engine="Blink"),e.browser+"(版本: "+e.browserVersion+"&nbsp;&nbsp;内核: "+e.engine+")"}},n={DeviceInfoObj:function(e){e=e||{domain:""};var n={deviceType:r.getDeviceType(),OS:r.getOS(),OSVersion:r.getOSVersion(),screenHeight:t.screen.height,screenWidth:t.screen.width,language:r.getLanguage(),netWork:r.getNetwork(),orientation:r.getOrientationStatu(),browserInfo:r.getBrowserInfo(),fingerprint:r.createFingerprint(e.domain),userAgent:i.navigator.userAgent};if(!e.info||0==e.info.length)return n;var s={};for(var o in n)e.info.forEach((function(e){e.toLowerCase()==o.toLowerCase()&&(s[e=o]=n[e])}));return s}};return{getDeviceInfo:function(e){return n.DeviceInfoObj(e)}}}(),De={type:e=>Object.prototype.toString.call(e).replace(/\[object\s|\]/g,""),isFunction(e){return"Function"===this.type(e)},isArray(e){return"Array"===this.type(e)},isNull:e=>null==e||""==e||null==e,objectIsNull:e=>"{}"===JSON.stringify(e),isObject(e){return"Object"===this.type(e)}};class Be{toReport(e,t){try{let r=JSON.stringify(t);var i=new XMLHttpRequest;i.open("POST",e,!0),i.setRequestHeader("Content-Type","application/json"),i.send(r)}catch(e){console.log(e)}}}class xe{toReport(e,t){try{let i=JSON.stringify(t);fetch(e,{headers:{"Content-Type":"application/json"},method:"POST",body:i,mode:"same-origin",keepalive:!0})}catch(i){(new Be).toReport(e,t),console.log("fetch请求异常",i)}}}class Me{toReport(e,t){try{(new Image).src=e+"?st="+(new Date).getTime()+"&"+this.formatParams(t)}catch(e){console.log(e)}}formatParams(e){var t=[];for(var i in e)t.push(encodeURIComponent(i)+"="+encodeURIComponent(e[i]));return t.join("&")}}class Pe{toReport(e,t){try{t.st=(new Date).getTime(),navigator.sendBeacon&&navigator.sendBeacon(e,this.formatParamsByURLSearchParams(t))}catch(e){console.log(e)}}formatParamsByFormData(e){const t=new FormData;for(var i in e)t.append(i,e[i]);return t}formatParamsByURLSearchParams(e){const t=new URLSearchParams;for(var i in e)"object"==typeof e[i]&&(e[i]=JSON.stringify(e[i])),t.append(i,e[i]);return t}formatParams(e){var t=[];for(var i in e)t.push(encodeURIComponent(i)+"="+encodeURIComponent(e[i]));return t.join("&")}}class Fe{constructor(e){this.url=e}report(e,t){t=t||{isFetch:!1,isXHR:!1,isImg:!1,isNavigator:!1},this.checkUrl(this.url)?this.sendInfo(e,t):console.log("上报信息url地址格式不正确,url=",this.url)}sendInfo(e,t={}){let i=new xe,r=new Me,n=new Be,s=new Pe;t.isImg?r.toReport(this.url,e):t.isFetch?i.toReport(this.url,e):t.isXHR?n.toReport(this.url,e):t.isNavigator?s.toReport(this.url,e):!!(t.isFetch&&t.isImg&&t.isXHR&&t.isNavigator)||s.toReport(this.url,e)}checkUrl(e){if(!e)return!1;return/^[hH][tT][tT][pP]([sS]?):\/\//.test(e)}}var Ue={isStop:!0,queues:[],add:function(e,t){this.queues.push({reportUrl:e,data:t})},fire:function(){if(!this.queues||0===this.queues.length)return void(this.isStop=!0);this.isStop=!1;let e=this.queues[0];e.reportUrl&&new Fe(e.reportUrl).report(e.data),this.queues.splice(0,1),this.fire()}};class Ne{constructor(e){this.category=ke.UNKNOW_ERROR,this.level=Ie.INFO,this.msg="",this.url="",this.line="",this.col="",this.errorObj="",this.reportUrl=e.reportUrl,this.extendsInfo=e.extendsInfo}recordError(){this.handleRecordError(),Ue.isStop&&Ue.fire()}handleRecordError(){try{if(!this.msg)return;if(this.reportUrl&&this.url&&this.url.toLowerCase().indexOf(this.reportUrl.toLowerCase())>=0)return void console.log("统计错误接口异常",this.msg);let e=this.handleErrorInfo();Ue.add(this.reportUrl,e)}catch(e){console.log(e)}}handleErrorInfo(){let e=this.getExtendsInfo(),t="",i=0;switch(this.category){case ke.BUSINESS:if(!this.msg.textKey)return e=Object.assign({},e,this.msg),e.l=window.location.href,e;t=JSON.stringify(this.msg),i=1,e.textKey=this.msg.textKey,this.msg.h&&(e.h=this.msg.h),this.msg.text&&(e.text=this.msg.text);break;case ke.PERFORMANCE:t=JSON.stringify(this.msg),i=1e3,e.clientInfo=this.getDeviceInfo();break;case ke.AJAX_ERROR:t=JSON.stringify(this.msg),i=100;break;case ke.RESOURCE_ERROR:const r={msg:this.msg,url:encodeURIComponent(this.url)};t=JSON.stringify(r),i=101;break;case ke.JS_ERROR:t="错误类别: "+this.category+"\r\n",t+="日志信息: "+this.msg+"\r\n",t+="url: "+encodeURIComponent(this.url)+"\r\n",t+="错误行号: "+this.line+"\r\n",t+="错误列号: "+this.col+"\r\n",this.errorObj&&this.errorObj.stack&&(t+="错误栈: "+this.errorObj.stack+"\r\n"),i=102;break;default:t=this.msg,i=106}return e.logInfo=t,e.l=window.location.pathname,e.action=i,e}getExtendsInfo(){try{let t,i={},r=this.extendsInfo||{};for(var e in De.isFunction(r.getDynamic)&&(t=r.getDynamic()),De.isObject(t)&&(r={...r,...t}),r)De.isFunction(r[e])||(i[e]=r[e]);return i}catch(e){return console.log("call getExtendsInfo error",e),{}}}getDeviceInfo(){try{let e=Oe.getDeviceInfo();return JSON.stringify(e)}catch(e){return console.log(e),""}}}function Ve(e,t){if(!e)return!0;if("string"==typeof e){if(t.startsWith("/")){if(window.location.hostname.endsWith(e))return!0}else{if(new URL(t).hostname.endsWith(e))return!0}return!1}if("object"==typeof e&&e instanceof Array){let i=!1;return e.forEach((e=>{if("string"==typeof e)if(t.startsWith("/"))window.location.hostname.endsWith(e)&&(i=!0);else{new URL(t).hostname.endsWith(e)&&(i=!0)}})),i}return!1}class Ge{constructor(e){this.params=e}handleError(e){switch(e){case Le.FETCH:new je(this.params).handleError();break;case Le.DEFAULT:new We(this.params).handleError();break;default:new je(this.params).handleError(),new We(this.params).handleError()}}}class je extends Ne{constructor(e){super(e),this.ajaxDomain=e.ajaxDomain}handleError(){if(!window.fetch)return;this.level=Ie.WARN,this.category=ke.AJAX_ERROR;let e=this,t=window.fetch;window.fetch=function(){let i=arguments,r=(new Date).getTime(),n=null;return t.apply(this,arguments).then((function(t){try{const s=t.headers?t.headers.get("content-type"):"";if("string"==typeof s&&s.includes("application/json")){const s=t.clone();n=s.status;let o=(new Date).getTime()-r;s.json().then((function(t){const s={fetchStart:r,url:i[0],requestOptions:i[1],status:n,responseBody:t,loadTime:o};e.msg=s,Ve(e.ajaxDomain,s.url)&&e.recordError()}))}else{const s=t.clone();n=s.status;let o=(new Date).getTime()-r;s.text().then((function(t){try{t=JSON.parse(t)}catch(e){console.log("JSON.parse 失败")}const s={fetchStart:r,url:i[0],requestOptions:i[1],status:n,responseBody:t,loadTime:o};e.msg=s,Ve(e.ajaxDomain,s.url)&&e.recordError()}))}}catch(e){console.log("获取响应数据上报异常"),console.log(e)}return t})).catch((function(e){console.log("获取响应数据上报异常"),console.log(e)}))}}}class We extends Ne{constructor(e){super(e),this.ajaxDomain=e.ajaxDomain}handleError(){if(!window.XMLHttpRequest)return;this.level=Ie.WARN,this.category=ke.AJAX_ERROR;let e=this,t=XMLHttpRequest.prototype.open,i=XMLHttpRequest.prototype.send;XMLHttpRequest.prototype.open=function(e,i,r){return this._url="string"==typeof i?i:i.href,this._method=e,t.call(this,e,this._url,"boolean"!=typeof r||r)},XMLHttpRequest.prototype.send=function(){let t=(new Date).getTime();return this.addEventListener&&this.addEventListener("readystatechange",(function(){if(4===this.readyState)if(this.status>=200&&this.status<300){let i=(new Date).getTime()-t;const r={method:this._method},n={fetchStart:t,url:this._url,requestOptions:r,responseBody:this.response,status:this.status,loadTime:i};e.msg=n,Ve(e.ajaxDomain,n.url)&&e.recordError()}else{let i=(new Date).getTime()-t;const r={method:this._method},n={fetchStart:t,url:this._url,requestOptions:r,status:this.status,loadTime:i};e.msg=n,Ve(e.ajaxDomain,n.url)&&e.recordError()}})),i.apply(this,arguments)}}}class Qe extends Ne{constructor(e){super(e)}handleError(){this.registerInfo(),this.registerWarn(),this.registerError()}registerInfo(){let e=this;console.tInfo=function(){e.handleLog(Ie.INFO,ke.CONSOLE_INFO,arguments)}}registerWarn(){let e=this;console.tWarn=function(){e.handleLog(Ie.WARN,ke.CONSOLE_WARN,arguments)}}registerError(){let e=this;console.tError=function(){e.handleLog(Ie.ERROR,ke.CONSOLE_ERROR,arguments)}}handleLog(e,t,i){try{this.level=e;let r=[...i];this.msg=r.join("\r\n"),this.url=location.href,this.category=t,this.recordError()}catch(t){console.log("console统计错误异常",e,t)}}}!function(){window.console||(window.console={});["tInfo","tWarn","tError"].forEach(((e,t)=>{console[e]||(console[e]=function(){})}))}();class ze extends Ne{constructor(e){super(e)}handleError(){window.onerror=(e,t,i,r,n)=>{console.log("monitor onerror");try{this.level=Ie.WARN,this.category=ke.JS_ERROR,this.msg=e,this.url=t,this.line=i,this.col=r,this.errorObj=n,this.recordError()}catch(n){console.log("js错误异常",n)}}}}class He extends Ne{constructor(e){super(e)}handleError(){window.addEventListener("unhandledrejection",(e=>{try{if(!e||!e.reason)return;e.reason.config&&e.reason.config.url&&(this.url=e.reason.config.url),this.level=Ie.WARN,this.category=ke.PROMISE_ERROR,this.msg=e.reason,this.recordError()}catch(e){console.log(e)}}),!0)}}class qe extends Ne{constructor(e){super(e)}handleError(){window.addEventListener("error",(e=>{console.log("monitor addEventListener error");try{if(!e)return;this.category=ke.RESOURCE_ERROR;let t=e.target||e.srcElement;if(!(t instanceof HTMLScriptElement||t instanceof HTMLLinkElement||t instanceof HTMLImageElement))return;this.level="IMG"===t.tagName.toUpperCase()?Ie.WARN:Ie.ERROR,this.msg="加载 "+t.tagName+" 资源错误",this.url=t.src||t.href,this.errorObj=t,this.recordError()}catch(e){console.log("资源加载收集异常",e)}}),!0)}}var $e,Xe,Ye,Ze,Ke=-1,Je=function(e){addEventListener("pageshow",(function(t){t.persisted&&(Ke=t.timeStamp,e(t))}),!0)},et=function(){return window.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]},tt=function(){var e=et();return e&&e.activationStart||0},it=function(e,t){var i=et(),r="navigate";return Ke>=0?r="back-forward-cache":i&&(document.prerendering||tt()>0?r="prerender":document.wasDiscarded?r="restore":i.type&&(r=i.type.replace(/_/g,"-"))),{name:e,value:void 0===t?-1:t,rating:"good",delta:0,entries:[],id:"v3-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:r}},rt=function(e,t,i){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var r=new PerformanceObserver((function(e){Promise.resolve().then((function(){t(e.getEntries())}))}));return r.observe(Object.assign({type:e,buffered:!0},i||{})),r}}catch(e){}},nt=function(e,t,i,r){var n,s;return function(o){t.value>=0&&(o||r)&&((s=t.value-(n||0))||void 0===n)&&(n=t.value,t.delta=s,t.rating=function(e,t){return e>t[1]?"poor":e>t[0]?"needs-improvement":"good"}(t.value,i),e(t))}},st=function(e){requestAnimationFrame((function(){return requestAnimationFrame((function(){return e()}))}))},ot=function(e){var t=function(t){"pagehide"!==t.type&&"hidden"!==document.visibilityState||e(t)};addEventListener("visibilitychange",t,!0),addEventListener("pagehide",t,!0)},at=function(e){var t=!1;return function(i){t||(e(i),t=!0)}},ht=-1,lt=function(){return"hidden"!==document.visibilityState||document.prerendering?1/0:0},dt=function(e){"hidden"===document.visibilityState&&ht>-1&&(ht="visibilitychange"===e.type?e.timeStamp:0,At())},ut=function(){addEventListener("visibilitychange",dt,!0),addEventListener("prerenderingchange",dt,!0)},At=function(){removeEventListener("visibilitychange",dt,!0),removeEventListener("prerenderingchange",dt,!0)},ct=function(){return ht<0&&(ht=lt(),ut(),Je((function(){setTimeout((function(){ht=lt(),ut()}),0)}))),{get firstHiddenTime(){return ht}}},pt=function(e){document.prerendering?addEventListener("prerenderingchange",(function(){return e()}),!0):e()},ft=[1800,3e3],mt=function(e,t){t=t||{},pt((function(){var i,r=ct(),n=it("FCP"),s=rt("paint",(function(e){e.forEach((function(e){"first-contentful-paint"===e.name&&(s.disconnect(),e.startTime<r.firstHiddenTime&&(n.value=Math.max(e.startTime-tt(),0),n.entries.push(e),i(!0)))}))}));s&&(i=nt(e,n,ft,t.reportAllChanges),Je((function(r){n=it("FCP"),i=nt(e,n,ft,t.reportAllChanges),st((function(){n.value=performance.now()-r.timeStamp,i(!0)}))})))}))},_t=[.1,.25],gt={passive:!0,capture:!0},yt=new Date,vt=function(e,t){$e||($e=t,Xe=e,Ye=new Date,St(removeEventListener),Et())},Et=function(){if(Xe>=0&&Xe<Ye-yt){var e={entryType:"first-input",name:$e.type,target:$e.target,cancelable:$e.cancelable,startTime:$e.timeStamp,processingStart:$e.timeStamp+Xe};Ze.forEach((function(t){t(e)})),Ze=[]}},bt=function(e){if(e.cancelable){var t=(e.timeStamp>1e12?new Date:performance.now())-e.timeStamp;"pointerdown"==e.type?function(e,t){var i=function(){vt(e,t),n()},r=function(){n()},n=function(){removeEventListener("pointerup",i,gt),removeEventListener("pointercancel",r,gt)};addEventListener("pointerup",i,gt),addEventListener("pointercancel",r,gt)}(t,e):vt(t,e)}},St=function(e){["mousedown","keydown","touchstart","pointerdown"].forEach((function(t){return e(t,bt,gt)}))},wt=[100,300],Tt=[2500,4e3],Rt={},Ct=[800,1800],kt=function e(t){document.prerendering?pt((function(){return e(t)})):"complete"!==document.readyState?addEventListener("load",(function(){return e(t)}),!0):setTimeout(t,0)},It=function(e,t){t=t||{};var i=it("TTFB"),r=nt(e,i,Ct,t.reportAllChanges);kt((function(){var n=et();if(n){var s=n.responseStart;if(s<=0||s>performance.now())return;i.value=Math.max(s-tt(),0),i.entries=[n],r(!0),Je((function(){i=it("TTFB",0),(r=nt(e,i,Ct,t.reportAllChanges))(!0)}))}}))};class Lt extends Ne{constructor(e){super(e||{}),this.category=ke.PERFORMANCE,this.reportUrl=e.reportUrl||"",this.performanceData={},this.saveData=this.saveData.bind(this),mt(this.saveData),function(e,t){t=t||{},pt((function(){var i,r=ct(),n=it("FID"),s=function(e){e.startTime<r.firstHiddenTime&&(n.value=e.processingStart-e.startTime,n.entries.push(e),i(!0))},o=function(e){e.forEach(s)},a=rt("first-input",o);i=nt(e,n,wt,t.reportAllChanges),a&&ot(at((function(){o(a.takeRecords()),a.disconnect()}))),a&&Je((function(){var r;n=it("FID"),i=nt(e,n,wt,t.reportAllChanges),Ze=[],Xe=-1,$e=null,St(addEventListener),r=s,Ze.push(r),Et()}))}))}(this.saveData),function(e,t){t=t||{},pt((function(){var i,r=ct(),n=it("LCP"),s=function(e){var t=e[e.length-1];t&&t.startTime<r.firstHiddenTime&&(n.value=Math.max(t.startTime-tt(),0),n.entries=[t],i())},o=rt("largest-contentful-paint",s);if(o){i=nt(e,n,Tt,t.reportAllChanges);var a=at((function(){Rt[n.id]||(s(o.takeRecords()),o.disconnect(),Rt[n.id]=!0,i(!0))}));["keydown","click"].forEach((function(e){addEventListener(e,a,!0)})),ot(a),Je((function(r){n=it("LCP"),i=nt(e,n,Tt,t.reportAllChanges),st((function(){n.value=performance.now()-r.timeStamp,Rt[n.id]=!0,i(!0)}))}))}}))}(this.saveData),function(e,t){t=t||{},mt(at((function(){var i,r=it("CLS",0),n=0,s=[],o=function(e){e.forEach((function(e){if(!e.hadRecentInput){var t=s[0],i=s[s.length-1];n&&e.startTime-i.startTime<1e3&&e.startTime-t.startTime<5e3?(n+=e.value,s.push(e)):(n=e.value,s=[e])}})),n>r.value&&(r.value=n,r.entries=s,i())},a=rt("layout-shift",o);a&&(i=nt(e,r,_t,t.reportAllChanges),ot((function(){o(a.takeRecords()),i(!0)})),Je((function(){n=0,r=it("CLS",0),i=nt(e,r,_t,t.reportAllChanges),st((function(){return i()}))})),setTimeout(i,0))})))}(this.saveData),It(this.saveData)}saveData(e){this.performanceData[e.name]=e.value,"LCP"===e.name&&this.record(this.performanceData)}record(e){this.msg=e,this.recordError()}reset}const Ot="common_a",Dt=/((<(A|B|BUTTON|DIV|H1|H2|H3|H4|H5|H6|P|IMG|SPAN|TABLE|TD|TEXTAREA|VIDEO)([^<>])*>)([^<>])+(<\/(A|B|BUTTON|DIV|H1|H2|H3|H4|H5|H6|P|IMG|SPAN|TABLE|TD|TEXTAREA|VIDEO)>)|(<(IMG|VIDEO)(.)+>))/i;function Bt(e){var t=e.nodeName,i="";if(e.hasAttribute("data-monitor")&&e.getAttribute("data-monitor"))return`${i=e.getAttribute("data-monitor")}`.slice(0,20);var r=e.outerHTML.match(Dt);if(r&&r.length>0)if("IMG"===t)i=e.getAttribute("alt");else i=(i=r[0].match(/>[^<>]+<\//)?r[0].match(/>[^<>]+<\//)[0]:"").replace(/[^A-Za-z0-9\u4e00-\u9fa5]/g,"");return`${i}`.slice(0,20)}class xt extends Ne{constructor(e){super(e||{}),this.category=ke.BUSINESS,this.reportUrl=e.reportUrl||"";const t=e.keyName||"textkey",i=this;window.addEventListener("click",(function(e){let r=e.target;if(!r)return!1;let n=r.getAttribute(t),s=r.getAttribute("link")||r.getAttribute("href");if(n||s){const e={textKey:n||Ot};s&&(e.h=s);const t=Bt(r);t&&(e.text=t),i.record(e)}else{for(;!n&&!s&&r.parentNode;)r=r.parentNode,r.getAttribute&&(n=r.getAttribute(t),s=r.getAttribute("link")||r.getAttribute("href"));if(n||s){const e={textKey:n||Ot};s&&(e.h=s);const t=Bt(r);t&&(e.text=t),i.record(e)}}}))}record(e){this.msg=e,this.recordError()}}class Mt extends Ne{constructor(e){super(e||{}),this.category=ke.BUSINESS,this.reportUrl=e.reportUrl||""}record(e){this.msg=e,this.recordError()}}Date.prototype.format=function(e){let t={"M+":this.getMonth()+1,"d+":this.getDate(),"h+":this.getHours()%12==0?12:this.getHours()%12,"H+":this.getHours(),"m+":this.getMinutes(),"s+":this.getSeconds(),"q+":Math.floor((this.getMonth()+3)/3),S:this.getMilliseconds()},i={0:"/u65e5",1:"/u4e00",2:"/u4e8c",3:"/u4e09",4:"/u56db",5:"/u4e94",6:"/u516d"};/(y+)/.test(e)&&(e=e.replace(RegExp.$1,(this.getFullYear()+"").substr(4-RegExp.$1.length))),/(E+)/.test(e)&&(e=e.replace(RegExp.$1,(RegExp.$1.length>1?RegExp.$1.length>2?"/u661f/u671f":"/u5468":"")+i[this.getDay()+""]));for(let i in t)new RegExp("("+i+")").test(e)&&(e=e.replace(RegExp.$1,1==RegExp.$1.length?t[i]:("00"+t[i]).substr((""+t[i]).length)));return e};class Pt{constructor(e){this.jsError=!0,this.promiseError=!0,this.resourceError=!0,this.ajaxError=!0,this.ajaxDomain=null,this.isReportHref=!1,this.consoleError=!1,e=e||{},this.jsError=!(!1===e.jsError),this.promiseError=!(!1===e.promiseError),this.resourceError=!(!1===e.resourceError),this.consoleError=!0===e.consoleError,this.ajaxError=!(!1===e.ajaxError),this.ajaxDomain=e.ajaxDomain||this.ajaxDomain,this.isReportHref=e.isReportHref||this.isReportHref,this.business=!(!1===e.business),this.reportUrl=e.url,this.performace=!(!1===e.performace),this.extendsInfo=e.extendsInfo||{};let t={reportUrl:this.reportUrl,extendsInfo:this.extendsInfo};if(this.jsError&&new ze(t).handleError(),this.promiseError&&new He(t).handleError(),this.resourceError&&new qe(t).handleError(),this.ajaxError){let e=Object.assign({},t,{ajaxDomain:this.ajaxDomain});new Ge(e).handleError()}this.consoleError&&new Qe(t).handleError(),this.performace&&new Lt(t),this.business&&new xt(t),this.manual=new Mt(t)}report(e){return this.manual&&this.manual.record(e),this}}const Ft={h264:1,h265:2,h266:4,vp8:8,vp9:16,av1:32},Ut=["h264","h265"],Nt=()=>Ut.reduce(((e,t)=>e+(Ft[t]||0)),0),Vt=e=>{const t=e.split("?"),i=new URLSearchParams(t[1]);return i.delete("vc"),i.set("vc",Nt().toString()),t[0]+"?"+i.toString()};class Gt{static initMonitor(){this.monitor=new Pt({url:"https://log.ys7.com/statistics.do/open_website_monitor",extendsInfo:{bn:"ezuikit_flv",getDynamic:()=>({})}})}static report(e,t){this.monitor||Gt.initMonitor();const i={type:e,data:{...t,vc:Gt.vc,version:"1.0.0-alpha.0",now:(new Date).getTime()}};try{this.monitor.report(i)}catch(e){}}}e(Gt,"vc",Nt());class jt extends Ce{constructor(e,t){super(e,t,de),this._opt.useMSE=!1,this._opt.hasAudio&&(this.audio=new Ae(this)),this.decoderWorker=new me(this),this.stream=null,this.demux=null,this._lastVolume=null,Z()&&(this.keepScreenOn=new Se(this)),this.debug.log("Soft Player options",this._opt)}destroy(){this._loading=!1,this._playing=!1,this._hasLoaded=!1,this._lastVolume=null,this._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},this.decoderWorker&&(this.decoderWorker.destroy(),this.decoderWorker=null),this.video&&(this.video.destroy(),this.video=null),this.audio&&(this.audio.destroy(),this.audio=null),this.stream&&(this.stream.destroy(),this.stream=null),this.demux&&(this.demux.destroy(),this.demux=null),this.events&&(this.events.destroy(),this.events=null),this.clearCheckHeartTimeout(),this.clearCheckLoadingTimeout(),this.clearStatsInterval(),this.releaseWakeLock(),this.keepScreenOn=null,this.resetStats(),this._audioTimestamp=0,this._videoTimestamp=0,this.emit("destroy"),this.off(),this.debug.log("play","destroy end")}set fullscreen(e){Z()&&this._opt.useWebFullScreen?(this.emit(w.webFullscreen,e),setTimeout((()=>{this.updateOption({rotate:e?270:0}),this.resize()}),10)):this.emit(w.fullscreen,e)}get fullscreen(){return K()||this.webFullscreen}set webFullscreen(e){this.emit(w.webFullscreen,e)}get webFullscreen(){return this.$container.classList.contains("flv-fullscreen-web")}set loaded(e){this._hasLoaded=e}get loaded(){return this._hasLoaded}set playing(e){e&&(this.loading=!1),this.playing!==e&&(this._playing=e,this.emit(w.playing,e),this.emit(w.volumechange,this.volume),e?this.emit(w.play):this.emit(w.pause))}get playing(){return this._playing}get volume(){return this.audio&&this.audio.volume||0}set volume(e){e!==this.volume&&(this.audio&&this.audio.setVolume(e),this._lastVolume=e)}get lastVolume(){return this._lastVolume}set loading(e){this.loading!==e&&(this._loading=e,this.emit(w.loading,this._loading))}get loading(){return this._loading}set audioTimestamp(e){null!==e&&(this._audioTimestamp=e)}get audioTimestamp(){return this._audioTimestamp}set videoTimestamp(e){null!==e&&(this._videoTimestamp=e,this._opt.useWCS||this._opt.useMSE||this.audioTimestamp&&this.videoTimestamp&&this.audio&&this.audio.emit(w.videoSyncAudio,{audioTimestamp:this.audioTimestamp,videoTimestamp:this.videoTimestamp,diff:this.audioTimestamp-this.videoTimestamp}))}get videoTimestamp(){return this._videoTimestamp}get isDebug(){return!0===this._opt.debug}updateOption(e){this._opt=Object.assign({},this._opt,e)}init(){return new Promise(((e,t)=>{this.stream||(this.stream=new fe(this)),this.audio||this._opt.hasAudio&&(this.audio=new Ae(this)),this.demux||(this.demux=new ve(this)),this.decoderWorker?e():(this.decoderWorker=new me(this),this.once(w.decoderWorkerInit,(()=>{e()})))}))}play(e){return this._opt=Object.assign({},this._opt,e||{}),new Promise(((e,t)=>{if(!this._opt.url)return t();this.loading=!0,this.playing=!1,this._times.playInitStart=q(),this.clearCheckHeartTimeout(),this.init().then((()=>{this._times.playStart=q(),this._opt.isNotMute&&this.mute(!1),this.enableWakeLock(),this.stream.fetchStream(this._opt.url,this._opt),this.checkLoadingTimeout(),this.stream.once(R.fetchError,(e=>{t(e)})),this.stream.once(R.websocketError,(e=>{t(e)})),this.stream.once(w.streamEnd,(()=>{t()})),this.stream.once(w.streamSuccess,(()=>{e(),this._times.streamResponse=q(),this.video.play(),this.checkStatsInterval()}))})).catch((e=>{t(e)}))}))}close(){return new Promise((e=>{this._close().then((()=>{this.video&&this.video.clearView(),e()}))}))}resumeAudioAfterPause(){this.lastVolume&&(this.volume=this.lastVolume)}_close(){return new Promise((e=>{this.stream&&(this.stream.destroy(),this.stream=null),this.demux&&(this.demux.destroy(),this.demux=null),this.decoderWorker&&(this.decoderWorker.destroy(),this.decoderWorker=null),this.audio&&(this.audio.destroy(),this.audio=null),this.clearCheckHeartTimeout(),this.clearCheckLoadingTimeout(),this.clearStatsInterval(),this.playing=!1,this.loading=!1,this.video&&(this.video.resetInit(),this.video.pause(!0)),this.releaseWakeLock(),this.resetStats(),this._audioTimestamp=0,this._videoTimestamp=0,this._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},setTimeout((()=>{e()}),0)}))}pause(e=!1){return e?this.close():this._close()}mute(e){this.audio&&this.audio.mute(e)}resize(){this.video.resize()}_onlyMseOrWcsVideo(){return!1===this._opt.hasAudio&&(this._opt.useMSE||this._opt.useWCS&&!this._opt.useOffscreen)}checkHeart(){this.clearCheckHeartTimeout(),this.checkHeartTimeout()}checkHeartTimeout(){this._checkHeartTimeout=setTimeout((()=>{if(this.playing){if(0!==this._stats.fps)return;this.pause().then((()=>{this.emit(w.timeout,w.delayTimeout),this.emit(w.delayTimeout)}))}}),1e3*this._opt.heartTimeout)}checkStatsInterval(){this._checkStatsInterval=setInterval((()=>{this.updateStats()}),1e3)}clearCheckHeartTimeout(){this._checkHeartTimeout&&(clearTimeout(this._checkHeartTimeout),this._checkHeartTimeout=null)}checkLoadingTimeout(){this._checkLoadingTimeout=setTimeout((()=>{this.playing||this.pause().then((()=>{this.emit(w.timeout,w.loadingTimeout),this.emit(w.loadingTimeout)}))}),1e3*this._opt.loadingTimeout)}clearCheckLoadingTimeout(){this._checkLoadingTimeout&&(clearTimeout(this._checkLoadingTimeout),this._checkLoadingTimeout=null)}clearStatsInterval(){this._checkStatsInterval&&(clearInterval(this._checkStatsInterval),this._checkStatsInterval=null)}handleRender(){this.loading&&(this.emit(w.start),this.loading=!1,this.clearCheckLoadingTimeout()),this.playing||(this.playing=!0),this.checkHeart()}updateStats(e){e=e||{},this._startBpsTime||(this._startBpsTime=q()),ee(e.ts)&&(this._stats.ts=e.ts),ee(e.buf)&&(this._stats.buf=e.buf),e.fps&&(this._stats.fps+=1),e.abps&&(this._stats.abps+=e.abps),e.vbps&&(this._stats.vbps+=e.vbps);const t=q();t-this._startBpsTime<1e3||(this.emit(w.stats,this._stats),this.emit(w.performance,function(e){let t=0;return e>=24?t=2:e>=15&&(t=1),t}(this._stats.fps)),this._stats.fps=0,this._stats.abps=0,this._stats.vbps=0,this._startBpsTime=t)}resetStats(){this._startBpsTime=null,this._stats={buf:0,fps:0,abps:0,vbps:0,ts:0}}enableWakeLock(){this._opt.keepScreenOn&&this.keepScreenOn&&this.keepScreenOn.enable()}releaseWakeLock(){this._opt.keepScreenOn&&this.keepScreenOn&&this.keepScreenOn.disable()}handlePlayToRenderTimes(){const e=this._times;e.playTimestamp=e.playStart-e.playInitStart,e.streamTimestamp=e.streamStart-e.playStart,e.streamResponseTimestamp=e.streamResponse-e.streamStart,e.demuxTimestamp=e.demuxStart-e.streamResponse,e.decodeTimestamp=e.decodeStart-e.demuxStart,e.videoTimestamp=e.videoStart-e.decodeStart,e.allTimestamp=e.videoStart-e.playInitStart,this.emit(w.playToRenderTimes,e)}getOption(){return this._opt}emitError(e,t=""){Gt.report("error",{event:e,value:t}),this.emit(w.error,e,t),this.emit(e,t)}}var Wt={exports:{}};!function(e,t){window,e.exports=function(e){var t={};function i(r){if(t[r])return t[r].exports;var n=t[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,i),n.l=!0,n.exports}return i.m=e,i.c=t,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(r,n,function(t){return e[t]}.bind(null,n));return r},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=14)}([function(e,t,i){var r=i(6),n=i.n(r),s=function(){function e(){}return e.e=function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var r="["+t+"] > "+i;e.ENABLE_CALLBACK&&e.emitter.emit("log","error",r),e.ENABLE_ERROR&&(console.error||console.warn)},e.i=function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var r="["+t+"] > "+i;e.ENABLE_CALLBACK&&e.emitter.emit("log","info",r),e.ENABLE_INFO&&console.info},e.w=function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var r="["+t+"] > "+i;e.ENABLE_CALLBACK&&e.emitter.emit("log","warn",r),e.ENABLE_WARN&&console.warn},e.d=function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var r="["+t+"] > "+i;e.ENABLE_CALLBACK&&e.emitter.emit("log","debug",r),e.ENABLE_DEBUG&&console.debug},e.v=function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var r="["+t+"] > "+i;e.ENABLE_CALLBACK&&e.emitter.emit("log","verbose",r),e.ENABLE_VERBOSE},e}();s.GLOBAL_TAG="mpegts.js",s.FORCE_GLOBAL_TAG=!1,s.ENABLE_ERROR=!0,s.ENABLE_INFO=!0,s.ENABLE_WARN=!0,s.ENABLE_DEBUG=!0,s.ENABLE_VERBOSE=!0,s.ENABLE_CALLBACK=!1,s.emitter=new n.a,t.a=s},function(e,t,i){t.a={IO_ERROR:"io_error",DEMUX_ERROR:"demux_error",INIT_SEGMENT:"init_segment",MEDIA_SEGMENT:"media_segment",LOADING_COMPLETE:"loading_complete",RECOVERED_EARLY_EOF:"recovered_early_eof",MEDIA_INFO:"media_info",METADATA_ARRIVED:"metadata_arrived",SCRIPTDATA_ARRIVED:"scriptdata_arrived",TIMED_ID3_METADATA_ARRIVED:"timed_id3_metadata_arrived",PES_PRIVATE_DATA_DESCRIPTOR:"pes_private_data_descriptor",PES_PRIVATE_DATA_ARRIVED:"pes_private_data_arrived",STATISTICS_INFO:"statistics_info",RECOMMEND_SEEKPOINT:"recommend_seekpoint"}},function(e,t,i){i.d(t,"c",(function(){return n})),i.d(t,"b",(function(){return s})),i.d(t,"a",(function(){return o}));var r=i(3),n={kIdle:0,kConnecting:1,kBuffering:2,kError:3,kComplete:4},s={OK:"OK",EXCEPTION:"Exception",HTTP_STATUS_CODE_INVALID:"HttpStatusCodeInvalid",CONNECTING_TIMEOUT:"ConnectingTimeout",EARLY_EOF:"EarlyEof",UNRECOVERABLE_EARLY_EOF:"UnrecoverableEarlyEof"},o=function(){function e(e){this._type=e||"undefined",this._status=n.kIdle,this._needStash=!1,this._onContentLengthKnown=null,this._onURLRedirect=null,this._onDataArrival=null,this._onError=null,this._onComplete=null}return e.prototype.destroy=function(){this._status=n.kIdle,this._onContentLengthKnown=null,this._onURLRedirect=null,this._onDataArrival=null,this._onError=null,this._onComplete=null},e.prototype.isWorking=function(){return this._status===n.kConnecting||this._status===n.kBuffering},Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this._status},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"needStashBuffer",{get:function(){return this._needStash},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onContentLengthKnown",{get:function(){return this._onContentLengthKnown},set:function(e){this._onContentLengthKnown=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onURLRedirect",{get:function(){return this._onURLRedirect},set:function(e){this._onURLRedirect=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onDataArrival",{get:function(){return this._onDataArrival},set:function(e){this._onDataArrival=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onError",{get:function(){return this._onError},set:function(e){this._onError=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onComplete",{get:function(){return this._onComplete},set:function(e){this._onComplete=e},enumerable:!1,configurable:!0}),e.prototype.open=function(e,t){throw new r.c("Unimplemented abstract function!")},e.prototype.abort=function(){throw new r.c("Unimplemented abstract function!")},e}()},function(e,t,i){i.d(t,"d",(function(){return s})),i.d(t,"a",(function(){return o})),i.d(t,"b",(function(){return a})),i.d(t,"c",(function(){return h}));var r,n=(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),s=function(){function e(e){this._message=e}return Object.defineProperty(e.prototype,"name",{get:function(){return"RuntimeException"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"message",{get:function(){return this._message},enumerable:!1,configurable:!0}),e.prototype.toString=function(){return this.name+": "+this.message},e}(),o=function(e){function t(t){return e.call(this,t)||this}return n(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"IllegalStateException"},enumerable:!1,configurable:!0}),t}(s),a=function(e){function t(t){return e.call(this,t)||this}return n(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"InvalidArgumentException"},enumerable:!1,configurable:!0}),t}(s),h=function(e){function t(t){return e.call(this,t)||this}return n(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"NotImplementedException"},enumerable:!1,configurable:!0}),t}(s)},function(e,t,i){var r={};!function(){var e=self.navigator.userAgent.toLowerCase(),t=/(edge)\/([\w.]+)/.exec(e)||/(opr)[\/]([\w.]+)/.exec(e)||/(chrome)[ \/]([\w.]+)/.exec(e)||/(iemobile)[\/]([\w.]+)/.exec(e)||/(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||e.indexOf("trident")>=0&&/(rv)(?::| )([\w.]+)/.exec(e)||e.indexOf("compatible")<0&&/(firefox)[ \/]([\w.]+)/.exec(e)||[],i=/(ipad)/.exec(e)||/(ipod)/.exec(e)||/(windows phone)/.exec(e)||/(iphone)/.exec(e)||/(kindle)/.exec(e)||/(android)/.exec(e)||/(windows)/.exec(e)||/(mac)/.exec(e)||/(linux)/.exec(e)||/(cros)/.exec(e)||[],n={browser:t[5]||t[3]||t[1]||"",version:t[2]||t[4]||"0",majorVersion:t[4]||t[2]||"0",platform:i[0]||""},s={};if(n.browser){s[n.browser]=!0;var o=n.majorVersion.split(".");s.version={major:parseInt(n.majorVersion,10),string:n.version},o.length>1&&(s.version.minor=parseInt(o[1],10)),o.length>2&&(s.version.build=parseInt(o[2],10))}for(var a in n.platform&&(s[n.platform]=!0),(s.chrome||s.opr||s.safari)&&(s.webkit=!0),(s.rv||s.iemobile)&&(s.rv&&delete s.rv,n.browser="msie",s.msie=!0),s.edge&&(delete s.edge,n.browser="msedge",s.msedge=!0),s.opr&&(n.browser="opera",s.opera=!0),s.safari&&s.android&&(n.browser="android",s.android=!0),s.name=n.browser,s.platform=n.platform,r)r.hasOwnProperty(a)&&delete r[a];Object.assign(r,s)}(),t.a=r},function(e,t,i){t.a={OK:"OK",FORMAT_ERROR:"FormatError",FORMAT_UNSUPPORTED:"FormatUnsupported",CODEC_UNSUPPORTED:"CodecUnsupported"}},function(e,t,i){var r,n="object"==typeof Reflect?Reflect:null,s=n&&"function"==typeof n.apply?n.apply:function(e,t,i){return Function.prototype.apply.call(e,t,i)};r=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function a(){a.init.call(this)}e.exports=a,e.exports.once=function(e,t){return new Promise((function(i,r){function n(i){e.removeListener(t,s),r(i)}function s(){"function"==typeof e.removeListener&&e.removeListener("error",n),i([].slice.call(arguments))}_(e,t,s,{once:!0}),"error"!==t&&function(e,t,i){"function"==typeof e.on&&_(e,"error",t,i)}(e,n,{once:!0})}))},a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var h=10;function l(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function d(e){return void 0===e._maxListeners?a.defaultMaxListeners:e._maxListeners}function u(e,t,i,r){var n,s,o;if(l(i),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,i.listener?i.listener:i),s=e._events),o=s[t]),void 0===o)o=s[t]=i,++e._eventsCount;else if("function"==typeof o?o=s[t]=r?[i,o]:[o,i]:r?o.unshift(i):o.push(i),(n=d(e))>0&&o.length>n&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=e,a.type=t,a.count=o.length}return e}function A(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function c(e,t,i){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:i},n=A.bind(r);return n.listener=i,r.wrapFn=n,n}function p(e,t,i){var r=e._events;if(void 0===r)return[];var n=r[t];return void 0===n?[]:"function"==typeof n?i?[n.listener||n]:[n]:i?function(e){for(var t=new Array(e.length),i=0;i<t.length;++i)t[i]=e[i].listener||e[i];return t}(n):m(n,n.length)}function f(e){var t=this._events;if(void 0!==t){var i=t[e];if("function"==typeof i)return 1;if(void 0!==i)return i.length}return 0}function m(e,t){for(var i=new Array(t),r=0;r<t;++r)i[r]=e[r];return i}function _(e,t,i,r){if("function"==typeof e.on)r.once?e.once(t,i):e.on(t,i);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function n(s){r.once&&e.removeEventListener(t,n),i(s)}))}}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return h},set:function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");h=e}}),a.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},a.prototype.getMaxListeners=function(){return d(this)},a.prototype.emit=function(e){for(var t=[],i=1;i<arguments.length;i++)t.push(arguments[i]);var r="error"===e,n=this._events;if(void 0!==n)r=r&&void 0===n.error;else if(!r)return!1;if(r){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var h=n[e];if(void 0===h)return!1;if("function"==typeof h)s(h,this,t);else{var l=h.length,d=m(h,l);for(i=0;i<l;++i)s(d[i],this,t)}return!0},a.prototype.addListener=function(e,t){return u(this,e,t,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(e,t){return u(this,e,t,!0)},a.prototype.once=function(e,t){return l(t),this.on(e,c(this,e,t)),this},a.prototype.prependOnceListener=function(e,t){return l(t),this.prependListener(e,c(this,e,t)),this},a.prototype.removeListener=function(e,t){var i,r,n,s,o;if(l(t),void 0===(r=this._events))return this;if(void 0===(i=r[e]))return this;if(i===t||i.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,i.listener||t));else if("function"!=typeof i){for(n=-1,s=i.length-1;s>=0;s--)if(i[s]===t||i[s].listener===t){o=i[s].listener,n=s;break}if(n<0)return this;0===n?i.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(i,n),1===i.length&&(r[e]=i[0]),void 0!==r.removeListener&&this.emit("removeListener",e,o||t)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(e){var t,i,r;if(void 0===(i=this._events))return this;if(void 0===i.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==i[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete i[e]),this;if(0===arguments.length){var n,s=Object.keys(i);for(r=0;r<s.length;++r)"removeListener"!==(n=s[r])&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=i[e]))this.removeListener(e,t);else if(void 0!==t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},a.prototype.listeners=function(e){return p(this,e,!0)},a.prototype.rawListeners=function(e){return p(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):f.call(e,t)},a.prototype.listenerCount=f,a.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(e,t,i){i.d(t,"d",(function(){return r})),i.d(t,"b",(function(){return n})),i.d(t,"a",(function(){return s})),i.d(t,"c",(function(){return o}));var r=function(e,t,i,r,n){this.dts=e,this.pts=t,this.duration=i,this.originalDts=r,this.isSyncPoint=n,this.fileposition=null},n=function(){function e(){this.beginDts=0,this.endDts=0,this.beginPts=0,this.endPts=0,this.originalBeginDts=0,this.originalEndDts=0,this.syncPoints=[],this.firstSample=null,this.lastSample=null}return e.prototype.appendSyncPoint=function(e){e.isSyncPoint=!0,this.syncPoints.push(e)},e}(),s=function(){function e(){this._list=[]}return e.prototype.clear=function(){this._list=[]},e.prototype.appendArray=function(e){var t=this._list;0!==e.length&&(t.length>0&&e[0].originalDts<t[t.length-1].originalDts&&this.clear(),Array.prototype.push.apply(t,e))},e.prototype.getLastSyncPointBeforeDts=function(e){if(0==this._list.length)return null;var t=this._list,i=0,r=t.length-1,n=0,s=0,o=r;for(e<t[0].dts&&(i=0,s=o+1);s<=o;){if((n=s+Math.floor((o-s)/2))===r||e>=t[n].dts&&e<t[n+1].dts){i=n;break}t[n].dts<e?s=n+1:o=n-1}return this._list[i]},e}(),o=function(){function e(e){this._type=e,this._list=[],this._lastAppendLocation=-1}return Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){return this._list.length},enumerable:!1,configurable:!0}),e.prototype.isEmpty=function(){return 0===this._list.length},e.prototype.clear=function(){this._list=[],this._lastAppendLocation=-1},e.prototype._searchNearestSegmentBefore=function(e){var t=this._list;if(0===t.length)return-2;var i=t.length-1,r=0,n=0,s=i,o=0;if(e<t[0].originalBeginDts)return-1;for(;n<=s;){if((r=n+Math.floor((s-n)/2))===i||e>t[r].lastSample.originalDts&&e<t[r+1].originalBeginDts){o=r;break}t[r].originalBeginDts<e?n=r+1:s=r-1}return o},e.prototype._searchNearestSegmentAfter=function(e){return this._searchNearestSegmentBefore(e)+1},e.prototype.append=function(e){var t=this._list,i=e,r=this._lastAppendLocation,n=0;-1!==r&&r<t.length&&i.originalBeginDts>=t[r].lastSample.originalDts&&(r===t.length-1||r<t.length-1&&i.originalBeginDts<t[r+1].originalBeginDts)?n=r+1:t.length>0&&(n=this._searchNearestSegmentBefore(i.originalBeginDts)+1),this._lastAppendLocation=n,this._list.splice(n,0,i)},e.prototype.getLastSegmentBefore=function(e){var t=this._searchNearestSegmentBefore(e);return t>=0?this._list[t]:null},e.prototype.getLastSampleBefore=function(e){var t=this.getLastSegmentBefore(e);return null!=t?t.lastSample:null},e.prototype.getLastSyncPointBefore=function(e){for(var t=this._searchNearestSegmentBefore(e),i=this._list[t].syncPoints;0===i.length&&t>0;)t--,i=this._list[t].syncPoints;return i.length>0?i[i.length-1]:null},e}()},function(e,t,i){var r=function(){function e(){this.mimeType=null,this.duration=null,this.hasAudio=null,this.hasVideo=null,this.audioCodec=null,this.videoCodec=null,this.audioDataRate=null,this.videoDataRate=null,this.audioSampleRate=null,this.audioChannelCount=null,this.width=null,this.height=null,this.fps=null,this.profile=null,this.level=null,this.refFrames=null,this.chromaFormat=null,this.sarNum=null,this.sarDen=null,this.metadata=null,this.segments=null,this.segmentCount=null,this.hasKeyframesIndex=null,this.keyframesIndex=null}return e.prototype.isComplete=function(){var e=!1===this.hasAudio||!0===this.hasAudio&&null!=this.audioCodec&&null!=this.audioSampleRate&&null!=this.audioChannelCount,t=!1===this.hasVideo||!0===this.hasVideo&&null!=this.videoCodec&&null!=this.width&&null!=this.height&&null!=this.fps&&null!=this.profile&&null!=this.level&&null!=this.refFrames&&null!=this.chromaFormat&&null!=this.sarNum&&null!=this.sarDen;return null!=this.mimeType&&e&&t},e.prototype.isSeekable=function(){return!0===this.hasKeyframesIndex},e.prototype.getNearestKeyframe=function(e){if(null==this.keyframesIndex)return null;var t=this.keyframesIndex,i=this._search(t.times,e);return{index:i,milliseconds:t.times[i],fileposition:t.filepositions[i]}},e.prototype._search=function(e,t){var i=0,r=e.length-1,n=0,s=0,o=r;for(t<e[0]&&(i=0,s=o+1);s<=o;){if((n=s+Math.floor((o-s)/2))===r||t>=e[n]&&t<e[n+1]){i=n;break}e[n]<t?s=n+1:o=n-1}return i},e}();t.a=r},function(e,t,i){var r=i(6),n=i.n(r),s=i(0),o=function(){function e(){}return Object.defineProperty(e,"forceGlobalTag",{get:function(){return s.a.FORCE_GLOBAL_TAG},set:function(t){s.a.FORCE_GLOBAL_TAG=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"globalTag",{get:function(){return s.a.GLOBAL_TAG},set:function(t){s.a.GLOBAL_TAG=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableAll",{get:function(){return s.a.ENABLE_VERBOSE&&s.a.ENABLE_DEBUG&&s.a.ENABLE_INFO&&s.a.ENABLE_WARN&&s.a.ENABLE_ERROR},set:function(t){s.a.ENABLE_VERBOSE=t,s.a.ENABLE_DEBUG=t,s.a.ENABLE_INFO=t,s.a.ENABLE_WARN=t,s.a.ENABLE_ERROR=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableDebug",{get:function(){return s.a.ENABLE_DEBUG},set:function(t){s.a.ENABLE_DEBUG=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableVerbose",{get:function(){return s.a.ENABLE_VERBOSE},set:function(t){s.a.ENABLE_VERBOSE=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableInfo",{get:function(){return s.a.ENABLE_INFO},set:function(t){s.a.ENABLE_INFO=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableWarn",{get:function(){return s.a.ENABLE_WARN},set:function(t){s.a.ENABLE_WARN=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableError",{get:function(){return s.a.ENABLE_ERROR},set:function(t){s.a.ENABLE_ERROR=t,e._notifyChange()},enumerable:!1,configurable:!0}),e.getConfig=function(){return{globalTag:s.a.GLOBAL_TAG,forceGlobalTag:s.a.FORCE_GLOBAL_TAG,enableVerbose:s.a.ENABLE_VERBOSE,enableDebug:s.a.ENABLE_DEBUG,enableInfo:s.a.ENABLE_INFO,enableWarn:s.a.ENABLE_WARN,enableError:s.a.ENABLE_ERROR,enableCallback:s.a.ENABLE_CALLBACK}},e.applyConfig=function(e){s.a.GLOBAL_TAG=e.globalTag,s.a.FORCE_GLOBAL_TAG=e.forceGlobalTag,s.a.ENABLE_VERBOSE=e.enableVerbose,s.a.ENABLE_DEBUG=e.enableDebug,s.a.ENABLE_INFO=e.enableInfo,s.a.ENABLE_WARN=e.enableWarn,s.a.ENABLE_ERROR=e.enableError,s.a.ENABLE_CALLBACK=e.enableCallback},e._notifyChange=function(){var t=e.emitter;if(t.listenerCount("change")>0){var i=e.getConfig();t.emit("change",i)}},e.registerListener=function(t){e.emitter.addListener("change",t)},e.removeListener=function(t){e.emitter.removeListener("change",t)},e.addLogListener=function(t){s.a.emitter.addListener("log",t),s.a.emitter.listenerCount("log")>0&&(s.a.ENABLE_CALLBACK=!0,e._notifyChange())},e.removeLogListener=function(t){s.a.emitter.removeListener("log",t),0===s.a.emitter.listenerCount("log")&&(s.a.ENABLE_CALLBACK=!1,e._notifyChange())},e}();o.emitter=new n.a,t.a=o},function(e,t,i){var r=i(6),n=i.n(r),s=i(0),o=i(4),a=i(8);function h(e,t,i){var r=e;if(t+i<r.length){for(;i--;)if(128!=(192&r[++t]))return!1;return!0}return!1}var l,d,u=function(e){for(var t=[],i=e,r=0,n=e.length;r<n;)if(i[r]<128)t.push(String.fromCharCode(i[r])),++r;else{if(i[r]<192);else if(i[r]<224){if(h(i,r,1)&&(s=(31&i[r])<<6|63&i[r+1])>=128){t.push(String.fromCharCode(65535&s)),r+=2;continue}}else if(i[r]<240){if(h(i,r,2)&&(s=(15&i[r])<<12|(63&i[r+1])<<6|63&i[r+2])>=2048&&55296!=(63488&s)){t.push(String.fromCharCode(65535&s)),r+=3;continue}}else if(i[r]<248){var s;if(h(i,r,3)&&(s=(7&i[r])<<18|(63&i[r+1])<<12|(63&i[r+2])<<6|63&i[r+3])>65536&&s<1114112){s-=65536,t.push(String.fromCharCode(s>>>10|55296)),t.push(String.fromCharCode(1023&s|56320)),r+=4;continue}}t.push(String.fromCharCode(65533)),++r}return t.join("")},A=i(3),c=(l=new ArrayBuffer(2),new DataView(l).setInt16(0,256,!0),256===new Int16Array(l)[0]),p=function(){function e(){}return e.parseScriptData=function(t,i,r){var n={};try{var o=e.parseValue(t,i,r),a=e.parseValue(t,i+o.size,r-o.size);n[o.data]=a.data}catch(e){s.a.e("AMF",e.toString())}return n},e.parseObject=function(t,i,r){if(r<3)throw new A.a("Data not enough when parse ScriptDataObject");var n=e.parseString(t,i,r),s=e.parseValue(t,i+n.size,r-n.size),o=s.objectEnd;return{data:{name:n.data,value:s.data},size:n.size+s.size,objectEnd:o}},e.parseVariable=function(t,i,r){return e.parseObject(t,i,r)},e.parseString=function(e,t,i){if(i<2)throw new A.a("Data not enough when parse String");var r=new DataView(e,t,i).getUint16(0,!c);return{data:r>0?u(new Uint8Array(e,t+2,r)):"",size:2+r}},e.parseLongString=function(e,t,i){if(i<4)throw new A.a("Data not enough when parse LongString");var r=new DataView(e,t,i).getUint32(0,!c);return{data:r>0?u(new Uint8Array(e,t+4,r)):"",size:4+r}},e.parseDate=function(e,t,i){if(i<10)throw new A.a("Data size invalid when parse Date");var r=new DataView(e,t,i),n=r.getFloat64(0,!c),s=r.getInt16(8,!c);return{data:new Date(n+=60*s*1e3),size:10}},e.parseValue=function(t,i,r){if(r<1)throw new A.a("Data not enough when parse Value");var n,o=new DataView(t,i,r),a=1,h=o.getUint8(0),l=!1;try{switch(h){case 0:n=o.getFloat64(1,!c),a+=8;break;case 1:n=!!o.getUint8(1),a+=1;break;case 2:var d=e.parseString(t,i+1,r-1);n=d.data,a+=d.size;break;case 3:n={};var u=0;for(9==(16777215&o.getUint32(r-4,!c))&&(u=3);a<r-4;){var p=e.parseObject(t,i+a,r-a-u);if(p.objectEnd)break;n[p.data.name]=p.data.value,a+=p.size}a<=r-3&&9==(16777215&o.getUint32(a-1,!c))&&(a+=3);break;case 8:for(n={},a+=4,u=0,9==(16777215&o.getUint32(r-4,!c))&&(u=3);a<r-8;){var f=e.parseVariable(t,i+a,r-a-u);if(f.objectEnd)break;n[f.data.name]=f.data.value,a+=f.size}a<=r-3&&9==(16777215&o.getUint32(a-1,!c))&&(a+=3);break;case 9:n=void 0,a=1,l=!0;break;case 10:n=[];var m=o.getUint32(1,!c);a+=4;for(var _=0;_<m;_++){var g=e.parseValue(t,i+a,r-a);n.push(g.data),a+=g.size}break;case 11:var y=e.parseDate(t,i+1,r-1);n=y.data,a+=y.size;break;case 12:var v=e.parseString(t,i+1,r-1);n=v.data,a+=v.size;break;default:a=r,s.a.w("AMF","Unsupported AMF value type "+h)}}catch(e){s.a.e("AMF",e.toString())}return{data:n,size:a,objectEnd:l}},e}(),f=function(){function e(e){this.TAG="ExpGolomb",this._buffer=e,this._buffer_index=0,this._total_bytes=e.byteLength,this._total_bits=8*e.byteLength,this._current_word=0,this._current_word_bits_left=0}return e.prototype.destroy=function(){this._buffer=null},e.prototype._fillCurrentWord=function(){var e=this._total_bytes-this._buffer_index;if(e<=0)throw new A.a("ExpGolomb: _fillCurrentWord() but no bytes available");var t=Math.min(4,e),i=new Uint8Array(4);i.set(this._buffer.subarray(this._buffer_index,this._buffer_index+t)),this._current_word=new DataView(i.buffer).getUint32(0,!1),this._buffer_index+=t,this._current_word_bits_left=8*t},e.prototype.readBits=function(e){if(e>32)throw new A.b("ExpGolomb: readBits() bits exceeded max 32bits!");if(e<=this._current_word_bits_left){var t=this._current_word>>>32-e;return this._current_word<<=e,this._current_word_bits_left-=e,t}var i=this._current_word_bits_left?this._current_word:0;i>>>=32-this._current_word_bits_left;var r=e-this._current_word_bits_left;this._fillCurrentWord();var n=Math.min(r,this._current_word_bits_left),s=this._current_word>>>32-n;return this._current_word<<=n,this._current_word_bits_left-=n,i<<n|s},e.prototype.readBool=function(){return 1===this.readBits(1)},e.prototype.readByte=function(){return this.readBits(8)},e.prototype._skipLeadingZero=function(){var e;for(e=0;e<this._current_word_bits_left;e++)if(0!=(this._current_word&2147483648>>>e))return this._current_word<<=e,this._current_word_bits_left-=e,e;return this._fillCurrentWord(),e+this._skipLeadingZero()},e.prototype.readUEG=function(){var e=this._skipLeadingZero();return this.readBits(e+1)-1},e.prototype.readSEG=function(){var e=this.readUEG();return 1&e?e+1>>>1:-1*(e>>>1)},e}(),m=function(){function e(){}return e._ebsp2rbsp=function(e){for(var t=e,i=t.byteLength,r=new Uint8Array(i),n=0,s=0;s<i;s++)s>=2&&3===t[s]&&0===t[s-1]&&0===t[s-2]||(r[n]=t[s],n++);return new Uint8Array(r.buffer,0,n)},e.parseSPS=function(t){for(var i=t.subarray(1,4),r="avc1.",n=0;n<3;n++){var s=i[n].toString(16);s.length<2&&(s="0"+s),r+=s}var o=e._ebsp2rbsp(t),a=new f(o);a.readByte();var h=a.readByte();a.readByte();var l=a.readByte();a.readUEG();var d=e.getProfileString(h),u=e.getLevelString(l),A=1,c=420,p=8,m=8;if((100===h||110===h||122===h||244===h||44===h||83===h||86===h||118===h||128===h||138===h||144===h)&&(3===(A=a.readUEG())&&a.readBits(1),A<=3&&(c=[0,420,422,444][A]),p=a.readUEG()+8,m=a.readUEG()+8,a.readBits(1),a.readBool()))for(var _=3!==A?8:12,g=0;g<_;g++)a.readBool()&&(g<6?e._skipScalingList(a,16):e._skipScalingList(a,64));a.readUEG();var y=a.readUEG();if(0===y)a.readUEG();else if(1===y){a.readBits(1),a.readSEG(),a.readSEG();var v=a.readUEG();for(g=0;g<v;g++)a.readSEG()}var E=a.readUEG();a.readBits(1);var b=a.readUEG(),S=a.readUEG(),w=a.readBits(1);0===w&&a.readBits(1),a.readBits(1);var T=0,R=0,C=0,k=0;a.readBool()&&(T=a.readUEG(),R=a.readUEG(),C=a.readUEG(),k=a.readUEG());var I=1,L=1,O=0,D=!0,B=0,x=0;if(a.readBool()){if(a.readBool()){var M=a.readByte();M>0&&M<16?(I=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][M-1],L=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][M-1]):255===M&&(I=a.readByte()<<8|a.readByte(),L=a.readByte()<<8|a.readByte())}if(a.readBool()&&a.readBool(),a.readBool()&&(a.readBits(4),a.readBool()&&a.readBits(24)),a.readBool()&&(a.readUEG(),a.readUEG()),a.readBool()){var P=a.readBits(32),F=a.readBits(32);D=a.readBool(),O=(B=F)/(x=2*P)}}var U=1;1===I&&1===L||(U=I/L);var N=0,V=0;0===A?(N=1,V=2-w):(N=3===A?1:2,V=(1===A?2:1)*(2-w));var G=16*(b+1),j=16*(S+1)*(2-w);G-=(T+R)*N,j-=(C+k)*V;var W=Math.ceil(G*U);return a.destroy(),a=null,{codec_mimetype:r,profile_idc:h,level_idc:l,profile_string:d,level_string:u,chroma_format_idc:A,bit_depth:p,bit_depth_luma:p,bit_depth_chroma:m,ref_frames:E,chroma_format:c,chroma_format_string:e.getChromaFormatString(c),frame_rate:{fixed:D,fps:O,fps_den:x,fps_num:B},sar_ratio:{width:I,height:L},codec_size:{width:G,height:j},present_size:{width:W,height:j}}},e._skipScalingList=function(e,t){for(var i=8,r=8,n=0;n<t;n++)0!==r&&(r=(i+e.readSEG()+256)%256),i=0===r?i:r},e.getProfileString=function(e){switch(e){case 66:return"Baseline";case 77:return"Main";case 88:return"Extended";case 100:return"High";case 110:return"High10";case 122:return"High422";case 244:return"High444";default:return"Unknown"}},e.getLevelString=function(e){return(e/10).toFixed(1)},e.getChromaFormatString=function(e){switch(e){case 420:return"4:2:0";case 422:return"4:2:2";case 444:return"4:4:4";default:return"Unknown"}},e}(),_=i(5),g=function(){function e(e,t){this.TAG="FLVDemuxer",this._config=t,this._onError=null,this._onMediaInfo=null,this._onMetaDataArrived=null,this._onScriptDataArrived=null,this._onTrackMetadata=null,this._onDataAvailable=null,this._dataOffset=e.dataOffset,this._firstParse=!0,this._dispatch=!1,this._hasAudio=e.hasAudioTrack,this._hasVideo=e.hasVideoTrack,this._hasAudioFlagOverrided=!1,this._hasVideoFlagOverrided=!1,this._audioInitialMetadataDispatched=!1,this._videoInitialMetadataDispatched=!1,this._mediaInfo=new a.a,this._mediaInfo.hasAudio=this._hasAudio,this._mediaInfo.hasVideo=this._hasVideo,this._metadata=null,this._audioMetadata=null,this._videoMetadata=null,this._naluLengthSize=4,this._timestampBase=0,this._timescale=1e3,this._duration=0,this._durationOverrided=!1,this._referenceFrameRate={fixed:!0,fps:23.976,fps_num:23976,fps_den:1e3},this._flvSoundRateTable=[5500,11025,22050,44100,48e3],this._mpegSamplingRates=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],this._mpegAudioV10SampleRateTable=[44100,48e3,32e3,0],this._mpegAudioV20SampleRateTable=[22050,24e3,16e3,0],this._mpegAudioV25SampleRateTable=[11025,12e3,8e3,0],this._mpegAudioL1BitRateTable=[0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1],this._mpegAudioL2BitRateTable=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1],this._mpegAudioL3BitRateTable=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1],this._videoTrack={type:"video",id:1,sequenceNumber:0,samples:[],length:0},this._audioTrack={type:"audio",id:2,sequenceNumber:0,samples:[],length:0},this._littleEndian=function(){var e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),256===new Int16Array(e)[0]}()}return e.prototype.destroy=function(){this._mediaInfo=null,this._metadata=null,this._audioMetadata=null,this._videoMetadata=null,this._videoTrack=null,this._audioTrack=null,this._onError=null,this._onMediaInfo=null,this._onMetaDataArrived=null,this._onScriptDataArrived=null,this._onTrackMetadata=null,this._onDataAvailable=null},e.probe=function(e){var t=new Uint8Array(e),i={match:!1};if(70!==t[0]||76!==t[1]||86!==t[2]||1!==t[3])return i;var r,n,s=(4&t[4])>>>2!=0,o=0!=(1&t[4]),a=(r=t)[n=5]<<24|r[n+1]<<16|r[n+2]<<8|r[n+3];return a<9?i:{match:!0,consumed:a,dataOffset:a,hasAudioTrack:s,hasVideoTrack:o}},e.prototype.bindDataSource=function(e){return e.onDataArrival=this.parseChunks.bind(this),this},Object.defineProperty(e.prototype,"onTrackMetadata",{get:function(){return this._onTrackMetadata},set:function(e){this._onTrackMetadata=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onMediaInfo",{get:function(){return this._onMediaInfo},set:function(e){this._onMediaInfo=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onMetaDataArrived",{get:function(){return this._onMetaDataArrived},set:function(e){this._onMetaDataArrived=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onScriptDataArrived",{get:function(){return this._onScriptDataArrived},set:function(e){this._onScriptDataArrived=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onError",{get:function(){return this._onError},set:function(e){this._onError=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onDataAvailable",{get:function(){return this._onDataAvailable},set:function(e){this._onDataAvailable=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"timestampBase",{get:function(){return this._timestampBase},set:function(e){this._timestampBase=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"overridedDuration",{get:function(){return this._duration},set:function(e){this._durationOverrided=!0,this._duration=e,this._mediaInfo.duration=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"overridedHasAudio",{set:function(e){this._hasAudioFlagOverrided=!0,this._hasAudio=e,this._mediaInfo.hasAudio=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"overridedHasVideo",{set:function(e){this._hasVideoFlagOverrided=!0,this._hasVideo=e,this._mediaInfo.hasVideo=e},enumerable:!1,configurable:!0}),e.prototype.resetMediaInfo=function(){this._mediaInfo=new a.a},e.prototype._isInitialMetadataDispatched=function(){return this._hasAudio&&this._hasVideo?this._audioInitialMetadataDispatched&&this._videoInitialMetadataDispatched:this._hasAudio&&!this._hasVideo?this._audioInitialMetadataDispatched:!(this._hasAudio||!this._hasVideo)&&this._videoInitialMetadataDispatched},e.prototype.parseChunks=function(t,i){if(!(this._onError&&this._onMediaInfo&&this._onTrackMetadata&&this._onDataAvailable))throw new A.a("Flv: onError & onMediaInfo & onTrackMetadata & onDataAvailable callback must be specified");var r=0,n=this._littleEndian;if(0===i){if(!(t.byteLength>13))return 0;r=e.probe(t).dataOffset}for(this._firstParse&&(this._firstParse=!1,i+r!==this._dataOffset&&s.a.w(this.TAG,"First time parsing but chunk byteStart invalid!"),0!==(o=new DataView(t,r)).getUint32(0,!n)&&s.a.w(this.TAG,"PrevTagSize0 !== 0 !!!"),r+=4);r<t.byteLength;){this._dispatch=!0;var o=new DataView(t,r);if(r+11+4>t.byteLength)break;var a=o.getUint8(0),h=16777215&o.getUint32(0,!n);if(r+11+h+4>t.byteLength)break;if(8===a||9===a||18===a){var l=o.getUint8(4),d=o.getUint8(5),u=o.getUint8(6)|d<<8|l<<16|o.getUint8(7)<<24;0!=(16777215&o.getUint32(7,!n))&&s.a.w(this.TAG,"Meet tag which has StreamID != 0!");var c=r+11;switch(a){case 8:this._parseAudioData(t,c,h,u);break;case 9:this._parseVideoData(t,c,h,u,i+r);break;case 18:this._parseScriptData(t,c,h)}var p=o.getUint32(11+h,!n);p!==11+h&&s.a.w(this.TAG,"Invalid PrevTagSize "+p),r+=11+h+4}else s.a.w(this.TAG,"Unsupported tag type "+a+", skipped"),r+=11+h+4}return this._isInitialMetadataDispatched()&&this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack),r},e.prototype._parseScriptData=function(e,t,i){var r=p.parseScriptData(e,t,i);if(r.hasOwnProperty("onMetaData")){if(null==r.onMetaData||"object"!=typeof r.onMetaData)return void s.a.w(this.TAG,"Invalid onMetaData structure!");this._metadata&&s.a.w(this.TAG,"Found another onMetaData tag!"),this._metadata=r;var n=this._metadata.onMetaData;if(this._onMetaDataArrived&&this._onMetaDataArrived(Object.assign({},n)),"boolean"==typeof n.hasAudio&&!1===this._hasAudioFlagOverrided&&(this._hasAudio=n.hasAudio,this._mediaInfo.hasAudio=this._hasAudio),"boolean"==typeof n.hasVideo&&!1===this._hasVideoFlagOverrided&&(this._hasVideo=n.hasVideo,this._mediaInfo.hasVideo=this._hasVideo),"number"==typeof n.audiodatarate&&(this._mediaInfo.audioDataRate=n.audiodatarate),"number"==typeof n.videodatarate&&(this._mediaInfo.videoDataRate=n.videodatarate),"number"==typeof n.width&&(this._mediaInfo.width=n.width),"number"==typeof n.height&&(this._mediaInfo.height=n.height),"number"==typeof n.duration){if(!this._durationOverrided){var o=Math.floor(n.duration*this._timescale);this._duration=o,this._mediaInfo.duration=o}}else this._mediaInfo.duration=0;if("number"==typeof n.framerate){var a=Math.floor(1e3*n.framerate);if(a>0){var h=a/1e3;this._referenceFrameRate.fixed=!0,this._referenceFrameRate.fps=h,this._referenceFrameRate.fps_num=a,this._referenceFrameRate.fps_den=1e3,this._mediaInfo.fps=h}}if("object"==typeof n.keyframes){this._mediaInfo.hasKeyframesIndex=!0;var l=n.keyframes;this._mediaInfo.keyframesIndex=this._parseKeyframesIndex(l),n.keyframes=null}else this._mediaInfo.hasKeyframesIndex=!1;this._dispatch=!1,this._mediaInfo.metadata=n,s.a.v(this.TAG,"Parsed onMetaData"),this._mediaInfo.isComplete()&&this._onMediaInfo(this._mediaInfo)}Object.keys(r).length>0&&this._onScriptDataArrived&&this._onScriptDataArrived(Object.assign({},r))},e.prototype._parseKeyframesIndex=function(e){for(var t=[],i=[],r=1;r<e.times.length;r++){var n=this._timestampBase+Math.floor(1e3*e.times[r]);t.push(n),i.push(e.filepositions[r])}return{times:t,filepositions:i}},e.prototype._parseAudioData=function(e,t,i,r){if(i<=1)s.a.w(this.TAG,"Flv: Invalid audio packet, missing SoundData payload!");else if(!0!==this._hasAudioFlagOverrided||!1!==this._hasAudio){this._littleEndian;var n=new DataView(e,t,i).getUint8(0),o=n>>>4;if(2===o||10===o){var a=0,h=(12&n)>>>2;if(h>=0&&h<=4){a=this._flvSoundRateTable[h];var l=1&n,d=this._audioMetadata,u=this._audioTrack;if(d||(!1===this._hasAudio&&!1===this._hasAudioFlagOverrided&&(this._hasAudio=!0,this._mediaInfo.hasAudio=!0),(d=this._audioMetadata={}).type="audio",d.id=u.id,d.timescale=this._timescale,d.duration=this._duration,d.audioSampleRate=a,d.channelCount=0===l?1:2),10===o){var A=this._parseAACAudioData(e,t+1,i-1);if(null==A)return;if(0===A.packetType){d.config&&s.a.w(this.TAG,"Found another AudioSpecificConfig!");var c=A.data;d.audioSampleRate=c.samplingRate,d.channelCount=c.channelCount,d.codec=c.codec,d.originalCodec=c.originalCodec,d.config=c.config,d.refSampleDuration=1024/d.audioSampleRate*d.timescale,s.a.v(this.TAG,"Parsed AudioSpecificConfig"),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._audioInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata("audio",d),(m=this._mediaInfo).audioCodec=d.originalCodec,m.audioSampleRate=d.audioSampleRate,m.audioChannelCount=d.channelCount,m.hasVideo?null!=m.videoCodec&&(m.mimeType='video/x-flv; codecs="'+m.videoCodec+","+m.audioCodec+'"'):m.mimeType='video/x-flv; codecs="'+m.audioCodec+'"',m.isComplete()&&this._onMediaInfo(m)}else if(1===A.packetType){var p=this._timestampBase+r,f={unit:A.data,length:A.data.byteLength,dts:p,pts:p};u.samples.push(f),u.length+=A.data.length}else s.a.e(this.TAG,"Flv: Unsupported AAC data type "+A.packetType)}else if(2===o){if(!d.codec){var m;if(null==(c=this._parseMP3AudioData(e,t+1,i-1,!0)))return;d.audioSampleRate=c.samplingRate,d.channelCount=c.channelCount,d.codec=c.codec,d.originalCodec=c.originalCodec,d.refSampleDuration=1152/d.audioSampleRate*d.timescale,s.a.v(this.TAG,"Parsed MPEG Audio Frame Header"),this._audioInitialMetadataDispatched=!0,this._onTrackMetadata("audio",d),(m=this._mediaInfo).audioCodec=d.codec,m.audioSampleRate=d.audioSampleRate,m.audioChannelCount=d.channelCount,m.audioDataRate=c.bitRate,m.hasVideo?null!=m.videoCodec&&(m.mimeType='video/x-flv; codecs="'+m.videoCodec+","+m.audioCodec+'"'):m.mimeType='video/x-flv; codecs="'+m.audioCodec+'"',m.isComplete()&&this._onMediaInfo(m)}var g=this._parseMP3AudioData(e,t+1,i-1,!1);if(null==g)return;p=this._timestampBase+r;var y={unit:g,length:g.byteLength,dts:p,pts:p};u.samples.push(y),u.length+=g.length}}else this._onError(_.a.FORMAT_ERROR,"Flv: Invalid audio sample rate idx: "+h)}else this._onError(_.a.CODEC_UNSUPPORTED,"Flv: Unsupported audio codec idx: "+o)}},e.prototype._parseAACAudioData=function(e,t,i){if(!(i<=1)){var r={},n=new Uint8Array(e,t,i);return r.packetType=n[0],0===n[0]?r.data=this._parseAACAudioSpecificConfig(e,t+1,i-1):r.data=n.subarray(1),r}s.a.w(this.TAG,"Flv: Invalid AAC packet, missing AACPacketType or/and Data!")},e.prototype._parseAACAudioSpecificConfig=function(e,t,i){var r,n,s=new Uint8Array(e,t,i),o=null,a=0,h=null;if(a=r=s[0]>>>3,(n=(7&s[0])<<1|s[1]>>>7)<0||n>=this._mpegSamplingRates.length)this._onError(_.a.FORMAT_ERROR,"Flv: AAC invalid sampling frequency index!");else{var l=this._mpegSamplingRates[n],d=(120&s[1])>>>3;if(!(d<0||d>=8)){5===a&&(h=(7&s[1])<<1|s[2]>>>7,s[2]);var u=self.navigator.userAgent.toLowerCase();return-1!==u.indexOf("firefox")?n>=6?(a=5,o=new Array(4),h=n-3):(a=2,o=new Array(2),h=n):-1!==u.indexOf("android")?(a=2,o=new Array(2),h=n):(a=5,h=n,o=new Array(4),n>=6?h=n-3:1===d&&(a=2,o=new Array(2),h=n)),o[0]=a<<3,o[0]|=(15&n)>>>1,o[1]=(15&n)<<7,o[1]|=(15&d)<<3,5===a&&(o[1]|=(15&h)>>>1,o[2]=(1&h)<<7,o[2]|=8,o[3]=0),{config:o,samplingRate:l,channelCount:d,codec:"mp4a.40."+a,originalCodec:"mp4a.40."+r}}this._onError(_.a.FORMAT_ERROR,"Flv: AAC invalid channel configuration")}},e.prototype._parseMP3AudioData=function(e,t,i,r){if(!(i<4)){this._littleEndian;var n=new Uint8Array(e,t,i),o=null;if(r){if(255!==n[0])return;var a=n[1]>>>3&3,h=(6&n[1])>>1,l=(240&n[2])>>>4,d=(12&n[2])>>>2,u=3!=(n[3]>>>6&3)?2:1,A=0,c=0;switch(a){case 0:A=this._mpegAudioV25SampleRateTable[d];break;case 2:A=this._mpegAudioV20SampleRateTable[d];break;case 3:A=this._mpegAudioV10SampleRateTable[d]}switch(h){case 1:l<this._mpegAudioL3BitRateTable.length&&(c=this._mpegAudioL3BitRateTable[l]);break;case 2:l<this._mpegAudioL2BitRateTable.length&&(c=this._mpegAudioL2BitRateTable[l]);break;case 3:l<this._mpegAudioL1BitRateTable.length&&(c=this._mpegAudioL1BitRateTable[l])}o={bitRate:c,samplingRate:A,channelCount:u,codec:"mp3",originalCodec:"mp3"}}else o=n;return o}s.a.w(this.TAG,"Flv: Invalid MP3 packet, header missing!")},e.prototype._parseVideoData=function(e,t,i,r,n){if(i<=1)s.a.w(this.TAG,"Flv: Invalid video packet, missing VideoData payload!");else if(!0!==this._hasVideoFlagOverrided||!1!==this._hasVideo){var o=new Uint8Array(e,t,i)[0],a=(240&o)>>>4,h=15&o;7===h?this._parseAVCVideoPacket(e,t+1,i-1,r,n,a):this._onError(_.a.CODEC_UNSUPPORTED,"Flv: Unsupported codec in video frame: "+h)}},e.prototype._parseAVCVideoPacket=function(e,t,i,r,n,o){if(i<4)s.a.w(this.TAG,"Flv: Invalid AVC packet, missing AVCPacketType or/and CompositionTime");else{var a=this._littleEndian,h=new DataView(e,t,i),l=h.getUint8(0),d=(16777215&h.getUint32(0,!a))<<8>>8;if(0===l)this._parseAVCDecoderConfigurationRecord(e,t+4,i-4);else if(1===l)this._parseAVCVideoData(e,t+4,i-4,r,n,o,d);else if(2!==l)return void this._onError(_.a.FORMAT_ERROR,"Flv: Invalid video packet type "+l)}},e.prototype._parseAVCDecoderConfigurationRecord=function(e,t,i){if(i<7)s.a.w(this.TAG,"Flv: Invalid AVCDecoderConfigurationRecord, lack of data!");else{var r=this._videoMetadata,n=this._videoTrack,o=this._littleEndian,a=new DataView(e,t,i);r?void 0!==r.avcc&&s.a.w(this.TAG,"Found another AVCDecoderConfigurationRecord!"):(!1===this._hasVideo&&!1===this._hasVideoFlagOverrided&&(this._hasVideo=!0,this._mediaInfo.hasVideo=!0),(r=this._videoMetadata={}).type="video",r.id=n.id,r.timescale=this._timescale,r.duration=this._duration);var h=a.getUint8(0),l=a.getUint8(1);if(a.getUint8(2),a.getUint8(3),1===h&&0!==l)if(this._naluLengthSize=1+(3&a.getUint8(4)),3===this._naluLengthSize||4===this._naluLengthSize){var d=31&a.getUint8(5);if(0!==d){d>1&&s.a.w(this.TAG,"Flv: Strange AVCDecoderConfigurationRecord: SPS Count = "+d);for(var u=6,A=0;A<d;A++){var c=a.getUint16(u,!o);if(u+=2,0!==c){var p=new Uint8Array(e,t+u,c);u+=c;var f=m.parseSPS(p);if(0===A){r.codecWidth=f.codec_size.width,r.codecHeight=f.codec_size.height,r.presentWidth=f.present_size.width,r.presentHeight=f.present_size.height,r.profile=f.profile_string,r.level=f.level_string,r.bitDepth=f.bit_depth,r.chromaFormat=f.chroma_format,r.sarRatio=f.sar_ratio,r.frameRate=f.frame_rate,!1!==f.frame_rate.fixed&&0!==f.frame_rate.fps_num&&0!==f.frame_rate.fps_den||(r.frameRate=this._referenceFrameRate);var g=r.frameRate.fps_den,y=r.frameRate.fps_num;r.refSampleDuration=r.timescale*(g/y);for(var v=p.subarray(1,4),E="avc1.",b=0;b<3;b++){var S=v[b].toString(16);S.length<2&&(S="0"+S),E+=S}r.codec=E;var w=this._mediaInfo;w.width=r.codecWidth,w.height=r.codecHeight,w.fps=r.frameRate.fps,w.profile=r.profile,w.level=r.level,w.refFrames=f.ref_frames,w.chromaFormat=f.chroma_format_string,w.sarNum=r.sarRatio.width,w.sarDen=r.sarRatio.height,w.videoCodec=E,w.hasAudio?null!=w.audioCodec&&(w.mimeType='video/x-flv; codecs="'+w.videoCodec+","+w.audioCodec+'"'):w.mimeType='video/x-flv; codecs="'+w.videoCodec+'"',w.isComplete()&&this._onMediaInfo(w)}}}var T=a.getUint8(u);if(0!==T){for(T>1&&s.a.w(this.TAG,"Flv: Strange AVCDecoderConfigurationRecord: PPS Count = "+T),u++,A=0;A<T;A++)c=a.getUint16(u,!o),u+=2,0!==c&&(u+=c);r.avcc=new Uint8Array(i),r.avcc.set(new Uint8Array(e,t,i),0),s.a.v(this.TAG,"Parsed AVCDecoderConfigurationRecord"),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._videoInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata("video",r)}else this._onError(_.a.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord: No PPS")}else this._onError(_.a.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord: No SPS")}else this._onError(_.a.FORMAT_ERROR,"Flv: Strange NaluLengthSizeMinusOne: "+(this._naluLengthSize-1));else this._onError(_.a.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord")}},e.prototype._parseAVCVideoData=function(e,t,i,r,n,o,a){for(var h=this._littleEndian,l=new DataView(e,t,i),d=[],u=0,A=0,c=this._naluLengthSize,p=this._timestampBase+r,f=1===o;A<i;){if(A+4>=i){s.a.w(this.TAG,"Malformed Nalu near timestamp "+p+", offset = "+A+", dataSize = "+i);break}var m=l.getUint32(A,!h);if(3===c&&(m>>>=8),m>i-c)return void s.a.w(this.TAG,"Malformed Nalus near timestamp "+p+", NaluSize > DataSize!");var _=31&l.getUint8(A+c);5===_&&(f=!0);var g=new Uint8Array(e,t+A,c+m),y={type:_,data:g};d.push(y),u+=g.byteLength,A+=c+m}if(d.length){var v=this._videoTrack,E={units:d,length:u,isKeyframe:f,dts:p,cts:a,pts:p+a};f&&(E.fileposition=n),v.samples.push(E),v.length+=u}},e}(),y=function(){function e(){}return e.prototype.destroy=function(){this.onError=null,this.onMediaInfo=null,this.onMetaDataArrived=null,this.onTrackMetadata=null,this.onDataAvailable=null,this.onTimedID3Metadata=null,this.onPESPrivateData=null,this.onPESPrivateDataDescriptor=null},e}(),v=function(){this.program_pmt_pid={}};!function(e){e[e.kMPEG1Audio=3]="kMPEG1Audio",e[e.kMPEG2Audio=4]="kMPEG2Audio",e[e.kPESPrivateData=6]="kPESPrivateData",e[e.kADTSAAC=15]="kADTSAAC",e[e.kID3=21]="kID3",e[e.kH264=27]="kH264",e[e.kH265=36]="kH265"}(d||(d={}));var E,b=function(){this.pid_stream_type={},this.common_pids={h264:void 0,adts_aac:void 0},this.pes_private_data_pids={},this.timed_id3_pids={}},S=function(){},w=function(){this.slices=[],this.total_length=0,this.file_position=0};!function(e){e[e.kUnspecified=0]="kUnspecified",e[e.kSliceNonIDR=1]="kSliceNonIDR",e[e.kSliceDPA=2]="kSliceDPA",e[e.kSliceDPB=3]="kSliceDPB",e[e.kSliceDPC=4]="kSliceDPC",e[e.kSliceIDR=5]="kSliceIDR",e[e.kSliceSEI=6]="kSliceSEI",e[e.kSliceSPS=7]="kSliceSPS",e[e.kSlicePPS=8]="kSlicePPS",e[e.kSliceAUD=9]="kSliceAUD",e[e.kEndOfSequence=10]="kEndOfSequence",e[e.kEndOfStream=11]="kEndOfStream",e[e.kFiller=12]="kFiller",e[e.kSPSExt=13]="kSPSExt",e[e.kReserved0=14]="kReserved0"}(E||(E={}));var T,R,C=function(){},k=function(e){var t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)},I=function(){function e(e){this.TAG="H264AnnexBParser",this.current_startcode_offset_=0,this.eof_flag_=!1,this.data_=e,this.current_startcode_offset_=this.findNextStartCodeOffset(0),this.eof_flag_&&s.a.e(this.TAG,"Could not found H264 startcode until payload end!")}return e.prototype.findNextStartCodeOffset=function(e){for(var t=e,i=this.data_;;){if(t+3>=i.byteLength)return this.eof_flag_=!0,i.byteLength;var r=i[t+0]<<24|i[t+1]<<16|i[t+2]<<8|i[t+3],n=i[t+0]<<16|i[t+1]<<8|i[t+2];if(1===r||1===n)return t;t++}},e.prototype.readNextNaluPayload=function(){for(var e=this.data_,t=null;null==t&&!this.eof_flag_;){var i=this.current_startcode_offset_,r=31&e[i+=1==(e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3])?4:3],n=(128&e[i])>>>7,s=this.findNextStartCodeOffset(i);if(this.current_startcode_offset_=s,!(r>=E.kReserved0)&&0===n){var o=e.subarray(i,s);(t=new C).type=r,t.data=o}}return t},e}(),L=function(){function e(e,t,i){var r=8+e.byteLength+1+2+t.byteLength,n=!1;66!==e[3]&&77!==e[3]&&88!==e[3]&&(n=!0,r+=4);var s=this.data=new Uint8Array(r);s[0]=1,s[1]=e[1],s[2]=e[2],s[3]=e[3],s[4]=255,s[5]=225;var o=e.byteLength;s[6]=o>>>8,s[7]=255&o;var a=8;s.set(e,8),s[a+=o]=1;var h=t.byteLength;s[a+1]=h>>>8,s[a+2]=255&h,s.set(t,a+3),a+=3+h,n&&(s[a]=252|i.chroma_format_idc,s[a+1]=248|i.bit_depth_luma-8,s[a+2]=248|i.bit_depth_chroma-8,s[a+3]=0,a+=4)}return e.prototype.getData=function(){return this.data},e}();!function(e){e[e.kNull=0]="kNull",e[e.kAACMain=1]="kAACMain",e[e.kAAC_LC=2]="kAAC_LC",e[e.kAAC_SSR=3]="kAAC_SSR",e[e.kAAC_LTP=4]="kAAC_LTP",e[e.kAAC_SBR=5]="kAAC_SBR",e[e.kAAC_Scalable=6]="kAAC_Scalable",e[e.kLayer1=32]="kLayer1",e[e.kLayer2=33]="kLayer2",e[e.kLayer3=34]="kLayer3"}(T||(T={})),function(e){e[e.k96000Hz=0]="k96000Hz",e[e.k88200Hz=1]="k88200Hz",e[e.k64000Hz=2]="k64000Hz",e[e.k48000Hz=3]="k48000Hz",e[e.k44100Hz=4]="k44100Hz",e[e.k32000Hz=5]="k32000Hz",e[e.k24000Hz=6]="k24000Hz",e[e.k22050Hz=7]="k22050Hz",e[e.k16000Hz=8]="k16000Hz",e[e.k12000Hz=9]="k12000Hz",e[e.k11025Hz=10]="k11025Hz",e[e.k8000Hz=11]="k8000Hz",e[e.k7350Hz=12]="k7350Hz"}(R||(R={}));var O,D=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],B=function(){},x=function(){function e(e){this.TAG="AACADTSParser",this.data_=e,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&s.a.e(this.TAG,"Could not found ADTS syncword until payload end")}return e.prototype.findNextSyncwordOffset=function(e){for(var t=e,i=this.data_;;){if(t+7>=i.byteLength)return this.eof_flag_=!0,i.byteLength;if(4095==(i[t+0]<<8|i[t+1])>>>4)return t;t++}},e.prototype.readNextAACFrame=function(){for(var e=this.data_,t=null;null==t&&!this.eof_flag_;){var i=this.current_syncword_offset_,r=(8&e[i+1])>>>3,n=(6&e[i+1])>>>1,s=1&e[i+1],o=(192&e[i+2])>>>6,a=(60&e[i+2])>>>2,h=(1&e[i+2])<<2|(192&e[i+3])>>>6,l=(3&e[i+3])<<11|e[i+4]<<3|(224&e[i+5])>>>5;if(e[i+6],i+l>this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}var d=1===s?7:9,u=l-d;i+=d;var A=this.findNextSyncwordOffset(i+u);if(this.current_syncword_offset_=A,(0===r||1===r)&&0===n){var c=e.subarray(i,i+u);(t=new B).audio_object_type=o+1,t.sampling_freq_index=a,t.sampling_frequency=D[a],t.channel_config=h,t.data=c}}return t},e.prototype.hasIncompleteData=function(){return this.has_last_incomplete_data},e.prototype.getIncompleteData=function(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null},e}(),M=function(e){var t=null,i=e.audio_object_type,r=e.audio_object_type,n=e.sampling_freq_index,s=e.channel_config,o=0,a=navigator.userAgent.toLowerCase();-1!==a.indexOf("firefox")?n>=6?(r=5,t=new Array(4),o=n-3):(r=2,t=new Array(2),o=n):-1!==a.indexOf("android")?(r=2,t=new Array(2),o=n):(r=5,o=n,t=new Array(4),n>=6?o=n-3:1===s&&(r=2,t=new Array(2),o=n)),t[0]=r<<3,t[0]|=(15&n)>>>1,t[1]=(15&n)<<7,t[1]|=(15&s)<<3,5===r&&(t[1]|=(15&o)>>>1,t[2]=(1&o)<<7,t[2]|=8,t[3]=0),this.config=t,this.sampling_rate=D[n],this.channel_count=s,this.codec_mimetype="mp4a.40."+r,this.original_codec_mimetype="mp4a.40."+i},P=function(){},F=function(){},U=(O=function(e,t){return(O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}O(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),N=function(e){function t(t,i){var r=e.call(this)||this;return r.TAG="TSDemuxer",r.first_parse_=!0,r.media_info_=new a.a,r.timescale_=90,r.duration_=0,r.current_pmt_pid_=-1,r.program_pmt_map_={},r.pes_slice_queues_={},r.video_metadata_={sps:void 0,pps:void 0,sps_details:void 0},r.audio_metadata_={audio_object_type:void 0,sampling_freq_index:void 0,sampling_frequency:void 0,channel_config:void 0},r.aac_last_sample_pts_=void 0,r.aac_last_incomplete_data_=null,r.has_video_=!1,r.has_audio_=!1,r.video_init_segment_dispatched_=!1,r.audio_init_segment_dispatched_=!1,r.video_metadata_changed_=!1,r.audio_metadata_changed_=!1,r.video_track_={type:"video",id:1,sequenceNumber:0,samples:[],length:0},r.audio_track_={type:"audio",id:2,sequenceNumber:0,samples:[],length:0},r.ts_packet_size_=t.ts_packet_size,r.sync_offset_=t.sync_offset,r.config_=i,r}return U(t,e),t.prototype.destroy=function(){this.media_info_=null,this.pes_slice_queues_=null,this.video_metadata_=null,this.audio_metadata_=null,this.aac_last_incomplete_data_=null,this.video_track_=null,this.audio_track_=null,e.prototype.destroy.call(this)},t.probe=function(e){var t=new Uint8Array(e),i=-1,r=188;if(t.byteLength<=3*r)return s.a.e("TSDemuxer","Probe data "+t.byteLength+" bytes is too few for judging MPEG-TS stream format!"),{match:!1};for(;-1===i;){for(var n=Math.min(1e3,t.byteLength-3*r),o=0;o<n;){if(71===t[o]&&71===t[o+r]&&71===t[o+2*r]){i=o;break}o++}if(-1===i)if(188===r)r=192;else{if(192!==r)break;r=204}}return-1===i?{match:!1}:(192===r&&i>=4?(s.a.v("TSDemuxer","ts_packet_size = 192, m2ts mode"),i-=4):204===r&&s.a.v("TSDemuxer","ts_packet_size = 204, RS encoded MPEG2-TS stream"),{match:!0,consumed:0,ts_packet_size:r,sync_offset:i})},t.prototype.bindDataSource=function(e){return e.onDataArrival=this.parseChunks.bind(this),this},t.prototype.resetMediaInfo=function(){this.media_info_=new a.a},t.prototype.parseChunks=function(e,t){if(!(this.onError&&this.onMediaInfo&&this.onTrackMetadata&&this.onDataAvailable))throw new A.a("onError & onMediaInfo & onTrackMetadata & onDataAvailable callback must be specified");var i=0;for(this.first_parse_&&(this.first_parse_=!1,i=this.sync_offset_);i+this.ts_packet_size_<=e.byteLength;){var r=t+i;192===this.ts_packet_size_&&(i+=4);var n=new Uint8Array(e,i,188),o=n[0];if(71!==o){s.a.e(this.TAG,"sync_byte = "+o+", not 0x47");break}var a=(64&n[1])>>>6,h=(n[1],(31&n[1])<<8|n[2]),l=(48&n[3])>>>4,d=15&n[3],u={},c=4;if(2==l||3==l){var p=n[4];if(5+p===188){i+=188,204===this.ts_packet_size_&&(i+=16);continue}p>0&&(u=this.parseAdaptationField(e,i+4,1+p)),c=5+p}if(1==l||3==l)if(0===h||h===this.current_pmt_pid_){a&&(c+=1+n[c]);var f=188-c;0===h?this.parsePAT(e,i+c,f,{payload_unit_start_indicator:a,continuity_conunter:d}):this.parsePMT(e,i+c,f,{payload_unit_start_indicator:a,continuity_conunter:d})}else if(null!=this.pmt_&&null!=this.pmt_.pid_stream_type[h]){f=188-c;var m=this.pmt_.pid_stream_type[h];h!==this.pmt_.common_pids.h264&&h!==this.pmt_.common_pids.adts_aac&&!0!==this.pmt_.pes_private_data_pids[h]&&!0!==this.pmt_.timed_id3_pids[h]||this.handlePESSlice(e,i+c,f,{pid:h,stream_type:m,file_position:r,payload_unit_start_indicator:a,continuity_conunter:d,random_access_indicator:u.random_access_indicator})}i+=188,204===this.ts_packet_size_&&(i+=16)}return this.dispatchAudioVideoMediaSegment(),i},t.prototype.parseAdaptationField=function(e,t,i){var r=new Uint8Array(e,t,i),n=r[0];return n>0?n>183?(s.a.w(this.TAG,"Illegal adaptation_field_length: "+n),{}):{discontinuity_indicator:(128&r[1])>>>7,random_access_indicator:(64&r[1])>>>6,elementary_stream_priority_indicator:(32&r[1])>>>5}:{}},t.prototype.parsePAT=function(e,t,i,r){var n=new Uint8Array(e,t,i),o=n[0];if(0===o){var a=(15&n[1])<<8|n[2],h=(n[3],n[4],(62&n[5])>>>1),l=1&n[5],d=n[6],u=(n[7],null);if(1===l&&0===d)(u=new v).version_number=h;else if(null==(u=this.pat_))return;for(var A=a-5-4,c=-1,p=-1,f=8;f<8+A;f+=4){var m=n[f]<<8|n[f+1],_=(31&n[f+2])<<8|n[f+3];0===m?u.network_pid=_:(u.program_pmt_pid[m]=_,-1===c&&(c=m),-1===p&&(p=_))}1===l&&0===d&&(null==this.pat_&&s.a.v(this.TAG,"Parsed first PAT: "+JSON.stringify(u)),this.pat_=u,this.current_program_=c,this.current_pmt_pid_=p)}else s.a.e(this.TAG,"parsePAT: table_id "+o+" is not corresponded to PAT!")},t.prototype.parsePMT=function(e,t,i,r){var n=new Uint8Array(e,t,i),o=n[0];if(2===o){var a=(15&n[1])<<8|n[2],h=n[3]<<8|n[4],l=(62&n[5])>>>1,u=1&n[5],A=n[6],c=(n[7],null);if(1===u&&0===A)(c=new b).program_number=h,c.version_number=l,this.program_pmt_map_[h]=c;else if(null==(c=this.program_pmt_map_[h]))return;n[8],n[9];for(var p=(15&n[10])<<8|n[11],f=12+p,m=a-9-p-4,_=f;_<f+m;){var g=n[_],y=(31&n[_+1])<<8|n[_+2],v=(15&n[_+3])<<8|n[_+4];if(c.pid_stream_type[y]=g,g!==d.kH264||c.common_pids.h264)if(g!==d.kADTSAAC||c.common_pids.adts_aac)if(g===d.kPESPrivateData){if(c.pes_private_data_pids[y]=!0,v>0){var E=n.subarray(_+5,_+5+v);this.dispatchPESPrivateDataDescriptor(y,g,E)}}else g===d.kID3&&(c.timed_id3_pids[y]=!0);else c.common_pids.adts_aac=y;else c.common_pids.h264=y;_+=5+v}h===this.current_program_&&(null==this.pmt_&&s.a.v(this.TAG,"Parsed first PMT: "+JSON.stringify(c)),this.pmt_=c,c.common_pids.h264&&(this.has_video_=!0),c.common_pids.adts_aac&&(this.has_audio_=!0))}else s.a.e(this.TAG,"parsePMT: table_id "+o+" is not corresponded to PMT!")},t.prototype.handlePESSlice=function(e,t,i,r){var n=new Uint8Array(e,t,i),o=n[0]<<16|n[1]<<8|n[2];if(n[3],n[4],n[5],r.payload_unit_start_indicator){if(1!==o)return void s.a.e(this.TAG,"handlePESSlice: packet_start_code_prefix should be 1 but with value "+o);var a=this.pes_slice_queues_[r.pid];if(a){for(var h=new Uint8Array(a.total_length),l=0,d=0;l<a.slices.length;l++){var u=a.slices[l];h.set(u,d),d+=u.byteLength}a.slices=[],a.total_length=0;var A=new S;A.pid=r.pid,A.data=h,A.stream_type=r.stream_type,A.file_position=a.file_position,A.random_access_indicator=a.random_access_indicator,this.parsePES(A)}this.pes_slice_queues_[r.pid]=new w,this.pes_slice_queues_[r.pid].file_position=r.file_position,this.pes_slice_queues_[r.pid].random_access_indicator=r.random_access_indicator}if(null!=this.pes_slice_queues_[r.pid]){var c=this.pes_slice_queues_[r.pid];c.slices.push(n),c.total_length+=n.byteLength}},t.prototype.parsePES=function(e){var t=e.data,i=t[0]<<16|t[1]<<8|t[2],r=t[3],n=t[4]<<8|t[5];if(1===i)if(188!==r&&190!==r&&191!==r&&240!==r&&241!==r&&255!==r&&242!==r&&248!==r){t[6];var o=(192&t[7])>>>6,a=t[8],h=void 0,l=void 0;2!==o&&3!==o||(h=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2,l=3===o?536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2:h);var u=9+a,A=void 0;if(0!==n){if(n<3+a)return void s.a.v(this.TAG,"Malformed PES: PES_packet_length < 3 + PES_header_data_length");A=n-3-a}else A=t.byteLength-u;var c=t.subarray(u,u+A);switch(e.stream_type){case d.kMPEG1Audio:case d.kMPEG2Audio:break;case d.kPESPrivateData:this.parsePESPrivateDataPayload(c,h,l,e.pid,r);break;case d.kADTSAAC:this.parseAACPayload(c,h);break;case d.kID3:this.parseTimedID3MetadataPayload(c,h,l,e.pid,r);break;case d.kH264:this.parseH264Payload(c,h,l,e.file_position,e.random_access_indicator);case d.kH265:}}else 188!==r&&191!==r&&240!==r&&241!==r&&255!==r&&242!==r&&248!==r||e.stream_type!==d.kPESPrivateData||(u=6,A=void 0,A=0!==n?n:t.byteLength-u,c=t.subarray(u,u+A),this.parsePESPrivateDataPayload(c,void 0,void 0,e.pid,r));else s.a.e(this.TAG,"parsePES: packet_start_code_prefix should be 1 but with value "+i)},t.prototype.parseH264Payload=function(e,t,i,r,n){for(var o=new I(e),a=null,h=[],l=0,d=!1;null!=(a=o.readNextNaluPayload());){var u=new k(a);if(u.type===E.kSliceSPS){var A=m.parseSPS(a.data);this.video_init_segment_dispatched_?!0===this.detectVideoMetadataChange(u,A)&&(s.a.v(this.TAG,"H264: Critical h264 metadata has been changed, attempt to re-generate InitSegment"),this.video_metadata_changed_=!0,this.video_metadata_={sps:u,pps:void 0,sps_details:A}):(this.video_metadata_.sps=u,this.video_metadata_.sps_details=A)}else u.type===E.kSlicePPS?this.video_init_segment_dispatched_&&!this.video_metadata_changed_||(this.video_metadata_.pps=u,this.video_metadata_.sps&&this.video_metadata_.pps&&(this.video_metadata_changed_&&this.dispatchVideoMediaSegment(),this.dispatchVideoInitSegment())):(u.type===E.kSliceIDR||u.type===E.kSliceNonIDR&&1===n)&&(d=!0);this.video_init_segment_dispatched_&&(h.push(u),l+=u.data.byteLength)}var c=Math.floor(t/this.timescale_),p=Math.floor(i/this.timescale_);if(h.length){var f=this.video_track_,_={units:h,length:l,isKeyframe:d,dts:p,pts:c,cts:c-p,file_position:r};f.samples.push(_),f.length+=l}},t.prototype.detectVideoMetadataChange=function(e,t){if(e.data.byteLength!==this.video_metadata_.sps.data.byteLength)return!0;if(t.codec_mimetype!==this.video_metadata_.sps_details.codec_mimetype)return s.a.v(this.TAG,"H264: Codec mimeType changed from "+this.video_metadata_.sps_details.codec_mimetype+" to "+t.codec_mimetype),!0;if(t.codec_size.width!==this.video_metadata_.sps_details.codec_size.width||t.codec_size.height!==this.video_metadata_.sps_details.codec_size.height){var i=this.video_metadata_.sps_details.codec_size,r=t.codec_size;return s.a.v(this.TAG,"H264: Coded Resolution changed from "+i.width+"x"+i.height+" to "+r.width+"x"+r.height),!0}return t.present_size.width!==this.video_metadata_.sps_details.present_size.width&&(s.a.v(this.TAG,"H264: Present resolution width changed from "+this.video_metadata_.sps_details.present_size.width+" to "+t.present_size.width),!0)},t.prototype.isInitSegmentDispatched=function(){return this.has_video_&&this.has_audio_?this.video_init_segment_dispatched_&&this.audio_init_segment_dispatched_:this.has_video_&&!this.has_audio_?this.video_init_segment_dispatched_:!(this.has_video_||!this.has_audio_)&&this.audio_init_segment_dispatched_},t.prototype.dispatchVideoInitSegment=function(){var e=this.video_metadata_.sps_details,t={type:"video"};t.id=this.video_track_.id,t.timescale=1e3,t.duration=this.duration_,t.codecWidth=e.codec_size.width,t.codecHeight=e.codec_size.height,t.presentWidth=e.present_size.width,t.presentHeight=e.present_size.height,t.profile=e.profile_string,t.level=e.level_string,t.bitDepth=e.bit_depth,t.chromaFormat=e.chroma_format,t.sarRatio=e.sar_ratio,t.frameRate=e.frame_rate;var i=t.frameRate.fps_den,r=t.frameRate.fps_num;t.refSampleDuration=i/r*1e3,t.codec=e.codec_mimetype;var n=this.video_metadata_.sps.data.subarray(4),o=this.video_metadata_.pps.data.subarray(4),a=new L(n,o,e);t.avcc=a.getData(),0==this.video_init_segment_dispatched_&&s.a.v(this.TAG,"Generated first AVCDecoderConfigurationRecord for mimeType: "+t.codec),this.onTrackMetadata("video",t),this.video_init_segment_dispatched_=!0,this.video_metadata_changed_=!1;var h=this.media_info_;h.hasVideo=!0,h.width=t.codecWidth,h.height=t.codecHeight,h.fps=t.frameRate.fps,h.profile=t.profile,h.level=t.level,h.refFrames=e.ref_frames,h.chromaFormat=e.chroma_format_string,h.sarNum=t.sarRatio.width,h.sarDen=t.sarRatio.height,h.videoCodec=t.codec,h.hasAudio&&h.audioCodec?h.mimeType='video/mp2t; codecs="'+h.videoCodec+","+h.audioCodec+'"':h.mimeType='video/mp2t; codecs="'+h.videoCodec+'"',h.isComplete()&&this.onMediaInfo(h)},t.prototype.dispatchVideoMediaSegment=function(){this.isInitSegmentDispatched()&&this.video_track_.length&&this.onDataAvailable(null,this.video_track_)},t.prototype.dispatchAudioMediaSegment=function(){this.isInitSegmentDispatched()&&this.audio_track_.length&&this.onDataAvailable(this.audio_track_,null)},t.prototype.dispatchAudioVideoMediaSegment=function(){this.isInitSegmentDispatched()&&(this.audio_track_.length||this.video_track_.length)&&this.onDataAvailable(this.audio_track_,this.video_track_)},t.prototype.parseAACPayload=function(e,t){if(!this.has_video_||this.video_init_segment_dispatched_){if(this.aac_last_incomplete_data_){var i=new Uint8Array(e.byteLength+this.aac_last_incomplete_data_.byteLength);i.set(this.aac_last_incomplete_data_,0),i.set(e,this.aac_last_incomplete_data_.byteLength),e=i}var r,n;if(null!=t)n=t/this.timescale_;else{if(null==this.aac_last_sample_pts_)return void s.a.w(this.TAG,"AAC: Unknown pts");r=1024/this.audio_metadata_.sampling_frequency*1e3,n=this.aac_last_sample_pts_+r}if(this.aac_last_incomplete_data_&&this.aac_last_sample_pts_){r=1024/this.audio_metadata_.sampling_frequency*1e3;var o=this.aac_last_sample_pts_+r;Math.abs(o-n)>1&&(s.a.w(this.TAG,"AAC: Detected pts overlapped, expected: "+o+"ms, PES pts: "+n+"ms"),n=o)}for(var a,h=new x(e),l=null,d=n;null!=(l=h.readNextAACFrame());){r=1024/l.sampling_frequency*1e3,0==this.audio_init_segment_dispatched_?(this.audio_metadata_.audio_object_type=l.audio_object_type,this.audio_metadata_.sampling_freq_index=l.sampling_freq_index,this.audio_metadata_.sampling_frequency=l.sampling_frequency,this.audio_metadata_.channel_config=l.channel_config,this.dispatchAudioInitSegment(l)):this.detectAudioMetadataChange(l)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(l)),a=d;var u=Math.floor(d),A={unit:l.data,length:l.data.byteLength,pts:u,dts:u};this.audio_track_.samples.push(A),this.audio_track_.length+=l.data.byteLength,d+=r}h.hasIncompleteData()&&(this.aac_last_incomplete_data_=h.getIncompleteData()),a&&(this.aac_last_sample_pts_=a)}},t.prototype.detectAudioMetadataChange=function(e){return e.audio_object_type!==this.audio_metadata_.audio_object_type?(s.a.v(this.TAG,"AAC: AudioObjectType changed from "+this.audio_metadata_.audio_object_type+" to "+e.audio_object_type),!0):e.sampling_freq_index!==this.audio_metadata_.sampling_freq_index?(s.a.v(this.TAG,"AAC: SamplingFrequencyIndex changed from "+this.audio_metadata_.sampling_freq_index+" to "+e.sampling_freq_index),!0):e.channel_config!==this.audio_metadata_.channel_config&&(s.a.v(this.TAG,"AAC: Channel configuration changed from "+this.audio_metadata_.channel_config+" to "+e.channel_config),!0)},t.prototype.dispatchAudioInitSegment=function(e){var t=new M(e),i={type:"audio"};i.id=this.audio_track_.id,i.timescale=1e3,i.duration=this.duration_,i.audioSampleRate=t.sampling_rate,i.channelCount=t.channel_count,i.codec=t.codec_mimetype,i.originalCodec=t.original_codec_mimetype,i.config=t.config,i.refSampleDuration=1024/i.audioSampleRate*i.timescale,0==this.audio_init_segment_dispatched_&&s.a.v(this.TAG,"Generated first AudioSpecificConfig for mimeType: "+i.codec),this.onTrackMetadata("audio",i),this.audio_init_segment_dispatched_=!0,this.video_metadata_changed_=!1;var r=this.media_info_;r.hasAudio=!0,r.audioCodec=i.originalCodec,r.audioSampleRate=i.audioSampleRate,r.audioChannelCount=i.channelCount,r.hasVideo&&r.videoCodec?r.mimeType='video/mp2t; codecs="'+r.videoCodec+","+r.audioCodec+'"':r.mimeType='video/mp2t; codecs="'+r.audioCodec+'"',r.isComplete()&&this.onMediaInfo(r)},t.prototype.dispatchPESPrivateDataDescriptor=function(e,t,i){var r=new F;r.pid=e,r.stream_type=t,r.descriptor=i,this.onPESPrivateDataDescriptor&&this.onPESPrivateDataDescriptor(r)},t.prototype.parsePESPrivateDataPayload=function(e,t,i,r,n){var s=new P;if(s.pid=r,s.stream_id=n,s.len=e.byteLength,s.data=e,null!=t){var o=Math.floor(t/this.timescale_);s.pts=o}else s.nearest_pts=this.aac_last_sample_pts_;if(null!=i){var a=Math.floor(i/this.timescale_);s.dts=a}this.onPESPrivateData&&this.onPESPrivateData(s)},t.prototype.parseTimedID3MetadataPayload=function(e,t,i,r,n){var s=new P;if(s.pid=r,s.stream_id=n,s.len=e.byteLength,s.data=e,null!=t){var o=Math.floor(t/this.timescale_);s.pts=o}if(null!=i){var a=Math.floor(i/this.timescale_);s.dts=a}this.onTimedID3Metadata&&this.onTimedID3Metadata(s)},t}(y),V=function(){function e(){}return e.init=function(){for(var t in e.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],".mp3":[]},e.types)e.types.hasOwnProperty(t)&&(e.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);var i=e.constants={};i.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),i.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),i.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),i.STSC=i.STCO=i.STTS,i.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),i.HDLR_VIDEO=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),i.HDLR_AUDIO=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),i.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),i.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),i.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])},e.box=function(e){for(var t=8,i=null,r=Array.prototype.slice.call(arguments,1),n=r.length,s=0;s<n;s++)t+=r[s].byteLength;(i=new Uint8Array(t))[0]=t>>>24&255,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t,i.set(e,4);var o=8;for(s=0;s<n;s++)i.set(r[s],o),o+=r[s].byteLength;return i},e.generateInitSegment=function(t){var i=e.box(e.types.ftyp,e.constants.FTYP),r=e.moov(t),n=new Uint8Array(i.byteLength+r.byteLength);return n.set(i,0),n.set(r,i.byteLength),n},e.moov=function(t){var i=e.mvhd(t.timescale,t.duration),r=e.trak(t),n=e.mvex(t);return e.box(e.types.moov,i,r,n)},e.mvhd=function(t,i){return e.box(e.types.mvhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]))},e.trak=function(t){return e.box(e.types.trak,e.tkhd(t),e.mdia(t))},e.tkhd=function(t){var i=t.id,r=t.duration,n=t.presentWidth,s=t.presentHeight;return e.box(e.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,n>>>8&255,255&n,0,0,s>>>8&255,255&s,0,0]))},e.mdia=function(t){return e.box(e.types.mdia,e.mdhd(t),e.hdlr(t),e.minf(t))},e.mdhd=function(t){var i=t.timescale,r=t.duration;return e.box(e.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,r>>>24&255,r>>>16&255,r>>>8&255,255&r,85,196,0,0]))},e.hdlr=function(t){var i=null;return i="audio"===t.type?e.constants.HDLR_AUDIO:e.constants.HDLR_VIDEO,e.box(e.types.hdlr,i)},e.minf=function(t){var i=null;return i="audio"===t.type?e.box(e.types.smhd,e.constants.SMHD):e.box(e.types.vmhd,e.constants.VMHD),e.box(e.types.minf,i,e.dinf(),e.stbl(t))},e.dinf=function(){return e.box(e.types.dinf,e.box(e.types.dref,e.constants.DREF))},e.stbl=function(t){return e.box(e.types.stbl,e.stsd(t),e.box(e.types.stts,e.constants.STTS),e.box(e.types.stsc,e.constants.STSC),e.box(e.types.stsz,e.constants.STSZ),e.box(e.types.stco,e.constants.STCO))},e.stsd=function(t){return"audio"===t.type?"mp3"===t.codec?e.box(e.types.stsd,e.constants.STSD_PREFIX,e.mp3(t)):e.box(e.types.stsd,e.constants.STSD_PREFIX,e.mp4a(t)):e.box(e.types.stsd,e.constants.STSD_PREFIX,e.avc1(t))},e.mp3=function(t){var i=t.channelCount,r=t.audioSampleRate,n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,i,0,16,0,0,0,0,r>>>8&255,255&r,0,0]);return e.box(e.types[".mp3"],n)},e.mp4a=function(t){var i=t.channelCount,r=t.audioSampleRate,n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,i,0,16,0,0,0,0,r>>>8&255,255&r,0,0]);return e.box(e.types.mp4a,n,e.esds(t))},e.esds=function(t){var i=t.config||[],r=i.length,n=new Uint8Array([0,0,0,0,3,23+r,0,1,0,4,15+r,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([r]).concat(i).concat([6,1,2]));return e.box(e.types.esds,n)},e.avc1=function(t){var i=t.avcc,r=t.codecWidth,n=t.codecHeight,s=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,r>>>8&255,255&r,n>>>8&255,255&n,0,72,0,0,0,72,0,0,0,0,0,0,0,1,10,120,113,113,47,102,108,118,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return e.box(e.types.avc1,s,e.box(e.types.avcC,i))},e.mvex=function(t){return e.box(e.types.mvex,e.trex(t))},e.trex=function(t){var i=t.id,r=new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return e.box(e.types.trex,r)},e.moof=function(t,i){return e.box(e.types.moof,e.mfhd(t.sequenceNumber),e.traf(t,i))},e.mfhd=function(t){var i=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t]);return e.box(e.types.mfhd,i)},e.traf=function(t,i){var r=t.id,n=e.box(e.types.tfhd,new Uint8Array([0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r])),s=e.box(e.types.tfdt,new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i])),o=e.sdtp(t),a=e.trun(t,o.byteLength+16+16+8+16+8+8);return e.box(e.types.traf,n,s,a,o)},e.sdtp=function(t){for(var i=t.samples||[],r=i.length,n=new Uint8Array(4+r),s=0;s<r;s++){var o=i[s].flags;n[s+4]=o.isLeading<<6|o.dependsOn<<4|o.isDependedOn<<2|o.hasRedundancy}return e.box(e.types.sdtp,n)},e.trun=function(t,i){var r=t.samples||[],n=r.length,s=12+16*n,o=new Uint8Array(s);i+=8+s,o.set([0,0,15,1,n>>>24&255,n>>>16&255,n>>>8&255,255&n,i>>>24&255,i>>>16&255,i>>>8&255,255&i],0);for(var a=0;a<n;a++){var h=r[a].duration,l=r[a].size,d=r[a].flags,u=r[a].cts;o.set([h>>>24&255,h>>>16&255,h>>>8&255,255&h,l>>>24&255,l>>>16&255,l>>>8&255,255&l,d.isLeading<<2|d.dependsOn,d.isDependedOn<<6|d.hasRedundancy<<4|d.isNonSync,0,0,u>>>24&255,u>>>16&255,u>>>8&255,255&u],12+16*a)}return e.box(e.types.trun,o)},e.mdat=function(t){return e.box(e.types.mdat,t)},e}();V.init();var G=V,j=function(){function e(){}return e.getSilentFrame=function(e,t){if("mp4a.40.2"===e){if(1===t)return new Uint8Array([0,200,0,128,35,128]);if(2===t)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(6===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if(1===t)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(2===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(3===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}return null},e}(),W=i(7),Q=function(){function e(e){this.TAG="MP4Remuxer",this._config=e,this._isLive=!0===e.isLive,this._dtsBase=-1,this._dtsBaseInited=!1,this._audioDtsBase=1/0,this._videoDtsBase=1/0,this._audioNextDts=void 0,this._videoNextDts=void 0,this._audioStashedLastSample=null,this._videoStashedLastSample=null,this._audioMeta=null,this._videoMeta=null,this._audioSegmentInfoList=new W.c("audio"),this._videoSegmentInfoList=new W.c("video"),this._onInitSegment=null,this._onMediaSegment=null,this._forceFirstIDR=!(!o.a.chrome||!(o.a.version.major<50||50===o.a.version.major&&o.a.version.build<2661)),this._fillSilentAfterSeek=o.a.msedge||o.a.msie,this._mp3UseMpegAudio=!o.a.firefox,this._fillAudioTimestampGap=this._config.fixAudioTimestampGap}return e.prototype.destroy=function(){this._dtsBase=-1,this._dtsBaseInited=!1,this._audioMeta=null,this._videoMeta=null,this._audioSegmentInfoList.clear(),this._audioSegmentInfoList=null,this._videoSegmentInfoList.clear(),this._videoSegmentInfoList=null,this._onInitSegment=null,this._onMediaSegment=null},e.prototype.bindDataSource=function(e){return e.onDataAvailable=this.remux.bind(this),e.onTrackMetadata=this._onTrackMetadataReceived.bind(this),this},Object.defineProperty(e.prototype,"onInitSegment",{get:function(){return this._onInitSegment},set:function(e){this._onInitSegment=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onMediaSegment",{get:function(){return this._onMediaSegment},set:function(e){this._onMediaSegment=e},enumerable:!1,configurable:!0}),e.prototype.insertDiscontinuity=function(){this._audioNextDts=this._videoNextDts=void 0},e.prototype.seek=function(e){this._audioStashedLastSample=null,this._videoStashedLastSample=null,this._videoSegmentInfoList.clear(),this._audioSegmentInfoList.clear()},e.prototype.remux=function(e,t){if(!this._onMediaSegment)throw new A.a("MP4Remuxer: onMediaSegment callback must be specificed!");this._dtsBaseInited||this._calculateDtsBase(e,t),t&&this._remuxVideo(t),e&&this._remuxAudio(e)},e.prototype._onTrackMetadataReceived=function(e,t){var i=null,r="mp4",n=t.codec;if("audio"===e)this._audioMeta=t,"mp3"===t.codec&&this._mp3UseMpegAudio?(r="mpeg",n="",i=new Uint8Array):i=G.generateInitSegment(t);else{if("video"!==e)return;this._videoMeta=t,i=G.generateInitSegment(t)}if(!this._onInitSegment)throw new A.a("MP4Remuxer: onInitSegment callback must be specified!");this._onInitSegment(e,{type:e,data:i.buffer,codec:n,container:e+"/"+r,mediaDuration:t.duration})},e.prototype._calculateDtsBase=function(e,t){this._dtsBaseInited||(e&&e.samples&&e.samples.length&&(this._audioDtsBase=e.samples[0].dts),t&&t.samples&&t.samples.length&&(this._videoDtsBase=t.samples[0].dts),this._dtsBase=Math.min(this._audioDtsBase,this._videoDtsBase),this._dtsBaseInited=!0)},e.prototype.getTimestampBase=function(){return this._dtsBaseInited?this._dtsBase:0},e.prototype.flushStashedSamples=function(){var e=this._videoStashedLastSample,t=this._audioStashedLastSample,i={type:"video",id:1,sequenceNumber:0,samples:[],length:0};null!=e&&(i.samples.push(e),i.length=e.length);var r={type:"audio",id:2,sequenceNumber:0,samples:[],length:0};null!=t&&(r.samples.push(t),r.length=t.length),this._videoStashedLastSample=null,this._audioStashedLastSample=null,this._remuxVideo(i,!0),this._remuxAudio(r,!0)},e.prototype._remuxAudio=function(e,t){if(null!=this._audioMeta){var i,r=e,n=r.samples,a=void 0,h=-1,l=this._audioMeta.refSampleDuration,d="mp3"===this._audioMeta.codec&&this._mp3UseMpegAudio,u=this._dtsBaseInited&&void 0===this._audioNextDts,A=!1;if(n&&0!==n.length&&(1!==n.length||t)){var c=0,p=null,f=0;d?(c=0,f=r.length):(c=8,f=8+r.length);var m=null;if(n.length>1&&(f-=(m=n.pop()).length),null!=this._audioStashedLastSample){var _=this._audioStashedLastSample;this._audioStashedLastSample=null,n.unshift(_),f+=_.length}null!=m&&(this._audioStashedLastSample=m);var g=n[0].dts-this._dtsBase;if(this._audioNextDts)a=g-this._audioNextDts;else if(this._audioSegmentInfoList.isEmpty())a=0,this._fillSilentAfterSeek&&!this._videoSegmentInfoList.isEmpty()&&"mp3"!==this._audioMeta.originalCodec&&(A=!0);else{var y=this._audioSegmentInfoList.getLastSampleBefore(g);if(null!=y){var v=g-(y.originalDts+y.duration);v<=3&&(v=0),a=g-(y.dts+y.duration+v)}else a=0}if(A){var E=g-a,b=this._videoSegmentInfoList.getLastSegmentBefore(g);if(null!=b&&b.beginDts<E){if(B=j.getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount)){var S=b.beginDts,w=E-b.beginDts;s.a.v(this.TAG,"InsertPrefixSilentAudio: dts: "+S+", duration: "+w),n.unshift({unit:B,dts:S,pts:S}),f+=B.byteLength}}else A=!1}for(var T=[],R=0;R<n.length;R++){var C=(_=n[R]).unit,k=_.dts-this._dtsBase,I=(S=k,!1),L=null,O=0;if(!(k<-.001)){if("mp3"!==this._audioMeta.codec){var D=k;if(this._audioNextDts&&(D=this._audioNextDts),(a=k-D)<=-3*l){s.a.w(this.TAG,"Dropping 1 audio frame (originalDts: "+k+" ms ,curRefDts: "+D+" ms) due to dtsCorrection: "+a+" ms overlap.");continue}if(a>=3*l&&this._fillAudioTimestampGap&&!o.a.safari){I=!0;var B,x=Math.floor(a/l);s.a.w(this.TAG,"Large audio timestamp gap detected, may cause AV sync to drift. Silent frames will be generated to avoid unsync.\noriginalDts: "+k+" ms, curRefDts: "+D+" ms, dtsCorrection: "+Math.round(a)+" ms, generate: "+x+" frames"),S=Math.floor(D),O=Math.floor(D+l)-S,null==(B=j.getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount))&&(s.a.w(this.TAG,"Unable to generate silent frame for "+this._audioMeta.originalCodec+" with "+this._audioMeta.channelCount+" channels, repeat last frame"),B=C),L=[];for(var M=0;M<x;M++){D+=l;var P=Math.floor(D),F=Math.floor(D+l)-P,U={dts:P,pts:P,cts:0,unit:B,size:B.byteLength,duration:F,originalDts:k,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}};L.push(U),f+=U.size}this._audioNextDts=D+l}else S=Math.floor(D),O=Math.floor(D+l)-S,this._audioNextDts=D+l}else S=k-a,O=R!==n.length-1?n[R+1].dts-this._dtsBase-a-S:null!=m?m.dts-this._dtsBase-a-S:T.length>=1?T[T.length-1].duration:Math.floor(l),this._audioNextDts=S+O;-1===h&&(h=S),T.push({dts:S,pts:S,cts:0,unit:_.unit,size:_.unit.byteLength,duration:O,originalDts:k,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}}),I&&T.push.apply(T,L)}}if(0===T.length)return r.samples=[],void(r.length=0);for(d?p=new Uint8Array(f):((p=new Uint8Array(f))[0]=f>>>24&255,p[1]=f>>>16&255,p[2]=f>>>8&255,p[3]=255&f,p.set(G.types.mdat,4)),R=0;R<T.length;R++)C=T[R].unit,p.set(C,c),c+=C.byteLength;var N=T[T.length-1];i=N.dts+N.duration;var V=new W.b;V.beginDts=h,V.endDts=i,V.beginPts=h,V.endPts=i,V.originalBeginDts=T[0].originalDts,V.originalEndDts=N.originalDts+N.duration,V.firstSample=new W.d(T[0].dts,T[0].pts,T[0].duration,T[0].originalDts,!1),V.lastSample=new W.d(N.dts,N.pts,N.duration,N.originalDts,!1),this._isLive||this._audioSegmentInfoList.append(V),r.samples=T,r.sequenceNumber++;var Q=null;Q=d?new Uint8Array:G.moof(r,h),r.samples=[],r.length=0;var z={type:"audio",data:this._mergeBoxes(Q,p).buffer,sampleCount:T.length,info:V};d&&u&&(z.timestampOffset=h),this._onMediaSegment("audio",z)}}},e.prototype._remuxVideo=function(e,t){if(null!=this._videoMeta){var i,r,n=e,s=n.samples,o=void 0,a=-1,h=-1;if(s&&0!==s.length&&(1!==s.length||t)){var l=8,d=null,u=8+e.length,A=null;if(s.length>1&&(u-=(A=s.pop()).length),null!=this._videoStashedLastSample){var c=this._videoStashedLastSample;this._videoStashedLastSample=null,s.unshift(c),u+=c.length}null!=A&&(this._videoStashedLastSample=A);var p=s[0].dts-this._dtsBase;if(this._videoNextDts)o=p-this._videoNextDts;else if(this._videoSegmentInfoList.isEmpty())o=0;else{var f=this._videoSegmentInfoList.getLastSampleBefore(p);if(null!=f){var m=p-(f.originalDts+f.duration);m<=3&&(m=0),o=p-(f.dts+f.duration+m)}else o=0}for(var _=new W.b,g=[],y=0;y<s.length;y++){var v=(c=s[y]).dts-this._dtsBase,E=c.isKeyframe,b=v-o,S=c.cts,w=b+S;-1===a&&(a=b,h=w);var T=0;if(T=y!==s.length-1?s[y+1].dts-this._dtsBase-o-b:null!=A?A.dts-this._dtsBase-o-b:g.length>=1?g[g.length-1].duration:Math.floor(this._videoMeta.refSampleDuration),E){var R=new W.d(b,w,T,c.dts,!0);R.fileposition=c.fileposition,_.appendSyncPoint(R)}g.push({dts:b,pts:w,cts:S,units:c.units,size:c.length,isKeyframe:E,duration:T,originalDts:v,flags:{isLeading:0,dependsOn:E?2:1,isDependedOn:E?1:0,hasRedundancy:0,isNonSync:E?0:1}})}for((d=new Uint8Array(u))[0]=u>>>24&255,d[1]=u>>>16&255,d[2]=u>>>8&255,d[3]=255&u,d.set(G.types.mdat,4),y=0;y<g.length;y++)for(var C=g[y].units;C.length;){var k=C.shift().data;d.set(k,l),l+=k.byteLength}var I=g[g.length-1];if(i=I.dts+I.duration,r=I.pts+I.duration,this._videoNextDts=i,_.beginDts=a,_.endDts=i,_.beginPts=h,_.endPts=r,_.originalBeginDts=g[0].originalDts,_.originalEndDts=I.originalDts+I.duration,_.firstSample=new W.d(g[0].dts,g[0].pts,g[0].duration,g[0].originalDts,g[0].isKeyframe),_.lastSample=new W.d(I.dts,I.pts,I.duration,I.originalDts,I.isKeyframe),this._isLive||this._videoSegmentInfoList.append(_),n.samples=g,n.sequenceNumber++,this._forceFirstIDR){var L=g[0].flags;L.dependsOn=2,L.isNonSync=0}var O=G.moof(n,a);n.samples=[],n.length=0,this._onMediaSegment("video",{type:"video",data:this._mergeBoxes(O,d).buffer,sampleCount:g.length,info:_})}}},e.prototype._mergeBoxes=function(e,t){var i=new Uint8Array(e.byteLength+t.byteLength);return i.set(e,0),i.set(t,e.byteLength),i},e}(),z=i(11),H=i(1),q=function(){function e(e,t){this.TAG="TransmuxingController",this._emitter=new n.a,this._config=t,e.segments||(e.segments=[{duration:e.duration,filesize:e.filesize,url:e.url}]),"boolean"!=typeof e.cors&&(e.cors=!0),"boolean"!=typeof e.withCredentials&&(e.withCredentials=!1),this._mediaDataSource=e,this._currentSegmentIndex=0;var i=0;this._mediaDataSource.segments.forEach((function(r){r.timestampBase=i,i+=r.duration,r.cors=e.cors,r.withCredentials=e.withCredentials,t.referrerPolicy&&(r.referrerPolicy=t.referrerPolicy)})),isNaN(i)||this._mediaDataSource.duration===i||(this._mediaDataSource.duration=i),this._mediaInfo=null,this._demuxer=null,this._remuxer=null,this._ioctl=null,this._pendingSeekTime=null,this._pendingResolveSeekPoint=null,this._statisticsReporter=null}return e.prototype.destroy=function(){this._mediaInfo=null,this._mediaDataSource=null,this._statisticsReporter&&this._disableStatisticsReporter(),this._ioctl&&(this._ioctl.destroy(),this._ioctl=null),this._demuxer&&(this._demuxer.destroy(),this._demuxer=null),this._remuxer&&(this._remuxer.destroy(),this._remuxer=null),this._emitter.removeAllListeners(),this._emitter=null},e.prototype.on=function(e,t){this._emitter.addListener(e,t)},e.prototype.off=function(e,t){this._emitter.removeListener(e,t)},e.prototype.start=function(){this._loadSegment(0),this._enableStatisticsReporter()},e.prototype._loadSegment=function(e,t){this._currentSegmentIndex=e;var i=this._mediaDataSource.segments[e],r=this._ioctl=new z.a(i,this._config,e);r.onError=this._onIOException.bind(this),r.onSeeked=this._onIOSeeked.bind(this),r.onComplete=this._onIOComplete.bind(this),r.onRedirect=this._onIORedirect.bind(this),r.onRecoveredEarlyEof=this._onIORecoveredEarlyEof.bind(this),t?this._demuxer.bindDataSource(this._ioctl):r.onDataArrival=this._onInitChunkArrival.bind(this),r.open(t)},e.prototype.stop=function(){this._internalAbort(),this._disableStatisticsReporter()},e.prototype._internalAbort=function(){this._ioctl&&(this._ioctl.destroy(),this._ioctl=null)},e.prototype.pause=function(){this._ioctl&&this._ioctl.isWorking()&&(this._ioctl.pause(),this._disableStatisticsReporter())},e.prototype.resume=function(){this._ioctl&&this._ioctl.isPaused()&&(this._ioctl.resume(),this._enableStatisticsReporter())},e.prototype.seek=function(e){if(null!=this._mediaInfo&&this._mediaInfo.isSeekable()){var t=this._searchSegmentIndexContains(e);if(t===this._currentSegmentIndex){var i=this._mediaInfo.segments[t];if(null==i)this._pendingSeekTime=e;else{var r=i.getNearestKeyframe(e);this._remuxer.seek(r.milliseconds),this._ioctl.seek(r.fileposition),this._pendingResolveSeekPoint=r.milliseconds}}else{var n=this._mediaInfo.segments[t];null==n?(this._pendingSeekTime=e,this._internalAbort(),this._remuxer.seek(),this._remuxer.insertDiscontinuity(),this._loadSegment(t)):(r=n.getNearestKeyframe(e),this._internalAbort(),this._remuxer.seek(e),this._remuxer.insertDiscontinuity(),this._demuxer.resetMediaInfo(),this._demuxer.timestampBase=this._mediaDataSource.segments[t].timestampBase,this._loadSegment(t,r.fileposition),this._pendingResolveSeekPoint=r.milliseconds,this._reportSegmentMediaInfo(t))}this._enableStatisticsReporter()}},e.prototype._searchSegmentIndexContains=function(e){for(var t=this._mediaDataSource.segments,i=t.length-1,r=0;r<t.length;r++)if(e<t[r].timestampBase){i=r-1;break}return i},e.prototype._onInitChunkArrival=function(e,t){var i=this,r=null,n=0;if(t>0)this._demuxer.bindDataSource(this._ioctl),this._demuxer.timestampBase=this._mediaDataSource.segments[this._currentSegmentIndex].timestampBase,n=this._demuxer.parseChunks(e,t);else if((r=N.probe(e)).match){var o=this._demuxer=new N(r,this._config);this._remuxer||(this._remuxer=new Q(this._config)),o.onError=this._onDemuxException.bind(this),o.onMediaInfo=this._onMediaInfo.bind(this),o.onMetaDataArrived=this._onMetaDataArrived.bind(this),o.onTimedID3Metadata=this._onTimedID3Metadata.bind(this),o.onPESPrivateDataDescriptor=this._onPESPrivateDataDescriptor.bind(this),o.onPESPrivateData=this._onPESPrivateData.bind(this),this._remuxer.bindDataSource(this._demuxer),this._demuxer.bindDataSource(this._ioctl),this._remuxer.onInitSegment=this._onRemuxerInitSegmentArrival.bind(this),this._remuxer.onMediaSegment=this._onRemuxerMediaSegmentArrival.bind(this),n=this._demuxer.parseChunks(e,t)}else if((r=g.probe(e)).match){this._demuxer=new g(r,this._config),this._remuxer||(this._remuxer=new Q(this._config));var a=this._mediaDataSource;null==a.duration||isNaN(a.duration)||(this._demuxer.overridedDuration=a.duration),"boolean"==typeof a.hasAudio&&(this._demuxer.overridedHasAudio=a.hasAudio),"boolean"==typeof a.hasVideo&&(this._demuxer.overridedHasVideo=a.hasVideo),this._demuxer.timestampBase=a.segments[this._currentSegmentIndex].timestampBase,this._demuxer.onError=this._onDemuxException.bind(this),this._demuxer.onMediaInfo=this._onMediaInfo.bind(this),this._demuxer.onMetaDataArrived=this._onMetaDataArrived.bind(this),this._demuxer.onScriptDataArrived=this._onScriptDataArrived.bind(this),this._remuxer.bindDataSource(this._demuxer.bindDataSource(this._ioctl)),this._remuxer.onInitSegment=this._onRemuxerInitSegmentArrival.bind(this),this._remuxer.onMediaSegment=this._onRemuxerMediaSegmentArrival.bind(this),n=this._demuxer.parseChunks(e,t)}else r=null,s.a.e(this.TAG,"Non MPEG-TS/FLV, Unsupported media type!"),Promise.resolve().then((function(){i._internalAbort()})),this._emitter.emit(H.a.DEMUX_ERROR,_.a.FORMAT_UNSUPPORTED,"Non MPEG-TS/FLV, Unsupported media type!"),n=0;return n},e.prototype._onMediaInfo=function(e){var t=this;null==this._mediaInfo&&(this._mediaInfo=Object.assign({},e),this._mediaInfo.keyframesIndex=null,this._mediaInfo.segments=[],this._mediaInfo.segmentCount=this._mediaDataSource.segments.length,Object.setPrototypeOf(this._mediaInfo,a.a.prototype));var i=Object.assign({},e);Object.setPrototypeOf(i,a.a.prototype),this._mediaInfo.segments[this._currentSegmentIndex]=i,this._reportSegmentMediaInfo(this._currentSegmentIndex),null!=this._pendingSeekTime&&Promise.resolve().then((function(){var e=t._pendingSeekTime;t._pendingSeekTime=null,t.seek(e)}))},e.prototype._onMetaDataArrived=function(e){this._emitter.emit(H.a.METADATA_ARRIVED,e)},e.prototype._onScriptDataArrived=function(e){this._emitter.emit(H.a.SCRIPTDATA_ARRIVED,e)},e.prototype._onTimedID3Metadata=function(e){var t=this._remuxer.getTimestampBase();null!=e.pts&&(e.pts-=t),null!=e.dts&&(e.dts-=t),this._emitter.emit(H.a.TIMED_ID3_METADATA_ARRIVED,e)},e.prototype._onPESPrivateDataDescriptor=function(e){this._emitter.emit(H.a.PES_PRIVATE_DATA_DESCRIPTOR,e)},e.prototype._onPESPrivateData=function(e){var t=this._remuxer.getTimestampBase();null!=e.pts&&(e.pts-=t),null!=e.nearest_pts&&(e.nearest_pts-=t),null!=e.dts&&(e.dts-=t),this._emitter.emit(H.a.PES_PRIVATE_DATA_ARRIVED,e)},e.prototype._onIOSeeked=function(){this._remuxer.insertDiscontinuity()},e.prototype._onIOComplete=function(e){var t=e+1;t<this._mediaDataSource.segments.length?(this._internalAbort(),this._remuxer&&this._remuxer.flushStashedSamples(),this._loadSegment(t)):(this._remuxer&&this._remuxer.flushStashedSamples(),this._emitter.emit(H.a.LOADING_COMPLETE),this._disableStatisticsReporter())},e.prototype._onIORedirect=function(e){var t=this._ioctl.extraData;this._mediaDataSource.segments[t].redirectedURL=e},e.prototype._onIORecoveredEarlyEof=function(){this._emitter.emit(H.a.RECOVERED_EARLY_EOF)},e.prototype._onIOException=function(e,t){s.a.e(this.TAG,"IOException: type = "+e+", code = "+t.code+", msg = "+t.msg),this._emitter.emit(H.a.IO_ERROR,e,t),this._disableStatisticsReporter()},e.prototype._onDemuxException=function(e,t){s.a.e(this.TAG,"DemuxException: type = "+e+", info = "+t),this._emitter.emit(H.a.DEMUX_ERROR,e,t)},e.prototype._onRemuxerInitSegmentArrival=function(e,t){this._emitter.emit(H.a.INIT_SEGMENT,e,t)},e.prototype._onRemuxerMediaSegmentArrival=function(e,t){if(null==this._pendingSeekTime&&(this._emitter.emit(H.a.MEDIA_SEGMENT,e,t),null!=this._pendingResolveSeekPoint&&"video"===e)){var i=t.info.syncPoints,r=this._pendingResolveSeekPoint;this._pendingResolveSeekPoint=null,o.a.safari&&i.length>0&&i[0].originalDts===r&&(r=i[0].pts),this._emitter.emit(H.a.RECOMMEND_SEEKPOINT,r)}},e.prototype._enableStatisticsReporter=function(){null==this._statisticsReporter&&(this._statisticsReporter=self.setInterval(this._reportStatisticsInfo.bind(this),this._config.statisticsInfoReportInterval))},e.prototype._disableStatisticsReporter=function(){this._statisticsReporter&&(self.clearInterval(this._statisticsReporter),this._statisticsReporter=null)},e.prototype._reportSegmentMediaInfo=function(e){var t=this._mediaInfo.segments[e],i=Object.assign({},t);i.duration=this._mediaInfo.duration,i.segmentCount=this._mediaInfo.segmentCount,delete i.segments,delete i.keyframesIndex,this._emitter.emit(H.a.MEDIA_INFO,i)},e.prototype._reportStatisticsInfo=function(){var e={};e.url=this._ioctl.currentURL,e.hasRedirect=this._ioctl.hasRedirect,e.hasRedirect&&(e.redirectedURL=this._ioctl.currentRedirectedURL),e.speed=this._ioctl.currentSpeed,e.loaderType=this._ioctl.loaderType,e.currentSegmentIndex=this._currentSegmentIndex,e.totalSegmentCount=this._mediaDataSource.segments.length,this._emitter.emit(H.a.STATISTICS_INFO,e)},e}();t.a=q},function(e,t,i){var r,n=i(0),s=function(){function e(){this._firstCheckpoint=0,this._lastCheckpoint=0,this._intervalBytes=0,this._totalBytes=0,this._lastSecondBytes=0,self.performance&&self.performance.now?this._now=self.performance.now.bind(self.performance):this._now=Date.now}return e.prototype.reset=function(){this._firstCheckpoint=this._lastCheckpoint=0,this._totalBytes=this._intervalBytes=0,this._lastSecondBytes=0},e.prototype.addBytes=function(e){0===this._firstCheckpoint?(this._firstCheckpoint=this._now(),this._lastCheckpoint=this._firstCheckpoint,this._intervalBytes+=e,this._totalBytes+=e):this._now()-this._lastCheckpoint<1e3?(this._intervalBytes+=e,this._totalBytes+=e):(this._lastSecondBytes=this._intervalBytes,this._intervalBytes=e,this._totalBytes+=e,this._lastCheckpoint=this._now())},Object.defineProperty(e.prototype,"currentKBps",{get:function(){this.addBytes(0);var e=(this._now()-this._lastCheckpoint)/1e3;return 0==e&&(e=1),this._intervalBytes/e/1024},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastSecondKBps",{get:function(){return this.addBytes(0),0!==this._lastSecondBytes?this._lastSecondBytes/1024:this._now()-this._lastCheckpoint>=500?this.currentKBps:0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"averageKBps",{get:function(){var e=(this._now()-this._firstCheckpoint)/1e3;return this._totalBytes/e/1024},enumerable:!1,configurable:!0}),e}(),o=i(2),a=i(4),h=i(3),l=(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),d=function(e){function t(t,i){var r=e.call(this,"fetch-stream-loader")||this;return r.TAG="FetchStreamLoader",r._seekHandler=t,r._config=i,r._needStash=!0,r._requestAbort=!1,r._abortController=null,r._contentLength=null,r._receivedLength=0,r}return l(t,e),t.isSupported=function(){try{var e=a.a.msedge&&a.a.version.minor>=15048,t=!a.a.msedge||e;return self.fetch&&self.ReadableStream&&t}catch(e){return!1}},t.prototype.destroy=function(){this.isWorking()&&this.abort(),e.prototype.destroy.call(this)},t.prototype.open=function(e,t){var i=this;this._dataSource=e,this._range=t;var r=e.url;this._config.reuseRedirectedURL&&null!=e.redirectedURL&&(r=e.redirectedURL);var n=this._seekHandler.getConfig(r,t),s=new self.Headers;if("object"==typeof n.headers){var a=n.headers;for(var l in a)a.hasOwnProperty(l)&&s.append(l,a[l])}var d={method:"GET",headers:s,mode:"cors",cache:"default",referrerPolicy:"no-referrer-when-downgrade"};if("object"==typeof this._config.headers)for(var l in this._config.headers)s.append(l,this._config.headers[l]);!1===e.cors&&(d.mode="same-origin"),e.withCredentials&&(d.credentials="include"),e.referrerPolicy&&(d.referrerPolicy=e.referrerPolicy),self.AbortController&&(this._abortController=new self.AbortController,d.signal=this._abortController.signal),this._status=o.c.kConnecting,self.fetch(n.url,d).then((function(e){if(i._requestAbort)return i._status=o.c.kIdle,void e.body.cancel();if(e.ok&&e.status>=200&&e.status<=299){if(e.url!==n.url&&i._onURLRedirect){var t=i._seekHandler.removeURLParameters(e.url);i._onURLRedirect(t)}var r=e.headers.get("Content-Length");return null!=r&&(i._contentLength=parseInt(r),0!==i._contentLength&&i._onContentLengthKnown&&i._onContentLengthKnown(i._contentLength)),i._pump.call(i,e.body.getReader())}if(i._status=o.c.kError,!i._onError)throw new h.d("FetchStreamLoader: Http code invalid, "+e.status+" "+e.statusText);i._onError(o.b.HTTP_STATUS_CODE_INVALID,{code:e.status,msg:e.statusText})})).catch((function(e){if(!i._abortController||!i._abortController.signal.aborted){if(i._status=o.c.kError,!i._onError)throw e;i._onError(o.b.EXCEPTION,{code:-1,msg:e.message})}}))},t.prototype.abort=function(){if(this._requestAbort=!0,(this._status!==o.c.kBuffering||!a.a.chrome)&&this._abortController)try{this._abortController.abort()}catch(e){}},t.prototype._pump=function(e){var t=this;return e.read().then((function(i){if(i.done)if(null!==t._contentLength&&t._receivedLength<t._contentLength){t._status=o.c.kError;var r=o.b.EARLY_EOF,n={code:-1,msg:"Fetch stream meet Early-EOF"};if(!t._onError)throw new h.d(n.msg);t._onError(r,n)}else t._status=o.c.kComplete,t._onComplete&&t._onComplete(t._range.from,t._range.from+t._receivedLength-1);else{if(t._abortController&&t._abortController.signal.aborted)return void(t._status=o.c.kComplete);if(!0===t._requestAbort)return t._status=o.c.kComplete,e.cancel();t._status=o.c.kBuffering;var s=i.value.buffer,a=t._range.from+t._receivedLength;t._receivedLength+=s.byteLength,t._onDataArrival&&t._onDataArrival(s,a,t._receivedLength),t._pump(e)}})).catch((function(e){if(t._abortController&&t._abortController.signal.aborted)t._status=o.c.kComplete;else if(11!==e.code||!a.a.msedge){t._status=o.c.kError;var i=0,r=null;if(19!==e.code&&"network error"!==e.message||!(null===t._contentLength||null!==t._contentLength&&t._receivedLength<t._contentLength)?(i=o.b.EXCEPTION,r={code:e.code,msg:e.message}):(i=o.b.EARLY_EOF,r={code:e.code,msg:"Fetch stream meet Early-EOF"}),!t._onError)throw new h.d(r.msg);t._onError(i,r)}}))},t}(o.a),u=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),A=function(e){function t(t,i){var r=e.call(this,"xhr-moz-chunked-loader")||this;return r.TAG="MozChunkedLoader",r._seekHandler=t,r._config=i,r._needStash=!0,r._xhr=null,r._requestAbort=!1,r._contentLength=null,r._receivedLength=0,r}return u(t,e),t.isSupported=function(){try{var e=new XMLHttpRequest;return e.open("GET","https://example.com",!0),e.responseType="moz-chunked-arraybuffer","moz-chunked-arraybuffer"===e.responseType}catch(e){return n.a.w("MozChunkedLoader",e.message),!1}},t.prototype.destroy=function(){this.isWorking()&&this.abort(),this._xhr&&(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onloadend=null,this._xhr.onerror=null,this._xhr=null),e.prototype.destroy.call(this)},t.prototype.open=function(e,t){this._dataSource=e,this._range=t;var i=e.url;this._config.reuseRedirectedURL&&null!=e.redirectedURL&&(i=e.redirectedURL);var r=this._seekHandler.getConfig(i,t);this._requestURL=r.url;var n=this._xhr=new XMLHttpRequest;if(n.open("GET",r.url,!0),n.responseType="moz-chunked-arraybuffer",n.onreadystatechange=this._onReadyStateChange.bind(this),n.onprogress=this._onProgress.bind(this),n.onloadend=this._onLoadEnd.bind(this),n.onerror=this._onXhrError.bind(this),e.withCredentials&&(n.withCredentials=!0),"object"==typeof r.headers){var s=r.headers;for(var a in s)s.hasOwnProperty(a)&&n.setRequestHeader(a,s[a])}if("object"==typeof this._config.headers)for(var a in s=this._config.headers)s.hasOwnProperty(a)&&n.setRequestHeader(a,s[a]);this._status=o.c.kConnecting,n.send()},t.prototype.abort=function(){this._requestAbort=!0,this._xhr&&this._xhr.abort(),this._status=o.c.kComplete},t.prototype._onReadyStateChange=function(e){var t=e.target;if(2===t.readyState){if(null!=t.responseURL&&t.responseURL!==this._requestURL&&this._onURLRedirect){var i=this._seekHandler.removeURLParameters(t.responseURL);this._onURLRedirect(i)}if(0!==t.status&&(t.status<200||t.status>299)){if(this._status=o.c.kError,!this._onError)throw new h.d("MozChunkedLoader: Http code invalid, "+t.status+" "+t.statusText);this._onError(o.b.HTTP_STATUS_CODE_INVALID,{code:t.status,msg:t.statusText})}else this._status=o.c.kBuffering}},t.prototype._onProgress=function(e){if(this._status!==o.c.kError){null===this._contentLength&&null!==e.total&&0!==e.total&&(this._contentLength=e.total,this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength));var t=e.target.response,i=this._range.from+this._receivedLength;this._receivedLength+=t.byteLength,this._onDataArrival&&this._onDataArrival(t,i,this._receivedLength)}},t.prototype._onLoadEnd=function(e){!0!==this._requestAbort?this._status!==o.c.kError&&(this._status=o.c.kComplete,this._onComplete&&this._onComplete(this._range.from,this._range.from+this._receivedLength-1)):this._requestAbort=!1},t.prototype._onXhrError=function(e){this._status=o.c.kError;var t=0,i=null;if(this._contentLength&&e.loaded<this._contentLength?(t=o.b.EARLY_EOF,i={code:-1,msg:"Moz-Chunked stream meet Early-Eof"}):(t=o.b.EXCEPTION,i={code:-1,msg:e.constructor.name+" "+e.type}),!this._onError)throw new h.d(i.msg);this._onError(t,i)},t}(o.a),c=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),p=function(e){function t(t,i){var r=e.call(this,"xhr-range-loader")||this;return r.TAG="RangeLoader",r._seekHandler=t,r._config=i,r._needStash=!1,r._chunkSizeKBList=[128,256,384,512,768,1024,1536,2048,3072,4096,5120,6144,7168,8192],r._currentChunkSizeKB=384,r._currentSpeedNormalized=0,r._zeroSpeedChunkCount=0,r._xhr=null,r._speedSampler=new s,r._requestAbort=!1,r._waitForTotalLength=!1,r._totalLengthReceived=!1,r._currentRequestURL=null,r._currentRedirectedURL=null,r._currentRequestRange=null,r._totalLength=null,r._contentLength=null,r._receivedLength=0,r._lastTimeLoaded=0,r}return c(t,e),t.isSupported=function(){try{var e=new XMLHttpRequest;return e.open("GET","https://example.com",!0),e.responseType="arraybuffer","arraybuffer"===e.responseType}catch(e){return n.a.w("RangeLoader",e.message),!1}},t.prototype.destroy=function(){this.isWorking()&&this.abort(),this._xhr&&(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onload=null,this._xhr.onerror=null,this._xhr=null),e.prototype.destroy.call(this)},Object.defineProperty(t.prototype,"currentSpeed",{get:function(){return this._speedSampler.lastSecondKBps},enumerable:!1,configurable:!0}),t.prototype.open=function(e,t){this._dataSource=e,this._range=t,this._status=o.c.kConnecting;var i=!1;null!=this._dataSource.filesize&&0!==this._dataSource.filesize&&(i=!0,this._totalLength=this._dataSource.filesize),this._totalLengthReceived||i?this._openSubRange():(this._waitForTotalLength=!0,this._internalOpen(this._dataSource,{from:0,to:-1}))},t.prototype._openSubRange=function(){var e=1024*this._currentChunkSizeKB,t=this._range.from+this._receivedLength,i=t+e;null!=this._contentLength&&i-this._range.from>=this._contentLength&&(i=this._range.from+this._contentLength-1),this._currentRequestRange={from:t,to:i},this._internalOpen(this._dataSource,this._currentRequestRange)},t.prototype._internalOpen=function(e,t){this._lastTimeLoaded=0;var i=e.url;this._config.reuseRedirectedURL&&(null!=this._currentRedirectedURL?i=this._currentRedirectedURL:null!=e.redirectedURL&&(i=e.redirectedURL));var r=this._seekHandler.getConfig(i,t);this._currentRequestURL=r.url;var n=this._xhr=new XMLHttpRequest;if(n.open("GET",r.url,!0),n.responseType="arraybuffer",n.onreadystatechange=this._onReadyStateChange.bind(this),n.onprogress=this._onProgress.bind(this),n.onload=this._onLoad.bind(this),n.onerror=this._onXhrError.bind(this),e.withCredentials&&(n.withCredentials=!0),"object"==typeof r.headers){var s=r.headers;for(var o in s)s.hasOwnProperty(o)&&n.setRequestHeader(o,s[o])}if("object"==typeof this._config.headers)for(var o in s=this._config.headers)s.hasOwnProperty(o)&&n.setRequestHeader(o,s[o]);n.send()},t.prototype.abort=function(){this._requestAbort=!0,this._internalAbort(),this._status=o.c.kComplete},t.prototype._internalAbort=function(){this._xhr&&(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onload=null,this._xhr.onerror=null,this._xhr.abort(),this._xhr=null)},t.prototype._onReadyStateChange=function(e){var t=e.target;if(2===t.readyState){if(null!=t.responseURL){var i=this._seekHandler.removeURLParameters(t.responseURL);t.responseURL!==this._currentRequestURL&&i!==this._currentRedirectedURL&&(this._currentRedirectedURL=i,this._onURLRedirect&&this._onURLRedirect(i))}if(t.status>=200&&t.status<=299){if(this._waitForTotalLength)return;this._status=o.c.kBuffering}else{if(this._status=o.c.kError,!this._onError)throw new h.d("RangeLoader: Http code invalid, "+t.status+" "+t.statusText);this._onError(o.b.HTTP_STATUS_CODE_INVALID,{code:t.status,msg:t.statusText})}}},t.prototype._onProgress=function(e){if(this._status!==o.c.kError){if(null===this._contentLength){var t=!1;if(this._waitForTotalLength){this._waitForTotalLength=!1,this._totalLengthReceived=!0,t=!0;var i=e.total;this._internalAbort(),null!=i&0!==i&&(this._totalLength=i)}if(-1===this._range.to?this._contentLength=this._totalLength-this._range.from:this._contentLength=this._range.to-this._range.from+1,t)return void this._openSubRange();this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength)}var r=e.loaded-this._lastTimeLoaded;this._lastTimeLoaded=e.loaded,this._speedSampler.addBytes(r)}},t.prototype._normalizeSpeed=function(e){var t=this._chunkSizeKBList,i=t.length-1,r=0,n=0,s=i;if(e<t[0])return t[0];for(;n<=s;){if((r=n+Math.floor((s-n)/2))===i||e>=t[r]&&e<t[r+1])return t[r];t[r]<e?n=r+1:s=r-1}},t.prototype._onLoad=function(e){if(this._status!==o.c.kError)if(this._waitForTotalLength)this._waitForTotalLength=!1;else{this._lastTimeLoaded=0;var t=this._speedSampler.lastSecondKBps;if(0===t&&(this._zeroSpeedChunkCount++,this._zeroSpeedChunkCount>=3&&(t=this._speedSampler.currentKBps)),0!==t){var i=this._normalizeSpeed(t);this._currentSpeedNormalized!==i&&(this._currentSpeedNormalized=i,this._currentChunkSizeKB=i)}var r=e.target.response,n=this._range.from+this._receivedLength;this._receivedLength+=r.byteLength;var s=!1;null!=this._contentLength&&this._receivedLength<this._contentLength?this._openSubRange():s=!0,this._onDataArrival&&this._onDataArrival(r,n,this._receivedLength),s&&(this._status=o.c.kComplete,this._onComplete&&this._onComplete(this._range.from,this._range.from+this._receivedLength-1))}},t.prototype._onXhrError=function(e){this._status=o.c.kError;var t=0,i=null;if(this._contentLength&&this._receivedLength>0&&this._receivedLength<this._contentLength?(t=o.b.EARLY_EOF,i={code:-1,msg:"RangeLoader meet Early-Eof"}):(t=o.b.EXCEPTION,i={code:-1,msg:e.constructor.name+" "+e.type}),!this._onError)throw new h.d(i.msg);this._onError(t,i)},t}(o.a),f=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),m=function(e){function t(){var t=e.call(this,"websocket-loader")||this;return t.TAG="WebSocketLoader",t._needStash=!0,t._ws=null,t._requestAbort=!1,t._receivedLength=0,t}return f(t,e),t.isSupported=function(){try{return void 0!==self.WebSocket}catch(e){return!1}},t.prototype.destroy=function(){this._ws&&this.abort(),e.prototype.destroy.call(this)},t.prototype.open=function(e){try{var t=this._ws=new self.WebSocket(e.url);t.binaryType="arraybuffer",t.onopen=this._onWebSocketOpen.bind(this),t.onclose=this._onWebSocketClose.bind(this),t.onmessage=this._onWebSocketMessage.bind(this),t.onerror=this._onWebSocketError.bind(this),this._status=o.c.kConnecting}catch(e){this._status=o.c.kError;var i={code:e.code,msg:e.message};if(!this._onError)throw new h.d(i.msg);this._onError(o.b.EXCEPTION,i)}},t.prototype.abort=function(){var e=this._ws;!e||0!==e.readyState&&1!==e.readyState||(this._requestAbort=!0,e.close()),this._ws=null,this._status=o.c.kComplete},t.prototype._onWebSocketOpen=function(e){this._status=o.c.kBuffering},t.prototype._onWebSocketClose=function(e){!0!==this._requestAbort?(this._status=o.c.kComplete,this._onComplete&&this._onComplete(0,this._receivedLength-1)):this._requestAbort=!1},t.prototype._onWebSocketMessage=function(e){var t=this;if(e.data instanceof ArrayBuffer)this._dispatchArrayBuffer(e.data);else if(e.data instanceof Blob){var i=new FileReader;i.onload=function(){t._dispatchArrayBuffer(i.result)},i.readAsArrayBuffer(e.data)}else{this._status=o.c.kError;var r={code:-1,msg:"Unsupported WebSocket message type: "+e.data.constructor.name};if(!this._onError)throw new h.d(r.msg);this._onError(o.b.EXCEPTION,r)}},t.prototype._dispatchArrayBuffer=function(e){var t=e,i=this._receivedLength;this._receivedLength+=t.byteLength,this._onDataArrival&&this._onDataArrival(t,i,this._receivedLength)},t.prototype._onWebSocketError=function(e){this._status=o.c.kError;var t={code:e.code,msg:e.message};if(!this._onError)throw new h.d(t.msg);this._onError(o.b.EXCEPTION,t)},t}(o.a),_=function(){function e(e){this._zeroStart=e||!1}return e.prototype.getConfig=function(e,t){var i={};if(0!==t.from||-1!==t.to){var r=void 0;r=-1!==t.to?"bytes="+t.from.toString()+"-"+t.to.toString():"bytes="+t.from.toString()+"-",i.Range=r}else this._zeroStart&&(i.Range="bytes=0-");return{url:e,headers:i}},e.prototype.removeURLParameters=function(e){return e},e}(),g=function(){function e(e,t){this._startName=e,this._endName=t}return e.prototype.getConfig=function(e,t){var i=e;if(0!==t.from||-1!==t.to){var r=!0;-1===i.indexOf("?")&&(i+="?",r=!1),r&&(i+="&"),i+=this._startName+"="+t.from.toString(),-1!==t.to&&(i+="&"+this._endName+"="+t.to.toString())}return{url:i,headers:{}}},e.prototype.removeURLParameters=function(e){var t=e.split("?")[0],i=void 0,r=e.indexOf("?");-1!==r&&(i=e.substring(r+1));var n="";if(null!=i&&i.length>0)for(var s=i.split("&"),o=0;o<s.length;o++){var a=s[o].split("="),h=o>0;a[0]!==this._startName&&a[0]!==this._endName&&(h&&(n+="&"),n+=s[o])}return 0===n.length?t:t+"?"+n},e}(),y=function(){function e(e,t,i){this.TAG="IOController",this._config=t,this._extraData=i,this._stashInitialSize=65536,null!=t.stashInitialSize&&t.stashInitialSize>0&&(this._stashInitialSize=t.stashInitialSize),this._stashUsed=0,this._stashSize=this._stashInitialSize,this._bufferSize=3145728,this._stashBuffer=new ArrayBuffer(this._bufferSize),this._stashByteStart=0,this._enableStash=!0,!1===t.enableStashBuffer&&(this._enableStash=!1),this._loader=null,this._loaderClass=null,this._seekHandler=null,this._dataSource=e,this._isWebSocketURL=/wss?:\/\/(.+?)/.test(e.url),this._refTotalLength=e.filesize?e.filesize:null,this._totalLength=this._refTotalLength,this._fullRequestFlag=!1,this._currentRange=null,this._redirectedURL=null,this._speedNormalized=0,this._speedSampler=new s,this._speedNormalizeList=[32,64,96,128,192,256,384,512,768,1024,1536,2048,3072,4096],this._isEarlyEofReconnecting=!1,this._paused=!1,this._resumeFrom=0,this._onDataArrival=null,this._onSeeked=null,this._onError=null,this._onComplete=null,this._onRedirect=null,this._onRecoveredEarlyEof=null,this._selectSeekHandler(),this._selectLoader(),this._createLoader()}return e.prototype.destroy=function(){this._loader.isWorking()&&this._loader.abort(),this._loader.destroy(),this._loader=null,this._loaderClass=null,this._dataSource=null,this._stashBuffer=null,this._stashUsed=this._stashSize=this._bufferSize=this._stashByteStart=0,this._currentRange=null,this._speedSampler=null,this._isEarlyEofReconnecting=!1,this._onDataArrival=null,this._onSeeked=null,this._onError=null,this._onComplete=null,this._onRedirect=null,this._onRecoveredEarlyEof=null,this._extraData=null},e.prototype.isWorking=function(){return this._loader&&this._loader.isWorking()&&!this._paused},e.prototype.isPaused=function(){return this._paused},Object.defineProperty(e.prototype,"status",{get:function(){return this._loader.status},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"extraData",{get:function(){return this._extraData},set:function(e){this._extraData=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onDataArrival",{get:function(){return this._onDataArrival},set:function(e){this._onDataArrival=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onSeeked",{get:function(){return this._onSeeked},set:function(e){this._onSeeked=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onError",{get:function(){return this._onError},set:function(e){this._onError=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onComplete",{get:function(){return this._onComplete},set:function(e){this._onComplete=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onRedirect",{get:function(){return this._onRedirect},set:function(e){this._onRedirect=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onRecoveredEarlyEof",{get:function(){return this._onRecoveredEarlyEof},set:function(e){this._onRecoveredEarlyEof=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentURL",{get:function(){return this._dataSource.url},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasRedirect",{get:function(){return null!=this._redirectedURL||null!=this._dataSource.redirectedURL},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentRedirectedURL",{get:function(){return this._redirectedURL||this._dataSource.redirectedURL},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentSpeed",{get:function(){return this._loaderClass===p?this._loader.currentSpeed:this._speedSampler.lastSecondKBps},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"loaderType",{get:function(){return this._loader.type},enumerable:!1,configurable:!0}),e.prototype._selectSeekHandler=function(){var e=this._config;if("range"===e.seekType)this._seekHandler=new _(this._config.rangeLoadZeroStart);else if("param"===e.seekType){var t=e.seekParamStart||"bstart",i=e.seekParamEnd||"bend";this._seekHandler=new g(t,i)}else{if("custom"!==e.seekType)throw new h.b("Invalid seekType in config: "+e.seekType);if("function"!=typeof e.customSeekHandler)throw new h.b("Custom seekType specified in config but invalid customSeekHandler!");this._seekHandler=new e.customSeekHandler}},e.prototype._selectLoader=function(){if(null!=this._config.customLoader)this._loaderClass=this._config.customLoader;else if(this._isWebSocketURL)this._loaderClass=m;else if(d.isSupported())this._loaderClass=d;else if(A.isSupported())this._loaderClass=A;else{if(!p.isSupported())throw new h.d("Your browser doesn't support xhr with arraybuffer responseType!");this._loaderClass=p}},e.prototype._createLoader=function(){this._loader=new this._loaderClass(this._seekHandler,this._config),!1===this._loader.needStashBuffer&&(this._enableStash=!1),this._loader.onContentLengthKnown=this._onContentLengthKnown.bind(this),this._loader.onURLRedirect=this._onURLRedirect.bind(this),this._loader.onDataArrival=this._onLoaderChunkArrival.bind(this),this._loader.onComplete=this._onLoaderComplete.bind(this),this._loader.onError=this._onLoaderError.bind(this)},e.prototype.open=function(e){this._currentRange={from:0,to:-1},e&&(this._currentRange.from=e),this._speedSampler.reset(),e||(this._fullRequestFlag=!0),this._loader.open(this._dataSource,Object.assign({},this._currentRange))},e.prototype.abort=function(){this._loader.abort(),this._paused&&(this._paused=!1,this._resumeFrom=0)},e.prototype.pause=function(){this.isWorking()&&(this._loader.abort(),0!==this._stashUsed?(this._resumeFrom=this._stashByteStart,this._currentRange.to=this._stashByteStart-1):this._resumeFrom=this._currentRange.to+1,this._stashUsed=0,this._stashByteStart=0,this._paused=!0)},e.prototype.resume=function(){if(this._paused){this._paused=!1;var e=this._resumeFrom;this._resumeFrom=0,this._internalSeek(e,!0)}},e.prototype.seek=function(e){this._paused=!1,this._stashUsed=0,this._stashByteStart=0,this._internalSeek(e,!0)},e.prototype._internalSeek=function(e,t){this._loader.isWorking()&&this._loader.abort(),this._flushStashBuffer(t),this._loader.destroy(),this._loader=null;var i={from:e,to:-1};this._currentRange={from:i.from,to:-1},this._speedSampler.reset(),this._stashSize=this._stashInitialSize,this._createLoader(),this._loader.open(this._dataSource,i),this._onSeeked&&this._onSeeked()},e.prototype.updateUrl=function(e){if(!e||"string"!=typeof e||0===e.length)throw new h.b("Url must be a non-empty string!");this._dataSource.url=e},e.prototype._expandBuffer=function(e){for(var t=this._stashSize;t+1048576<e;)t*=2;if((t+=1048576)!==this._bufferSize){var i=new ArrayBuffer(t);if(this._stashUsed>0){var r=new Uint8Array(this._stashBuffer,0,this._stashUsed);new Uint8Array(i,0,t).set(r,0)}this._stashBuffer=i,this._bufferSize=t}},e.prototype._normalizeSpeed=function(e){var t=this._speedNormalizeList,i=t.length-1,r=0,n=0,s=i;if(e<t[0])return t[0];for(;n<=s;){if((r=n+Math.floor((s-n)/2))===i||e>=t[r]&&e<t[r+1])return t[r];t[r]<e?n=r+1:s=r-1}},e.prototype._adjustStashSize=function(e){var t=0;(t=this._config.isLive?e/8:e<512?e:e>=512&&e<=1024?Math.floor(1.5*e):2*e)>8192&&(t=8192);var i=1024*t+1048576;this._bufferSize<i&&this._expandBuffer(i),this._stashSize=1024*t},e.prototype._dispatchChunks=function(e,t){return this._currentRange.to=t+e.byteLength-1,this._onDataArrival(e,t)},e.prototype._onURLRedirect=function(e){this._redirectedURL=e,this._onRedirect&&this._onRedirect(e)},e.prototype._onContentLengthKnown=function(e){e&&this._fullRequestFlag&&(this._totalLength=e,this._fullRequestFlag=!1)},e.prototype._onLoaderChunkArrival=function(e,t,i){if(!this._onDataArrival)throw new h.a("IOController: No existing consumer (onDataArrival) callback!");if(!this._paused){this._isEarlyEofReconnecting&&(this._isEarlyEofReconnecting=!1,this._onRecoveredEarlyEof&&this._onRecoveredEarlyEof()),this._speedSampler.addBytes(e.byteLength);var r=this._speedSampler.lastSecondKBps;if(0!==r){var n=this._normalizeSpeed(r);this._speedNormalized!==n&&(this._speedNormalized=n,this._adjustStashSize(n))}if(this._enableStash)if(0===this._stashUsed&&0===this._stashByteStart&&(this._stashByteStart=t),this._stashUsed+e.byteLength<=this._stashSize)(a=new Uint8Array(this._stashBuffer,0,this._stashSize)).set(new Uint8Array(e),this._stashUsed),this._stashUsed+=e.byteLength;else if(a=new Uint8Array(this._stashBuffer,0,this._bufferSize),this._stashUsed>0){var s=this._stashBuffer.slice(0,this._stashUsed);(l=this._dispatchChunks(s,this._stashByteStart))<s.byteLength?l>0&&(d=new Uint8Array(s,l),a.set(d,0),this._stashUsed=d.byteLength,this._stashByteStart+=l):(this._stashUsed=0,this._stashByteStart+=l),this._stashUsed+e.byteLength>this._bufferSize&&(this._expandBuffer(this._stashUsed+e.byteLength),a=new Uint8Array(this._stashBuffer,0,this._bufferSize)),a.set(new Uint8Array(e),this._stashUsed),this._stashUsed+=e.byteLength}else(l=this._dispatchChunks(e,t))<e.byteLength&&((o=e.byteLength-l)>this._bufferSize&&(this._expandBuffer(o),a=new Uint8Array(this._stashBuffer,0,this._bufferSize)),a.set(new Uint8Array(e,l),0),this._stashUsed+=o,this._stashByteStart=t+l);else if(0===this._stashUsed){var o;(l=this._dispatchChunks(e,t))<e.byteLength&&((o=e.byteLength-l)>this._bufferSize&&this._expandBuffer(o),(a=new Uint8Array(this._stashBuffer,0,this._bufferSize)).set(new Uint8Array(e,l),0),this._stashUsed+=o,this._stashByteStart=t+l)}else{var a,l;if(this._stashUsed+e.byteLength>this._bufferSize&&this._expandBuffer(this._stashUsed+e.byteLength),(a=new Uint8Array(this._stashBuffer,0,this._bufferSize)).set(new Uint8Array(e),this._stashUsed),this._stashUsed+=e.byteLength,(l=this._dispatchChunks(this._stashBuffer.slice(0,this._stashUsed),this._stashByteStart))<this._stashUsed&&l>0){var d=new Uint8Array(this._stashBuffer,l);a.set(d,0)}this._stashUsed-=l,this._stashByteStart+=l}}},e.prototype._flushStashBuffer=function(e){if(this._stashUsed>0){var t=this._stashBuffer.slice(0,this._stashUsed),i=this._dispatchChunks(t,this._stashByteStart),r=t.byteLength-i;if(i<t.byteLength){if(!e){if(i>0){var s=new Uint8Array(this._stashBuffer,0,this._bufferSize),o=new Uint8Array(t,i);s.set(o,0),this._stashUsed=o.byteLength,this._stashByteStart+=i}return 0}n.a.w(this.TAG,r+" bytes unconsumed data remain when flush buffer, dropped")}return this._stashUsed=0,this._stashByteStart=0,r}return 0},e.prototype._onLoaderComplete=function(e,t){this._flushStashBuffer(!0),this._onComplete&&this._onComplete(this._extraData)},e.prototype._onLoaderError=function(e,t){switch(n.a.e(this.TAG,"Loader error, code = "+t.code+", msg = "+t.msg),this._flushStashBuffer(!1),this._isEarlyEofReconnecting&&(this._isEarlyEofReconnecting=!1,e=o.b.UNRECOVERABLE_EARLY_EOF),e){case o.b.EARLY_EOF:if(!this._config.isLive&&this._totalLength){var i=this._currentRange.to+1;return void(i<this._totalLength&&(n.a.w(this.TAG,"Connection lost, trying reconnect..."),this._isEarlyEofReconnecting=!0,this._internalSeek(i,!1)))}e=o.b.UNRECOVERABLE_EARLY_EOF;case o.b.UNRECOVERABLE_EARLY_EOF:case o.b.CONNECTING_TIMEOUT:case o.b.HTTP_STATUS_CODE_INVALID:case o.b.EXCEPTION:}if(!this._onError)throw new h.d("IOException: "+t.msg);this._onError(e,t)},e}();t.a=y},function(e,t,i){var r=function(){function e(){}return e.install=function(){Object.setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Object.assign=Object.assign||function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),i=1;i<arguments.length;i++){var r=arguments[i];if(null!=r)for(var n in r)r.hasOwnProperty(n)&&(t[n]=r[n])}return t},"function"!=typeof self.Promise&&i(15).polyfill()},e}();r.install(),t.a=r},function(e,t,i){function r(e){var t={};function i(r){if(t[r])return t[r].exports;var n=t[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,i),n.l=!0,n.exports}i.m=e,i.c=t,i.i=function(e){return e},i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},i.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="/",i.oe=function(e){throw e};var r=i(i.s=ENTRY_MODULE);return r.default||r}function n(e){return(e+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function s(e,t,r){var s={};s[r]=[];var o=t.toString(),a=o.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!a)return s;for(var h,l=a[1],d=new RegExp("(\\\\n|\\W)"+n(l)+"\\(\\s*(/\\*.*?\\*/)?\\s*.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)","g");h=d.exec(o);)"dll-reference"!==h[3]&&s[r].push(h[3]);for(d=new RegExp("\\("+n(l)+'\\("(dll-reference\\s([\\.|\\-|\\+|\\w|/|@]+))"\\)\\)\\(\\s*(/\\*.*?\\*/)?\\s*.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)',"g");h=d.exec(o);)e[h[2]]||(s[r].push(h[1]),e[h[2]]=i(h[1]).m),s[h[2]]=s[h[2]]||[],s[h[2]].push(h[4]);for(var u,A=Object.keys(s),c=0;c<A.length;c++)for(var p=0;p<s[A[c]].length;p++)u=s[A[c]][p],isNaN(1*u)||(s[A[c]][p]=1*s[A[c]][p]);return s}function o(e){return Object.keys(e).reduce((function(t,i){return t||e[i].length>0}),!1)}e.exports=function(e,t){t=t||{};var n={main:i.m},a=t.all?{main:Object.keys(n.main)}:function(e,t){for(var i={main:[t]},r={main:[]},n={main:{}};o(i);)for(var a=Object.keys(i),h=0;h<a.length;h++){var l=a[h],d=i[l].pop();if(n[l]=n[l]||{},!n[l][d]&&e[l][d]){n[l][d]=!0,r[l]=r[l]||[],r[l].push(d);for(var u=s(e,e[l][d],l),A=Object.keys(u),c=0;c<A.length;c++)i[A[c]]=i[A[c]]||[],i[A[c]]=i[A[c]].concat(u[A[c]])}}return r}(n,e),h="";Object.keys(a).filter((function(e){return"main"!==e})).forEach((function(e){for(var t=0;a[e][t];)t++;a[e].push(t),n[e][t]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",h=h+"var "+e+" = ("+r.toString().replace("ENTRY_MODULE",JSON.stringify(t))+")({"+a[e].map((function(t){return JSON.stringify(t)+": "+n[e][t].toString()})).join(",")+"});\n"})),h=h+"new (("+r.toString().replace("ENTRY_MODULE",JSON.stringify(e))+")({"+a.main.map((function(e){return JSON.stringify(e)+": "+n.main[e].toString()})).join(",")+"}))(self);";var l=new window.Blob([h],{type:"text/javascript"});if(t.bare)return l;var d=(window.URL||window.webkitURL||window.mozURL||window.msURL).createObjectURL(l),u=new window.Worker(d);return u.objectURL=d,u}},function(e,t,i){e.exports=i(19).default},function(e,t,i){(function(t,i){
6
+ */!function(e){!function(){var t="undefined"!=typeof window&&void 0!==window.document?window.document:{},i=e.exports,r=function(){for(var e,i=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],r=0,n=i.length,s={};r<n;r++)if((e=i[r])&&e[1]in t){for(r=0;r<e.length;r++)s[i[0][r]]=e[r];return s}return!1}(),n={change:r.fullscreenchange,error:r.fullscreenerror},s={request:function(e,i){return new Promise(function(n,s){var o=function(){this.off("change",o),n()}.bind(this);this.on("change",o);var a=(e=e||t.documentElement)[r.requestFullscreen](i);a instanceof Promise&&a.then(o).catch(s)}.bind(this))},exit:function(){return new Promise(function(e,i){if(this.isFullscreen){var n=function(){this.off("change",n),e()}.bind(this);this.on("change",n);var s=t[r.exitFullscreen]();s instanceof Promise&&s.then(n).catch(i)}else e()}.bind(this))},toggle:function(e,t){return this.isFullscreen?this.exit():this.request(e,t)},onchange:function(e){this.on("change",e)},onerror:function(e){this.on("error",e)},on:function(e,i){var r=n[e];r&&t.addEventListener(r,i,!1)},off:function(e,i){var r=n[e];r&&t.removeEventListener(r,i,!1)},raw:r};r?(Object.defineProperties(s,{isFullscreen:{get:function(){return Boolean(t[r.fullscreenElement])}},element:{enumerable:!0,get:function(){return t[r.fullscreenElement]}},isEnabled:{enumerable:!0,get:function(){return Boolean(t[r.fullscreenEnabled])}}}),i?e.exports=s:window.screenfull=s):i?e.exports={isEnabled:!1}:window.screenfull={isEnabled:!1}}()}(W);var Q=j(W.exports);function z(){}function H(e=""){const t=e.split(","),i=atob(t[1]),r=t[0].replace("data:","").replace(";base64","");let n=i.length;const s=new Uint8Array(n);for(;n--;)s[n]=i.charCodeAt(n);return new File([s],"file",{type:r})}function q(){return(new Date).getTime()}function $(e,t,i){if(e)return"object"==typeof t&&Object.keys(t).forEach((i=>{$(e,i,t[i])})),e.style[t]=i,e}function X(){return performance&&"function"==typeof performance.now?performance.now():Date.now()}function Y(e){let t=0,i=X();return r=>{t+=r;const n=X(),s=n-i;s>=1e3&&(e(t/s*1e3),i=n,t=0)}}function Z(){return/iphone|ipod|android.*mobile|windows.*phone|blackberry.*mobile/i.test(window.navigator.userAgent.toLowerCase())}function K(){return Q.isFullscreen}function J(e){return null==e}function ee(e){return!J(e)}function te(e){const t=e||window.event;return t.target||t.srcElement}(()=>{try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(e instanceof WebAssembly.Module)return new WebAssembly.Instance(e)instanceof WebAssembly.Instance}}catch(e){}})();class ie{constructor(){}on(e,t,i){const r=this.e||(this.e={});return(r[e]||(r[e]=[])).push({fn:t,ctx:i}),this}once(e,t,i){const r=this;function n(...s){r.off(e,n),t.apply(i,s)}return n._=t,this.on(e,n,i)}emit(e,...t){const i=((this.e||(this.e={}))[e]||[]).slice();for(let e=0;e<i.length;e+=1)i[e].fn.apply(i[e].ctx,t);return this}off(e,t){const i=this.e||(this.e={});if(!e)return Object.keys(i).forEach((e=>{delete i[e]})),void delete this.e;const r=i[e],n=[];if(r&&t)for(let e=0,i=r.length;e<i;e+=1)r[e].fn!==t&&r[e].fn._!==t&&n.push(r[e]);return n.length?i[e]=n:delete i[e],this}}let re=class extends ie{constructor(){super(),this.init=!1}resetInit(){this.init=!1,this.videoInfo={width:"",height:"",encType:"",encTypeCode:""}}destroy(){this.resetInit(),this.player.$container.removeChild(this.$videoElement),this.off()}updateVideoInfo(e){e.encTypeCode&&(this.videoInfo.encType=D[e.encTypeCode]),e.width&&(this.videoInfo.width=e.width),e.height&&(this.videoInfo.height=e.height),this.videoInfo.encType&&this.videoInfo.height&&this.videoInfo.width&&!this.init&&(this.player.emit(w.videoInfo,this.videoInfo),this.init=!0)}play(){}pause(){}clearView(){}};const ne="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof global&&global.global===global?global:void 0;function se(e,t,i){const r=new XMLHttpRequest;r.open("GET",e),r.responseType="blob",r.onload=function(){le(r.response,t,i)},r.onerror=function(){},r.send()}function oe(e){const t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch(e){}return t.status>=200&&t.status<=299}function ae(e){try{e.dispatchEvent(new MouseEvent("click"))}catch(t){const i=document.createEvent("MouseEvents");i.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(i)}}const he=ne.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent);var le="object"!=typeof window||window!==ne?function(){}:"download"in HTMLAnchorElement.prototype&&!he?function(e,t,i){const r=ne.URL||ne.webkitURL,n=document.createElementNS("http://www.w3.org/1999/xhtml","a");t=t||e.name||"download",n.download=t,n.rel="noopener","string"==typeof e?(n.href=e,n.origin!==location.origin?oe(n.href)?se(e,t,i):ae(n,n.target="_blank"):ae(n)):(n.href=r.createObjectURL(e),setTimeout((function(){r.revokeObjectURL(n.href)}),4e4),setTimeout((function(){ae(n)}),0))}:"msSaveOrOpenBlob"in navigator?function(e,t,i){if(t=t||e.name||"download","string"==typeof e)if(oe(e))se(e,t,i);else{const t=document.createElement("a");t.href=e,t.target="_blank",setTimeout((function(){ae(t)}))}else navigator.msSaveOrOpenBlob(function(e,t){return void 0===t?t={autoBom:!1}:"object"!=typeof t&&(t={autoBom:!t}),t.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob([String.fromCharCode(65279),e],{type:e.type}):e}(e,i),t)}:function(e,t,i,r){if((r=r||open("","_blank"))&&(r.document.title=r.document.body.innerText="downloading..."),"string"==typeof e)return se(e,t,i);const n="application/octet-stream"===e.type,s=/constructor/i.test(ne.HTMLElement)||ne.safari,o=/CriOS\/[\d]+/.test(navigator.userAgent);if((o||n&&s||he)&&"undefined"!=typeof FileReader){const t=new FileReader;t.onloadend=function(){let e=t.result;e=o?e:e.replace(/^data:[^;]*;/,"data:attachment/file;"),r?r.location.href=e:location=e,r=null},t.readAsDataURL(e)}else{const t=ne.URL||ne.webkitURL,i=t.createObjectURL(e);r?r.location=i:location.href=i,r=null,setTimeout((function(){t.revokeObjectURL(i)}),4e4)}};class de extends re{constructor(e){super(),this.player=e;const t=document.createElement("canvas");t.style.position="absolute",t.style.top=0,t.style.left=0,this.$videoElement=t,e.$container.appendChild(this.$videoElement),this.context2D=null,this.contextGl=null,this.contextGlRender=null,this.contextGlDestroy=null,this.bitmaprenderer=null,this.renderType=null,this.videoInfo={width:"",height:"",encType:""},this._initCanvasRender(),this.player.debug.log("CanvasVideo","init")}destroy(){super.destroy(),this.contextGl&&(this.contextGl=null),this.context2D&&(this.context2D=null),this.contextGlRender&&(this.contextGlDestroy&&this.contextGlDestroy(),this.contextGlDestroy=null,this.contextGlRender=null),this.bitmaprenderer&&(this.bitmaprenderer=null),this.renderType=null,this.player.debug.log("CanvasVideoLoader","destroy")}_initContextGl(){this.contextGl=function(e){let t=null;const i=["webgl","experimental-webgl","moz-webgl","webkit-3d"];let r=0;for(;!t&&r<i.length;){const n=i[r];try{const i={preserveDrawingBuffer:!0};t=e.getContext(n,i)}catch(e){t=null}t&&"function"==typeof t.getParameter||(t=null),++r}return t}(this.$videoElement);const e=((e,t)=>{var i=["attribute vec4 vertexPos;","attribute vec4 texturePos;","varying vec2 textureCoord;","void main()","{","gl_Position = vertexPos;","textureCoord = texturePos.xy;","}"].join("\n"),r=["precision highp float;","varying highp vec2 textureCoord;","uniform sampler2D ySampler;","uniform sampler2D uSampler;","uniform sampler2D vSampler;","const mat4 YUV2RGB = mat4","(","1.1643828125, 0, 1.59602734375, -.87078515625,","1.1643828125, -.39176171875, -.81296875, .52959375,","1.1643828125, 2.017234375, 0, -1.081390625,","0, 0, 0, 1",");","void main(void) {","highp float y = texture2D(ySampler, textureCoord).r;","highp float u = texture2D(uSampler, textureCoord).r;","highp float v = texture2D(vSampler, textureCoord).r;","gl_FragColor = vec4(y, u, v, 1) * YUV2RGB;","}"].join("\n");t&&e.pixelStorei(e.UNPACK_ALIGNMENT,1);var n=e.createShader(e.VERTEX_SHADER);e.shaderSource(n,i),e.compileShader(n),e.getShaderParameter(n,e.COMPILE_STATUS);var s=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(s,r),e.compileShader(s),e.getShaderParameter(s,e.COMPILE_STATUS);var o=e.createProgram();e.attachShader(o,n),e.attachShader(o,s),e.linkProgram(o),e.getProgramParameter(o,e.LINK_STATUS),e.useProgram(o);var a=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,a),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,1,-1,1,1,-1,-1,-1]),e.STATIC_DRAW);var h=e.getAttribLocation(o,"vertexPos");e.enableVertexAttribArray(h),e.vertexAttribPointer(h,2,e.FLOAT,!1,0,0);var l=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,l),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,0,0,0,1,1,0,1]),e.STATIC_DRAW);var d=e.getAttribLocation(o,"texturePos");function u(t,i){var r=e.createTexture();return e.bindTexture(e.TEXTURE_2D,r),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.bindTexture(e.TEXTURE_2D,null),e.uniform1i(e.getUniformLocation(o,t),i),r}e.enableVertexAttribArray(d),e.vertexAttribPointer(d,2,e.FLOAT,!1,0,0);var A=u("ySampler",0),c=u("uSampler",1),p=u("vSampler",2);return{render:function(t,i,r,n,s){e.viewport(0,0,t,i),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,A),e.texImage2D(e.TEXTURE_2D,0,e.LUMINANCE,t,i,0,e.LUMINANCE,e.UNSIGNED_BYTE,r),e.activeTexture(e.TEXTURE1),e.bindTexture(e.TEXTURE_2D,c),e.texImage2D(e.TEXTURE_2D,0,e.LUMINANCE,t/2,i/2,0,e.LUMINANCE,e.UNSIGNED_BYTE,n),e.activeTexture(e.TEXTURE2),e.bindTexture(e.TEXTURE_2D,p),e.texImage2D(e.TEXTURE_2D,0,e.LUMINANCE,t/2,i/2,0,e.LUMINANCE,e.UNSIGNED_BYTE,s),e.drawArrays(e.TRIANGLE_STRIP,0,4)},destroy:function(){try{e.deleteProgram(o),e.deleteBuffer(a),e.deleteBuffer(l),e.deleteTexture(A),e.deleteTexture(c),e.deleteTexture(p)}catch(e){}}}})(this.contextGl,this.player._opt.openWebglAlignment);this.contextGlRender=e.render,this.contextGlDestroy=e.destroy}_initContext2D(){this.context2D=this.$videoElement.getContext("2d")}_initCanvasRender(){this.player._opt.useWCS&&!this._supportOffscreen()?(this.renderType=M,this._initContext2D()):this._supportOffscreen()?(this.renderType=F,this._bindOffscreen()):(this.renderType=P,this._initContextGl())}_supportOffscreen(){return"function"==typeof this.$videoElement.transferControlToOffscreen&&this.player._opt.useOffscreen}_bindOffscreen(){this.bitmaprenderer=this.$videoElement.getContext("bitmaprenderer")}initCanvasViewSize(){this.$videoElement.width=this.videoInfo.width,this.$videoElement.height=this.videoInfo.height,this.resize()}render(e){switch(this.player.videoTimestamp=e.ts,this.renderType){case F:this.bitmaprenderer.transferFromImageBitmap(e.buffer);break;case P:this.contextGlRender(this.$videoElement.width,this.$videoElement.height,e.output[0],e.output[1],e.output[2]);break;case M:this.context2D.drawImage(e.videoFrame,0,0,this.$videoElement.width,this.$videoElement.height),(t=e.videoFrame).close?t.close():t.destroy&&t.destroy()}var t}screenshot(e,t,i,r){e=e||q(),r=r||O.download;const n={png:"image/png",jpeg:"image/jpeg",webp:"image/webp"};let s=.92;!n[t]&&O[t]&&(r=t,t="png",i=void 0),"string"==typeof i&&(r=i,i=void 0),void 0!==i&&(s=Number(i));const o=this.$videoElement.toDataURL(n[t]||n.png,s);if(r===O.base64)return o;{const t=H(o);if(r===O.blob)return t;r===O.download&&le(t,e)}}clearView(){switch(this.renderType){case F:(function(e,t){const i=document.createElement("canvas");return i.width=e,i.height=t,window.createImageBitmap(i,0,0,e,t)})(this.$videoElement.width,this.$videoElement.height).then((e=>{this.bitmaprenderer.transferFromImageBitmap(e)}));break;case P:this.contextGl.clear(this.contextGl.COLOR_BUFFER_BIT);break;case M:this.context2D.clearRect(0,0,this.$videoElement.width,this.$videoElement.height)}}resize(){this.player.debug.log("canvasVideo","resize");const e=this.player._opt,t=this.player.width,i=this.player.height;let r=this.$videoElement.width,n=this.$videoElement.height;const s=e.rotate,o=(t-r)/2,a=(i-n)/2;270!==s&&90!==s||(r=this.$videoElement.height,n=this.$videoElement.width);const h=t/r,l=i/n;let d=h>l?l:h;e.scaleMode!==x.auto&&h!==l&&(d=h+","+l),e.scaleMode===x.fullAuto&&(d=h>l?h:l);let u="scale("+d+")";s&&(u+=" rotate("+s+"deg)"),this.$videoElement.style.transform=u,this.$videoElement.style.left=o+"px",this.$videoElement.style.top=a+"px"}}class ue extends ie{constructor(e){super(),this.bufferList=[],this.player=e,this.scriptNode=null,this.hasInitScriptNode=!1,this.audioContextChannel=null,this.audioContext=new(window.AudioContext||window.webkitAudioContext),this.gainNode=this.audioContext.createGain();const t=this.audioContext.createBufferSource();t.buffer=this.audioContext.createBuffer(1,1,22050),t.connect(this.audioContext.destination),t.noteOn?t.noteOn(0):t.start(0),this.audioBufferSourceNode=t,this.mediaStreamAudioDestinationNode=this.audioContext.createMediaStreamDestination(),this.audioEnabled(!0),this.gainNode.gain.value=0,this.playing=!1,this.audioSyncVideoOption={diff:null},this.audioInfo={encType:"",channels:"",sampleRate:""},this.init=!1,this.hasAudio=!1,this.on(w.videoSyncAudio,(e=>{this.audioSyncVideoOption=e})),this.player.debug.log("AudioContext","init")}resetInit(){this.init=!1,this.audioInfo={encType:"",channels:"",sampleRate:""}}destroy(){this.closeAudio(),this.resetInit(),this.audioContext.close(),this.audioContext=null,this.gainNode=null,this.hasAudio=!1,this.playing=!1,this.scriptNode&&(this.scriptNode.onaudioprocess=z,this.scriptNode=null),this.audioBufferSourceNode=null,this.mediaStreamAudioDestinationNode=null,this.hasInitScriptNode=!1,this.audioSyncVideoOption={diff:null},this.off(),this.player.debug.log("AudioContext","destroy")}updateAudioInfo(e){e.encTypeCode&&(this.audioInfo.encType=B[e.encTypeCode]),e.channels&&(this.audioInfo.channels=e.channels),e.sampleRate&&(this.audioInfo.sampleRate=e.sampleRate),this.audioInfo.sampleRate&&this.audioInfo.channels&&this.audioInfo.encType&&!this.init&&(this.player.emit(w.audioInfo,this.audioInfo),this.init=!0)}get isPlaying(){return this.playing}get isMute(){return 0===this.gainNode.gain.value}get volume(){return this.gainNode.gain.value}get bufferSize(){return this.bufferList.length}initScriptNode(){if(this.playing=!0,this.hasInitScriptNode)return;const e=this.audioInfo.channels,t=this.audioContext.createScriptProcessor(1024,0,e);t.onaudioprocess=t=>{const i=t.outputBuffer;if(this.bufferList.length&&this.playing){if(!this.player._opt.useWCS&&!this.player._opt.useMSE&&this.player._opt.wasmDecodeAudioSyncVideo){if(this.audioSyncVideoOption.diff>U)return void this.player.debug.warn("AudioContext",`audioSyncVideoOption more than diff :${this.audioSyncVideoOption.diff}, waiting`);if(this.audioSyncVideoOption.diff<-1e3){this.player.debug.warn("AudioContext",`audioSyncVideoOption less than diff :${this.audioSyncVideoOption.diff}, dropping`);let e=this.bufferList.shift();for(;e.ts-this.player.videoTimestamp<-1e3&&this.bufferList.length>0;)e=this.bufferList.shift();if(0===this.bufferList.length)return}}if(0===this.bufferList.length)return;const t=this.bufferList.shift();t&&t.ts&&(this.player.audioTimestamp=t.ts);for(let r=0;r<e;r++){const e=t.buffer[r],n=i.getChannelData(r);for(let t=0;t<1024;t++)n[t]=e[t]||0}}},t.connect(this.gainNode),this.scriptNode=t,this.gainNode.connect(this.audioContext.destination),this.gainNode.connect(this.mediaStreamAudioDestinationNode),this.hasInitScriptNode=!0}mute(e){e?(this.isMute||this.player.emit(w.mute,e),this.setVolume(0),this.clear()):(this.isMute&&this.player.emit(w.mute,e),this.setVolume(.5))}setVolume(e){e=parseFloat(e).toFixed(2),isNaN(e)||(this.audioEnabled(!0),e=function(e,t,i){return Math.max(Math.min(e,Math.max(t,i)),Math.min(t,i))}(e,0,1),this.gainNode.gain.value=e,this.gainNode.gain.setValueAtTime(e,this.audioContext.currentTime),this.player.emit(w.volumechange,this.player.volume))}closeAudio(){this.hasInitScriptNode&&(this.scriptNode&&this.scriptNode.disconnect(this.gainNode),this.gainNode&&this.gainNode.disconnect(this.audioContext.destination),this.gainNode&&this.gainNode.disconnect(this.mediaStreamAudioDestinationNode)),this.clear()}audioEnabled(e){e?"suspended"===this.audioContext.state&&this.audioContext.resume():"running"===this.audioContext.state&&this.audioContext.suspend()}isStateRunning(){return"running"===this.audioContext.state}isStateSuspended(){return"suspended"===this.audioContext.state}clear(){this.bufferList=[]}play(e,t){this.isMute||(this.hasAudio=!0,this.bufferList.push({buffer:e,ts:t}),this.bufferList.length>20&&(this.player.debug.warn("AudioContext",`bufferList is large: ${this.bufferList.length}`),this.bufferList.length>50&&this.bufferList.shift()))}pause(){this.audioSyncVideoOption={diff:null},this.playing=!1,this.clear()}resume(){this.playing=!0}}class Ae{constructor(e){return new(Ae.getLoaderFactory())(e)}static getLoaderFactory(){return ue}}class ce extends ie{constructor(e){super(),this.player=e,this.playing=!1,this.abortController=new AbortController,this.streamRate=Y((t=>{e.emit(w.kBps,(t/1024).toFixed(2))})),e.debug.log("FetchStream","init")}destroy(){this.abort(),this.off(),this.streamRate=null,this.player.debug.log("FetchStream","destroy")}fetchStream(e,t={}){const{demux:i}=this.player;this.player._times.streamStart=q();const r=Object.assign({signal:this.abortController.signal},{headers:t.headers||{}});fetch(e,r).then((e=>{const t=e.body.getReader();this.emit(w.streamSuccess);const r=()=>{t.read().then((({done:e,value:t})=>{e?i.close():(this.streamRate&&this.streamRate(t.byteLength),i.dispatch(t),r())})).catch((e=>{i.close();const t=e.toString();-1===t.indexOf(N)&&-1===t.indexOf(V)&&e.name!==G&&(this.abort(),this.emit(R.fetchError,e),this.player.emit(w.error,R.fetchError))}))};r()})).catch((e=>{"AbortError"!==e.name&&(i.close(),this.abort(),this.emit(R.fetchError,e),this.player.emit(w.error,R.fetchError))}))}abort(){this.abortController&&(this.abortController.abort(),this.abortController=null)}}class pe extends ie{constructor(e){super(),this.player=e,this.socket=null,this.socketStatus=C,this.wsUrl=null,this.streamRate=Y((t=>{e.emit(w.kBps,(t/1024).toFixed(2))})),e.debug.log("WebsocketLoader","init")}destroy(){this.socket&&(this.socket.close(1e3,"Client disconnecting"),this.socket=null),this.socketStatus=C,this.streamRate=null,this.wsUrl=null,this.off(),this.player.debug.log("websocketLoader","destroy")}_createWebSocket(){const e=this.player,{debug:t,events:{proxy:i},demux:r}=e;this.socket=new WebSocket(this.wsUrl),this.socket.binaryType="arraybuffer",i(this.socket,"open",(()=>{this.emit(w.streamSuccess),t.log("websocketLoader","socket open"),this.socketStatus=k})),i(this.socket,"message",(e=>{this.streamRate&&this.streamRate(e.data.byteLength),this._handleMessage(e.data)})),i(this.socket,"close",(()=>{t.log("websocketLoader","socket close"),this.emit(w.streamEnd),this.socketStatus=I})),i(this.socket,"error",(e=>{t.log("websocketLoader","socket error"),this.emit(R.websocketError,e),this.player.emit(w.error,R.websocketError),this.socketStatus=L,r.close(),t.log("websocketLoader","socket error:",e)}))}_handleMessage(e){const{demux:t}=this.player;t?t.dispatch(e):this.player.debug.warn("websocketLoader","websocket handle message demux is null")}fetchStream(e,t){this.player._times.streamStart=q(),this.wsUrl=e,this._createWebSocket()}}class fe{constructor(e){return new(fe.getLoaderFactory(e._opt.protocol))(e)}static getLoaderFactory(e){return e===i?ce:e===t?pe:void 0}}class me{constructor(e){this.player=e,this.decoderWorker=new Worker(e._opt.decoder),this._initDecoderWorker(),e.debug.log("decoderWorker","init")}destroy(){this.decoderWorker.postMessage({cmd:b}),this.decoderWorker.terminate(),this.decoderWorker=null,this.player.debug.log("decoderWorker","destroy")}_initDecoderWorker(){const{debug:e,events:{proxy:t}}=this.player;this.decoderWorker.onmessage=t=>{const i=t.data;switch(i.cmd){case o:e.log("decoderWorker","onmessage:",o),this.player.loaded||this.player.emit(w.load),this.player.emit(w.decoderWorkerInit),this._initWork();break;case A:e.log("decoderWorker","onmessage:",A,i.code),this.player._times.decodeStart||(this.player._times.decodeStart=q()),this.player.video.updateVideoInfo({encTypeCode:i.code});break;case u:e.log("decoderWorker","onmessage:",u,i.code),this.player.audio&&this.player.audio.updateAudioInfo({encTypeCode:i.code});break;case a:if(e.log("decoderWorker","onmessage:",a,`width:${i.w},height:${i.h}`),this.player.video.updateVideoInfo({width:i.w,height:i.h}),!this.player._opt.openWebglAlignment&&i.w/2%4!=0)return void this.player.emit(R.webglAlignmentError);this.player.video.initCanvasViewSize();break;case d:e.log("decoderWorker","onmessage:",d,`channels:${i.channels},sampleRate:${i.sampleRate}`),this.player.audio&&(this.player.audio.updateAudioInfo(i),this.player.audio.initScriptNode(i));break;case h:this.player.handleRender(),this.player.video.render(i),this.player.emit(w.timeUpdate,i.ts),this.player.updateStats({fps:!0,ts:i.ts,buf:i.delay}),this.player._times.videoStart||(this.player._times.videoStart=q(),this.player.handlePlayToRenderTimes());break;case l:this.player.playing&&this.player.audio&&this.player.audio.play(i.buffer,i.ts);break;case c:i.message&&-1!==i.message.indexOf(p)&&this.player.emitError(R.wasmDecodeError);break;default:this.player[i.cmd]&&this.player[i.cmd](i)}}}_initWork(){const e={debug:this.player._opt.debug,useOffscreen:this.player._opt.useOffscreen,useWCS:this.player._opt.useWCS,videoBuffer:this.player._opt.videoBuffer,videoBufferDelay:this.player._opt.videoBufferDelay,openWebglAlignment:this.player._opt.openWebglAlignment};this.decoderWorker.postMessage({cmd:y,opt:JSON.stringify(e),sampleRate:this.player.audio&&this.player.audio.audioContext.sampleRate||0})}decodeVideo(e,t,i){const r={type:m,ts:Math.max(t,0),isIFrame:i};this.decoderWorker.postMessage({cmd:v,buffer:e,options:r},[e.buffer])}decodeAudio(e,t){this.player._opt.useWCS||this.player._opt.useMSE?this._decodeAudioNoDelay(e,t):this._decodeAudio(e,t)}_decodeAudio(e,t){const i={type:f,ts:Math.max(t,0)};this.decoderWorker.postMessage({cmd:v,buffer:e,options:i},[e.buffer])}_decodeAudioNoDelay(e,t){this.decoderWorker.postMessage({cmd:E,buffer:e,ts:Math.max(t,0)},[e.buffer])}updateWorkConfig(e){this.decoderWorker.postMessage({cmd:S,key:e.key,value:e.value})}}class _e extends ie{constructor(e){super(),this.player=e,this.stopId=null,this.firstTimestamp=null,this.startTimestamp=null,this.delay=-1,this.bufferList=[],this.dropping=!1,this.initInterval()}destroy(){this.stopId&&(clearInterval(this.stopId),this.stopId=null),this.firstTimestamp=null,this.startTimestamp=null,this.delay=-1,this.bufferList=[],this.dropping=!1,this.off(),this.player.debug.log("CommonDemux","destroy")}getDelay(e){if(!e)return-1;if(this.firstTimestamp){if(e){const t=Date.now()-this.startTimestamp,i=e-this.firstTimestamp;this.delay=t>=i?t-i:i-t}}else this.firstTimestamp=e,this.startTimestamp=Date.now(),this.delay=-1;return this.delay}resetDelay(){this.firstTimestamp=null,this.startTimestamp=null,this.delay=-1,this.dropping=!1}initInterval(){this.player.debug.log("common dumex","init Interval");const e=()=>{let e;const t=this.player._opt.videoBuffer,i=this.player._opt.videoBufferDelay;if(this.bufferList.length)if(this.dropping){for(e=this.bufferList.shift(),e.type===f&&0===e.payload[1]&&this._doDecoderDecode(e);!e.isIFrame&&this.bufferList.length;)e=this.bufferList.shift(),e.type===f&&0===e.payload[1]&&this._doDecoderDecode(e);e.isIFrame&&this.getDelay(e.ts)<=Math.min(t,200)&&(this.dropping=!1,this._doDecoderDecode(e))}else e=this.bufferList[0],-1===this.getDelay(e.ts)?(this.bufferList.shift(),this._doDecoderDecode(e)):this.delay>t+i?(this.resetDelay(),this.dropping=!0):(e=this.bufferList[0],this.getDelay(e.ts)>t&&(this.bufferList.shift(),this._doDecoderDecode(e)))};e(),this.stopId=setInterval(e,10)}_doDecode(e,t,i,r,n){const s=this.player,o={ts:i,cts:n,type:t,isIFrame:!1};s._opt.useWCS&&!s._opt.useOffscreen?(t===m&&(o.isIFrame=r),this.pushBuffer(e,o)):t===m?s.decoderWorker&&s.decoderWorker.decodeVideo(e,i,r):t===f&&s._opt.hasAudio&&s.decoderWorker&&s.decoderWorker.decodeAudio(e,i)}_doDecoderDecode(e){const t=this.player;e.type===f?t._opt.hasAudio&&t.decoderWorker&&t.decoderWorker.decodeAudio(e.payload,e.ts):e.type}pushBuffer(e,t){t.type===f?this.bufferList.push({ts:t.ts,payload:e,type:f}):t.type===m&&this.bufferList.push({ts:t.ts,cts:t.cts,payload:e,type:m,isIFrame:t.isIFrame})}close(){}}class ge extends _e{constructor(e){super(e),this.input=this._inputFlv(),this.flvDemux=this.dispatchFlvData(this.input),e.debug.log("FlvDemux","init")}destroy(){super.destroy(),this.input=null,this.flvDemux=null,this.player.debug.log("FlvDemux","destroy")}dispatch(e){this.flvDemux(e)}*_inputFlv(){yield 9;const e=new ArrayBuffer(4),t=new Uint8Array(e),i=new Uint32Array(e),r=this.player;for(;;){t[3]=0;const e=yield 15,n=e[4];t[0]=e[7],t[1]=e[6],t[2]=e[5];const s=i[0];t[0]=e[10],t[1]=e[9],t[2]=e[8];let o=i[0];16777215===o&&(t[3]=e[11],o=i[0]);const a=yield s;switch(n){case _:r._opt.hasAudio&&(r.updateStats({abps:a.byteLength}),a.byteLength>0&&this._doDecode(a,f,o));break;case g:if(r._times.demuxStart||(r._times.demuxStart=q()),r._opt.hasVideo){r.updateStats({vbps:a.byteLength});const e=a[0]>>4==1;if(a.byteLength>0){i[0]=a[4],i[1]=a[3],i[2]=a[2],i[3]=0;const t=i[0];this._doDecode(a,m,o,e,t)}}}}}dispatchFlvData(e){let t=e.next(),i=null;return r=>{let n=new Uint8Array(r);if(i){const e=new Uint8Array(i.length+n.length);e.set(i),e.set(n,i.length),n=e,i=null}for(;n.length>=t.value;){const i=n.slice(t.value);t=e.next(n.slice(0,t.value)),n=i}n.length>0&&(i=n)}}close(){this.input&&this.input.return(null)}}class ye extends _e{constructor(e){super(e),e.debug.log("M7sDemux","init")}destroy(){super.destroy(),this.player.debug.log("M7sDemux","destroy"),this.player=null}dispatch(e){const t=this.player,i=new DataView(e),r=i.getUint8(0),n=i.getUint32(1,!1);switch(r){case f:if(t._opt.hasAudio){const i=new Uint8Array(e,5);t.updateStats({abps:i.byteLength}),i.byteLength>0&&this._doDecode(i,r,n)}break;case m:if(t._opt.hasVideo)if(t._times.demuxStart||(t._times.demuxStart=q()),i.byteLength>5){const s=new Uint8Array(e,5),o=i.getUint8(5)>>4==1;t.updateStats({vbps:s.byteLength}),s.byteLength>0&&this._doDecode(s,r,n,o)}else this.player.debug.warn("M7sDemux","dispatch","dv byteLength is",i.byteLength)}}}class ve{constructor(e){return new(ve.getLoaderFactory(e._opt.demuxType))(e)}static getLoaderFactory(e){return e===n?ye:e===r?ge:void 0}}const Ee=()=>"undefined"!=typeof navigator&&parseFloat((""+(/CPU.*OS ([0-9_]{3,4})[0-9_]{0,1}|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent)||[0,""])[1]).replace("undefined","3_2").replace("_",".").replace("_",""))<10&&!window.MSStream,be=()=>"wakeLock"in navigator;class Se{constructor(e){if(this.player=e,this.enabled=!1,be()){this._wakeLock=null;const e=()=>{null!==this._wakeLock&&"visible"===document.visibilityState&&this.enable()};document.addEventListener("visibilitychange",e),document.addEventListener("fullscreenchange",e)}else Ee()?this.noSleepTimer=null:(this.noSleepVideo=document.createElement("video"),this.noSleepVideo.setAttribute("title","No Sleep"),this.noSleepVideo.setAttribute("playsinline",""),this._addSourceToVideo(this.noSleepVideo,"webm","data:video/webm;base64,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"),this._addSourceToVideo(this.noSleepVideo,"mp4","data:video/mp4;base64,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"),this.noSleepVideo.addEventListener("loadedmetadata",(()=>{this.noSleepVideo.duration<=1?this.noSleepVideo.setAttribute("loop",""):this.noSleepVideo.addEventListener("timeupdate",(()=>{this.noSleepVideo.currentTime>.5&&(this.noSleepVideo.currentTime=Math.random())}))})))}_addSourceToVideo(e,t,i){const r=document.createElement("source");r.src=i,r.type=`video/${t}`,e.appendChild(r)}get isEnabled(){return this.enabled}enable(){const e=this.player.debug;if(be())return navigator.wakeLock.request("screen").then((t=>{this._wakeLock=t,this.enabled=!0,e.log("wakeLock","Wake Lock active."),this._wakeLock.addEventListener("release",(()=>{e.log("wakeLock","Wake Lock released.")}))})).catch((t=>{throw this.enabled=!1,e.error("wakeLock",`${t.name}, ${t.message}`),t}));if(Ee())return this.disable(),this.noSleepTimer=window.setInterval((()=>{document.hidden||(window.location.href=window.location.href.split("#")[0],window.setTimeout(window.stop,0))}),15e3),this.enabled=!0,Promise.resolve();return this.noSleepVideo.play().then((e=>(this.enabled=!0,e))).catch((e=>{throw this.enabled=!1,e}))}disable(){const e=this.player.debug;be()?(this._wakeLock&&this._wakeLock.release(),this._wakeLock=null):Ee()?this.noSleepTimer&&(e.warn("wakeLock","NoSleep now disabled for older iOS devices."),window.clearInterval(this.noSleepTimer),this.noSleepTimer=null):this.noSleepVideo.pause(),this.enabled=!1}}class we{constructor(e){this.log=(t,...i)=>{e._opt.debug&&console.log(`[${t}]`,...i)},this.warn=(t,...i)=>{e._opt.debug&&console.warn(`[${t}]`,...i)},this.error=(e,...t)=>{console.error(`[${e}]`,...t)}}}class Te{constructor(e){this.destroys=[],this.proxy=this.proxy.bind(this),this.master=e}proxy(e,t,i,r={}){if(!e)return;if(Array.isArray(t))return t.map((t=>this.proxy(e,t,i,r)));e.addEventListener(t,i,r);const n=()=>e.removeEventListener(t,i,r);return this.destroys.push(n),n}destroy(){this.master.debug&&this.master.debug.log("Events","destroy"),this.destroys.forEach((e=>e()))}}class Re{constructor(e){this.player=e,((e,t)=>{const{events:{proxy:i}}=e,r=document.createElement("object");r.setAttribute("aria-hidden","true"),r.setAttribute("tabindex",-1),r.type="text/html",r.data="about:blank",$(r,{display:"block",position:"absolute",top:"0",left:"0",height:"100%",width:"100%",overflow:"hidden",pointerEvents:"none",zIndex:"-1"});let n=e.width,s=e.height;i(r,"load",(()=>{i(r.contentDocument.defaultView,"resize",(()=>{e.width===n&&e.height===s||(n=e.width,s=e.height,e.emit(w.resize),a())}))})),e.$container.appendChild(r),e.on(w.destroy,(()=>{e.$container.removeChild(r)}));const o=i=>{const r=!0===(n=i)||!1===n?i:e.fullscreen;var n;$(t.$fullscreenExit,"display",r?"flex":"none"),$(t.$fullscreen,"display",r?"none":"flex")},a=()=>{Z()&&t.$controls&&e._opt.useWebFullScreen&&setTimeout((()=>{if(e.fullscreen){const i=e.height/2-e.width+19,r=e.height/2-19;t.$controls.style.transform=`translateX(${-i}px) translateY(-${r}px) rotate(-90deg)`}else t.$controls.style.transform="translateX(0) translateY(0) rotate(0)"}),10)};try{Q.on("change",o),e.events.destroys.push((()=>{Q.off("change",o)}))}catch(e){}e.on(w.webFullscreen,(e=>{o(e),a()}))})(e,this)}}class Ce extends ie{constructor(e,t,i){var r;super(),this.$container=e,this._opt=t,this.debug=new we(this),this._loading=!1,this._playing=!1,this._hasLoaded=!1,this._checkHeartTimeout=null,this._checkLoadingTimeout=null,this._checkStatsInterval=null,this._startBpsTime=null,this._isPlayingBeforePageHidden=!1,this._stats={buf:0,fps:0,abps:0,vbps:0,ts:0},this._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},this._videoTimestamp=0,this._audioTimestamp=0,r=this,Object.defineProperty(r,"rect",{get:()=>{const e=r.$container.getBoundingClientRect();return e.width=Math.max(e.width,r.$container.clientWidth),e.height=Math.max(e.height,r.$container.clientHeight),e}}),["bottom","height","left","right","top","width"].forEach((e=>{Object.defineProperty(r,e,{get:()=>r.rect[e]})})),this.events=new Te(this),this.video=new i(this),(e=>{try{const t=t=>{te(t)===e.$container&&(e.emit(T.fullscreen,e.fullscreen),e.fullscreen?e._opt.useMSE&&e.resize():e.resize())};Q.on("change",t),e.events.destroys.push((()=>{Q.off("change",t)}))}catch(e){}if(e.on(w.decoderWorkerInit,(()=>{e.debug.log("player","has loaded"),e.loaded=!0})),e.on(w.play,(()=>{e.loading=!1})),e.on(w.fullscreen,(t=>{if(t)try{Q.request(e.$container).then((()=>{})).catch((t=>{Z()&&e._opt.useWebFullScreen&&(e.webFullscreen=!0)}))}catch(t){Z()&&e._opt.useWebFullScreen&&(e.webFullscreen=!0)}else try{Q.exit().then((()=>{e.webFullscreen&&(e.webFullscreen=!1)})).catch((()=>{e.webFullscreen=!1}))}catch(t){e.webFullscreen=!1}})),Z()&&e.on(w.webFullscreen,(t=>{t?e.$container.classList.add("flv-fullscreen-web"):e.$container.classList.remove("flv-fullscreen-web"),e.emit(T.fullscreen,e.fullscreen)})),e.on(w.resize,(()=>{e.video&&e.video.resize()})),e._opt.debug){const t=[w.timeUpdate];Object.keys(w).forEach((i=>{e.on(w[i],(r=>{t.includes(i)||e.debug.log("player events",w[i],r)}))})),Object.keys(R).forEach((t=>{e.on(R[t],(i=>{e.debug.log("player event error",R[t],i)}))}))}})(this),(e=>{const{_opt:t,debug:i,events:{proxy:r}}=e;t.supportDblclickFullscreen&&r(e.$container,"dblclick",(t=>{const i=te(t).nodeName.toLowerCase();"canvas"!==i&&"video"!==i||(e.fullscreen=!e.fullscreen)})),r(document,"visibilitychange",(()=>{t.hiddenAutoPause&&(i.log("visibilitychange",document.visibilityState,e._isPlayingBeforePageHidden),"visible"===document.visibilityState?e._isPlayingBeforePageHidden&&e.play():(e._isPlayingBeforePageHidden=e.playing,e.playing&&e.pause()))})),r(window,"fullscreenchange",(()=>{null!==e.keepScreenOn&&"visible"===document.visibilityState&&e.enableWakeLock&&e.enableWakeLock()}))})(this),this.control=new Re(this)}}class ke{static get JS_ERROR(){return"js_error"}static get RESOURCE_ERROR(){return"resource_error"}static get VUE_ERROR(){return"vue_error"}static get PROMISE_ERROR(){return"promise_error"}static get AJAX_ERROR(){return"ajax_error"}static get CONSOLE_INFO(){return"console_info"}static get CONSOLE_WARN(){return"console_warn"}static get CONSOLE_ERROR(){return"console_error"}static get CROSS_SCRIPT_ERROR(){return"cross_srcipt_error"}static get UNKNOW_ERROR(){return"unknow_error"}static get PERFORMANCE(){return"performance"}static get BUSINESS(){return"business"}}class Ie{static get ERROR(){return"Error"}static get WARN(){return"Warning"}static get INFO(){return"Info"}}class Le{static get FETCH(){return"fetch"}static get DEFAULT(){return"default"}}var Oe=function(){var e="undefined"!=typeof self?self:this,t=e||{},i={navigator:void 0!==e.navigator?e.navigator:{},infoMap:{engine:["WebKit","Trident","Gecko","Presto"],browser:["Safari","Chrome","Edge","IE","Firefox","Firefox Focus","Chromium","Opera","Vivaldi","Yandex","Arora","Lunascape","QupZilla","Coc Coc","Kindle","Iceweasel","Konqueror","Iceape","SeaMonkey","Epiphany","360","360SE","360EE","UC","QQBrowser","QQ","Baidu","Maxthon","Sogou","LBBROWSER","2345Explorer","TheWorld","XiaoMi","Quark","Qiyu","Wechat","Taobao","Alipay","Weibo","Douban","Suning","iQiYi"],os:["Windows","Linux","Mac OS","Android","Ubuntu","FreeBSD","Debian","iOS","Windows Phone","BlackBerry","MeeGo","Symbian","Chrome OS","WebOS"],device:["Mobile","Tablet","iPad"]}},r={getMatchMap:function(e){return{Trident:e.indexOf("Trident")>-1||e.indexOf("NET CLR")>-1,Presto:e.indexOf("Presto")>-1,WebKit:e.indexOf("AppleWebKit")>-1,Gecko:e.indexOf("Gecko/")>-1,Safari:e.indexOf("Safari")>-1,Chrome:e.indexOf("Chrome")>-1||e.indexOf("CriOS")>-1,IE:e.indexOf("MSIE")>-1||e.indexOf("Trident")>-1,Edge:e.indexOf("Edge")>-1,Firefox:e.indexOf("Firefox")>-1||e.indexOf("FxiOS")>-1,"Firefox Focus":e.indexOf("Focus")>-1,Chromium:e.indexOf("Chromium")>-1,Opera:e.indexOf("Opera")>-1||e.indexOf("OPR")>-1,Vivaldi:e.indexOf("Vivaldi")>-1,Yandex:e.indexOf("YaBrowser")>-1,Arora:e.indexOf("Arora")>-1,Lunascape:e.indexOf("Lunascape")>-1,QupZilla:e.indexOf("QupZilla")>-1,"Coc Coc":e.indexOf("coc_coc_browser")>-1,Kindle:e.indexOf("Kindle")>-1||e.indexOf("Silk/")>-1,Iceweasel:e.indexOf("Iceweasel")>-1,Konqueror:e.indexOf("Konqueror")>-1,Iceape:e.indexOf("Iceape")>-1,SeaMonkey:e.indexOf("SeaMonkey")>-1,Epiphany:e.indexOf("Epiphany")>-1,360:e.indexOf("QihooBrowser")>-1||e.indexOf("QHBrowser")>-1,"360EE":e.indexOf("360EE")>-1,"360SE":e.indexOf("360SE")>-1,UC:e.indexOf("UC")>-1||e.indexOf(" UBrowser")>-1,QQBrowser:e.indexOf("QQBrowser")>-1,QQ:e.indexOf("QQ/")>-1,Baidu:e.indexOf("Baidu")>-1||e.indexOf("BIDUBrowser")>-1,Maxthon:e.indexOf("Maxthon")>-1,Sogou:e.indexOf("MetaSr")>-1||e.indexOf("Sogou")>-1,LBBROWSER:e.indexOf("LBBROWSER")>-1,"2345Explorer":e.indexOf("2345Explorer")>-1,TheWorld:e.indexOf("TheWorld")>-1,XiaoMi:e.indexOf("MiuiBrowser")>-1,Quark:e.indexOf("Quark")>-1,Qiyu:e.indexOf("Qiyu")>-1,Wechat:e.indexOf("MicroMessenger")>-1,Taobao:e.indexOf("AliApp(TB")>-1,Alipay:e.indexOf("AliApp(AP")>-1,Weibo:e.indexOf("Weibo")>-1,Douban:e.indexOf("com.douban.frodo")>-1,Suning:e.indexOf("SNEBUY-APP")>-1,iQiYi:e.indexOf("IqiyiApp")>-1,Windows:e.indexOf("Windows")>-1,Linux:e.indexOf("Linux")>-1||e.indexOf("X11")>-1,"Mac OS":e.indexOf("Macintosh")>-1,Android:e.indexOf("Android")>-1||e.indexOf("Adr")>-1,Ubuntu:e.indexOf("Ubuntu")>-1,FreeBSD:e.indexOf("FreeBSD")>-1,Debian:e.indexOf("Debian")>-1,"Windows Phone":e.indexOf("IEMobile")>-1||e.indexOf("Windows Phone")>-1,BlackBerry:e.indexOf("BlackBerry")>-1||e.indexOf("RIM")>-1,MeeGo:e.indexOf("MeeGo")>-1,Symbian:e.indexOf("Symbian")>-1,iOS:e.indexOf("like Mac OS X")>-1,"Chrome OS":e.indexOf("CrOS")>-1,WebOS:e.indexOf("hpwOS")>-1,Mobile:e.indexOf("Mobi")>-1||e.indexOf("iPh")>-1||e.indexOf("480")>-1,Tablet:e.indexOf("Tablet")>-1||e.indexOf("Nexus 7")>-1,iPad:e.indexOf("iPad")>-1}},matchInfoMap:function(e){var t=i.navigator.userAgent||{},n=r.getMatchMap(t);for(var s in i.infoMap)for(var o=0;o<i.infoMap[s].length;o++){var a=i.infoMap[s][o];n[a]&&(e[s]=a)}},getOS:function(){return r.matchInfoMap(this),this.os},getOSVersion:function(){var e=this,t=i.navigator.userAgent||{};e.osVersion="";var r={Windows:function(){var e=t.replace(/^.*Windows NT ([\d.]+);.*$/,"$1");return{6.4:"10",6.3:"8.1",6.2:"8",6.1:"7","6.0":"Vista",5.2:"XP",5.1:"XP","5.0":"2000"}[e]||e},Android:function(){return t.replace(/^.*Android ([\d.]+);.*$/,"$1")},iOS:function(){return t.replace(/^.*OS ([\d_]+) like.*$/,"$1").replace(/_/g,".")},Debian:function(){return t.replace(/^.*Debian\/([\d.]+).*$/,"$1")},"Windows Phone":function(){return t.replace(/^.*Windows Phone( OS)? ([\d.]+);.*$/,"$2")},"Mac OS":function(){return t.replace(/^.*Mac OS X ([\d_]+).*$/,"$1").replace(/_/g,".")},WebOS:function(){return t.replace(/^.*hpwOS\/([\d.]+);.*$/,"$1")}};return r[e.os]&&(e.osVersion=r[e.os](),e.osVersion==t&&(e.osVersion="")),e.osVersion},getOrientationStatu:function(){return window.matchMedia("(orientation: portrait)").matches?"竖屏":"横屏"},getDeviceType:function(){var e=this;return e.device="PC",r.matchInfoMap(e),e.device},getNetwork:function(){return navigator&&navigator.connection&&navigator.connection.effectiveType},getLanguage:function(){var e;return this.language=((e=(i.navigator.browserLanguage||i.navigator.language).split("-"))[1]&&(e[1]=e[1].toUpperCase()),e.join("_")),this.language},createFingerprint:function(e){var t=document.createElement("canvas"),i=t.getContext("2d"),r=e||window.location.host;i.textBaseline="top",i.font="14px 'Arial'",i.textBaseline="tencent",i.fillStyle="#f60",i.fillRect(125,1,62,20),i.fillStyle="#069",i.fillText(r,2,15),i.fillStyle="rgba(102, 204, 0, 0.7)",i.fillText(r,4,17);var n=t.toDataURL().replace("data:image/png;base64,",""),s=function(e){var t,i,r,n="";for(t=0,i=(e+="").length;t<i;t++)n+=(r=e.charCodeAt(t).toString(16)).length<2?"0"+r:r;return n}(atob(n).slice(-16,-12));return s},getBrowserInfo:function(){var e=this;r.matchInfoMap(e);var n=i.navigator.userAgent||{},s=function(e,t){var r=i.navigator.mimeTypes;for(var n in r)if(r[n][e]==t)return!0;return!1},o=r.getMatchMap(n),a=!1;if(t.chrome){var h=n.replace(/^.*Chrome\/([\d]+).*$/,"$1");h>36&&t.showModalDialog?a=!0:h>45&&(a=s("type","application/vnd.chromium.remoting-viewer"))}if(o.Baidu&&o.Opera&&(o.Baidu=!1),o.Mobile&&(o.Mobile=!(n.indexOf("iPad")>-1)),a&&(s("type","application/gameplugin")||i.navigator&&void 0===i.navigator.connection.saveData?o["360SE"]=!0:o["360EE"]=!0),o.IE||o.Edge)switch(window.screenTop-window.screenY){case 71:case 74:case 99:case 75:case 74:case 105:break;case 102:o["360EE"]=!0;break;case 104:o["360SE"]=!0}var l={Safari:function(){return n.replace(/^.*Version\/([\d.]+).*$/,"$1")},Chrome:function(){return n.replace(/^.*Chrome\/([\d.]+).*$/,"$1").replace(/^.*CriOS\/([\d.]+).*$/,"$1")},IE:function(){return n.replace(/^.*MSIE ([\d.]+).*$/,"$1").replace(/^.*rv:([\d.]+).*$/,"$1")},Edge:function(){return n.replace(/^.*Edge\/([\d.]+).*$/,"$1")},Firefox:function(){return n.replace(/^.*Firefox\/([\d.]+).*$/,"$1").replace(/^.*FxiOS\/([\d.]+).*$/,"$1")},"Firefox Focus":function(){return n.replace(/^.*Focus\/([\d.]+).*$/,"$1")},Chromium:function(){return n.replace(/^.*Chromium\/([\d.]+).*$/,"$1")},Opera:function(){return n.replace(/^.*Opera\/([\d.]+).*$/,"$1").replace(/^.*OPR\/([\d.]+).*$/,"$1")},Vivaldi:function(){return n.replace(/^.*Vivaldi\/([\d.]+).*$/,"$1")},Yandex:function(){return n.replace(/^.*YaBrowser\/([\d.]+).*$/,"$1")},Arora:function(){return n.replace(/^.*Arora\/([\d.]+).*$/,"$1")},Lunascape:function(){return n.replace(/^.*Lunascape[\/\s]([\d.]+).*$/,"$1")},QupZilla:function(){return n.replace(/^.*QupZilla[\/\s]([\d.]+).*$/,"$1")},"Coc Coc":function(){return n.replace(/^.*coc_coc_browser\/([\d.]+).*$/,"$1")},Kindle:function(){return n.replace(/^.*Version\/([\d.]+).*$/,"$1")},Iceweasel:function(){return n.replace(/^.*Iceweasel\/([\d.]+).*$/,"$1")},Konqueror:function(){return n.replace(/^.*Konqueror\/([\d.]+).*$/,"$1")},Iceape:function(){return n.replace(/^.*Iceape\/([\d.]+).*$/,"$1")},SeaMonkey:function(){return n.replace(/^.*SeaMonkey\/([\d.]+).*$/,"$1")},Epiphany:function(){return n.replace(/^.*Epiphany\/([\d.]+).*$/,"$1")},360:function(){return n.replace(/^.*QihooBrowser\/([\d.]+).*$/,"$1")},"360SE":function(){return{63:"10.0",55:"9.1",45:"8.1",42:"8.0",31:"7.0",21:"6.3"}[n.replace(/^.*Chrome\/([\d]+).*$/,"$1")]||""},"360EE":function(){return{69:"11.0",63:"9.5",55:"9.0",50:"8.7",30:"7.5"}[n.replace(/^.*Chrome\/([\d]+).*$/,"$1")]||""},Maxthon:function(){return n.replace(/^.*Maxthon\/([\d.]+).*$/,"$1")},QQBrowser:function(){return n.replace(/^.*QQBrowser\/([\d.]+).*$/,"$1")},QQ:function(){return n.replace(/^.*QQ\/([\d.]+).*$/,"$1")},Baidu:function(){return n.replace(/^.*BIDUBrowser[\s\/]([\d.]+).*$/,"$1")},UC:function(){return n.replace(/^.*UC?Browser\/([\d.]+).*$/,"$1")},Sogou:function(){return n.replace(/^.*SE ([\d.X]+).*$/,"$1").replace(/^.*SogouMobileBrowser\/([\d.]+).*$/,"$1")},LBBROWSER:function(){return{57:"6.5",49:"6.0",46:"5.9",42:"5.3",39:"5.2",34:"5.0",29:"4.5",21:"4.0"}[navigator.userAgent.replace(/^.*Chrome\/([\d]+).*$/,"$1")]||""},"2345Explorer":function(){return n.replace(/^.*2345Explorer\/([\d.]+).*$/,"$1")},TheWorld:function(){return n.replace(/^.*TheWorld ([\d.]+).*$/,"$1")},XiaoMi:function(){return n.replace(/^.*MiuiBrowser\/([\d.]+).*$/,"$1")},Quark:function(){return n.replace(/^.*Quark\/([\d.]+).*$/,"$1")},Qiyu:function(){return n.replace(/^.*Qiyu\/([\d.]+).*$/,"$1")},Wechat:function(){return n.replace(/^.*MicroMessenger\/([\d.]+).*$/,"$1")},Taobao:function(){return n.replace(/^.*AliApp\(TB\/([\d.]+).*$/,"$1")},Alipay:function(){return n.replace(/^.*AliApp\(AP\/([\d.]+).*$/,"$1")},Weibo:function(){return n.replace(/^.*weibo__([\d.]+).*$/,"$1")},Douban:function(){return n.replace(/^.*com.douban.frodo\/([\d.]+).*$/,"$1")},Suning:function(){return n.replace(/^.*SNEBUY-APP([\d.]+).*$/,"$1")},iQiYi:function(){return n.replace(/^.*IqiyiVersion\/([\d.]+).*$/,"$1")}};return e.browserVersion="",l[e.browser]&&(e.browserVersion=l[e.browser](),e.browserVersion==n&&(e.browserVersion="")),"Edge"==e.browser&&(e.engine="EdgeHTML"),"Chrome"==e.browser&&parseInt(e.browserVersion)>27&&(e.engine="Blink"),"Opera"==e.browser&&parseInt(e.browserVersion)>12&&(e.engine="Blink"),"Yandex"==e.browser&&(e.engine="Blink"),e.browser+"(版本: "+e.browserVersion+"&nbsp;&nbsp;内核: "+e.engine+")"}},n={DeviceInfoObj:function(e){e=e||{domain:""};var n={deviceType:r.getDeviceType(),OS:r.getOS(),OSVersion:r.getOSVersion(),screenHeight:t.screen.height,screenWidth:t.screen.width,language:r.getLanguage(),netWork:r.getNetwork(),orientation:r.getOrientationStatu(),browserInfo:r.getBrowserInfo(),fingerprint:r.createFingerprint(e.domain),userAgent:i.navigator.userAgent};if(!e.info||0==e.info.length)return n;var s={};for(var o in n)e.info.forEach((function(e){e.toLowerCase()==o.toLowerCase()&&(s[e=o]=n[e])}));return s}};return{getDeviceInfo:function(e){return n.DeviceInfoObj(e)}}}(),De={type:e=>Object.prototype.toString.call(e).replace(/\[object\s|\]/g,""),isFunction(e){return"Function"===this.type(e)},isArray(e){return"Array"===this.type(e)},isNull:e=>null==e||""==e||null==e,objectIsNull:e=>"{}"===JSON.stringify(e),isObject(e){return"Object"===this.type(e)}};class Be{toReport(e,t){try{let r=JSON.stringify(t);var i=new XMLHttpRequest;i.open("POST",e,!0),i.setRequestHeader("Content-Type","application/json"),i.send(r)}catch(e){console.log(e)}}}class xe{toReport(e,t){try{let i=JSON.stringify(t);fetch(e,{headers:{"Content-Type":"application/json"},method:"POST",body:i,mode:"same-origin",keepalive:!0})}catch(i){(new Be).toReport(e,t),console.log("fetch请求异常",i)}}}class Me{toReport(e,t){try{(new Image).src=e+"?st="+(new Date).getTime()+"&"+this.formatParams(t)}catch(e){console.log(e)}}formatParams(e){var t=[];for(var i in e)t.push(encodeURIComponent(i)+"="+encodeURIComponent(e[i]));return t.join("&")}}class Pe{toReport(e,t){try{t.st=(new Date).getTime(),navigator.sendBeacon&&navigator.sendBeacon(e,this.formatParamsByURLSearchParams(t))}catch(e){console.log(e)}}formatParamsByFormData(e){const t=new FormData;for(var i in e)t.append(i,e[i]);return t}formatParamsByURLSearchParams(e){const t=new URLSearchParams;for(var i in e)"object"==typeof e[i]&&(e[i]=JSON.stringify(e[i])),t.append(i,e[i]);return t}formatParams(e){var t=[];for(var i in e)t.push(encodeURIComponent(i)+"="+encodeURIComponent(e[i]));return t.join("&")}}class Fe{constructor(e){this.url=e}report(e,t){t=t||{isFetch:!1,isXHR:!1,isImg:!1,isNavigator:!1},this.checkUrl(this.url)?this.sendInfo(e,t):console.log("上报信息url地址格式不正确,url=",this.url)}sendInfo(e,t={}){let i=new xe,r=new Me,n=new Be,s=new Pe;t.isImg?r.toReport(this.url,e):t.isFetch?i.toReport(this.url,e):t.isXHR?n.toReport(this.url,e):t.isNavigator?s.toReport(this.url,e):!!(t.isFetch&&t.isImg&&t.isXHR&&t.isNavigator)||s.toReport(this.url,e)}checkUrl(e){if(!e)return!1;return/^[hH][tT][tT][pP]([sS]?):\/\//.test(e)}}var Ue={isStop:!0,queues:[],add:function(e,t){this.queues.push({reportUrl:e,data:t})},fire:function(){if(!this.queues||0===this.queues.length)return void(this.isStop=!0);this.isStop=!1;let e=this.queues[0];e.reportUrl&&new Fe(e.reportUrl).report(e.data),this.queues.splice(0,1),this.fire()}};class Ne{constructor(e){this.category=ke.UNKNOW_ERROR,this.level=Ie.INFO,this.msg="",this.url="",this.line="",this.col="",this.errorObj="",this.reportUrl=e.reportUrl,this.extendsInfo=e.extendsInfo}recordError(){this.handleRecordError(),Ue.isStop&&Ue.fire()}handleRecordError(){try{if(!this.msg)return;if(this.reportUrl&&this.url&&this.url.toLowerCase().indexOf(this.reportUrl.toLowerCase())>=0)return void console.log("统计错误接口异常",this.msg);let e=this.handleErrorInfo();Ue.add(this.reportUrl,e)}catch(e){console.log(e)}}handleErrorInfo(){let e=this.getExtendsInfo(),t="",i=0;switch(this.category){case ke.BUSINESS:if(!this.msg.textKey)return e=Object.assign({},e,this.msg),e.l=window.location.href,e;t=JSON.stringify(this.msg),i=1,e.textKey=this.msg.textKey,this.msg.h&&(e.h=this.msg.h),this.msg.text&&(e.text=this.msg.text);break;case ke.PERFORMANCE:t=JSON.stringify(this.msg),i=1e3,e.clientInfo=this.getDeviceInfo();break;case ke.AJAX_ERROR:t=JSON.stringify(this.msg),i=100;break;case ke.RESOURCE_ERROR:const r={msg:this.msg,url:encodeURIComponent(this.url)};t=JSON.stringify(r),i=101;break;case ke.JS_ERROR:t="错误类别: "+this.category+"\r\n",t+="日志信息: "+this.msg+"\r\n",t+="url: "+encodeURIComponent(this.url)+"\r\n",t+="错误行号: "+this.line+"\r\n",t+="错误列号: "+this.col+"\r\n",this.errorObj&&this.errorObj.stack&&(t+="错误栈: "+this.errorObj.stack+"\r\n"),i=102;break;default:t=this.msg,i=106}return e.logInfo=t,e.l=window.location.pathname,e.action=i,e}getExtendsInfo(){try{let t,i={},r=this.extendsInfo||{};for(var e in De.isFunction(r.getDynamic)&&(t=r.getDynamic()),De.isObject(t)&&(r={...r,...t}),r)De.isFunction(r[e])||(i[e]=r[e]);return i}catch(e){return console.log("call getExtendsInfo error",e),{}}}getDeviceInfo(){try{let e=Oe.getDeviceInfo();return JSON.stringify(e)}catch(e){return console.log(e),""}}}function Ve(e,t){if(!e)return!0;if("string"==typeof e){if(t.startsWith("/")){if(window.location.hostname.endsWith(e))return!0}else{if(new URL(t).hostname.endsWith(e))return!0}return!1}if("object"==typeof e&&e instanceof Array){let i=!1;return e.forEach((e=>{if("string"==typeof e)if(t.startsWith("/"))window.location.hostname.endsWith(e)&&(i=!0);else{new URL(t).hostname.endsWith(e)&&(i=!0)}})),i}return!1}class Ge{constructor(e){this.params=e}handleError(e){switch(e){case Le.FETCH:new je(this.params).handleError();break;case Le.DEFAULT:new We(this.params).handleError();break;default:new je(this.params).handleError(),new We(this.params).handleError()}}}class je extends Ne{constructor(e){super(e),this.ajaxDomain=e.ajaxDomain}handleError(){if(!window.fetch)return;this.level=Ie.WARN,this.category=ke.AJAX_ERROR;let e=this,t=window.fetch;window.fetch=function(){let i=arguments,r=(new Date).getTime(),n=null;return t.apply(this,arguments).then((function(t){try{const s=t.headers?t.headers.get("content-type"):"";if("string"==typeof s&&s.includes("application/json")){const s=t.clone();n=s.status;let o=(new Date).getTime()-r;s.json().then((function(t){const s={fetchStart:r,url:i[0],requestOptions:i[1],status:n,responseBody:t,loadTime:o};e.msg=s,Ve(e.ajaxDomain,s.url)&&e.recordError()}))}else{const s=t.clone();n=s.status;let o=(new Date).getTime()-r;s.text().then((function(t){try{t=JSON.parse(t)}catch(e){console.log("JSON.parse 失败")}const s={fetchStart:r,url:i[0],requestOptions:i[1],status:n,responseBody:t,loadTime:o};e.msg=s,Ve(e.ajaxDomain,s.url)&&e.recordError()}))}}catch(e){console.log("获取响应数据上报异常"),console.log(e)}return t})).catch((function(e){console.log("获取响应数据上报异常"),console.log(e)}))}}}class We extends Ne{constructor(e){super(e),this.ajaxDomain=e.ajaxDomain}handleError(){if(!window.XMLHttpRequest)return;this.level=Ie.WARN,this.category=ke.AJAX_ERROR;let e=this,t=XMLHttpRequest.prototype.open,i=XMLHttpRequest.prototype.send;XMLHttpRequest.prototype.open=function(e,i,r){return this._url="string"==typeof i?i:i.href,this._method=e,t.call(this,e,this._url,"boolean"!=typeof r||r)},XMLHttpRequest.prototype.send=function(){let t=(new Date).getTime();return this.addEventListener&&this.addEventListener("readystatechange",(function(){if(4===this.readyState)if(this.status>=200&&this.status<300){let i=(new Date).getTime()-t;const r={method:this._method},n={fetchStart:t,url:this._url,requestOptions:r,responseBody:this.response,status:this.status,loadTime:i};e.msg=n,Ve(e.ajaxDomain,n.url)&&e.recordError()}else{let i=(new Date).getTime()-t;const r={method:this._method},n={fetchStart:t,url:this._url,requestOptions:r,status:this.status,loadTime:i};e.msg=n,Ve(e.ajaxDomain,n.url)&&e.recordError()}})),i.apply(this,arguments)}}}class Qe extends Ne{constructor(e){super(e)}handleError(){this.registerInfo(),this.registerWarn(),this.registerError()}registerInfo(){let e=this;console.tInfo=function(){e.handleLog(Ie.INFO,ke.CONSOLE_INFO,arguments)}}registerWarn(){let e=this;console.tWarn=function(){e.handleLog(Ie.WARN,ke.CONSOLE_WARN,arguments)}}registerError(){let e=this;console.tError=function(){e.handleLog(Ie.ERROR,ke.CONSOLE_ERROR,arguments)}}handleLog(e,t,i){try{this.level=e;let r=[...i];this.msg=r.join("\r\n"),this.url=location.href,this.category=t,this.recordError()}catch(t){console.log("console统计错误异常",e,t)}}}!function(){window.console||(window.console={});["tInfo","tWarn","tError"].forEach(((e,t)=>{console[e]||(console[e]=function(){})}))}();class ze extends Ne{constructor(e){super(e)}handleError(){window.onerror=(e,t,i,r,n)=>{console.log("monitor onerror");try{this.level=Ie.WARN,this.category=ke.JS_ERROR,this.msg=e,this.url=t,this.line=i,this.col=r,this.errorObj=n,this.recordError()}catch(n){console.log("js错误异常",n)}}}}class He extends Ne{constructor(e){super(e)}handleError(){window.addEventListener("unhandledrejection",(e=>{try{if(!e||!e.reason)return;e.reason.config&&e.reason.config.url&&(this.url=e.reason.config.url),this.level=Ie.WARN,this.category=ke.PROMISE_ERROR,this.msg=e.reason,this.recordError()}catch(e){console.log(e)}}),!0)}}class qe extends Ne{constructor(e){super(e)}handleError(){window.addEventListener("error",(e=>{console.log("monitor addEventListener error");try{if(!e)return;this.category=ke.RESOURCE_ERROR;let t=e.target||e.srcElement;if(!(t instanceof HTMLScriptElement||t instanceof HTMLLinkElement||t instanceof HTMLImageElement))return;this.level="IMG"===t.tagName.toUpperCase()?Ie.WARN:Ie.ERROR,this.msg="加载 "+t.tagName+" 资源错误",this.url=t.src||t.href,this.errorObj=t,this.recordError()}catch(e){console.log("资源加载收集异常",e)}}),!0)}}var $e,Xe,Ye,Ze,Ke=-1,Je=function(e){addEventListener("pageshow",(function(t){t.persisted&&(Ke=t.timeStamp,e(t))}),!0)},et=function(){return window.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]},tt=function(){var e=et();return e&&e.activationStart||0},it=function(e,t){var i=et(),r="navigate";return Ke>=0?r="back-forward-cache":i&&(document.prerendering||tt()>0?r="prerender":document.wasDiscarded?r="restore":i.type&&(r=i.type.replace(/_/g,"-"))),{name:e,value:void 0===t?-1:t,rating:"good",delta:0,entries:[],id:"v3-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:r}},rt=function(e,t,i){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var r=new PerformanceObserver((function(e){Promise.resolve().then((function(){t(e.getEntries())}))}));return r.observe(Object.assign({type:e,buffered:!0},i||{})),r}}catch(e){}},nt=function(e,t,i,r){var n,s;return function(o){t.value>=0&&(o||r)&&((s=t.value-(n||0))||void 0===n)&&(n=t.value,t.delta=s,t.rating=function(e,t){return e>t[1]?"poor":e>t[0]?"needs-improvement":"good"}(t.value,i),e(t))}},st=function(e){requestAnimationFrame((function(){return requestAnimationFrame((function(){return e()}))}))},ot=function(e){var t=function(t){"pagehide"!==t.type&&"hidden"!==document.visibilityState||e(t)};addEventListener("visibilitychange",t,!0),addEventListener("pagehide",t,!0)},at=function(e){var t=!1;return function(i){t||(e(i),t=!0)}},ht=-1,lt=function(){return"hidden"!==document.visibilityState||document.prerendering?1/0:0},dt=function(e){"hidden"===document.visibilityState&&ht>-1&&(ht="visibilitychange"===e.type?e.timeStamp:0,At())},ut=function(){addEventListener("visibilitychange",dt,!0),addEventListener("prerenderingchange",dt,!0)},At=function(){removeEventListener("visibilitychange",dt,!0),removeEventListener("prerenderingchange",dt,!0)},ct=function(){return ht<0&&(ht=lt(),ut(),Je((function(){setTimeout((function(){ht=lt(),ut()}),0)}))),{get firstHiddenTime(){return ht}}},pt=function(e){document.prerendering?addEventListener("prerenderingchange",(function(){return e()}),!0):e()},ft=[1800,3e3],mt=function(e,t){t=t||{},pt((function(){var i,r=ct(),n=it("FCP"),s=rt("paint",(function(e){e.forEach((function(e){"first-contentful-paint"===e.name&&(s.disconnect(),e.startTime<r.firstHiddenTime&&(n.value=Math.max(e.startTime-tt(),0),n.entries.push(e),i(!0)))}))}));s&&(i=nt(e,n,ft,t.reportAllChanges),Je((function(r){n=it("FCP"),i=nt(e,n,ft,t.reportAllChanges),st((function(){n.value=performance.now()-r.timeStamp,i(!0)}))})))}))},_t=[.1,.25],gt={passive:!0,capture:!0},yt=new Date,vt=function(e,t){$e||($e=t,Xe=e,Ye=new Date,St(removeEventListener),Et())},Et=function(){if(Xe>=0&&Xe<Ye-yt){var e={entryType:"first-input",name:$e.type,target:$e.target,cancelable:$e.cancelable,startTime:$e.timeStamp,processingStart:$e.timeStamp+Xe};Ze.forEach((function(t){t(e)})),Ze=[]}},bt=function(e){if(e.cancelable){var t=(e.timeStamp>1e12?new Date:performance.now())-e.timeStamp;"pointerdown"==e.type?function(e,t){var i=function(){vt(e,t),n()},r=function(){n()},n=function(){removeEventListener("pointerup",i,gt),removeEventListener("pointercancel",r,gt)};addEventListener("pointerup",i,gt),addEventListener("pointercancel",r,gt)}(t,e):vt(t,e)}},St=function(e){["mousedown","keydown","touchstart","pointerdown"].forEach((function(t){return e(t,bt,gt)}))},wt=[100,300],Tt=[2500,4e3],Rt={},Ct=[800,1800],kt=function e(t){document.prerendering?pt((function(){return e(t)})):"complete"!==document.readyState?addEventListener("load",(function(){return e(t)}),!0):setTimeout(t,0)},It=function(e,t){t=t||{};var i=it("TTFB"),r=nt(e,i,Ct,t.reportAllChanges);kt((function(){var n=et();if(n){var s=n.responseStart;if(s<=0||s>performance.now())return;i.value=Math.max(s-tt(),0),i.entries=[n],r(!0),Je((function(){i=it("TTFB",0),(r=nt(e,i,Ct,t.reportAllChanges))(!0)}))}}))};class Lt extends Ne{constructor(e){super(e||{}),this.category=ke.PERFORMANCE,this.reportUrl=e.reportUrl||"",this.performanceData={},this.saveData=this.saveData.bind(this),mt(this.saveData),function(e,t){t=t||{},pt((function(){var i,r=ct(),n=it("FID"),s=function(e){e.startTime<r.firstHiddenTime&&(n.value=e.processingStart-e.startTime,n.entries.push(e),i(!0))},o=function(e){e.forEach(s)},a=rt("first-input",o);i=nt(e,n,wt,t.reportAllChanges),a&&ot(at((function(){o(a.takeRecords()),a.disconnect()}))),a&&Je((function(){var r;n=it("FID"),i=nt(e,n,wt,t.reportAllChanges),Ze=[],Xe=-1,$e=null,St(addEventListener),r=s,Ze.push(r),Et()}))}))}(this.saveData),function(e,t){t=t||{},pt((function(){var i,r=ct(),n=it("LCP"),s=function(e){var t=e[e.length-1];t&&t.startTime<r.firstHiddenTime&&(n.value=Math.max(t.startTime-tt(),0),n.entries=[t],i())},o=rt("largest-contentful-paint",s);if(o){i=nt(e,n,Tt,t.reportAllChanges);var a=at((function(){Rt[n.id]||(s(o.takeRecords()),o.disconnect(),Rt[n.id]=!0,i(!0))}));["keydown","click"].forEach((function(e){addEventListener(e,a,!0)})),ot(a),Je((function(r){n=it("LCP"),i=nt(e,n,Tt,t.reportAllChanges),st((function(){n.value=performance.now()-r.timeStamp,Rt[n.id]=!0,i(!0)}))}))}}))}(this.saveData),function(e,t){t=t||{},mt(at((function(){var i,r=it("CLS",0),n=0,s=[],o=function(e){e.forEach((function(e){if(!e.hadRecentInput){var t=s[0],i=s[s.length-1];n&&e.startTime-i.startTime<1e3&&e.startTime-t.startTime<5e3?(n+=e.value,s.push(e)):(n=e.value,s=[e])}})),n>r.value&&(r.value=n,r.entries=s,i())},a=rt("layout-shift",o);a&&(i=nt(e,r,_t,t.reportAllChanges),ot((function(){o(a.takeRecords()),i(!0)})),Je((function(){n=0,r=it("CLS",0),i=nt(e,r,_t,t.reportAllChanges),st((function(){return i()}))})),setTimeout(i,0))})))}(this.saveData),It(this.saveData)}saveData(e){this.performanceData[e.name]=e.value,"LCP"===e.name&&this.record(this.performanceData)}record(e){this.msg=e,this.recordError()}reset}const Ot="common_a",Dt=/((<(A|B|BUTTON|DIV|H1|H2|H3|H4|H5|H6|P|IMG|SPAN|TABLE|TD|TEXTAREA|VIDEO)([^<>])*>)([^<>])+(<\/(A|B|BUTTON|DIV|H1|H2|H3|H4|H5|H6|P|IMG|SPAN|TABLE|TD|TEXTAREA|VIDEO)>)|(<(IMG|VIDEO)(.)+>))/i;function Bt(e){var t=e.nodeName,i="";if(e.hasAttribute("data-monitor")&&e.getAttribute("data-monitor"))return`${i=e.getAttribute("data-monitor")}`.slice(0,20);var r=e.outerHTML.match(Dt);if(r&&r.length>0)if("IMG"===t)i=e.getAttribute("alt");else i=(i=r[0].match(/>[^<>]+<\//)?r[0].match(/>[^<>]+<\//)[0]:"").replace(/[^A-Za-z0-9\u4e00-\u9fa5]/g,"");return`${i}`.slice(0,20)}class xt extends Ne{constructor(e){super(e||{}),this.category=ke.BUSINESS,this.reportUrl=e.reportUrl||"";const t=e.keyName||"textkey",i=this;window.addEventListener("click",(function(e){let r=e.target;if(!r)return!1;let n=r.getAttribute(t),s=r.getAttribute("link")||r.getAttribute("href");if(n||s){const e={textKey:n||Ot};s&&(e.h=s);const t=Bt(r);t&&(e.text=t),i.record(e)}else{for(;!n&&!s&&r.parentNode;)r=r.parentNode,r.getAttribute&&(n=r.getAttribute(t),s=r.getAttribute("link")||r.getAttribute("href"));if(n||s){const e={textKey:n||Ot};s&&(e.h=s);const t=Bt(r);t&&(e.text=t),i.record(e)}}}))}record(e){this.msg=e,this.recordError()}}class Mt extends Ne{constructor(e){super(e||{}),this.category=ke.BUSINESS,this.reportUrl=e.reportUrl||""}record(e){this.msg=e,this.recordError()}}Date.prototype.format=function(e){let t={"M+":this.getMonth()+1,"d+":this.getDate(),"h+":this.getHours()%12==0?12:this.getHours()%12,"H+":this.getHours(),"m+":this.getMinutes(),"s+":this.getSeconds(),"q+":Math.floor((this.getMonth()+3)/3),S:this.getMilliseconds()},i={0:"/u65e5",1:"/u4e00",2:"/u4e8c",3:"/u4e09",4:"/u56db",5:"/u4e94",6:"/u516d"};/(y+)/.test(e)&&(e=e.replace(RegExp.$1,(this.getFullYear()+"").substr(4-RegExp.$1.length))),/(E+)/.test(e)&&(e=e.replace(RegExp.$1,(RegExp.$1.length>1?RegExp.$1.length>2?"/u661f/u671f":"/u5468":"")+i[this.getDay()+""]));for(let i in t)new RegExp("("+i+")").test(e)&&(e=e.replace(RegExp.$1,1==RegExp.$1.length?t[i]:("00"+t[i]).substr((""+t[i]).length)));return e};class Pt{constructor(e){this.jsError=!0,this.promiseError=!0,this.resourceError=!0,this.ajaxError=!0,this.ajaxDomain=null,this.isReportHref=!1,this.consoleError=!1,e=e||{},this.jsError=!(!1===e.jsError),this.promiseError=!(!1===e.promiseError),this.resourceError=!(!1===e.resourceError),this.consoleError=!0===e.consoleError,this.ajaxError=!(!1===e.ajaxError),this.ajaxDomain=e.ajaxDomain||this.ajaxDomain,this.isReportHref=e.isReportHref||this.isReportHref,this.business=!(!1===e.business),this.reportUrl=e.url,this.performace=!(!1===e.performace),this.extendsInfo=e.extendsInfo||{};let t={reportUrl:this.reportUrl,extendsInfo:this.extendsInfo};if(this.jsError&&new ze(t).handleError(),this.promiseError&&new He(t).handleError(),this.resourceError&&new qe(t).handleError(),this.ajaxError){let e=Object.assign({},t,{ajaxDomain:this.ajaxDomain});new Ge(e).handleError()}this.consoleError&&new Qe(t).handleError(),this.performace&&new Lt(t),this.business&&new xt(t),this.manual=new Mt(t)}report(e){return this.manual&&this.manual.record(e),this}}const Ft={h264:1,h265:2,h266:4,vp8:8,vp9:16,av1:32},Ut=["h264","h265"],Nt=()=>Ut.reduce(((e,t)=>e+(Ft[t]||0)),0),Vt=e=>{const t=e.split("?"),i=new URLSearchParams(t[1]);return i.delete("vc"),i.set("vc",Nt().toString()),t[0]+"?"+i.toString()};class Gt{static initMonitor(){this.monitor=new Pt({url:"https://log.ys7.com/statistics.do/open_website_monitor",extendsInfo:{bn:"ezuikit_flv",getDynamic:()=>({})}})}static report(e,t){this.monitor||Gt.initMonitor();const i={type:e,data:{...t,vc:Gt.vc,version:"1.0.0-alpha.1",now:(new Date).getTime()}};try{this.monitor.report(i)}catch(e){}}}e(Gt,"vc",Nt());class jt extends Ce{constructor(e,t){super(e,t,de),this._opt.useMSE=!1,this._opt.hasAudio&&(this.audio=new Ae(this)),this.decoderWorker=new me(this),this.stream=null,this.demux=null,this._lastVolume=null,Z()&&(this.keepScreenOn=new Se(this)),this.debug.log("Soft Player options",this._opt)}destroy(){this._loading=!1,this._playing=!1,this._hasLoaded=!1,this._lastVolume=null,this._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},this.decoderWorker&&(this.decoderWorker.destroy(),this.decoderWorker=null),this.video&&(this.video.destroy(),this.video=null),this.audio&&(this.audio.destroy(),this.audio=null),this.stream&&(this.stream.destroy(),this.stream=null),this.demux&&(this.demux.destroy(),this.demux=null),this.events&&(this.events.destroy(),this.events=null),this.clearCheckHeartTimeout(),this.clearCheckLoadingTimeout(),this.clearStatsInterval(),this.releaseWakeLock(),this.keepScreenOn=null,this.resetStats(),this._audioTimestamp=0,this._videoTimestamp=0,this.emit("destroy"),this.off(),this.debug.log("play","destroy end")}set fullscreen(e){Z()&&this._opt.useWebFullScreen?(this.emit(w.webFullscreen,e),setTimeout((()=>{this.updateOption({rotate:e?270:0}),this.resize()}),10)):this.emit(w.fullscreen,e)}get fullscreen(){return K()||this.webFullscreen}set webFullscreen(e){this.emit(w.webFullscreen,e)}get webFullscreen(){return this.$container.classList.contains("flv-fullscreen-web")}set loaded(e){this._hasLoaded=e}get loaded(){return this._hasLoaded}set playing(e){e&&(this.loading=!1),this.playing!==e&&(this._playing=e,this.emit(w.playing,e),this.emit(w.volumechange,this.volume),e?this.emit(w.play):this.emit(w.pause))}get playing(){return this._playing}get volume(){return this.audio&&this.audio.volume||0}set volume(e){e!==this.volume&&(this.audio&&this.audio.setVolume(e),this._lastVolume=e)}get lastVolume(){return this._lastVolume}set loading(e){this.loading!==e&&(this._loading=e,this.emit(w.loading,this._loading))}get loading(){return this._loading}set audioTimestamp(e){null!==e&&(this._audioTimestamp=e)}get audioTimestamp(){return this._audioTimestamp}set videoTimestamp(e){null!==e&&(this._videoTimestamp=e,this._opt.useWCS||this._opt.useMSE||this.audioTimestamp&&this.videoTimestamp&&this.audio&&this.audio.emit(w.videoSyncAudio,{audioTimestamp:this.audioTimestamp,videoTimestamp:this.videoTimestamp,diff:this.audioTimestamp-this.videoTimestamp}))}get videoTimestamp(){return this._videoTimestamp}get isDebug(){return!0===this._opt.debug}updateOption(e){this._opt=Object.assign({},this._opt,e)}init(){return new Promise(((e,t)=>{this.stream||(this.stream=new fe(this)),this.audio||this._opt.hasAudio&&(this.audio=new Ae(this)),this.demux||(this.demux=new ve(this)),this.decoderWorker?e():(this.decoderWorker=new me(this),this.once(w.decoderWorkerInit,(()=>{e()})))}))}play(e){return this._opt=Object.assign({},this._opt,e||{}),new Promise(((e,t)=>{if(!this._opt.url)return t();this.loading=!0,this.playing=!1,this._times.playInitStart=q(),this.clearCheckHeartTimeout(),this.init().then((()=>{this._times.playStart=q(),this._opt.isNotMute&&this.mute(!1),this.enableWakeLock(),this.stream.fetchStream(this._opt.url,this._opt),this.checkLoadingTimeout(),this.stream.once(R.fetchError,(e=>{t(e)})),this.stream.once(R.websocketError,(e=>{t(e)})),this.stream.once(w.streamEnd,(()=>{t()})),this.stream.once(w.streamSuccess,(()=>{e(),this._times.streamResponse=q(),this.video.play(),this.checkStatsInterval()}))})).catch((e=>{t(e)}))}))}close(){return new Promise((e=>{this._close().then((()=>{this.video&&this.video.clearView(),e()}))}))}resumeAudioAfterPause(){this.lastVolume&&(this.volume=this.lastVolume)}_close(){return new Promise((e=>{this.stream&&(this.stream.destroy(),this.stream=null),this.demux&&(this.demux.destroy(),this.demux=null),this.decoderWorker&&(this.decoderWorker.destroy(),this.decoderWorker=null),this.audio&&(this.audio.destroy(),this.audio=null),this.clearCheckHeartTimeout(),this.clearCheckLoadingTimeout(),this.clearStatsInterval(),this.playing=!1,this.loading=!1,this.video&&(this.video.resetInit(),this.video.pause(!0)),this.releaseWakeLock(),this.resetStats(),this._audioTimestamp=0,this._videoTimestamp=0,this._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},setTimeout((()=>{e()}),0)}))}pause(e=!1){return e?this.close():this._close()}mute(e){this.audio&&this.audio.mute(e)}resize(){this.video.resize()}_onlyMseOrWcsVideo(){return!1===this._opt.hasAudio&&(this._opt.useMSE||this._opt.useWCS&&!this._opt.useOffscreen)}checkHeart(){this.clearCheckHeartTimeout(),this.checkHeartTimeout()}checkHeartTimeout(){this._checkHeartTimeout=setTimeout((()=>{if(this.playing){if(0!==this._stats.fps)return;this.pause().then((()=>{this.emit(w.timeout,w.delayTimeout),this.emit(w.delayTimeout)}))}}),1e3*this._opt.heartTimeout)}checkStatsInterval(){this._checkStatsInterval=setInterval((()=>{this.updateStats()}),1e3)}clearCheckHeartTimeout(){this._checkHeartTimeout&&(clearTimeout(this._checkHeartTimeout),this._checkHeartTimeout=null)}checkLoadingTimeout(){this._checkLoadingTimeout=setTimeout((()=>{this.playing||this.pause().then((()=>{this.emit(w.timeout,w.loadingTimeout),this.emit(w.loadingTimeout)}))}),1e3*this._opt.loadingTimeout)}clearCheckLoadingTimeout(){this._checkLoadingTimeout&&(clearTimeout(this._checkLoadingTimeout),this._checkLoadingTimeout=null)}clearStatsInterval(){this._checkStatsInterval&&(clearInterval(this._checkStatsInterval),this._checkStatsInterval=null)}handleRender(){this.loading&&(this.emit(w.start),this.loading=!1,this.clearCheckLoadingTimeout()),this.playing||(this.playing=!0),this.checkHeart()}updateStats(e){e=e||{},this._startBpsTime||(this._startBpsTime=q()),ee(e.ts)&&(this._stats.ts=e.ts),ee(e.buf)&&(this._stats.buf=e.buf),e.fps&&(this._stats.fps+=1),e.abps&&(this._stats.abps+=e.abps),e.vbps&&(this._stats.vbps+=e.vbps);const t=q();t-this._startBpsTime<1e3||(this.emit(w.stats,this._stats),this.emit(w.performance,function(e){let t=0;return e>=24?t=2:e>=15&&(t=1),t}(this._stats.fps)),this._stats.fps=0,this._stats.abps=0,this._stats.vbps=0,this._startBpsTime=t)}resetStats(){this._startBpsTime=null,this._stats={buf:0,fps:0,abps:0,vbps:0,ts:0}}enableWakeLock(){this._opt.keepScreenOn&&this.keepScreenOn&&this.keepScreenOn.enable()}releaseWakeLock(){this._opt.keepScreenOn&&this.keepScreenOn&&this.keepScreenOn.disable()}handlePlayToRenderTimes(){const e=this._times;e.playTimestamp=e.playStart-e.playInitStart,e.streamTimestamp=e.streamStart-e.playStart,e.streamResponseTimestamp=e.streamResponse-e.streamStart,e.demuxTimestamp=e.demuxStart-e.streamResponse,e.decodeTimestamp=e.decodeStart-e.demuxStart,e.videoTimestamp=e.videoStart-e.decodeStart,e.allTimestamp=e.videoStart-e.playInitStart,this.emit(w.playToRenderTimes,e)}getOption(){return this._opt}emitError(e,t=""){Gt.report("error",{event:e,value:t}),this.emit(w.error,e,t),this.emit(e,t)}}var Wt={exports:{}};!function(e,t){window,e.exports=function(e){var t={};function i(r){if(t[r])return t[r].exports;var n=t[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,i),n.l=!0,n.exports}return i.m=e,i.c=t,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(r,n,function(t){return e[t]}.bind(null,n));return r},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=14)}([function(e,t,i){var r=i(6),n=i.n(r),s=function(){function e(){}return e.e=function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var r="["+t+"] > "+i;e.ENABLE_CALLBACK&&e.emitter.emit("log","error",r),e.ENABLE_ERROR&&(console.error||console.warn)},e.i=function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var r="["+t+"] > "+i;e.ENABLE_CALLBACK&&e.emitter.emit("log","info",r),e.ENABLE_INFO&&console.info},e.w=function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var r="["+t+"] > "+i;e.ENABLE_CALLBACK&&e.emitter.emit("log","warn",r),e.ENABLE_WARN&&console.warn},e.d=function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var r="["+t+"] > "+i;e.ENABLE_CALLBACK&&e.emitter.emit("log","debug",r),e.ENABLE_DEBUG&&console.debug},e.v=function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var r="["+t+"] > "+i;e.ENABLE_CALLBACK&&e.emitter.emit("log","verbose",r),e.ENABLE_VERBOSE},e}();s.GLOBAL_TAG="mpegts.js",s.FORCE_GLOBAL_TAG=!1,s.ENABLE_ERROR=!0,s.ENABLE_INFO=!0,s.ENABLE_WARN=!0,s.ENABLE_DEBUG=!0,s.ENABLE_VERBOSE=!0,s.ENABLE_CALLBACK=!1,s.emitter=new n.a,t.a=s},function(e,t,i){t.a={IO_ERROR:"io_error",DEMUX_ERROR:"demux_error",INIT_SEGMENT:"init_segment",MEDIA_SEGMENT:"media_segment",LOADING_COMPLETE:"loading_complete",RECOVERED_EARLY_EOF:"recovered_early_eof",MEDIA_INFO:"media_info",METADATA_ARRIVED:"metadata_arrived",SCRIPTDATA_ARRIVED:"scriptdata_arrived",TIMED_ID3_METADATA_ARRIVED:"timed_id3_metadata_arrived",PES_PRIVATE_DATA_DESCRIPTOR:"pes_private_data_descriptor",PES_PRIVATE_DATA_ARRIVED:"pes_private_data_arrived",STATISTICS_INFO:"statistics_info",RECOMMEND_SEEKPOINT:"recommend_seekpoint"}},function(e,t,i){i.d(t,"c",(function(){return n})),i.d(t,"b",(function(){return s})),i.d(t,"a",(function(){return o}));var r=i(3),n={kIdle:0,kConnecting:1,kBuffering:2,kError:3,kComplete:4},s={OK:"OK",EXCEPTION:"Exception",HTTP_STATUS_CODE_INVALID:"HttpStatusCodeInvalid",CONNECTING_TIMEOUT:"ConnectingTimeout",EARLY_EOF:"EarlyEof",UNRECOVERABLE_EARLY_EOF:"UnrecoverableEarlyEof"},o=function(){function e(e){this._type=e||"undefined",this._status=n.kIdle,this._needStash=!1,this._onContentLengthKnown=null,this._onURLRedirect=null,this._onDataArrival=null,this._onError=null,this._onComplete=null}return e.prototype.destroy=function(){this._status=n.kIdle,this._onContentLengthKnown=null,this._onURLRedirect=null,this._onDataArrival=null,this._onError=null,this._onComplete=null},e.prototype.isWorking=function(){return this._status===n.kConnecting||this._status===n.kBuffering},Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this._status},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"needStashBuffer",{get:function(){return this._needStash},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onContentLengthKnown",{get:function(){return this._onContentLengthKnown},set:function(e){this._onContentLengthKnown=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onURLRedirect",{get:function(){return this._onURLRedirect},set:function(e){this._onURLRedirect=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onDataArrival",{get:function(){return this._onDataArrival},set:function(e){this._onDataArrival=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onError",{get:function(){return this._onError},set:function(e){this._onError=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onComplete",{get:function(){return this._onComplete},set:function(e){this._onComplete=e},enumerable:!1,configurable:!0}),e.prototype.open=function(e,t){throw new r.c("Unimplemented abstract function!")},e.prototype.abort=function(){throw new r.c("Unimplemented abstract function!")},e}()},function(e,t,i){i.d(t,"d",(function(){return s})),i.d(t,"a",(function(){return o})),i.d(t,"b",(function(){return a})),i.d(t,"c",(function(){return h}));var r,n=(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),s=function(){function e(e){this._message=e}return Object.defineProperty(e.prototype,"name",{get:function(){return"RuntimeException"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"message",{get:function(){return this._message},enumerable:!1,configurable:!0}),e.prototype.toString=function(){return this.name+": "+this.message},e}(),o=function(e){function t(t){return e.call(this,t)||this}return n(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"IllegalStateException"},enumerable:!1,configurable:!0}),t}(s),a=function(e){function t(t){return e.call(this,t)||this}return n(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"InvalidArgumentException"},enumerable:!1,configurable:!0}),t}(s),h=function(e){function t(t){return e.call(this,t)||this}return n(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"NotImplementedException"},enumerable:!1,configurable:!0}),t}(s)},function(e,t,i){var r={};!function(){var e=self.navigator.userAgent.toLowerCase(),t=/(edge)\/([\w.]+)/.exec(e)||/(opr)[\/]([\w.]+)/.exec(e)||/(chrome)[ \/]([\w.]+)/.exec(e)||/(iemobile)[\/]([\w.]+)/.exec(e)||/(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||e.indexOf("trident")>=0&&/(rv)(?::| )([\w.]+)/.exec(e)||e.indexOf("compatible")<0&&/(firefox)[ \/]([\w.]+)/.exec(e)||[],i=/(ipad)/.exec(e)||/(ipod)/.exec(e)||/(windows phone)/.exec(e)||/(iphone)/.exec(e)||/(kindle)/.exec(e)||/(android)/.exec(e)||/(windows)/.exec(e)||/(mac)/.exec(e)||/(linux)/.exec(e)||/(cros)/.exec(e)||[],n={browser:t[5]||t[3]||t[1]||"",version:t[2]||t[4]||"0",majorVersion:t[4]||t[2]||"0",platform:i[0]||""},s={};if(n.browser){s[n.browser]=!0;var o=n.majorVersion.split(".");s.version={major:parseInt(n.majorVersion,10),string:n.version},o.length>1&&(s.version.minor=parseInt(o[1],10)),o.length>2&&(s.version.build=parseInt(o[2],10))}for(var a in n.platform&&(s[n.platform]=!0),(s.chrome||s.opr||s.safari)&&(s.webkit=!0),(s.rv||s.iemobile)&&(s.rv&&delete s.rv,n.browser="msie",s.msie=!0),s.edge&&(delete s.edge,n.browser="msedge",s.msedge=!0),s.opr&&(n.browser="opera",s.opera=!0),s.safari&&s.android&&(n.browser="android",s.android=!0),s.name=n.browser,s.platform=n.platform,r)r.hasOwnProperty(a)&&delete r[a];Object.assign(r,s)}(),t.a=r},function(e,t,i){t.a={OK:"OK",FORMAT_ERROR:"FormatError",FORMAT_UNSUPPORTED:"FormatUnsupported",CODEC_UNSUPPORTED:"CodecUnsupported"}},function(e,t,i){var r,n="object"==typeof Reflect?Reflect:null,s=n&&"function"==typeof n.apply?n.apply:function(e,t,i){return Function.prototype.apply.call(e,t,i)};r=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function a(){a.init.call(this)}e.exports=a,e.exports.once=function(e,t){return new Promise((function(i,r){function n(i){e.removeListener(t,s),r(i)}function s(){"function"==typeof e.removeListener&&e.removeListener("error",n),i([].slice.call(arguments))}_(e,t,s,{once:!0}),"error"!==t&&function(e,t,i){"function"==typeof e.on&&_(e,"error",t,i)}(e,n,{once:!0})}))},a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var h=10;function l(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function d(e){return void 0===e._maxListeners?a.defaultMaxListeners:e._maxListeners}function u(e,t,i,r){var n,s,o;if(l(i),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,i.listener?i.listener:i),s=e._events),o=s[t]),void 0===o)o=s[t]=i,++e._eventsCount;else if("function"==typeof o?o=s[t]=r?[i,o]:[o,i]:r?o.unshift(i):o.push(i),(n=d(e))>0&&o.length>n&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=e,a.type=t,a.count=o.length}return e}function A(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function c(e,t,i){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:i},n=A.bind(r);return n.listener=i,r.wrapFn=n,n}function p(e,t,i){var r=e._events;if(void 0===r)return[];var n=r[t];return void 0===n?[]:"function"==typeof n?i?[n.listener||n]:[n]:i?function(e){for(var t=new Array(e.length),i=0;i<t.length;++i)t[i]=e[i].listener||e[i];return t}(n):m(n,n.length)}function f(e){var t=this._events;if(void 0!==t){var i=t[e];if("function"==typeof i)return 1;if(void 0!==i)return i.length}return 0}function m(e,t){for(var i=new Array(t),r=0;r<t;++r)i[r]=e[r];return i}function _(e,t,i,r){if("function"==typeof e.on)r.once?e.once(t,i):e.on(t,i);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function n(s){r.once&&e.removeEventListener(t,n),i(s)}))}}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return h},set:function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");h=e}}),a.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},a.prototype.getMaxListeners=function(){return d(this)},a.prototype.emit=function(e){for(var t=[],i=1;i<arguments.length;i++)t.push(arguments[i]);var r="error"===e,n=this._events;if(void 0!==n)r=r&&void 0===n.error;else if(!r)return!1;if(r){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var h=n[e];if(void 0===h)return!1;if("function"==typeof h)s(h,this,t);else{var l=h.length,d=m(h,l);for(i=0;i<l;++i)s(d[i],this,t)}return!0},a.prototype.addListener=function(e,t){return u(this,e,t,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(e,t){return u(this,e,t,!0)},a.prototype.once=function(e,t){return l(t),this.on(e,c(this,e,t)),this},a.prototype.prependOnceListener=function(e,t){return l(t),this.prependListener(e,c(this,e,t)),this},a.prototype.removeListener=function(e,t){var i,r,n,s,o;if(l(t),void 0===(r=this._events))return this;if(void 0===(i=r[e]))return this;if(i===t||i.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,i.listener||t));else if("function"!=typeof i){for(n=-1,s=i.length-1;s>=0;s--)if(i[s]===t||i[s].listener===t){o=i[s].listener,n=s;break}if(n<0)return this;0===n?i.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(i,n),1===i.length&&(r[e]=i[0]),void 0!==r.removeListener&&this.emit("removeListener",e,o||t)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(e){var t,i,r;if(void 0===(i=this._events))return this;if(void 0===i.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==i[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete i[e]),this;if(0===arguments.length){var n,s=Object.keys(i);for(r=0;r<s.length;++r)"removeListener"!==(n=s[r])&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=i[e]))this.removeListener(e,t);else if(void 0!==t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},a.prototype.listeners=function(e){return p(this,e,!0)},a.prototype.rawListeners=function(e){return p(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):f.call(e,t)},a.prototype.listenerCount=f,a.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(e,t,i){i.d(t,"d",(function(){return r})),i.d(t,"b",(function(){return n})),i.d(t,"a",(function(){return s})),i.d(t,"c",(function(){return o}));var r=function(e,t,i,r,n){this.dts=e,this.pts=t,this.duration=i,this.originalDts=r,this.isSyncPoint=n,this.fileposition=null},n=function(){function e(){this.beginDts=0,this.endDts=0,this.beginPts=0,this.endPts=0,this.originalBeginDts=0,this.originalEndDts=0,this.syncPoints=[],this.firstSample=null,this.lastSample=null}return e.prototype.appendSyncPoint=function(e){e.isSyncPoint=!0,this.syncPoints.push(e)},e}(),s=function(){function e(){this._list=[]}return e.prototype.clear=function(){this._list=[]},e.prototype.appendArray=function(e){var t=this._list;0!==e.length&&(t.length>0&&e[0].originalDts<t[t.length-1].originalDts&&this.clear(),Array.prototype.push.apply(t,e))},e.prototype.getLastSyncPointBeforeDts=function(e){if(0==this._list.length)return null;var t=this._list,i=0,r=t.length-1,n=0,s=0,o=r;for(e<t[0].dts&&(i=0,s=o+1);s<=o;){if((n=s+Math.floor((o-s)/2))===r||e>=t[n].dts&&e<t[n+1].dts){i=n;break}t[n].dts<e?s=n+1:o=n-1}return this._list[i]},e}(),o=function(){function e(e){this._type=e,this._list=[],this._lastAppendLocation=-1}return Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){return this._list.length},enumerable:!1,configurable:!0}),e.prototype.isEmpty=function(){return 0===this._list.length},e.prototype.clear=function(){this._list=[],this._lastAppendLocation=-1},e.prototype._searchNearestSegmentBefore=function(e){var t=this._list;if(0===t.length)return-2;var i=t.length-1,r=0,n=0,s=i,o=0;if(e<t[0].originalBeginDts)return-1;for(;n<=s;){if((r=n+Math.floor((s-n)/2))===i||e>t[r].lastSample.originalDts&&e<t[r+1].originalBeginDts){o=r;break}t[r].originalBeginDts<e?n=r+1:s=r-1}return o},e.prototype._searchNearestSegmentAfter=function(e){return this._searchNearestSegmentBefore(e)+1},e.prototype.append=function(e){var t=this._list,i=e,r=this._lastAppendLocation,n=0;-1!==r&&r<t.length&&i.originalBeginDts>=t[r].lastSample.originalDts&&(r===t.length-1||r<t.length-1&&i.originalBeginDts<t[r+1].originalBeginDts)?n=r+1:t.length>0&&(n=this._searchNearestSegmentBefore(i.originalBeginDts)+1),this._lastAppendLocation=n,this._list.splice(n,0,i)},e.prototype.getLastSegmentBefore=function(e){var t=this._searchNearestSegmentBefore(e);return t>=0?this._list[t]:null},e.prototype.getLastSampleBefore=function(e){var t=this.getLastSegmentBefore(e);return null!=t?t.lastSample:null},e.prototype.getLastSyncPointBefore=function(e){for(var t=this._searchNearestSegmentBefore(e),i=this._list[t].syncPoints;0===i.length&&t>0;)t--,i=this._list[t].syncPoints;return i.length>0?i[i.length-1]:null},e}()},function(e,t,i){var r=function(){function e(){this.mimeType=null,this.duration=null,this.hasAudio=null,this.hasVideo=null,this.audioCodec=null,this.videoCodec=null,this.audioDataRate=null,this.videoDataRate=null,this.audioSampleRate=null,this.audioChannelCount=null,this.width=null,this.height=null,this.fps=null,this.profile=null,this.level=null,this.refFrames=null,this.chromaFormat=null,this.sarNum=null,this.sarDen=null,this.metadata=null,this.segments=null,this.segmentCount=null,this.hasKeyframesIndex=null,this.keyframesIndex=null}return e.prototype.isComplete=function(){var e=!1===this.hasAudio||!0===this.hasAudio&&null!=this.audioCodec&&null!=this.audioSampleRate&&null!=this.audioChannelCount,t=!1===this.hasVideo||!0===this.hasVideo&&null!=this.videoCodec&&null!=this.width&&null!=this.height&&null!=this.fps&&null!=this.profile&&null!=this.level&&null!=this.refFrames&&null!=this.chromaFormat&&null!=this.sarNum&&null!=this.sarDen;return null!=this.mimeType&&e&&t},e.prototype.isSeekable=function(){return!0===this.hasKeyframesIndex},e.prototype.getNearestKeyframe=function(e){if(null==this.keyframesIndex)return null;var t=this.keyframesIndex,i=this._search(t.times,e);return{index:i,milliseconds:t.times[i],fileposition:t.filepositions[i]}},e.prototype._search=function(e,t){var i=0,r=e.length-1,n=0,s=0,o=r;for(t<e[0]&&(i=0,s=o+1);s<=o;){if((n=s+Math.floor((o-s)/2))===r||t>=e[n]&&t<e[n+1]){i=n;break}e[n]<t?s=n+1:o=n-1}return i},e}();t.a=r},function(e,t,i){var r=i(6),n=i.n(r),s=i(0),o=function(){function e(){}return Object.defineProperty(e,"forceGlobalTag",{get:function(){return s.a.FORCE_GLOBAL_TAG},set:function(t){s.a.FORCE_GLOBAL_TAG=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"globalTag",{get:function(){return s.a.GLOBAL_TAG},set:function(t){s.a.GLOBAL_TAG=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableAll",{get:function(){return s.a.ENABLE_VERBOSE&&s.a.ENABLE_DEBUG&&s.a.ENABLE_INFO&&s.a.ENABLE_WARN&&s.a.ENABLE_ERROR},set:function(t){s.a.ENABLE_VERBOSE=t,s.a.ENABLE_DEBUG=t,s.a.ENABLE_INFO=t,s.a.ENABLE_WARN=t,s.a.ENABLE_ERROR=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableDebug",{get:function(){return s.a.ENABLE_DEBUG},set:function(t){s.a.ENABLE_DEBUG=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableVerbose",{get:function(){return s.a.ENABLE_VERBOSE},set:function(t){s.a.ENABLE_VERBOSE=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableInfo",{get:function(){return s.a.ENABLE_INFO},set:function(t){s.a.ENABLE_INFO=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableWarn",{get:function(){return s.a.ENABLE_WARN},set:function(t){s.a.ENABLE_WARN=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableError",{get:function(){return s.a.ENABLE_ERROR},set:function(t){s.a.ENABLE_ERROR=t,e._notifyChange()},enumerable:!1,configurable:!0}),e.getConfig=function(){return{globalTag:s.a.GLOBAL_TAG,forceGlobalTag:s.a.FORCE_GLOBAL_TAG,enableVerbose:s.a.ENABLE_VERBOSE,enableDebug:s.a.ENABLE_DEBUG,enableInfo:s.a.ENABLE_INFO,enableWarn:s.a.ENABLE_WARN,enableError:s.a.ENABLE_ERROR,enableCallback:s.a.ENABLE_CALLBACK}},e.applyConfig=function(e){s.a.GLOBAL_TAG=e.globalTag,s.a.FORCE_GLOBAL_TAG=e.forceGlobalTag,s.a.ENABLE_VERBOSE=e.enableVerbose,s.a.ENABLE_DEBUG=e.enableDebug,s.a.ENABLE_INFO=e.enableInfo,s.a.ENABLE_WARN=e.enableWarn,s.a.ENABLE_ERROR=e.enableError,s.a.ENABLE_CALLBACK=e.enableCallback},e._notifyChange=function(){var t=e.emitter;if(t.listenerCount("change")>0){var i=e.getConfig();t.emit("change",i)}},e.registerListener=function(t){e.emitter.addListener("change",t)},e.removeListener=function(t){e.emitter.removeListener("change",t)},e.addLogListener=function(t){s.a.emitter.addListener("log",t),s.a.emitter.listenerCount("log")>0&&(s.a.ENABLE_CALLBACK=!0,e._notifyChange())},e.removeLogListener=function(t){s.a.emitter.removeListener("log",t),0===s.a.emitter.listenerCount("log")&&(s.a.ENABLE_CALLBACK=!1,e._notifyChange())},e}();o.emitter=new n.a,t.a=o},function(e,t,i){var r=i(6),n=i.n(r),s=i(0),o=i(4),a=i(8);function h(e,t,i){var r=e;if(t+i<r.length){for(;i--;)if(128!=(192&r[++t]))return!1;return!0}return!1}var l,d,u=function(e){for(var t=[],i=e,r=0,n=e.length;r<n;)if(i[r]<128)t.push(String.fromCharCode(i[r])),++r;else{if(i[r]<192);else if(i[r]<224){if(h(i,r,1)&&(s=(31&i[r])<<6|63&i[r+1])>=128){t.push(String.fromCharCode(65535&s)),r+=2;continue}}else if(i[r]<240){if(h(i,r,2)&&(s=(15&i[r])<<12|(63&i[r+1])<<6|63&i[r+2])>=2048&&55296!=(63488&s)){t.push(String.fromCharCode(65535&s)),r+=3;continue}}else if(i[r]<248){var s;if(h(i,r,3)&&(s=(7&i[r])<<18|(63&i[r+1])<<12|(63&i[r+2])<<6|63&i[r+3])>65536&&s<1114112){s-=65536,t.push(String.fromCharCode(s>>>10|55296)),t.push(String.fromCharCode(1023&s|56320)),r+=4;continue}}t.push(String.fromCharCode(65533)),++r}return t.join("")},A=i(3),c=(l=new ArrayBuffer(2),new DataView(l).setInt16(0,256,!0),256===new Int16Array(l)[0]),p=function(){function e(){}return e.parseScriptData=function(t,i,r){var n={};try{var o=e.parseValue(t,i,r),a=e.parseValue(t,i+o.size,r-o.size);n[o.data]=a.data}catch(e){s.a.e("AMF",e.toString())}return n},e.parseObject=function(t,i,r){if(r<3)throw new A.a("Data not enough when parse ScriptDataObject");var n=e.parseString(t,i,r),s=e.parseValue(t,i+n.size,r-n.size),o=s.objectEnd;return{data:{name:n.data,value:s.data},size:n.size+s.size,objectEnd:o}},e.parseVariable=function(t,i,r){return e.parseObject(t,i,r)},e.parseString=function(e,t,i){if(i<2)throw new A.a("Data not enough when parse String");var r=new DataView(e,t,i).getUint16(0,!c);return{data:r>0?u(new Uint8Array(e,t+2,r)):"",size:2+r}},e.parseLongString=function(e,t,i){if(i<4)throw new A.a("Data not enough when parse LongString");var r=new DataView(e,t,i).getUint32(0,!c);return{data:r>0?u(new Uint8Array(e,t+4,r)):"",size:4+r}},e.parseDate=function(e,t,i){if(i<10)throw new A.a("Data size invalid when parse Date");var r=new DataView(e,t,i),n=r.getFloat64(0,!c),s=r.getInt16(8,!c);return{data:new Date(n+=60*s*1e3),size:10}},e.parseValue=function(t,i,r){if(r<1)throw new A.a("Data not enough when parse Value");var n,o=new DataView(t,i,r),a=1,h=o.getUint8(0),l=!1;try{switch(h){case 0:n=o.getFloat64(1,!c),a+=8;break;case 1:n=!!o.getUint8(1),a+=1;break;case 2:var d=e.parseString(t,i+1,r-1);n=d.data,a+=d.size;break;case 3:n={};var u=0;for(9==(16777215&o.getUint32(r-4,!c))&&(u=3);a<r-4;){var p=e.parseObject(t,i+a,r-a-u);if(p.objectEnd)break;n[p.data.name]=p.data.value,a+=p.size}a<=r-3&&9==(16777215&o.getUint32(a-1,!c))&&(a+=3);break;case 8:for(n={},a+=4,u=0,9==(16777215&o.getUint32(r-4,!c))&&(u=3);a<r-8;){var f=e.parseVariable(t,i+a,r-a-u);if(f.objectEnd)break;n[f.data.name]=f.data.value,a+=f.size}a<=r-3&&9==(16777215&o.getUint32(a-1,!c))&&(a+=3);break;case 9:n=void 0,a=1,l=!0;break;case 10:n=[];var m=o.getUint32(1,!c);a+=4;for(var _=0;_<m;_++){var g=e.parseValue(t,i+a,r-a);n.push(g.data),a+=g.size}break;case 11:var y=e.parseDate(t,i+1,r-1);n=y.data,a+=y.size;break;case 12:var v=e.parseString(t,i+1,r-1);n=v.data,a+=v.size;break;default:a=r,s.a.w("AMF","Unsupported AMF value type "+h)}}catch(e){s.a.e("AMF",e.toString())}return{data:n,size:a,objectEnd:l}},e}(),f=function(){function e(e){this.TAG="ExpGolomb",this._buffer=e,this._buffer_index=0,this._total_bytes=e.byteLength,this._total_bits=8*e.byteLength,this._current_word=0,this._current_word_bits_left=0}return e.prototype.destroy=function(){this._buffer=null},e.prototype._fillCurrentWord=function(){var e=this._total_bytes-this._buffer_index;if(e<=0)throw new A.a("ExpGolomb: _fillCurrentWord() but no bytes available");var t=Math.min(4,e),i=new Uint8Array(4);i.set(this._buffer.subarray(this._buffer_index,this._buffer_index+t)),this._current_word=new DataView(i.buffer).getUint32(0,!1),this._buffer_index+=t,this._current_word_bits_left=8*t},e.prototype.readBits=function(e){if(e>32)throw new A.b("ExpGolomb: readBits() bits exceeded max 32bits!");if(e<=this._current_word_bits_left){var t=this._current_word>>>32-e;return this._current_word<<=e,this._current_word_bits_left-=e,t}var i=this._current_word_bits_left?this._current_word:0;i>>>=32-this._current_word_bits_left;var r=e-this._current_word_bits_left;this._fillCurrentWord();var n=Math.min(r,this._current_word_bits_left),s=this._current_word>>>32-n;return this._current_word<<=n,this._current_word_bits_left-=n,i<<n|s},e.prototype.readBool=function(){return 1===this.readBits(1)},e.prototype.readByte=function(){return this.readBits(8)},e.prototype._skipLeadingZero=function(){var e;for(e=0;e<this._current_word_bits_left;e++)if(0!=(this._current_word&2147483648>>>e))return this._current_word<<=e,this._current_word_bits_left-=e,e;return this._fillCurrentWord(),e+this._skipLeadingZero()},e.prototype.readUEG=function(){var e=this._skipLeadingZero();return this.readBits(e+1)-1},e.prototype.readSEG=function(){var e=this.readUEG();return 1&e?e+1>>>1:-1*(e>>>1)},e}(),m=function(){function e(){}return e._ebsp2rbsp=function(e){for(var t=e,i=t.byteLength,r=new Uint8Array(i),n=0,s=0;s<i;s++)s>=2&&3===t[s]&&0===t[s-1]&&0===t[s-2]||(r[n]=t[s],n++);return new Uint8Array(r.buffer,0,n)},e.parseSPS=function(t){for(var i=t.subarray(1,4),r="avc1.",n=0;n<3;n++){var s=i[n].toString(16);s.length<2&&(s="0"+s),r+=s}var o=e._ebsp2rbsp(t),a=new f(o);a.readByte();var h=a.readByte();a.readByte();var l=a.readByte();a.readUEG();var d=e.getProfileString(h),u=e.getLevelString(l),A=1,c=420,p=8,m=8;if((100===h||110===h||122===h||244===h||44===h||83===h||86===h||118===h||128===h||138===h||144===h)&&(3===(A=a.readUEG())&&a.readBits(1),A<=3&&(c=[0,420,422,444][A]),p=a.readUEG()+8,m=a.readUEG()+8,a.readBits(1),a.readBool()))for(var _=3!==A?8:12,g=0;g<_;g++)a.readBool()&&(g<6?e._skipScalingList(a,16):e._skipScalingList(a,64));a.readUEG();var y=a.readUEG();if(0===y)a.readUEG();else if(1===y){a.readBits(1),a.readSEG(),a.readSEG();var v=a.readUEG();for(g=0;g<v;g++)a.readSEG()}var E=a.readUEG();a.readBits(1);var b=a.readUEG(),S=a.readUEG(),w=a.readBits(1);0===w&&a.readBits(1),a.readBits(1);var T=0,R=0,C=0,k=0;a.readBool()&&(T=a.readUEG(),R=a.readUEG(),C=a.readUEG(),k=a.readUEG());var I=1,L=1,O=0,D=!0,B=0,x=0;if(a.readBool()){if(a.readBool()){var M=a.readByte();M>0&&M<16?(I=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][M-1],L=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][M-1]):255===M&&(I=a.readByte()<<8|a.readByte(),L=a.readByte()<<8|a.readByte())}if(a.readBool()&&a.readBool(),a.readBool()&&(a.readBits(4),a.readBool()&&a.readBits(24)),a.readBool()&&(a.readUEG(),a.readUEG()),a.readBool()){var P=a.readBits(32),F=a.readBits(32);D=a.readBool(),O=(B=F)/(x=2*P)}}var U=1;1===I&&1===L||(U=I/L);var N=0,V=0;0===A?(N=1,V=2-w):(N=3===A?1:2,V=(1===A?2:1)*(2-w));var G=16*(b+1),j=16*(S+1)*(2-w);G-=(T+R)*N,j-=(C+k)*V;var W=Math.ceil(G*U);return a.destroy(),a=null,{codec_mimetype:r,profile_idc:h,level_idc:l,profile_string:d,level_string:u,chroma_format_idc:A,bit_depth:p,bit_depth_luma:p,bit_depth_chroma:m,ref_frames:E,chroma_format:c,chroma_format_string:e.getChromaFormatString(c),frame_rate:{fixed:D,fps:O,fps_den:x,fps_num:B},sar_ratio:{width:I,height:L},codec_size:{width:G,height:j},present_size:{width:W,height:j}}},e._skipScalingList=function(e,t){for(var i=8,r=8,n=0;n<t;n++)0!==r&&(r=(i+e.readSEG()+256)%256),i=0===r?i:r},e.getProfileString=function(e){switch(e){case 66:return"Baseline";case 77:return"Main";case 88:return"Extended";case 100:return"High";case 110:return"High10";case 122:return"High422";case 244:return"High444";default:return"Unknown"}},e.getLevelString=function(e){return(e/10).toFixed(1)},e.getChromaFormatString=function(e){switch(e){case 420:return"4:2:0";case 422:return"4:2:2";case 444:return"4:4:4";default:return"Unknown"}},e}(),_=i(5),g=function(){function e(e,t){this.TAG="FLVDemuxer",this._config=t,this._onError=null,this._onMediaInfo=null,this._onMetaDataArrived=null,this._onScriptDataArrived=null,this._onTrackMetadata=null,this._onDataAvailable=null,this._dataOffset=e.dataOffset,this._firstParse=!0,this._dispatch=!1,this._hasAudio=e.hasAudioTrack,this._hasVideo=e.hasVideoTrack,this._hasAudioFlagOverrided=!1,this._hasVideoFlagOverrided=!1,this._audioInitialMetadataDispatched=!1,this._videoInitialMetadataDispatched=!1,this._mediaInfo=new a.a,this._mediaInfo.hasAudio=this._hasAudio,this._mediaInfo.hasVideo=this._hasVideo,this._metadata=null,this._audioMetadata=null,this._videoMetadata=null,this._naluLengthSize=4,this._timestampBase=0,this._timescale=1e3,this._duration=0,this._durationOverrided=!1,this._referenceFrameRate={fixed:!0,fps:23.976,fps_num:23976,fps_den:1e3},this._flvSoundRateTable=[5500,11025,22050,44100,48e3],this._mpegSamplingRates=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],this._mpegAudioV10SampleRateTable=[44100,48e3,32e3,0],this._mpegAudioV20SampleRateTable=[22050,24e3,16e3,0],this._mpegAudioV25SampleRateTable=[11025,12e3,8e3,0],this._mpegAudioL1BitRateTable=[0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1],this._mpegAudioL2BitRateTable=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1],this._mpegAudioL3BitRateTable=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1],this._videoTrack={type:"video",id:1,sequenceNumber:0,samples:[],length:0},this._audioTrack={type:"audio",id:2,sequenceNumber:0,samples:[],length:0},this._littleEndian=function(){var e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),256===new Int16Array(e)[0]}()}return e.prototype.destroy=function(){this._mediaInfo=null,this._metadata=null,this._audioMetadata=null,this._videoMetadata=null,this._videoTrack=null,this._audioTrack=null,this._onError=null,this._onMediaInfo=null,this._onMetaDataArrived=null,this._onScriptDataArrived=null,this._onTrackMetadata=null,this._onDataAvailable=null},e.probe=function(e){var t=new Uint8Array(e),i={match:!1};if(70!==t[0]||76!==t[1]||86!==t[2]||1!==t[3])return i;var r,n,s=(4&t[4])>>>2!=0,o=0!=(1&t[4]),a=(r=t)[n=5]<<24|r[n+1]<<16|r[n+2]<<8|r[n+3];return a<9?i:{match:!0,consumed:a,dataOffset:a,hasAudioTrack:s,hasVideoTrack:o}},e.prototype.bindDataSource=function(e){return e.onDataArrival=this.parseChunks.bind(this),this},Object.defineProperty(e.prototype,"onTrackMetadata",{get:function(){return this._onTrackMetadata},set:function(e){this._onTrackMetadata=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onMediaInfo",{get:function(){return this._onMediaInfo},set:function(e){this._onMediaInfo=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onMetaDataArrived",{get:function(){return this._onMetaDataArrived},set:function(e){this._onMetaDataArrived=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onScriptDataArrived",{get:function(){return this._onScriptDataArrived},set:function(e){this._onScriptDataArrived=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onError",{get:function(){return this._onError},set:function(e){this._onError=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onDataAvailable",{get:function(){return this._onDataAvailable},set:function(e){this._onDataAvailable=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"timestampBase",{get:function(){return this._timestampBase},set:function(e){this._timestampBase=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"overridedDuration",{get:function(){return this._duration},set:function(e){this._durationOverrided=!0,this._duration=e,this._mediaInfo.duration=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"overridedHasAudio",{set:function(e){this._hasAudioFlagOverrided=!0,this._hasAudio=e,this._mediaInfo.hasAudio=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"overridedHasVideo",{set:function(e){this._hasVideoFlagOverrided=!0,this._hasVideo=e,this._mediaInfo.hasVideo=e},enumerable:!1,configurable:!0}),e.prototype.resetMediaInfo=function(){this._mediaInfo=new a.a},e.prototype._isInitialMetadataDispatched=function(){return this._hasAudio&&this._hasVideo?this._audioInitialMetadataDispatched&&this._videoInitialMetadataDispatched:this._hasAudio&&!this._hasVideo?this._audioInitialMetadataDispatched:!(this._hasAudio||!this._hasVideo)&&this._videoInitialMetadataDispatched},e.prototype.parseChunks=function(t,i){if(!(this._onError&&this._onMediaInfo&&this._onTrackMetadata&&this._onDataAvailable))throw new A.a("Flv: onError & onMediaInfo & onTrackMetadata & onDataAvailable callback must be specified");var r=0,n=this._littleEndian;if(0===i){if(!(t.byteLength>13))return 0;r=e.probe(t).dataOffset}for(this._firstParse&&(this._firstParse=!1,i+r!==this._dataOffset&&s.a.w(this.TAG,"First time parsing but chunk byteStart invalid!"),0!==(o=new DataView(t,r)).getUint32(0,!n)&&s.a.w(this.TAG,"PrevTagSize0 !== 0 !!!"),r+=4);r<t.byteLength;){this._dispatch=!0;var o=new DataView(t,r);if(r+11+4>t.byteLength)break;var a=o.getUint8(0),h=16777215&o.getUint32(0,!n);if(r+11+h+4>t.byteLength)break;if(8===a||9===a||18===a){var l=o.getUint8(4),d=o.getUint8(5),u=o.getUint8(6)|d<<8|l<<16|o.getUint8(7)<<24;0!=(16777215&o.getUint32(7,!n))&&s.a.w(this.TAG,"Meet tag which has StreamID != 0!");var c=r+11;switch(a){case 8:this._parseAudioData(t,c,h,u);break;case 9:this._parseVideoData(t,c,h,u,i+r);break;case 18:this._parseScriptData(t,c,h)}var p=o.getUint32(11+h,!n);p!==11+h&&s.a.w(this.TAG,"Invalid PrevTagSize "+p),r+=11+h+4}else s.a.w(this.TAG,"Unsupported tag type "+a+", skipped"),r+=11+h+4}return this._isInitialMetadataDispatched()&&this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack),r},e.prototype._parseScriptData=function(e,t,i){var r=p.parseScriptData(e,t,i);if(r.hasOwnProperty("onMetaData")){if(null==r.onMetaData||"object"!=typeof r.onMetaData)return void s.a.w(this.TAG,"Invalid onMetaData structure!");this._metadata&&s.a.w(this.TAG,"Found another onMetaData tag!"),this._metadata=r;var n=this._metadata.onMetaData;if(this._onMetaDataArrived&&this._onMetaDataArrived(Object.assign({},n)),"boolean"==typeof n.hasAudio&&!1===this._hasAudioFlagOverrided&&(this._hasAudio=n.hasAudio,this._mediaInfo.hasAudio=this._hasAudio),"boolean"==typeof n.hasVideo&&!1===this._hasVideoFlagOverrided&&(this._hasVideo=n.hasVideo,this._mediaInfo.hasVideo=this._hasVideo),"number"==typeof n.audiodatarate&&(this._mediaInfo.audioDataRate=n.audiodatarate),"number"==typeof n.videodatarate&&(this._mediaInfo.videoDataRate=n.videodatarate),"number"==typeof n.width&&(this._mediaInfo.width=n.width),"number"==typeof n.height&&(this._mediaInfo.height=n.height),"number"==typeof n.duration){if(!this._durationOverrided){var o=Math.floor(n.duration*this._timescale);this._duration=o,this._mediaInfo.duration=o}}else this._mediaInfo.duration=0;if("number"==typeof n.framerate){var a=Math.floor(1e3*n.framerate);if(a>0){var h=a/1e3;this._referenceFrameRate.fixed=!0,this._referenceFrameRate.fps=h,this._referenceFrameRate.fps_num=a,this._referenceFrameRate.fps_den=1e3,this._mediaInfo.fps=h}}if("object"==typeof n.keyframes){this._mediaInfo.hasKeyframesIndex=!0;var l=n.keyframes;this._mediaInfo.keyframesIndex=this._parseKeyframesIndex(l),n.keyframes=null}else this._mediaInfo.hasKeyframesIndex=!1;this._dispatch=!1,this._mediaInfo.metadata=n,s.a.v(this.TAG,"Parsed onMetaData"),this._mediaInfo.isComplete()&&this._onMediaInfo(this._mediaInfo)}Object.keys(r).length>0&&this._onScriptDataArrived&&this._onScriptDataArrived(Object.assign({},r))},e.prototype._parseKeyframesIndex=function(e){for(var t=[],i=[],r=1;r<e.times.length;r++){var n=this._timestampBase+Math.floor(1e3*e.times[r]);t.push(n),i.push(e.filepositions[r])}return{times:t,filepositions:i}},e.prototype._parseAudioData=function(e,t,i,r){if(i<=1)s.a.w(this.TAG,"Flv: Invalid audio packet, missing SoundData payload!");else if(!0!==this._hasAudioFlagOverrided||!1!==this._hasAudio){this._littleEndian;var n=new DataView(e,t,i).getUint8(0),o=n>>>4;if(2===o||10===o){var a=0,h=(12&n)>>>2;if(h>=0&&h<=4){a=this._flvSoundRateTable[h];var l=1&n,d=this._audioMetadata,u=this._audioTrack;if(d||(!1===this._hasAudio&&!1===this._hasAudioFlagOverrided&&(this._hasAudio=!0,this._mediaInfo.hasAudio=!0),(d=this._audioMetadata={}).type="audio",d.id=u.id,d.timescale=this._timescale,d.duration=this._duration,d.audioSampleRate=a,d.channelCount=0===l?1:2),10===o){var A=this._parseAACAudioData(e,t+1,i-1);if(null==A)return;if(0===A.packetType){d.config&&s.a.w(this.TAG,"Found another AudioSpecificConfig!");var c=A.data;d.audioSampleRate=c.samplingRate,d.channelCount=c.channelCount,d.codec=c.codec,d.originalCodec=c.originalCodec,d.config=c.config,d.refSampleDuration=1024/d.audioSampleRate*d.timescale,s.a.v(this.TAG,"Parsed AudioSpecificConfig"),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._audioInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata("audio",d),(m=this._mediaInfo).audioCodec=d.originalCodec,m.audioSampleRate=d.audioSampleRate,m.audioChannelCount=d.channelCount,m.hasVideo?null!=m.videoCodec&&(m.mimeType='video/x-flv; codecs="'+m.videoCodec+","+m.audioCodec+'"'):m.mimeType='video/x-flv; codecs="'+m.audioCodec+'"',m.isComplete()&&this._onMediaInfo(m)}else if(1===A.packetType){var p=this._timestampBase+r,f={unit:A.data,length:A.data.byteLength,dts:p,pts:p};u.samples.push(f),u.length+=A.data.length}else s.a.e(this.TAG,"Flv: Unsupported AAC data type "+A.packetType)}else if(2===o){if(!d.codec){var m;if(null==(c=this._parseMP3AudioData(e,t+1,i-1,!0)))return;d.audioSampleRate=c.samplingRate,d.channelCount=c.channelCount,d.codec=c.codec,d.originalCodec=c.originalCodec,d.refSampleDuration=1152/d.audioSampleRate*d.timescale,s.a.v(this.TAG,"Parsed MPEG Audio Frame Header"),this._audioInitialMetadataDispatched=!0,this._onTrackMetadata("audio",d),(m=this._mediaInfo).audioCodec=d.codec,m.audioSampleRate=d.audioSampleRate,m.audioChannelCount=d.channelCount,m.audioDataRate=c.bitRate,m.hasVideo?null!=m.videoCodec&&(m.mimeType='video/x-flv; codecs="'+m.videoCodec+","+m.audioCodec+'"'):m.mimeType='video/x-flv; codecs="'+m.audioCodec+'"',m.isComplete()&&this._onMediaInfo(m)}var g=this._parseMP3AudioData(e,t+1,i-1,!1);if(null==g)return;p=this._timestampBase+r;var y={unit:g,length:g.byteLength,dts:p,pts:p};u.samples.push(y),u.length+=g.length}}else this._onError(_.a.FORMAT_ERROR,"Flv: Invalid audio sample rate idx: "+h)}else this._onError(_.a.CODEC_UNSUPPORTED,"Flv: Unsupported audio codec idx: "+o)}},e.prototype._parseAACAudioData=function(e,t,i){if(!(i<=1)){var r={},n=new Uint8Array(e,t,i);return r.packetType=n[0],0===n[0]?r.data=this._parseAACAudioSpecificConfig(e,t+1,i-1):r.data=n.subarray(1),r}s.a.w(this.TAG,"Flv: Invalid AAC packet, missing AACPacketType or/and Data!")},e.prototype._parseAACAudioSpecificConfig=function(e,t,i){var r,n,s=new Uint8Array(e,t,i),o=null,a=0,h=null;if(a=r=s[0]>>>3,(n=(7&s[0])<<1|s[1]>>>7)<0||n>=this._mpegSamplingRates.length)this._onError(_.a.FORMAT_ERROR,"Flv: AAC invalid sampling frequency index!");else{var l=this._mpegSamplingRates[n],d=(120&s[1])>>>3;if(!(d<0||d>=8)){5===a&&(h=(7&s[1])<<1|s[2]>>>7,s[2]);var u=self.navigator.userAgent.toLowerCase();return-1!==u.indexOf("firefox")?n>=6?(a=5,o=new Array(4),h=n-3):(a=2,o=new Array(2),h=n):-1!==u.indexOf("android")?(a=2,o=new Array(2),h=n):(a=5,h=n,o=new Array(4),n>=6?h=n-3:1===d&&(a=2,o=new Array(2),h=n)),o[0]=a<<3,o[0]|=(15&n)>>>1,o[1]=(15&n)<<7,o[1]|=(15&d)<<3,5===a&&(o[1]|=(15&h)>>>1,o[2]=(1&h)<<7,o[2]|=8,o[3]=0),{config:o,samplingRate:l,channelCount:d,codec:"mp4a.40."+a,originalCodec:"mp4a.40."+r}}this._onError(_.a.FORMAT_ERROR,"Flv: AAC invalid channel configuration")}},e.prototype._parseMP3AudioData=function(e,t,i,r){if(!(i<4)){this._littleEndian;var n=new Uint8Array(e,t,i),o=null;if(r){if(255!==n[0])return;var a=n[1]>>>3&3,h=(6&n[1])>>1,l=(240&n[2])>>>4,d=(12&n[2])>>>2,u=3!=(n[3]>>>6&3)?2:1,A=0,c=0;switch(a){case 0:A=this._mpegAudioV25SampleRateTable[d];break;case 2:A=this._mpegAudioV20SampleRateTable[d];break;case 3:A=this._mpegAudioV10SampleRateTable[d]}switch(h){case 1:l<this._mpegAudioL3BitRateTable.length&&(c=this._mpegAudioL3BitRateTable[l]);break;case 2:l<this._mpegAudioL2BitRateTable.length&&(c=this._mpegAudioL2BitRateTable[l]);break;case 3:l<this._mpegAudioL1BitRateTable.length&&(c=this._mpegAudioL1BitRateTable[l])}o={bitRate:c,samplingRate:A,channelCount:u,codec:"mp3",originalCodec:"mp3"}}else o=n;return o}s.a.w(this.TAG,"Flv: Invalid MP3 packet, header missing!")},e.prototype._parseVideoData=function(e,t,i,r,n){if(i<=1)s.a.w(this.TAG,"Flv: Invalid video packet, missing VideoData payload!");else if(!0!==this._hasVideoFlagOverrided||!1!==this._hasVideo){var o=new Uint8Array(e,t,i)[0],a=(240&o)>>>4,h=15&o;7===h?this._parseAVCVideoPacket(e,t+1,i-1,r,n,a):this._onError(_.a.CODEC_UNSUPPORTED,"Flv: Unsupported codec in video frame: "+h)}},e.prototype._parseAVCVideoPacket=function(e,t,i,r,n,o){if(i<4)s.a.w(this.TAG,"Flv: Invalid AVC packet, missing AVCPacketType or/and CompositionTime");else{var a=this._littleEndian,h=new DataView(e,t,i),l=h.getUint8(0),d=(16777215&h.getUint32(0,!a))<<8>>8;if(0===l)this._parseAVCDecoderConfigurationRecord(e,t+4,i-4);else if(1===l)this._parseAVCVideoData(e,t+4,i-4,r,n,o,d);else if(2!==l)return void this._onError(_.a.FORMAT_ERROR,"Flv: Invalid video packet type "+l)}},e.prototype._parseAVCDecoderConfigurationRecord=function(e,t,i){if(i<7)s.a.w(this.TAG,"Flv: Invalid AVCDecoderConfigurationRecord, lack of data!");else{var r=this._videoMetadata,n=this._videoTrack,o=this._littleEndian,a=new DataView(e,t,i);r?void 0!==r.avcc&&s.a.w(this.TAG,"Found another AVCDecoderConfigurationRecord!"):(!1===this._hasVideo&&!1===this._hasVideoFlagOverrided&&(this._hasVideo=!0,this._mediaInfo.hasVideo=!0),(r=this._videoMetadata={}).type="video",r.id=n.id,r.timescale=this._timescale,r.duration=this._duration);var h=a.getUint8(0),l=a.getUint8(1);if(a.getUint8(2),a.getUint8(3),1===h&&0!==l)if(this._naluLengthSize=1+(3&a.getUint8(4)),3===this._naluLengthSize||4===this._naluLengthSize){var d=31&a.getUint8(5);if(0!==d){d>1&&s.a.w(this.TAG,"Flv: Strange AVCDecoderConfigurationRecord: SPS Count = "+d);for(var u=6,A=0;A<d;A++){var c=a.getUint16(u,!o);if(u+=2,0!==c){var p=new Uint8Array(e,t+u,c);u+=c;var f=m.parseSPS(p);if(0===A){r.codecWidth=f.codec_size.width,r.codecHeight=f.codec_size.height,r.presentWidth=f.present_size.width,r.presentHeight=f.present_size.height,r.profile=f.profile_string,r.level=f.level_string,r.bitDepth=f.bit_depth,r.chromaFormat=f.chroma_format,r.sarRatio=f.sar_ratio,r.frameRate=f.frame_rate,!1!==f.frame_rate.fixed&&0!==f.frame_rate.fps_num&&0!==f.frame_rate.fps_den||(r.frameRate=this._referenceFrameRate);var g=r.frameRate.fps_den,y=r.frameRate.fps_num;r.refSampleDuration=r.timescale*(g/y);for(var v=p.subarray(1,4),E="avc1.",b=0;b<3;b++){var S=v[b].toString(16);S.length<2&&(S="0"+S),E+=S}r.codec=E;var w=this._mediaInfo;w.width=r.codecWidth,w.height=r.codecHeight,w.fps=r.frameRate.fps,w.profile=r.profile,w.level=r.level,w.refFrames=f.ref_frames,w.chromaFormat=f.chroma_format_string,w.sarNum=r.sarRatio.width,w.sarDen=r.sarRatio.height,w.videoCodec=E,w.hasAudio?null!=w.audioCodec&&(w.mimeType='video/x-flv; codecs="'+w.videoCodec+","+w.audioCodec+'"'):w.mimeType='video/x-flv; codecs="'+w.videoCodec+'"',w.isComplete()&&this._onMediaInfo(w)}}}var T=a.getUint8(u);if(0!==T){for(T>1&&s.a.w(this.TAG,"Flv: Strange AVCDecoderConfigurationRecord: PPS Count = "+T),u++,A=0;A<T;A++)c=a.getUint16(u,!o),u+=2,0!==c&&(u+=c);r.avcc=new Uint8Array(i),r.avcc.set(new Uint8Array(e,t,i),0),s.a.v(this.TAG,"Parsed AVCDecoderConfigurationRecord"),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._videoInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata("video",r)}else this._onError(_.a.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord: No PPS")}else this._onError(_.a.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord: No SPS")}else this._onError(_.a.FORMAT_ERROR,"Flv: Strange NaluLengthSizeMinusOne: "+(this._naluLengthSize-1));else this._onError(_.a.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord")}},e.prototype._parseAVCVideoData=function(e,t,i,r,n,o,a){for(var h=this._littleEndian,l=new DataView(e,t,i),d=[],u=0,A=0,c=this._naluLengthSize,p=this._timestampBase+r,f=1===o;A<i;){if(A+4>=i){s.a.w(this.TAG,"Malformed Nalu near timestamp "+p+", offset = "+A+", dataSize = "+i);break}var m=l.getUint32(A,!h);if(3===c&&(m>>>=8),m>i-c)return void s.a.w(this.TAG,"Malformed Nalus near timestamp "+p+", NaluSize > DataSize!");var _=31&l.getUint8(A+c);5===_&&(f=!0);var g=new Uint8Array(e,t+A,c+m),y={type:_,data:g};d.push(y),u+=g.byteLength,A+=c+m}if(d.length){var v=this._videoTrack,E={units:d,length:u,isKeyframe:f,dts:p,cts:a,pts:p+a};f&&(E.fileposition=n),v.samples.push(E),v.length+=u}},e}(),y=function(){function e(){}return e.prototype.destroy=function(){this.onError=null,this.onMediaInfo=null,this.onMetaDataArrived=null,this.onTrackMetadata=null,this.onDataAvailable=null,this.onTimedID3Metadata=null,this.onPESPrivateData=null,this.onPESPrivateDataDescriptor=null},e}(),v=function(){this.program_pmt_pid={}};!function(e){e[e.kMPEG1Audio=3]="kMPEG1Audio",e[e.kMPEG2Audio=4]="kMPEG2Audio",e[e.kPESPrivateData=6]="kPESPrivateData",e[e.kADTSAAC=15]="kADTSAAC",e[e.kID3=21]="kID3",e[e.kH264=27]="kH264",e[e.kH265=36]="kH265"}(d||(d={}));var E,b=function(){this.pid_stream_type={},this.common_pids={h264:void 0,adts_aac:void 0},this.pes_private_data_pids={},this.timed_id3_pids={}},S=function(){},w=function(){this.slices=[],this.total_length=0,this.file_position=0};!function(e){e[e.kUnspecified=0]="kUnspecified",e[e.kSliceNonIDR=1]="kSliceNonIDR",e[e.kSliceDPA=2]="kSliceDPA",e[e.kSliceDPB=3]="kSliceDPB",e[e.kSliceDPC=4]="kSliceDPC",e[e.kSliceIDR=5]="kSliceIDR",e[e.kSliceSEI=6]="kSliceSEI",e[e.kSliceSPS=7]="kSliceSPS",e[e.kSlicePPS=8]="kSlicePPS",e[e.kSliceAUD=9]="kSliceAUD",e[e.kEndOfSequence=10]="kEndOfSequence",e[e.kEndOfStream=11]="kEndOfStream",e[e.kFiller=12]="kFiller",e[e.kSPSExt=13]="kSPSExt",e[e.kReserved0=14]="kReserved0"}(E||(E={}));var T,R,C=function(){},k=function(e){var t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)},I=function(){function e(e){this.TAG="H264AnnexBParser",this.current_startcode_offset_=0,this.eof_flag_=!1,this.data_=e,this.current_startcode_offset_=this.findNextStartCodeOffset(0),this.eof_flag_&&s.a.e(this.TAG,"Could not found H264 startcode until payload end!")}return e.prototype.findNextStartCodeOffset=function(e){for(var t=e,i=this.data_;;){if(t+3>=i.byteLength)return this.eof_flag_=!0,i.byteLength;var r=i[t+0]<<24|i[t+1]<<16|i[t+2]<<8|i[t+3],n=i[t+0]<<16|i[t+1]<<8|i[t+2];if(1===r||1===n)return t;t++}},e.prototype.readNextNaluPayload=function(){for(var e=this.data_,t=null;null==t&&!this.eof_flag_;){var i=this.current_startcode_offset_,r=31&e[i+=1==(e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3])?4:3],n=(128&e[i])>>>7,s=this.findNextStartCodeOffset(i);if(this.current_startcode_offset_=s,!(r>=E.kReserved0)&&0===n){var o=e.subarray(i,s);(t=new C).type=r,t.data=o}}return t},e}(),L=function(){function e(e,t,i){var r=8+e.byteLength+1+2+t.byteLength,n=!1;66!==e[3]&&77!==e[3]&&88!==e[3]&&(n=!0,r+=4);var s=this.data=new Uint8Array(r);s[0]=1,s[1]=e[1],s[2]=e[2],s[3]=e[3],s[4]=255,s[5]=225;var o=e.byteLength;s[6]=o>>>8,s[7]=255&o;var a=8;s.set(e,8),s[a+=o]=1;var h=t.byteLength;s[a+1]=h>>>8,s[a+2]=255&h,s.set(t,a+3),a+=3+h,n&&(s[a]=252|i.chroma_format_idc,s[a+1]=248|i.bit_depth_luma-8,s[a+2]=248|i.bit_depth_chroma-8,s[a+3]=0,a+=4)}return e.prototype.getData=function(){return this.data},e}();!function(e){e[e.kNull=0]="kNull",e[e.kAACMain=1]="kAACMain",e[e.kAAC_LC=2]="kAAC_LC",e[e.kAAC_SSR=3]="kAAC_SSR",e[e.kAAC_LTP=4]="kAAC_LTP",e[e.kAAC_SBR=5]="kAAC_SBR",e[e.kAAC_Scalable=6]="kAAC_Scalable",e[e.kLayer1=32]="kLayer1",e[e.kLayer2=33]="kLayer2",e[e.kLayer3=34]="kLayer3"}(T||(T={})),function(e){e[e.k96000Hz=0]="k96000Hz",e[e.k88200Hz=1]="k88200Hz",e[e.k64000Hz=2]="k64000Hz",e[e.k48000Hz=3]="k48000Hz",e[e.k44100Hz=4]="k44100Hz",e[e.k32000Hz=5]="k32000Hz",e[e.k24000Hz=6]="k24000Hz",e[e.k22050Hz=7]="k22050Hz",e[e.k16000Hz=8]="k16000Hz",e[e.k12000Hz=9]="k12000Hz",e[e.k11025Hz=10]="k11025Hz",e[e.k8000Hz=11]="k8000Hz",e[e.k7350Hz=12]="k7350Hz"}(R||(R={}));var O,D=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],B=function(){},x=function(){function e(e){this.TAG="AACADTSParser",this.data_=e,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&s.a.e(this.TAG,"Could not found ADTS syncword until payload end")}return e.prototype.findNextSyncwordOffset=function(e){for(var t=e,i=this.data_;;){if(t+7>=i.byteLength)return this.eof_flag_=!0,i.byteLength;if(4095==(i[t+0]<<8|i[t+1])>>>4)return t;t++}},e.prototype.readNextAACFrame=function(){for(var e=this.data_,t=null;null==t&&!this.eof_flag_;){var i=this.current_syncword_offset_,r=(8&e[i+1])>>>3,n=(6&e[i+1])>>>1,s=1&e[i+1],o=(192&e[i+2])>>>6,a=(60&e[i+2])>>>2,h=(1&e[i+2])<<2|(192&e[i+3])>>>6,l=(3&e[i+3])<<11|e[i+4]<<3|(224&e[i+5])>>>5;if(e[i+6],i+l>this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}var d=1===s?7:9,u=l-d;i+=d;var A=this.findNextSyncwordOffset(i+u);if(this.current_syncword_offset_=A,(0===r||1===r)&&0===n){var c=e.subarray(i,i+u);(t=new B).audio_object_type=o+1,t.sampling_freq_index=a,t.sampling_frequency=D[a],t.channel_config=h,t.data=c}}return t},e.prototype.hasIncompleteData=function(){return this.has_last_incomplete_data},e.prototype.getIncompleteData=function(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null},e}(),M=function(e){var t=null,i=e.audio_object_type,r=e.audio_object_type,n=e.sampling_freq_index,s=e.channel_config,o=0,a=navigator.userAgent.toLowerCase();-1!==a.indexOf("firefox")?n>=6?(r=5,t=new Array(4),o=n-3):(r=2,t=new Array(2),o=n):-1!==a.indexOf("android")?(r=2,t=new Array(2),o=n):(r=5,o=n,t=new Array(4),n>=6?o=n-3:1===s&&(r=2,t=new Array(2),o=n)),t[0]=r<<3,t[0]|=(15&n)>>>1,t[1]=(15&n)<<7,t[1]|=(15&s)<<3,5===r&&(t[1]|=(15&o)>>>1,t[2]=(1&o)<<7,t[2]|=8,t[3]=0),this.config=t,this.sampling_rate=D[n],this.channel_count=s,this.codec_mimetype="mp4a.40."+r,this.original_codec_mimetype="mp4a.40."+i},P=function(){},F=function(){},U=(O=function(e,t){return(O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}O(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),N=function(e){function t(t,i){var r=e.call(this)||this;return r.TAG="TSDemuxer",r.first_parse_=!0,r.media_info_=new a.a,r.timescale_=90,r.duration_=0,r.current_pmt_pid_=-1,r.program_pmt_map_={},r.pes_slice_queues_={},r.video_metadata_={sps:void 0,pps:void 0,sps_details:void 0},r.audio_metadata_={audio_object_type:void 0,sampling_freq_index:void 0,sampling_frequency:void 0,channel_config:void 0},r.aac_last_sample_pts_=void 0,r.aac_last_incomplete_data_=null,r.has_video_=!1,r.has_audio_=!1,r.video_init_segment_dispatched_=!1,r.audio_init_segment_dispatched_=!1,r.video_metadata_changed_=!1,r.audio_metadata_changed_=!1,r.video_track_={type:"video",id:1,sequenceNumber:0,samples:[],length:0},r.audio_track_={type:"audio",id:2,sequenceNumber:0,samples:[],length:0},r.ts_packet_size_=t.ts_packet_size,r.sync_offset_=t.sync_offset,r.config_=i,r}return U(t,e),t.prototype.destroy=function(){this.media_info_=null,this.pes_slice_queues_=null,this.video_metadata_=null,this.audio_metadata_=null,this.aac_last_incomplete_data_=null,this.video_track_=null,this.audio_track_=null,e.prototype.destroy.call(this)},t.probe=function(e){var t=new Uint8Array(e),i=-1,r=188;if(t.byteLength<=3*r)return s.a.e("TSDemuxer","Probe data "+t.byteLength+" bytes is too few for judging MPEG-TS stream format!"),{match:!1};for(;-1===i;){for(var n=Math.min(1e3,t.byteLength-3*r),o=0;o<n;){if(71===t[o]&&71===t[o+r]&&71===t[o+2*r]){i=o;break}o++}if(-1===i)if(188===r)r=192;else{if(192!==r)break;r=204}}return-1===i?{match:!1}:(192===r&&i>=4?(s.a.v("TSDemuxer","ts_packet_size = 192, m2ts mode"),i-=4):204===r&&s.a.v("TSDemuxer","ts_packet_size = 204, RS encoded MPEG2-TS stream"),{match:!0,consumed:0,ts_packet_size:r,sync_offset:i})},t.prototype.bindDataSource=function(e){return e.onDataArrival=this.parseChunks.bind(this),this},t.prototype.resetMediaInfo=function(){this.media_info_=new a.a},t.prototype.parseChunks=function(e,t){if(!(this.onError&&this.onMediaInfo&&this.onTrackMetadata&&this.onDataAvailable))throw new A.a("onError & onMediaInfo & onTrackMetadata & onDataAvailable callback must be specified");var i=0;for(this.first_parse_&&(this.first_parse_=!1,i=this.sync_offset_);i+this.ts_packet_size_<=e.byteLength;){var r=t+i;192===this.ts_packet_size_&&(i+=4);var n=new Uint8Array(e,i,188),o=n[0];if(71!==o){s.a.e(this.TAG,"sync_byte = "+o+", not 0x47");break}var a=(64&n[1])>>>6,h=(n[1],(31&n[1])<<8|n[2]),l=(48&n[3])>>>4,d=15&n[3],u={},c=4;if(2==l||3==l){var p=n[4];if(5+p===188){i+=188,204===this.ts_packet_size_&&(i+=16);continue}p>0&&(u=this.parseAdaptationField(e,i+4,1+p)),c=5+p}if(1==l||3==l)if(0===h||h===this.current_pmt_pid_){a&&(c+=1+n[c]);var f=188-c;0===h?this.parsePAT(e,i+c,f,{payload_unit_start_indicator:a,continuity_conunter:d}):this.parsePMT(e,i+c,f,{payload_unit_start_indicator:a,continuity_conunter:d})}else if(null!=this.pmt_&&null!=this.pmt_.pid_stream_type[h]){f=188-c;var m=this.pmt_.pid_stream_type[h];h!==this.pmt_.common_pids.h264&&h!==this.pmt_.common_pids.adts_aac&&!0!==this.pmt_.pes_private_data_pids[h]&&!0!==this.pmt_.timed_id3_pids[h]||this.handlePESSlice(e,i+c,f,{pid:h,stream_type:m,file_position:r,payload_unit_start_indicator:a,continuity_conunter:d,random_access_indicator:u.random_access_indicator})}i+=188,204===this.ts_packet_size_&&(i+=16)}return this.dispatchAudioVideoMediaSegment(),i},t.prototype.parseAdaptationField=function(e,t,i){var r=new Uint8Array(e,t,i),n=r[0];return n>0?n>183?(s.a.w(this.TAG,"Illegal adaptation_field_length: "+n),{}):{discontinuity_indicator:(128&r[1])>>>7,random_access_indicator:(64&r[1])>>>6,elementary_stream_priority_indicator:(32&r[1])>>>5}:{}},t.prototype.parsePAT=function(e,t,i,r){var n=new Uint8Array(e,t,i),o=n[0];if(0===o){var a=(15&n[1])<<8|n[2],h=(n[3],n[4],(62&n[5])>>>1),l=1&n[5],d=n[6],u=(n[7],null);if(1===l&&0===d)(u=new v).version_number=h;else if(null==(u=this.pat_))return;for(var A=a-5-4,c=-1,p=-1,f=8;f<8+A;f+=4){var m=n[f]<<8|n[f+1],_=(31&n[f+2])<<8|n[f+3];0===m?u.network_pid=_:(u.program_pmt_pid[m]=_,-1===c&&(c=m),-1===p&&(p=_))}1===l&&0===d&&(null==this.pat_&&s.a.v(this.TAG,"Parsed first PAT: "+JSON.stringify(u)),this.pat_=u,this.current_program_=c,this.current_pmt_pid_=p)}else s.a.e(this.TAG,"parsePAT: table_id "+o+" is not corresponded to PAT!")},t.prototype.parsePMT=function(e,t,i,r){var n=new Uint8Array(e,t,i),o=n[0];if(2===o){var a=(15&n[1])<<8|n[2],h=n[3]<<8|n[4],l=(62&n[5])>>>1,u=1&n[5],A=n[6],c=(n[7],null);if(1===u&&0===A)(c=new b).program_number=h,c.version_number=l,this.program_pmt_map_[h]=c;else if(null==(c=this.program_pmt_map_[h]))return;n[8],n[9];for(var p=(15&n[10])<<8|n[11],f=12+p,m=a-9-p-4,_=f;_<f+m;){var g=n[_],y=(31&n[_+1])<<8|n[_+2],v=(15&n[_+3])<<8|n[_+4];if(c.pid_stream_type[y]=g,g!==d.kH264||c.common_pids.h264)if(g!==d.kADTSAAC||c.common_pids.adts_aac)if(g===d.kPESPrivateData){if(c.pes_private_data_pids[y]=!0,v>0){var E=n.subarray(_+5,_+5+v);this.dispatchPESPrivateDataDescriptor(y,g,E)}}else g===d.kID3&&(c.timed_id3_pids[y]=!0);else c.common_pids.adts_aac=y;else c.common_pids.h264=y;_+=5+v}h===this.current_program_&&(null==this.pmt_&&s.a.v(this.TAG,"Parsed first PMT: "+JSON.stringify(c)),this.pmt_=c,c.common_pids.h264&&(this.has_video_=!0),c.common_pids.adts_aac&&(this.has_audio_=!0))}else s.a.e(this.TAG,"parsePMT: table_id "+o+" is not corresponded to PMT!")},t.prototype.handlePESSlice=function(e,t,i,r){var n=new Uint8Array(e,t,i),o=n[0]<<16|n[1]<<8|n[2];if(n[3],n[4],n[5],r.payload_unit_start_indicator){if(1!==o)return void s.a.e(this.TAG,"handlePESSlice: packet_start_code_prefix should be 1 but with value "+o);var a=this.pes_slice_queues_[r.pid];if(a){for(var h=new Uint8Array(a.total_length),l=0,d=0;l<a.slices.length;l++){var u=a.slices[l];h.set(u,d),d+=u.byteLength}a.slices=[],a.total_length=0;var A=new S;A.pid=r.pid,A.data=h,A.stream_type=r.stream_type,A.file_position=a.file_position,A.random_access_indicator=a.random_access_indicator,this.parsePES(A)}this.pes_slice_queues_[r.pid]=new w,this.pes_slice_queues_[r.pid].file_position=r.file_position,this.pes_slice_queues_[r.pid].random_access_indicator=r.random_access_indicator}if(null!=this.pes_slice_queues_[r.pid]){var c=this.pes_slice_queues_[r.pid];c.slices.push(n),c.total_length+=n.byteLength}},t.prototype.parsePES=function(e){var t=e.data,i=t[0]<<16|t[1]<<8|t[2],r=t[3],n=t[4]<<8|t[5];if(1===i)if(188!==r&&190!==r&&191!==r&&240!==r&&241!==r&&255!==r&&242!==r&&248!==r){t[6];var o=(192&t[7])>>>6,a=t[8],h=void 0,l=void 0;2!==o&&3!==o||(h=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2,l=3===o?536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2:h);var u=9+a,A=void 0;if(0!==n){if(n<3+a)return void s.a.v(this.TAG,"Malformed PES: PES_packet_length < 3 + PES_header_data_length");A=n-3-a}else A=t.byteLength-u;var c=t.subarray(u,u+A);switch(e.stream_type){case d.kMPEG1Audio:case d.kMPEG2Audio:break;case d.kPESPrivateData:this.parsePESPrivateDataPayload(c,h,l,e.pid,r);break;case d.kADTSAAC:this.parseAACPayload(c,h);break;case d.kID3:this.parseTimedID3MetadataPayload(c,h,l,e.pid,r);break;case d.kH264:this.parseH264Payload(c,h,l,e.file_position,e.random_access_indicator);case d.kH265:}}else 188!==r&&191!==r&&240!==r&&241!==r&&255!==r&&242!==r&&248!==r||e.stream_type!==d.kPESPrivateData||(u=6,A=void 0,A=0!==n?n:t.byteLength-u,c=t.subarray(u,u+A),this.parsePESPrivateDataPayload(c,void 0,void 0,e.pid,r));else s.a.e(this.TAG,"parsePES: packet_start_code_prefix should be 1 but with value "+i)},t.prototype.parseH264Payload=function(e,t,i,r,n){for(var o=new I(e),a=null,h=[],l=0,d=!1;null!=(a=o.readNextNaluPayload());){var u=new k(a);if(u.type===E.kSliceSPS){var A=m.parseSPS(a.data);this.video_init_segment_dispatched_?!0===this.detectVideoMetadataChange(u,A)&&(s.a.v(this.TAG,"H264: Critical h264 metadata has been changed, attempt to re-generate InitSegment"),this.video_metadata_changed_=!0,this.video_metadata_={sps:u,pps:void 0,sps_details:A}):(this.video_metadata_.sps=u,this.video_metadata_.sps_details=A)}else u.type===E.kSlicePPS?this.video_init_segment_dispatched_&&!this.video_metadata_changed_||(this.video_metadata_.pps=u,this.video_metadata_.sps&&this.video_metadata_.pps&&(this.video_metadata_changed_&&this.dispatchVideoMediaSegment(),this.dispatchVideoInitSegment())):(u.type===E.kSliceIDR||u.type===E.kSliceNonIDR&&1===n)&&(d=!0);this.video_init_segment_dispatched_&&(h.push(u),l+=u.data.byteLength)}var c=Math.floor(t/this.timescale_),p=Math.floor(i/this.timescale_);if(h.length){var f=this.video_track_,_={units:h,length:l,isKeyframe:d,dts:p,pts:c,cts:c-p,file_position:r};f.samples.push(_),f.length+=l}},t.prototype.detectVideoMetadataChange=function(e,t){if(e.data.byteLength!==this.video_metadata_.sps.data.byteLength)return!0;if(t.codec_mimetype!==this.video_metadata_.sps_details.codec_mimetype)return s.a.v(this.TAG,"H264: Codec mimeType changed from "+this.video_metadata_.sps_details.codec_mimetype+" to "+t.codec_mimetype),!0;if(t.codec_size.width!==this.video_metadata_.sps_details.codec_size.width||t.codec_size.height!==this.video_metadata_.sps_details.codec_size.height){var i=this.video_metadata_.sps_details.codec_size,r=t.codec_size;return s.a.v(this.TAG,"H264: Coded Resolution changed from "+i.width+"x"+i.height+" to "+r.width+"x"+r.height),!0}return t.present_size.width!==this.video_metadata_.sps_details.present_size.width&&(s.a.v(this.TAG,"H264: Present resolution width changed from "+this.video_metadata_.sps_details.present_size.width+" to "+t.present_size.width),!0)},t.prototype.isInitSegmentDispatched=function(){return this.has_video_&&this.has_audio_?this.video_init_segment_dispatched_&&this.audio_init_segment_dispatched_:this.has_video_&&!this.has_audio_?this.video_init_segment_dispatched_:!(this.has_video_||!this.has_audio_)&&this.audio_init_segment_dispatched_},t.prototype.dispatchVideoInitSegment=function(){var e=this.video_metadata_.sps_details,t={type:"video"};t.id=this.video_track_.id,t.timescale=1e3,t.duration=this.duration_,t.codecWidth=e.codec_size.width,t.codecHeight=e.codec_size.height,t.presentWidth=e.present_size.width,t.presentHeight=e.present_size.height,t.profile=e.profile_string,t.level=e.level_string,t.bitDepth=e.bit_depth,t.chromaFormat=e.chroma_format,t.sarRatio=e.sar_ratio,t.frameRate=e.frame_rate;var i=t.frameRate.fps_den,r=t.frameRate.fps_num;t.refSampleDuration=i/r*1e3,t.codec=e.codec_mimetype;var n=this.video_metadata_.sps.data.subarray(4),o=this.video_metadata_.pps.data.subarray(4),a=new L(n,o,e);t.avcc=a.getData(),0==this.video_init_segment_dispatched_&&s.a.v(this.TAG,"Generated first AVCDecoderConfigurationRecord for mimeType: "+t.codec),this.onTrackMetadata("video",t),this.video_init_segment_dispatched_=!0,this.video_metadata_changed_=!1;var h=this.media_info_;h.hasVideo=!0,h.width=t.codecWidth,h.height=t.codecHeight,h.fps=t.frameRate.fps,h.profile=t.profile,h.level=t.level,h.refFrames=e.ref_frames,h.chromaFormat=e.chroma_format_string,h.sarNum=t.sarRatio.width,h.sarDen=t.sarRatio.height,h.videoCodec=t.codec,h.hasAudio&&h.audioCodec?h.mimeType='video/mp2t; codecs="'+h.videoCodec+","+h.audioCodec+'"':h.mimeType='video/mp2t; codecs="'+h.videoCodec+'"',h.isComplete()&&this.onMediaInfo(h)},t.prototype.dispatchVideoMediaSegment=function(){this.isInitSegmentDispatched()&&this.video_track_.length&&this.onDataAvailable(null,this.video_track_)},t.prototype.dispatchAudioMediaSegment=function(){this.isInitSegmentDispatched()&&this.audio_track_.length&&this.onDataAvailable(this.audio_track_,null)},t.prototype.dispatchAudioVideoMediaSegment=function(){this.isInitSegmentDispatched()&&(this.audio_track_.length||this.video_track_.length)&&this.onDataAvailable(this.audio_track_,this.video_track_)},t.prototype.parseAACPayload=function(e,t){if(!this.has_video_||this.video_init_segment_dispatched_){if(this.aac_last_incomplete_data_){var i=new Uint8Array(e.byteLength+this.aac_last_incomplete_data_.byteLength);i.set(this.aac_last_incomplete_data_,0),i.set(e,this.aac_last_incomplete_data_.byteLength),e=i}var r,n;if(null!=t)n=t/this.timescale_;else{if(null==this.aac_last_sample_pts_)return void s.a.w(this.TAG,"AAC: Unknown pts");r=1024/this.audio_metadata_.sampling_frequency*1e3,n=this.aac_last_sample_pts_+r}if(this.aac_last_incomplete_data_&&this.aac_last_sample_pts_){r=1024/this.audio_metadata_.sampling_frequency*1e3;var o=this.aac_last_sample_pts_+r;Math.abs(o-n)>1&&(s.a.w(this.TAG,"AAC: Detected pts overlapped, expected: "+o+"ms, PES pts: "+n+"ms"),n=o)}for(var a,h=new x(e),l=null,d=n;null!=(l=h.readNextAACFrame());){r=1024/l.sampling_frequency*1e3,0==this.audio_init_segment_dispatched_?(this.audio_metadata_.audio_object_type=l.audio_object_type,this.audio_metadata_.sampling_freq_index=l.sampling_freq_index,this.audio_metadata_.sampling_frequency=l.sampling_frequency,this.audio_metadata_.channel_config=l.channel_config,this.dispatchAudioInitSegment(l)):this.detectAudioMetadataChange(l)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(l)),a=d;var u=Math.floor(d),A={unit:l.data,length:l.data.byteLength,pts:u,dts:u};this.audio_track_.samples.push(A),this.audio_track_.length+=l.data.byteLength,d+=r}h.hasIncompleteData()&&(this.aac_last_incomplete_data_=h.getIncompleteData()),a&&(this.aac_last_sample_pts_=a)}},t.prototype.detectAudioMetadataChange=function(e){return e.audio_object_type!==this.audio_metadata_.audio_object_type?(s.a.v(this.TAG,"AAC: AudioObjectType changed from "+this.audio_metadata_.audio_object_type+" to "+e.audio_object_type),!0):e.sampling_freq_index!==this.audio_metadata_.sampling_freq_index?(s.a.v(this.TAG,"AAC: SamplingFrequencyIndex changed from "+this.audio_metadata_.sampling_freq_index+" to "+e.sampling_freq_index),!0):e.channel_config!==this.audio_metadata_.channel_config&&(s.a.v(this.TAG,"AAC: Channel configuration changed from "+this.audio_metadata_.channel_config+" to "+e.channel_config),!0)},t.prototype.dispatchAudioInitSegment=function(e){var t=new M(e),i={type:"audio"};i.id=this.audio_track_.id,i.timescale=1e3,i.duration=this.duration_,i.audioSampleRate=t.sampling_rate,i.channelCount=t.channel_count,i.codec=t.codec_mimetype,i.originalCodec=t.original_codec_mimetype,i.config=t.config,i.refSampleDuration=1024/i.audioSampleRate*i.timescale,0==this.audio_init_segment_dispatched_&&s.a.v(this.TAG,"Generated first AudioSpecificConfig for mimeType: "+i.codec),this.onTrackMetadata("audio",i),this.audio_init_segment_dispatched_=!0,this.video_metadata_changed_=!1;var r=this.media_info_;r.hasAudio=!0,r.audioCodec=i.originalCodec,r.audioSampleRate=i.audioSampleRate,r.audioChannelCount=i.channelCount,r.hasVideo&&r.videoCodec?r.mimeType='video/mp2t; codecs="'+r.videoCodec+","+r.audioCodec+'"':r.mimeType='video/mp2t; codecs="'+r.audioCodec+'"',r.isComplete()&&this.onMediaInfo(r)},t.prototype.dispatchPESPrivateDataDescriptor=function(e,t,i){var r=new F;r.pid=e,r.stream_type=t,r.descriptor=i,this.onPESPrivateDataDescriptor&&this.onPESPrivateDataDescriptor(r)},t.prototype.parsePESPrivateDataPayload=function(e,t,i,r,n){var s=new P;if(s.pid=r,s.stream_id=n,s.len=e.byteLength,s.data=e,null!=t){var o=Math.floor(t/this.timescale_);s.pts=o}else s.nearest_pts=this.aac_last_sample_pts_;if(null!=i){var a=Math.floor(i/this.timescale_);s.dts=a}this.onPESPrivateData&&this.onPESPrivateData(s)},t.prototype.parseTimedID3MetadataPayload=function(e,t,i,r,n){var s=new P;if(s.pid=r,s.stream_id=n,s.len=e.byteLength,s.data=e,null!=t){var o=Math.floor(t/this.timescale_);s.pts=o}if(null!=i){var a=Math.floor(i/this.timescale_);s.dts=a}this.onTimedID3Metadata&&this.onTimedID3Metadata(s)},t}(y),V=function(){function e(){}return e.init=function(){for(var t in e.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],".mp3":[]},e.types)e.types.hasOwnProperty(t)&&(e.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);var i=e.constants={};i.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),i.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),i.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),i.STSC=i.STCO=i.STTS,i.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),i.HDLR_VIDEO=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),i.HDLR_AUDIO=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),i.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),i.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),i.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])},e.box=function(e){for(var t=8,i=null,r=Array.prototype.slice.call(arguments,1),n=r.length,s=0;s<n;s++)t+=r[s].byteLength;(i=new Uint8Array(t))[0]=t>>>24&255,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t,i.set(e,4);var o=8;for(s=0;s<n;s++)i.set(r[s],o),o+=r[s].byteLength;return i},e.generateInitSegment=function(t){var i=e.box(e.types.ftyp,e.constants.FTYP),r=e.moov(t),n=new Uint8Array(i.byteLength+r.byteLength);return n.set(i,0),n.set(r,i.byteLength),n},e.moov=function(t){var i=e.mvhd(t.timescale,t.duration),r=e.trak(t),n=e.mvex(t);return e.box(e.types.moov,i,r,n)},e.mvhd=function(t,i){return e.box(e.types.mvhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]))},e.trak=function(t){return e.box(e.types.trak,e.tkhd(t),e.mdia(t))},e.tkhd=function(t){var i=t.id,r=t.duration,n=t.presentWidth,s=t.presentHeight;return e.box(e.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,n>>>8&255,255&n,0,0,s>>>8&255,255&s,0,0]))},e.mdia=function(t){return e.box(e.types.mdia,e.mdhd(t),e.hdlr(t),e.minf(t))},e.mdhd=function(t){var i=t.timescale,r=t.duration;return e.box(e.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,r>>>24&255,r>>>16&255,r>>>8&255,255&r,85,196,0,0]))},e.hdlr=function(t){var i=null;return i="audio"===t.type?e.constants.HDLR_AUDIO:e.constants.HDLR_VIDEO,e.box(e.types.hdlr,i)},e.minf=function(t){var i=null;return i="audio"===t.type?e.box(e.types.smhd,e.constants.SMHD):e.box(e.types.vmhd,e.constants.VMHD),e.box(e.types.minf,i,e.dinf(),e.stbl(t))},e.dinf=function(){return e.box(e.types.dinf,e.box(e.types.dref,e.constants.DREF))},e.stbl=function(t){return e.box(e.types.stbl,e.stsd(t),e.box(e.types.stts,e.constants.STTS),e.box(e.types.stsc,e.constants.STSC),e.box(e.types.stsz,e.constants.STSZ),e.box(e.types.stco,e.constants.STCO))},e.stsd=function(t){return"audio"===t.type?"mp3"===t.codec?e.box(e.types.stsd,e.constants.STSD_PREFIX,e.mp3(t)):e.box(e.types.stsd,e.constants.STSD_PREFIX,e.mp4a(t)):e.box(e.types.stsd,e.constants.STSD_PREFIX,e.avc1(t))},e.mp3=function(t){var i=t.channelCount,r=t.audioSampleRate,n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,i,0,16,0,0,0,0,r>>>8&255,255&r,0,0]);return e.box(e.types[".mp3"],n)},e.mp4a=function(t){var i=t.channelCount,r=t.audioSampleRate,n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,i,0,16,0,0,0,0,r>>>8&255,255&r,0,0]);return e.box(e.types.mp4a,n,e.esds(t))},e.esds=function(t){var i=t.config||[],r=i.length,n=new Uint8Array([0,0,0,0,3,23+r,0,1,0,4,15+r,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([r]).concat(i).concat([6,1,2]));return e.box(e.types.esds,n)},e.avc1=function(t){var i=t.avcc,r=t.codecWidth,n=t.codecHeight,s=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,r>>>8&255,255&r,n>>>8&255,255&n,0,72,0,0,0,72,0,0,0,0,0,0,0,1,10,120,113,113,47,102,108,118,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return e.box(e.types.avc1,s,e.box(e.types.avcC,i))},e.mvex=function(t){return e.box(e.types.mvex,e.trex(t))},e.trex=function(t){var i=t.id,r=new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return e.box(e.types.trex,r)},e.moof=function(t,i){return e.box(e.types.moof,e.mfhd(t.sequenceNumber),e.traf(t,i))},e.mfhd=function(t){var i=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t]);return e.box(e.types.mfhd,i)},e.traf=function(t,i){var r=t.id,n=e.box(e.types.tfhd,new Uint8Array([0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r])),s=e.box(e.types.tfdt,new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i])),o=e.sdtp(t),a=e.trun(t,o.byteLength+16+16+8+16+8+8);return e.box(e.types.traf,n,s,a,o)},e.sdtp=function(t){for(var i=t.samples||[],r=i.length,n=new Uint8Array(4+r),s=0;s<r;s++){var o=i[s].flags;n[s+4]=o.isLeading<<6|o.dependsOn<<4|o.isDependedOn<<2|o.hasRedundancy}return e.box(e.types.sdtp,n)},e.trun=function(t,i){var r=t.samples||[],n=r.length,s=12+16*n,o=new Uint8Array(s);i+=8+s,o.set([0,0,15,1,n>>>24&255,n>>>16&255,n>>>8&255,255&n,i>>>24&255,i>>>16&255,i>>>8&255,255&i],0);for(var a=0;a<n;a++){var h=r[a].duration,l=r[a].size,d=r[a].flags,u=r[a].cts;o.set([h>>>24&255,h>>>16&255,h>>>8&255,255&h,l>>>24&255,l>>>16&255,l>>>8&255,255&l,d.isLeading<<2|d.dependsOn,d.isDependedOn<<6|d.hasRedundancy<<4|d.isNonSync,0,0,u>>>24&255,u>>>16&255,u>>>8&255,255&u],12+16*a)}return e.box(e.types.trun,o)},e.mdat=function(t){return e.box(e.types.mdat,t)},e}();V.init();var G=V,j=function(){function e(){}return e.getSilentFrame=function(e,t){if("mp4a.40.2"===e){if(1===t)return new Uint8Array([0,200,0,128,35,128]);if(2===t)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(6===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if(1===t)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(2===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(3===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}return null},e}(),W=i(7),Q=function(){function e(e){this.TAG="MP4Remuxer",this._config=e,this._isLive=!0===e.isLive,this._dtsBase=-1,this._dtsBaseInited=!1,this._audioDtsBase=1/0,this._videoDtsBase=1/0,this._audioNextDts=void 0,this._videoNextDts=void 0,this._audioStashedLastSample=null,this._videoStashedLastSample=null,this._audioMeta=null,this._videoMeta=null,this._audioSegmentInfoList=new W.c("audio"),this._videoSegmentInfoList=new W.c("video"),this._onInitSegment=null,this._onMediaSegment=null,this._forceFirstIDR=!(!o.a.chrome||!(o.a.version.major<50||50===o.a.version.major&&o.a.version.build<2661)),this._fillSilentAfterSeek=o.a.msedge||o.a.msie,this._mp3UseMpegAudio=!o.a.firefox,this._fillAudioTimestampGap=this._config.fixAudioTimestampGap}return e.prototype.destroy=function(){this._dtsBase=-1,this._dtsBaseInited=!1,this._audioMeta=null,this._videoMeta=null,this._audioSegmentInfoList.clear(),this._audioSegmentInfoList=null,this._videoSegmentInfoList.clear(),this._videoSegmentInfoList=null,this._onInitSegment=null,this._onMediaSegment=null},e.prototype.bindDataSource=function(e){return e.onDataAvailable=this.remux.bind(this),e.onTrackMetadata=this._onTrackMetadataReceived.bind(this),this},Object.defineProperty(e.prototype,"onInitSegment",{get:function(){return this._onInitSegment},set:function(e){this._onInitSegment=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onMediaSegment",{get:function(){return this._onMediaSegment},set:function(e){this._onMediaSegment=e},enumerable:!1,configurable:!0}),e.prototype.insertDiscontinuity=function(){this._audioNextDts=this._videoNextDts=void 0},e.prototype.seek=function(e){this._audioStashedLastSample=null,this._videoStashedLastSample=null,this._videoSegmentInfoList.clear(),this._audioSegmentInfoList.clear()},e.prototype.remux=function(e,t){if(!this._onMediaSegment)throw new A.a("MP4Remuxer: onMediaSegment callback must be specificed!");this._dtsBaseInited||this._calculateDtsBase(e,t),t&&this._remuxVideo(t),e&&this._remuxAudio(e)},e.prototype._onTrackMetadataReceived=function(e,t){var i=null,r="mp4",n=t.codec;if("audio"===e)this._audioMeta=t,"mp3"===t.codec&&this._mp3UseMpegAudio?(r="mpeg",n="",i=new Uint8Array):i=G.generateInitSegment(t);else{if("video"!==e)return;this._videoMeta=t,i=G.generateInitSegment(t)}if(!this._onInitSegment)throw new A.a("MP4Remuxer: onInitSegment callback must be specified!");this._onInitSegment(e,{type:e,data:i.buffer,codec:n,container:e+"/"+r,mediaDuration:t.duration})},e.prototype._calculateDtsBase=function(e,t){this._dtsBaseInited||(e&&e.samples&&e.samples.length&&(this._audioDtsBase=e.samples[0].dts),t&&t.samples&&t.samples.length&&(this._videoDtsBase=t.samples[0].dts),this._dtsBase=Math.min(this._audioDtsBase,this._videoDtsBase),this._dtsBaseInited=!0)},e.prototype.getTimestampBase=function(){return this._dtsBaseInited?this._dtsBase:0},e.prototype.flushStashedSamples=function(){var e=this._videoStashedLastSample,t=this._audioStashedLastSample,i={type:"video",id:1,sequenceNumber:0,samples:[],length:0};null!=e&&(i.samples.push(e),i.length=e.length);var r={type:"audio",id:2,sequenceNumber:0,samples:[],length:0};null!=t&&(r.samples.push(t),r.length=t.length),this._videoStashedLastSample=null,this._audioStashedLastSample=null,this._remuxVideo(i,!0),this._remuxAudio(r,!0)},e.prototype._remuxAudio=function(e,t){if(null!=this._audioMeta){var i,r=e,n=r.samples,a=void 0,h=-1,l=this._audioMeta.refSampleDuration,d="mp3"===this._audioMeta.codec&&this._mp3UseMpegAudio,u=this._dtsBaseInited&&void 0===this._audioNextDts,A=!1;if(n&&0!==n.length&&(1!==n.length||t)){var c=0,p=null,f=0;d?(c=0,f=r.length):(c=8,f=8+r.length);var m=null;if(n.length>1&&(f-=(m=n.pop()).length),null!=this._audioStashedLastSample){var _=this._audioStashedLastSample;this._audioStashedLastSample=null,n.unshift(_),f+=_.length}null!=m&&(this._audioStashedLastSample=m);var g=n[0].dts-this._dtsBase;if(this._audioNextDts)a=g-this._audioNextDts;else if(this._audioSegmentInfoList.isEmpty())a=0,this._fillSilentAfterSeek&&!this._videoSegmentInfoList.isEmpty()&&"mp3"!==this._audioMeta.originalCodec&&(A=!0);else{var y=this._audioSegmentInfoList.getLastSampleBefore(g);if(null!=y){var v=g-(y.originalDts+y.duration);v<=3&&(v=0),a=g-(y.dts+y.duration+v)}else a=0}if(A){var E=g-a,b=this._videoSegmentInfoList.getLastSegmentBefore(g);if(null!=b&&b.beginDts<E){if(B=j.getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount)){var S=b.beginDts,w=E-b.beginDts;s.a.v(this.TAG,"InsertPrefixSilentAudio: dts: "+S+", duration: "+w),n.unshift({unit:B,dts:S,pts:S}),f+=B.byteLength}}else A=!1}for(var T=[],R=0;R<n.length;R++){var C=(_=n[R]).unit,k=_.dts-this._dtsBase,I=(S=k,!1),L=null,O=0;if(!(k<-.001)){if("mp3"!==this._audioMeta.codec){var D=k;if(this._audioNextDts&&(D=this._audioNextDts),(a=k-D)<=-3*l){s.a.w(this.TAG,"Dropping 1 audio frame (originalDts: "+k+" ms ,curRefDts: "+D+" ms) due to dtsCorrection: "+a+" ms overlap.");continue}if(a>=3*l&&this._fillAudioTimestampGap&&!o.a.safari){I=!0;var B,x=Math.floor(a/l);s.a.w(this.TAG,"Large audio timestamp gap detected, may cause AV sync to drift. Silent frames will be generated to avoid unsync.\noriginalDts: "+k+" ms, curRefDts: "+D+" ms, dtsCorrection: "+Math.round(a)+" ms, generate: "+x+" frames"),S=Math.floor(D),O=Math.floor(D+l)-S,null==(B=j.getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount))&&(s.a.w(this.TAG,"Unable to generate silent frame for "+this._audioMeta.originalCodec+" with "+this._audioMeta.channelCount+" channels, repeat last frame"),B=C),L=[];for(var M=0;M<x;M++){D+=l;var P=Math.floor(D),F=Math.floor(D+l)-P,U={dts:P,pts:P,cts:0,unit:B,size:B.byteLength,duration:F,originalDts:k,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}};L.push(U),f+=U.size}this._audioNextDts=D+l}else S=Math.floor(D),O=Math.floor(D+l)-S,this._audioNextDts=D+l}else S=k-a,O=R!==n.length-1?n[R+1].dts-this._dtsBase-a-S:null!=m?m.dts-this._dtsBase-a-S:T.length>=1?T[T.length-1].duration:Math.floor(l),this._audioNextDts=S+O;-1===h&&(h=S),T.push({dts:S,pts:S,cts:0,unit:_.unit,size:_.unit.byteLength,duration:O,originalDts:k,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}}),I&&T.push.apply(T,L)}}if(0===T.length)return r.samples=[],void(r.length=0);for(d?p=new Uint8Array(f):((p=new Uint8Array(f))[0]=f>>>24&255,p[1]=f>>>16&255,p[2]=f>>>8&255,p[3]=255&f,p.set(G.types.mdat,4)),R=0;R<T.length;R++)C=T[R].unit,p.set(C,c),c+=C.byteLength;var N=T[T.length-1];i=N.dts+N.duration;var V=new W.b;V.beginDts=h,V.endDts=i,V.beginPts=h,V.endPts=i,V.originalBeginDts=T[0].originalDts,V.originalEndDts=N.originalDts+N.duration,V.firstSample=new W.d(T[0].dts,T[0].pts,T[0].duration,T[0].originalDts,!1),V.lastSample=new W.d(N.dts,N.pts,N.duration,N.originalDts,!1),this._isLive||this._audioSegmentInfoList.append(V),r.samples=T,r.sequenceNumber++;var Q=null;Q=d?new Uint8Array:G.moof(r,h),r.samples=[],r.length=0;var z={type:"audio",data:this._mergeBoxes(Q,p).buffer,sampleCount:T.length,info:V};d&&u&&(z.timestampOffset=h),this._onMediaSegment("audio",z)}}},e.prototype._remuxVideo=function(e,t){if(null!=this._videoMeta){var i,r,n=e,s=n.samples,o=void 0,a=-1,h=-1;if(s&&0!==s.length&&(1!==s.length||t)){var l=8,d=null,u=8+e.length,A=null;if(s.length>1&&(u-=(A=s.pop()).length),null!=this._videoStashedLastSample){var c=this._videoStashedLastSample;this._videoStashedLastSample=null,s.unshift(c),u+=c.length}null!=A&&(this._videoStashedLastSample=A);var p=s[0].dts-this._dtsBase;if(this._videoNextDts)o=p-this._videoNextDts;else if(this._videoSegmentInfoList.isEmpty())o=0;else{var f=this._videoSegmentInfoList.getLastSampleBefore(p);if(null!=f){var m=p-(f.originalDts+f.duration);m<=3&&(m=0),o=p-(f.dts+f.duration+m)}else o=0}for(var _=new W.b,g=[],y=0;y<s.length;y++){var v=(c=s[y]).dts-this._dtsBase,E=c.isKeyframe,b=v-o,S=c.cts,w=b+S;-1===a&&(a=b,h=w);var T=0;if(T=y!==s.length-1?s[y+1].dts-this._dtsBase-o-b:null!=A?A.dts-this._dtsBase-o-b:g.length>=1?g[g.length-1].duration:Math.floor(this._videoMeta.refSampleDuration),E){var R=new W.d(b,w,T,c.dts,!0);R.fileposition=c.fileposition,_.appendSyncPoint(R)}g.push({dts:b,pts:w,cts:S,units:c.units,size:c.length,isKeyframe:E,duration:T,originalDts:v,flags:{isLeading:0,dependsOn:E?2:1,isDependedOn:E?1:0,hasRedundancy:0,isNonSync:E?0:1}})}for((d=new Uint8Array(u))[0]=u>>>24&255,d[1]=u>>>16&255,d[2]=u>>>8&255,d[3]=255&u,d.set(G.types.mdat,4),y=0;y<g.length;y++)for(var C=g[y].units;C.length;){var k=C.shift().data;d.set(k,l),l+=k.byteLength}var I=g[g.length-1];if(i=I.dts+I.duration,r=I.pts+I.duration,this._videoNextDts=i,_.beginDts=a,_.endDts=i,_.beginPts=h,_.endPts=r,_.originalBeginDts=g[0].originalDts,_.originalEndDts=I.originalDts+I.duration,_.firstSample=new W.d(g[0].dts,g[0].pts,g[0].duration,g[0].originalDts,g[0].isKeyframe),_.lastSample=new W.d(I.dts,I.pts,I.duration,I.originalDts,I.isKeyframe),this._isLive||this._videoSegmentInfoList.append(_),n.samples=g,n.sequenceNumber++,this._forceFirstIDR){var L=g[0].flags;L.dependsOn=2,L.isNonSync=0}var O=G.moof(n,a);n.samples=[],n.length=0,this._onMediaSegment("video",{type:"video",data:this._mergeBoxes(O,d).buffer,sampleCount:g.length,info:_})}}},e.prototype._mergeBoxes=function(e,t){var i=new Uint8Array(e.byteLength+t.byteLength);return i.set(e,0),i.set(t,e.byteLength),i},e}(),z=i(11),H=i(1),q=function(){function e(e,t){this.TAG="TransmuxingController",this._emitter=new n.a,this._config=t,e.segments||(e.segments=[{duration:e.duration,filesize:e.filesize,url:e.url}]),"boolean"!=typeof e.cors&&(e.cors=!0),"boolean"!=typeof e.withCredentials&&(e.withCredentials=!1),this._mediaDataSource=e,this._currentSegmentIndex=0;var i=0;this._mediaDataSource.segments.forEach((function(r){r.timestampBase=i,i+=r.duration,r.cors=e.cors,r.withCredentials=e.withCredentials,t.referrerPolicy&&(r.referrerPolicy=t.referrerPolicy)})),isNaN(i)||this._mediaDataSource.duration===i||(this._mediaDataSource.duration=i),this._mediaInfo=null,this._demuxer=null,this._remuxer=null,this._ioctl=null,this._pendingSeekTime=null,this._pendingResolveSeekPoint=null,this._statisticsReporter=null}return e.prototype.destroy=function(){this._mediaInfo=null,this._mediaDataSource=null,this._statisticsReporter&&this._disableStatisticsReporter(),this._ioctl&&(this._ioctl.destroy(),this._ioctl=null),this._demuxer&&(this._demuxer.destroy(),this._demuxer=null),this._remuxer&&(this._remuxer.destroy(),this._remuxer=null),this._emitter.removeAllListeners(),this._emitter=null},e.prototype.on=function(e,t){this._emitter.addListener(e,t)},e.prototype.off=function(e,t){this._emitter.removeListener(e,t)},e.prototype.start=function(){this._loadSegment(0),this._enableStatisticsReporter()},e.prototype._loadSegment=function(e,t){this._currentSegmentIndex=e;var i=this._mediaDataSource.segments[e],r=this._ioctl=new z.a(i,this._config,e);r.onError=this._onIOException.bind(this),r.onSeeked=this._onIOSeeked.bind(this),r.onComplete=this._onIOComplete.bind(this),r.onRedirect=this._onIORedirect.bind(this),r.onRecoveredEarlyEof=this._onIORecoveredEarlyEof.bind(this),t?this._demuxer.bindDataSource(this._ioctl):r.onDataArrival=this._onInitChunkArrival.bind(this),r.open(t)},e.prototype.stop=function(){this._internalAbort(),this._disableStatisticsReporter()},e.prototype._internalAbort=function(){this._ioctl&&(this._ioctl.destroy(),this._ioctl=null)},e.prototype.pause=function(){this._ioctl&&this._ioctl.isWorking()&&(this._ioctl.pause(),this._disableStatisticsReporter())},e.prototype.resume=function(){this._ioctl&&this._ioctl.isPaused()&&(this._ioctl.resume(),this._enableStatisticsReporter())},e.prototype.seek=function(e){if(null!=this._mediaInfo&&this._mediaInfo.isSeekable()){var t=this._searchSegmentIndexContains(e);if(t===this._currentSegmentIndex){var i=this._mediaInfo.segments[t];if(null==i)this._pendingSeekTime=e;else{var r=i.getNearestKeyframe(e);this._remuxer.seek(r.milliseconds),this._ioctl.seek(r.fileposition),this._pendingResolveSeekPoint=r.milliseconds}}else{var n=this._mediaInfo.segments[t];null==n?(this._pendingSeekTime=e,this._internalAbort(),this._remuxer.seek(),this._remuxer.insertDiscontinuity(),this._loadSegment(t)):(r=n.getNearestKeyframe(e),this._internalAbort(),this._remuxer.seek(e),this._remuxer.insertDiscontinuity(),this._demuxer.resetMediaInfo(),this._demuxer.timestampBase=this._mediaDataSource.segments[t].timestampBase,this._loadSegment(t,r.fileposition),this._pendingResolveSeekPoint=r.milliseconds,this._reportSegmentMediaInfo(t))}this._enableStatisticsReporter()}},e.prototype._searchSegmentIndexContains=function(e){for(var t=this._mediaDataSource.segments,i=t.length-1,r=0;r<t.length;r++)if(e<t[r].timestampBase){i=r-1;break}return i},e.prototype._onInitChunkArrival=function(e,t){var i=this,r=null,n=0;if(t>0)this._demuxer.bindDataSource(this._ioctl),this._demuxer.timestampBase=this._mediaDataSource.segments[this._currentSegmentIndex].timestampBase,n=this._demuxer.parseChunks(e,t);else if((r=N.probe(e)).match){var o=this._demuxer=new N(r,this._config);this._remuxer||(this._remuxer=new Q(this._config)),o.onError=this._onDemuxException.bind(this),o.onMediaInfo=this._onMediaInfo.bind(this),o.onMetaDataArrived=this._onMetaDataArrived.bind(this),o.onTimedID3Metadata=this._onTimedID3Metadata.bind(this),o.onPESPrivateDataDescriptor=this._onPESPrivateDataDescriptor.bind(this),o.onPESPrivateData=this._onPESPrivateData.bind(this),this._remuxer.bindDataSource(this._demuxer),this._demuxer.bindDataSource(this._ioctl),this._remuxer.onInitSegment=this._onRemuxerInitSegmentArrival.bind(this),this._remuxer.onMediaSegment=this._onRemuxerMediaSegmentArrival.bind(this),n=this._demuxer.parseChunks(e,t)}else if((r=g.probe(e)).match){this._demuxer=new g(r,this._config),this._remuxer||(this._remuxer=new Q(this._config));var a=this._mediaDataSource;null==a.duration||isNaN(a.duration)||(this._demuxer.overridedDuration=a.duration),"boolean"==typeof a.hasAudio&&(this._demuxer.overridedHasAudio=a.hasAudio),"boolean"==typeof a.hasVideo&&(this._demuxer.overridedHasVideo=a.hasVideo),this._demuxer.timestampBase=a.segments[this._currentSegmentIndex].timestampBase,this._demuxer.onError=this._onDemuxException.bind(this),this._demuxer.onMediaInfo=this._onMediaInfo.bind(this),this._demuxer.onMetaDataArrived=this._onMetaDataArrived.bind(this),this._demuxer.onScriptDataArrived=this._onScriptDataArrived.bind(this),this._remuxer.bindDataSource(this._demuxer.bindDataSource(this._ioctl)),this._remuxer.onInitSegment=this._onRemuxerInitSegmentArrival.bind(this),this._remuxer.onMediaSegment=this._onRemuxerMediaSegmentArrival.bind(this),n=this._demuxer.parseChunks(e,t)}else r=null,s.a.e(this.TAG,"Non MPEG-TS/FLV, Unsupported media type!"),Promise.resolve().then((function(){i._internalAbort()})),this._emitter.emit(H.a.DEMUX_ERROR,_.a.FORMAT_UNSUPPORTED,"Non MPEG-TS/FLV, Unsupported media type!"),n=0;return n},e.prototype._onMediaInfo=function(e){var t=this;null==this._mediaInfo&&(this._mediaInfo=Object.assign({},e),this._mediaInfo.keyframesIndex=null,this._mediaInfo.segments=[],this._mediaInfo.segmentCount=this._mediaDataSource.segments.length,Object.setPrototypeOf(this._mediaInfo,a.a.prototype));var i=Object.assign({},e);Object.setPrototypeOf(i,a.a.prototype),this._mediaInfo.segments[this._currentSegmentIndex]=i,this._reportSegmentMediaInfo(this._currentSegmentIndex),null!=this._pendingSeekTime&&Promise.resolve().then((function(){var e=t._pendingSeekTime;t._pendingSeekTime=null,t.seek(e)}))},e.prototype._onMetaDataArrived=function(e){this._emitter.emit(H.a.METADATA_ARRIVED,e)},e.prototype._onScriptDataArrived=function(e){this._emitter.emit(H.a.SCRIPTDATA_ARRIVED,e)},e.prototype._onTimedID3Metadata=function(e){var t=this._remuxer.getTimestampBase();null!=e.pts&&(e.pts-=t),null!=e.dts&&(e.dts-=t),this._emitter.emit(H.a.TIMED_ID3_METADATA_ARRIVED,e)},e.prototype._onPESPrivateDataDescriptor=function(e){this._emitter.emit(H.a.PES_PRIVATE_DATA_DESCRIPTOR,e)},e.prototype._onPESPrivateData=function(e){var t=this._remuxer.getTimestampBase();null!=e.pts&&(e.pts-=t),null!=e.nearest_pts&&(e.nearest_pts-=t),null!=e.dts&&(e.dts-=t),this._emitter.emit(H.a.PES_PRIVATE_DATA_ARRIVED,e)},e.prototype._onIOSeeked=function(){this._remuxer.insertDiscontinuity()},e.prototype._onIOComplete=function(e){var t=e+1;t<this._mediaDataSource.segments.length?(this._internalAbort(),this._remuxer&&this._remuxer.flushStashedSamples(),this._loadSegment(t)):(this._remuxer&&this._remuxer.flushStashedSamples(),this._emitter.emit(H.a.LOADING_COMPLETE),this._disableStatisticsReporter())},e.prototype._onIORedirect=function(e){var t=this._ioctl.extraData;this._mediaDataSource.segments[t].redirectedURL=e},e.prototype._onIORecoveredEarlyEof=function(){this._emitter.emit(H.a.RECOVERED_EARLY_EOF)},e.prototype._onIOException=function(e,t){s.a.e(this.TAG,"IOException: type = "+e+", code = "+t.code+", msg = "+t.msg),this._emitter.emit(H.a.IO_ERROR,e,t),this._disableStatisticsReporter()},e.prototype._onDemuxException=function(e,t){s.a.e(this.TAG,"DemuxException: type = "+e+", info = "+t),this._emitter.emit(H.a.DEMUX_ERROR,e,t)},e.prototype._onRemuxerInitSegmentArrival=function(e,t){this._emitter.emit(H.a.INIT_SEGMENT,e,t)},e.prototype._onRemuxerMediaSegmentArrival=function(e,t){if(null==this._pendingSeekTime&&(this._emitter.emit(H.a.MEDIA_SEGMENT,e,t),null!=this._pendingResolveSeekPoint&&"video"===e)){var i=t.info.syncPoints,r=this._pendingResolveSeekPoint;this._pendingResolveSeekPoint=null,o.a.safari&&i.length>0&&i[0].originalDts===r&&(r=i[0].pts),this._emitter.emit(H.a.RECOMMEND_SEEKPOINT,r)}},e.prototype._enableStatisticsReporter=function(){null==this._statisticsReporter&&(this._statisticsReporter=self.setInterval(this._reportStatisticsInfo.bind(this),this._config.statisticsInfoReportInterval))},e.prototype._disableStatisticsReporter=function(){this._statisticsReporter&&(self.clearInterval(this._statisticsReporter),this._statisticsReporter=null)},e.prototype._reportSegmentMediaInfo=function(e){var t=this._mediaInfo.segments[e],i=Object.assign({},t);i.duration=this._mediaInfo.duration,i.segmentCount=this._mediaInfo.segmentCount,delete i.segments,delete i.keyframesIndex,this._emitter.emit(H.a.MEDIA_INFO,i)},e.prototype._reportStatisticsInfo=function(){var e={};e.url=this._ioctl.currentURL,e.hasRedirect=this._ioctl.hasRedirect,e.hasRedirect&&(e.redirectedURL=this._ioctl.currentRedirectedURL),e.speed=this._ioctl.currentSpeed,e.loaderType=this._ioctl.loaderType,e.currentSegmentIndex=this._currentSegmentIndex,e.totalSegmentCount=this._mediaDataSource.segments.length,this._emitter.emit(H.a.STATISTICS_INFO,e)},e}();t.a=q},function(e,t,i){var r,n=i(0),s=function(){function e(){this._firstCheckpoint=0,this._lastCheckpoint=0,this._intervalBytes=0,this._totalBytes=0,this._lastSecondBytes=0,self.performance&&self.performance.now?this._now=self.performance.now.bind(self.performance):this._now=Date.now}return e.prototype.reset=function(){this._firstCheckpoint=this._lastCheckpoint=0,this._totalBytes=this._intervalBytes=0,this._lastSecondBytes=0},e.prototype.addBytes=function(e){0===this._firstCheckpoint?(this._firstCheckpoint=this._now(),this._lastCheckpoint=this._firstCheckpoint,this._intervalBytes+=e,this._totalBytes+=e):this._now()-this._lastCheckpoint<1e3?(this._intervalBytes+=e,this._totalBytes+=e):(this._lastSecondBytes=this._intervalBytes,this._intervalBytes=e,this._totalBytes+=e,this._lastCheckpoint=this._now())},Object.defineProperty(e.prototype,"currentKBps",{get:function(){this.addBytes(0);var e=(this._now()-this._lastCheckpoint)/1e3;return 0==e&&(e=1),this._intervalBytes/e/1024},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastSecondKBps",{get:function(){return this.addBytes(0),0!==this._lastSecondBytes?this._lastSecondBytes/1024:this._now()-this._lastCheckpoint>=500?this.currentKBps:0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"averageKBps",{get:function(){var e=(this._now()-this._firstCheckpoint)/1e3;return this._totalBytes/e/1024},enumerable:!1,configurable:!0}),e}(),o=i(2),a=i(4),h=i(3),l=(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),d=function(e){function t(t,i){var r=e.call(this,"fetch-stream-loader")||this;return r.TAG="FetchStreamLoader",r._seekHandler=t,r._config=i,r._needStash=!0,r._requestAbort=!1,r._abortController=null,r._contentLength=null,r._receivedLength=0,r}return l(t,e),t.isSupported=function(){try{var e=a.a.msedge&&a.a.version.minor>=15048,t=!a.a.msedge||e;return self.fetch&&self.ReadableStream&&t}catch(e){return!1}},t.prototype.destroy=function(){this.isWorking()&&this.abort(),e.prototype.destroy.call(this)},t.prototype.open=function(e,t){var i=this;this._dataSource=e,this._range=t;var r=e.url;this._config.reuseRedirectedURL&&null!=e.redirectedURL&&(r=e.redirectedURL);var n=this._seekHandler.getConfig(r,t),s=new self.Headers;if("object"==typeof n.headers){var a=n.headers;for(var l in a)a.hasOwnProperty(l)&&s.append(l,a[l])}var d={method:"GET",headers:s,mode:"cors",cache:"default",referrerPolicy:"no-referrer-when-downgrade"};if("object"==typeof this._config.headers)for(var l in this._config.headers)s.append(l,this._config.headers[l]);!1===e.cors&&(d.mode="same-origin"),e.withCredentials&&(d.credentials="include"),e.referrerPolicy&&(d.referrerPolicy=e.referrerPolicy),self.AbortController&&(this._abortController=new self.AbortController,d.signal=this._abortController.signal),this._status=o.c.kConnecting,self.fetch(n.url,d).then((function(e){if(i._requestAbort)return i._status=o.c.kIdle,void e.body.cancel();if(e.ok&&e.status>=200&&e.status<=299){if(e.url!==n.url&&i._onURLRedirect){var t=i._seekHandler.removeURLParameters(e.url);i._onURLRedirect(t)}var r=e.headers.get("Content-Length");return null!=r&&(i._contentLength=parseInt(r),0!==i._contentLength&&i._onContentLengthKnown&&i._onContentLengthKnown(i._contentLength)),i._pump.call(i,e.body.getReader())}if(i._status=o.c.kError,!i._onError)throw new h.d("FetchStreamLoader: Http code invalid, "+e.status+" "+e.statusText);i._onError(o.b.HTTP_STATUS_CODE_INVALID,{code:e.status,msg:e.statusText})})).catch((function(e){if(!i._abortController||!i._abortController.signal.aborted){if(i._status=o.c.kError,!i._onError)throw e;i._onError(o.b.EXCEPTION,{code:-1,msg:e.message})}}))},t.prototype.abort=function(){if(this._requestAbort=!0,(this._status!==o.c.kBuffering||!a.a.chrome)&&this._abortController)try{this._abortController.abort()}catch(e){}},t.prototype._pump=function(e){var t=this;return e.read().then((function(i){if(i.done)if(null!==t._contentLength&&t._receivedLength<t._contentLength){t._status=o.c.kError;var r=o.b.EARLY_EOF,n={code:-1,msg:"Fetch stream meet Early-EOF"};if(!t._onError)throw new h.d(n.msg);t._onError(r,n)}else t._status=o.c.kComplete,t._onComplete&&t._onComplete(t._range.from,t._range.from+t._receivedLength-1);else{if(t._abortController&&t._abortController.signal.aborted)return void(t._status=o.c.kComplete);if(!0===t._requestAbort)return t._status=o.c.kComplete,e.cancel();t._status=o.c.kBuffering;var s=i.value.buffer,a=t._range.from+t._receivedLength;t._receivedLength+=s.byteLength,t._onDataArrival&&t._onDataArrival(s,a,t._receivedLength),t._pump(e)}})).catch((function(e){if(t._abortController&&t._abortController.signal.aborted)t._status=o.c.kComplete;else if(11!==e.code||!a.a.msedge){t._status=o.c.kError;var i=0,r=null;if(19!==e.code&&"network error"!==e.message||!(null===t._contentLength||null!==t._contentLength&&t._receivedLength<t._contentLength)?(i=o.b.EXCEPTION,r={code:e.code,msg:e.message}):(i=o.b.EARLY_EOF,r={code:e.code,msg:"Fetch stream meet Early-EOF"}),!t._onError)throw new h.d(r.msg);t._onError(i,r)}}))},t}(o.a),u=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),A=function(e){function t(t,i){var r=e.call(this,"xhr-moz-chunked-loader")||this;return r.TAG="MozChunkedLoader",r._seekHandler=t,r._config=i,r._needStash=!0,r._xhr=null,r._requestAbort=!1,r._contentLength=null,r._receivedLength=0,r}return u(t,e),t.isSupported=function(){try{var e=new XMLHttpRequest;return e.open("GET","https://example.com",!0),e.responseType="moz-chunked-arraybuffer","moz-chunked-arraybuffer"===e.responseType}catch(e){return n.a.w("MozChunkedLoader",e.message),!1}},t.prototype.destroy=function(){this.isWorking()&&this.abort(),this._xhr&&(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onloadend=null,this._xhr.onerror=null,this._xhr=null),e.prototype.destroy.call(this)},t.prototype.open=function(e,t){this._dataSource=e,this._range=t;var i=e.url;this._config.reuseRedirectedURL&&null!=e.redirectedURL&&(i=e.redirectedURL);var r=this._seekHandler.getConfig(i,t);this._requestURL=r.url;var n=this._xhr=new XMLHttpRequest;if(n.open("GET",r.url,!0),n.responseType="moz-chunked-arraybuffer",n.onreadystatechange=this._onReadyStateChange.bind(this),n.onprogress=this._onProgress.bind(this),n.onloadend=this._onLoadEnd.bind(this),n.onerror=this._onXhrError.bind(this),e.withCredentials&&(n.withCredentials=!0),"object"==typeof r.headers){var s=r.headers;for(var a in s)s.hasOwnProperty(a)&&n.setRequestHeader(a,s[a])}if("object"==typeof this._config.headers)for(var a in s=this._config.headers)s.hasOwnProperty(a)&&n.setRequestHeader(a,s[a]);this._status=o.c.kConnecting,n.send()},t.prototype.abort=function(){this._requestAbort=!0,this._xhr&&this._xhr.abort(),this._status=o.c.kComplete},t.prototype._onReadyStateChange=function(e){var t=e.target;if(2===t.readyState){if(null!=t.responseURL&&t.responseURL!==this._requestURL&&this._onURLRedirect){var i=this._seekHandler.removeURLParameters(t.responseURL);this._onURLRedirect(i)}if(0!==t.status&&(t.status<200||t.status>299)){if(this._status=o.c.kError,!this._onError)throw new h.d("MozChunkedLoader: Http code invalid, "+t.status+" "+t.statusText);this._onError(o.b.HTTP_STATUS_CODE_INVALID,{code:t.status,msg:t.statusText})}else this._status=o.c.kBuffering}},t.prototype._onProgress=function(e){if(this._status!==o.c.kError){null===this._contentLength&&null!==e.total&&0!==e.total&&(this._contentLength=e.total,this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength));var t=e.target.response,i=this._range.from+this._receivedLength;this._receivedLength+=t.byteLength,this._onDataArrival&&this._onDataArrival(t,i,this._receivedLength)}},t.prototype._onLoadEnd=function(e){!0!==this._requestAbort?this._status!==o.c.kError&&(this._status=o.c.kComplete,this._onComplete&&this._onComplete(this._range.from,this._range.from+this._receivedLength-1)):this._requestAbort=!1},t.prototype._onXhrError=function(e){this._status=o.c.kError;var t=0,i=null;if(this._contentLength&&e.loaded<this._contentLength?(t=o.b.EARLY_EOF,i={code:-1,msg:"Moz-Chunked stream meet Early-Eof"}):(t=o.b.EXCEPTION,i={code:-1,msg:e.constructor.name+" "+e.type}),!this._onError)throw new h.d(i.msg);this._onError(t,i)},t}(o.a),c=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),p=function(e){function t(t,i){var r=e.call(this,"xhr-range-loader")||this;return r.TAG="RangeLoader",r._seekHandler=t,r._config=i,r._needStash=!1,r._chunkSizeKBList=[128,256,384,512,768,1024,1536,2048,3072,4096,5120,6144,7168,8192],r._currentChunkSizeKB=384,r._currentSpeedNormalized=0,r._zeroSpeedChunkCount=0,r._xhr=null,r._speedSampler=new s,r._requestAbort=!1,r._waitForTotalLength=!1,r._totalLengthReceived=!1,r._currentRequestURL=null,r._currentRedirectedURL=null,r._currentRequestRange=null,r._totalLength=null,r._contentLength=null,r._receivedLength=0,r._lastTimeLoaded=0,r}return c(t,e),t.isSupported=function(){try{var e=new XMLHttpRequest;return e.open("GET","https://example.com",!0),e.responseType="arraybuffer","arraybuffer"===e.responseType}catch(e){return n.a.w("RangeLoader",e.message),!1}},t.prototype.destroy=function(){this.isWorking()&&this.abort(),this._xhr&&(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onload=null,this._xhr.onerror=null,this._xhr=null),e.prototype.destroy.call(this)},Object.defineProperty(t.prototype,"currentSpeed",{get:function(){return this._speedSampler.lastSecondKBps},enumerable:!1,configurable:!0}),t.prototype.open=function(e,t){this._dataSource=e,this._range=t,this._status=o.c.kConnecting;var i=!1;null!=this._dataSource.filesize&&0!==this._dataSource.filesize&&(i=!0,this._totalLength=this._dataSource.filesize),this._totalLengthReceived||i?this._openSubRange():(this._waitForTotalLength=!0,this._internalOpen(this._dataSource,{from:0,to:-1}))},t.prototype._openSubRange=function(){var e=1024*this._currentChunkSizeKB,t=this._range.from+this._receivedLength,i=t+e;null!=this._contentLength&&i-this._range.from>=this._contentLength&&(i=this._range.from+this._contentLength-1),this._currentRequestRange={from:t,to:i},this._internalOpen(this._dataSource,this._currentRequestRange)},t.prototype._internalOpen=function(e,t){this._lastTimeLoaded=0;var i=e.url;this._config.reuseRedirectedURL&&(null!=this._currentRedirectedURL?i=this._currentRedirectedURL:null!=e.redirectedURL&&(i=e.redirectedURL));var r=this._seekHandler.getConfig(i,t);this._currentRequestURL=r.url;var n=this._xhr=new XMLHttpRequest;if(n.open("GET",r.url,!0),n.responseType="arraybuffer",n.onreadystatechange=this._onReadyStateChange.bind(this),n.onprogress=this._onProgress.bind(this),n.onload=this._onLoad.bind(this),n.onerror=this._onXhrError.bind(this),e.withCredentials&&(n.withCredentials=!0),"object"==typeof r.headers){var s=r.headers;for(var o in s)s.hasOwnProperty(o)&&n.setRequestHeader(o,s[o])}if("object"==typeof this._config.headers)for(var o in s=this._config.headers)s.hasOwnProperty(o)&&n.setRequestHeader(o,s[o]);n.send()},t.prototype.abort=function(){this._requestAbort=!0,this._internalAbort(),this._status=o.c.kComplete},t.prototype._internalAbort=function(){this._xhr&&(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onload=null,this._xhr.onerror=null,this._xhr.abort(),this._xhr=null)},t.prototype._onReadyStateChange=function(e){var t=e.target;if(2===t.readyState){if(null!=t.responseURL){var i=this._seekHandler.removeURLParameters(t.responseURL);t.responseURL!==this._currentRequestURL&&i!==this._currentRedirectedURL&&(this._currentRedirectedURL=i,this._onURLRedirect&&this._onURLRedirect(i))}if(t.status>=200&&t.status<=299){if(this._waitForTotalLength)return;this._status=o.c.kBuffering}else{if(this._status=o.c.kError,!this._onError)throw new h.d("RangeLoader: Http code invalid, "+t.status+" "+t.statusText);this._onError(o.b.HTTP_STATUS_CODE_INVALID,{code:t.status,msg:t.statusText})}}},t.prototype._onProgress=function(e){if(this._status!==o.c.kError){if(null===this._contentLength){var t=!1;if(this._waitForTotalLength){this._waitForTotalLength=!1,this._totalLengthReceived=!0,t=!0;var i=e.total;this._internalAbort(),null!=i&0!==i&&(this._totalLength=i)}if(-1===this._range.to?this._contentLength=this._totalLength-this._range.from:this._contentLength=this._range.to-this._range.from+1,t)return void this._openSubRange();this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength)}var r=e.loaded-this._lastTimeLoaded;this._lastTimeLoaded=e.loaded,this._speedSampler.addBytes(r)}},t.prototype._normalizeSpeed=function(e){var t=this._chunkSizeKBList,i=t.length-1,r=0,n=0,s=i;if(e<t[0])return t[0];for(;n<=s;){if((r=n+Math.floor((s-n)/2))===i||e>=t[r]&&e<t[r+1])return t[r];t[r]<e?n=r+1:s=r-1}},t.prototype._onLoad=function(e){if(this._status!==o.c.kError)if(this._waitForTotalLength)this._waitForTotalLength=!1;else{this._lastTimeLoaded=0;var t=this._speedSampler.lastSecondKBps;if(0===t&&(this._zeroSpeedChunkCount++,this._zeroSpeedChunkCount>=3&&(t=this._speedSampler.currentKBps)),0!==t){var i=this._normalizeSpeed(t);this._currentSpeedNormalized!==i&&(this._currentSpeedNormalized=i,this._currentChunkSizeKB=i)}var r=e.target.response,n=this._range.from+this._receivedLength;this._receivedLength+=r.byteLength;var s=!1;null!=this._contentLength&&this._receivedLength<this._contentLength?this._openSubRange():s=!0,this._onDataArrival&&this._onDataArrival(r,n,this._receivedLength),s&&(this._status=o.c.kComplete,this._onComplete&&this._onComplete(this._range.from,this._range.from+this._receivedLength-1))}},t.prototype._onXhrError=function(e){this._status=o.c.kError;var t=0,i=null;if(this._contentLength&&this._receivedLength>0&&this._receivedLength<this._contentLength?(t=o.b.EARLY_EOF,i={code:-1,msg:"RangeLoader meet Early-Eof"}):(t=o.b.EXCEPTION,i={code:-1,msg:e.constructor.name+" "+e.type}),!this._onError)throw new h.d(i.msg);this._onError(t,i)},t}(o.a),f=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),m=function(e){function t(){var t=e.call(this,"websocket-loader")||this;return t.TAG="WebSocketLoader",t._needStash=!0,t._ws=null,t._requestAbort=!1,t._receivedLength=0,t}return f(t,e),t.isSupported=function(){try{return void 0!==self.WebSocket}catch(e){return!1}},t.prototype.destroy=function(){this._ws&&this.abort(),e.prototype.destroy.call(this)},t.prototype.open=function(e){try{var t=this._ws=new self.WebSocket(e.url);t.binaryType="arraybuffer",t.onopen=this._onWebSocketOpen.bind(this),t.onclose=this._onWebSocketClose.bind(this),t.onmessage=this._onWebSocketMessage.bind(this),t.onerror=this._onWebSocketError.bind(this),this._status=o.c.kConnecting}catch(e){this._status=o.c.kError;var i={code:e.code,msg:e.message};if(!this._onError)throw new h.d(i.msg);this._onError(o.b.EXCEPTION,i)}},t.prototype.abort=function(){var e=this._ws;!e||0!==e.readyState&&1!==e.readyState||(this._requestAbort=!0,e.close()),this._ws=null,this._status=o.c.kComplete},t.prototype._onWebSocketOpen=function(e){this._status=o.c.kBuffering},t.prototype._onWebSocketClose=function(e){!0!==this._requestAbort?(this._status=o.c.kComplete,this._onComplete&&this._onComplete(0,this._receivedLength-1)):this._requestAbort=!1},t.prototype._onWebSocketMessage=function(e){var t=this;if(e.data instanceof ArrayBuffer)this._dispatchArrayBuffer(e.data);else if(e.data instanceof Blob){var i=new FileReader;i.onload=function(){t._dispatchArrayBuffer(i.result)},i.readAsArrayBuffer(e.data)}else{this._status=o.c.kError;var r={code:-1,msg:"Unsupported WebSocket message type: "+e.data.constructor.name};if(!this._onError)throw new h.d(r.msg);this._onError(o.b.EXCEPTION,r)}},t.prototype._dispatchArrayBuffer=function(e){var t=e,i=this._receivedLength;this._receivedLength+=t.byteLength,this._onDataArrival&&this._onDataArrival(t,i,this._receivedLength)},t.prototype._onWebSocketError=function(e){this._status=o.c.kError;var t={code:e.code,msg:e.message};if(!this._onError)throw new h.d(t.msg);this._onError(o.b.EXCEPTION,t)},t}(o.a),_=function(){function e(e){this._zeroStart=e||!1}return e.prototype.getConfig=function(e,t){var i={};if(0!==t.from||-1!==t.to){var r=void 0;r=-1!==t.to?"bytes="+t.from.toString()+"-"+t.to.toString():"bytes="+t.from.toString()+"-",i.Range=r}else this._zeroStart&&(i.Range="bytes=0-");return{url:e,headers:i}},e.prototype.removeURLParameters=function(e){return e},e}(),g=function(){function e(e,t){this._startName=e,this._endName=t}return e.prototype.getConfig=function(e,t){var i=e;if(0!==t.from||-1!==t.to){var r=!0;-1===i.indexOf("?")&&(i+="?",r=!1),r&&(i+="&"),i+=this._startName+"="+t.from.toString(),-1!==t.to&&(i+="&"+this._endName+"="+t.to.toString())}return{url:i,headers:{}}},e.prototype.removeURLParameters=function(e){var t=e.split("?")[0],i=void 0,r=e.indexOf("?");-1!==r&&(i=e.substring(r+1));var n="";if(null!=i&&i.length>0)for(var s=i.split("&"),o=0;o<s.length;o++){var a=s[o].split("="),h=o>0;a[0]!==this._startName&&a[0]!==this._endName&&(h&&(n+="&"),n+=s[o])}return 0===n.length?t:t+"?"+n},e}(),y=function(){function e(e,t,i){this.TAG="IOController",this._config=t,this._extraData=i,this._stashInitialSize=65536,null!=t.stashInitialSize&&t.stashInitialSize>0&&(this._stashInitialSize=t.stashInitialSize),this._stashUsed=0,this._stashSize=this._stashInitialSize,this._bufferSize=3145728,this._stashBuffer=new ArrayBuffer(this._bufferSize),this._stashByteStart=0,this._enableStash=!0,!1===t.enableStashBuffer&&(this._enableStash=!1),this._loader=null,this._loaderClass=null,this._seekHandler=null,this._dataSource=e,this._isWebSocketURL=/wss?:\/\/(.+?)/.test(e.url),this._refTotalLength=e.filesize?e.filesize:null,this._totalLength=this._refTotalLength,this._fullRequestFlag=!1,this._currentRange=null,this._redirectedURL=null,this._speedNormalized=0,this._speedSampler=new s,this._speedNormalizeList=[32,64,96,128,192,256,384,512,768,1024,1536,2048,3072,4096],this._isEarlyEofReconnecting=!1,this._paused=!1,this._resumeFrom=0,this._onDataArrival=null,this._onSeeked=null,this._onError=null,this._onComplete=null,this._onRedirect=null,this._onRecoveredEarlyEof=null,this._selectSeekHandler(),this._selectLoader(),this._createLoader()}return e.prototype.destroy=function(){this._loader.isWorking()&&this._loader.abort(),this._loader.destroy(),this._loader=null,this._loaderClass=null,this._dataSource=null,this._stashBuffer=null,this._stashUsed=this._stashSize=this._bufferSize=this._stashByteStart=0,this._currentRange=null,this._speedSampler=null,this._isEarlyEofReconnecting=!1,this._onDataArrival=null,this._onSeeked=null,this._onError=null,this._onComplete=null,this._onRedirect=null,this._onRecoveredEarlyEof=null,this._extraData=null},e.prototype.isWorking=function(){return this._loader&&this._loader.isWorking()&&!this._paused},e.prototype.isPaused=function(){return this._paused},Object.defineProperty(e.prototype,"status",{get:function(){return this._loader.status},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"extraData",{get:function(){return this._extraData},set:function(e){this._extraData=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onDataArrival",{get:function(){return this._onDataArrival},set:function(e){this._onDataArrival=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onSeeked",{get:function(){return this._onSeeked},set:function(e){this._onSeeked=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onError",{get:function(){return this._onError},set:function(e){this._onError=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onComplete",{get:function(){return this._onComplete},set:function(e){this._onComplete=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onRedirect",{get:function(){return this._onRedirect},set:function(e){this._onRedirect=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onRecoveredEarlyEof",{get:function(){return this._onRecoveredEarlyEof},set:function(e){this._onRecoveredEarlyEof=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentURL",{get:function(){return this._dataSource.url},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasRedirect",{get:function(){return null!=this._redirectedURL||null!=this._dataSource.redirectedURL},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentRedirectedURL",{get:function(){return this._redirectedURL||this._dataSource.redirectedURL},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentSpeed",{get:function(){return this._loaderClass===p?this._loader.currentSpeed:this._speedSampler.lastSecondKBps},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"loaderType",{get:function(){return this._loader.type},enumerable:!1,configurable:!0}),e.prototype._selectSeekHandler=function(){var e=this._config;if("range"===e.seekType)this._seekHandler=new _(this._config.rangeLoadZeroStart);else if("param"===e.seekType){var t=e.seekParamStart||"bstart",i=e.seekParamEnd||"bend";this._seekHandler=new g(t,i)}else{if("custom"!==e.seekType)throw new h.b("Invalid seekType in config: "+e.seekType);if("function"!=typeof e.customSeekHandler)throw new h.b("Custom seekType specified in config but invalid customSeekHandler!");this._seekHandler=new e.customSeekHandler}},e.prototype._selectLoader=function(){if(null!=this._config.customLoader)this._loaderClass=this._config.customLoader;else if(this._isWebSocketURL)this._loaderClass=m;else if(d.isSupported())this._loaderClass=d;else if(A.isSupported())this._loaderClass=A;else{if(!p.isSupported())throw new h.d("Your browser doesn't support xhr with arraybuffer responseType!");this._loaderClass=p}},e.prototype._createLoader=function(){this._loader=new this._loaderClass(this._seekHandler,this._config),!1===this._loader.needStashBuffer&&(this._enableStash=!1),this._loader.onContentLengthKnown=this._onContentLengthKnown.bind(this),this._loader.onURLRedirect=this._onURLRedirect.bind(this),this._loader.onDataArrival=this._onLoaderChunkArrival.bind(this),this._loader.onComplete=this._onLoaderComplete.bind(this),this._loader.onError=this._onLoaderError.bind(this)},e.prototype.open=function(e){this._currentRange={from:0,to:-1},e&&(this._currentRange.from=e),this._speedSampler.reset(),e||(this._fullRequestFlag=!0),this._loader.open(this._dataSource,Object.assign({},this._currentRange))},e.prototype.abort=function(){this._loader.abort(),this._paused&&(this._paused=!1,this._resumeFrom=0)},e.prototype.pause=function(){this.isWorking()&&(this._loader.abort(),0!==this._stashUsed?(this._resumeFrom=this._stashByteStart,this._currentRange.to=this._stashByteStart-1):this._resumeFrom=this._currentRange.to+1,this._stashUsed=0,this._stashByteStart=0,this._paused=!0)},e.prototype.resume=function(){if(this._paused){this._paused=!1;var e=this._resumeFrom;this._resumeFrom=0,this._internalSeek(e,!0)}},e.prototype.seek=function(e){this._paused=!1,this._stashUsed=0,this._stashByteStart=0,this._internalSeek(e,!0)},e.prototype._internalSeek=function(e,t){this._loader.isWorking()&&this._loader.abort(),this._flushStashBuffer(t),this._loader.destroy(),this._loader=null;var i={from:e,to:-1};this._currentRange={from:i.from,to:-1},this._speedSampler.reset(),this._stashSize=this._stashInitialSize,this._createLoader(),this._loader.open(this._dataSource,i),this._onSeeked&&this._onSeeked()},e.prototype.updateUrl=function(e){if(!e||"string"!=typeof e||0===e.length)throw new h.b("Url must be a non-empty string!");this._dataSource.url=e},e.prototype._expandBuffer=function(e){for(var t=this._stashSize;t+1048576<e;)t*=2;if((t+=1048576)!==this._bufferSize){var i=new ArrayBuffer(t);if(this._stashUsed>0){var r=new Uint8Array(this._stashBuffer,0,this._stashUsed);new Uint8Array(i,0,t).set(r,0)}this._stashBuffer=i,this._bufferSize=t}},e.prototype._normalizeSpeed=function(e){var t=this._speedNormalizeList,i=t.length-1,r=0,n=0,s=i;if(e<t[0])return t[0];for(;n<=s;){if((r=n+Math.floor((s-n)/2))===i||e>=t[r]&&e<t[r+1])return t[r];t[r]<e?n=r+1:s=r-1}},e.prototype._adjustStashSize=function(e){var t=0;(t=this._config.isLive?e/8:e<512?e:e>=512&&e<=1024?Math.floor(1.5*e):2*e)>8192&&(t=8192);var i=1024*t+1048576;this._bufferSize<i&&this._expandBuffer(i),this._stashSize=1024*t},e.prototype._dispatchChunks=function(e,t){return this._currentRange.to=t+e.byteLength-1,this._onDataArrival(e,t)},e.prototype._onURLRedirect=function(e){this._redirectedURL=e,this._onRedirect&&this._onRedirect(e)},e.prototype._onContentLengthKnown=function(e){e&&this._fullRequestFlag&&(this._totalLength=e,this._fullRequestFlag=!1)},e.prototype._onLoaderChunkArrival=function(e,t,i){if(!this._onDataArrival)throw new h.a("IOController: No existing consumer (onDataArrival) callback!");if(!this._paused){this._isEarlyEofReconnecting&&(this._isEarlyEofReconnecting=!1,this._onRecoveredEarlyEof&&this._onRecoveredEarlyEof()),this._speedSampler.addBytes(e.byteLength);var r=this._speedSampler.lastSecondKBps;if(0!==r){var n=this._normalizeSpeed(r);this._speedNormalized!==n&&(this._speedNormalized=n,this._adjustStashSize(n))}if(this._enableStash)if(0===this._stashUsed&&0===this._stashByteStart&&(this._stashByteStart=t),this._stashUsed+e.byteLength<=this._stashSize)(a=new Uint8Array(this._stashBuffer,0,this._stashSize)).set(new Uint8Array(e),this._stashUsed),this._stashUsed+=e.byteLength;else if(a=new Uint8Array(this._stashBuffer,0,this._bufferSize),this._stashUsed>0){var s=this._stashBuffer.slice(0,this._stashUsed);(l=this._dispatchChunks(s,this._stashByteStart))<s.byteLength?l>0&&(d=new Uint8Array(s,l),a.set(d,0),this._stashUsed=d.byteLength,this._stashByteStart+=l):(this._stashUsed=0,this._stashByteStart+=l),this._stashUsed+e.byteLength>this._bufferSize&&(this._expandBuffer(this._stashUsed+e.byteLength),a=new Uint8Array(this._stashBuffer,0,this._bufferSize)),a.set(new Uint8Array(e),this._stashUsed),this._stashUsed+=e.byteLength}else(l=this._dispatchChunks(e,t))<e.byteLength&&((o=e.byteLength-l)>this._bufferSize&&(this._expandBuffer(o),a=new Uint8Array(this._stashBuffer,0,this._bufferSize)),a.set(new Uint8Array(e,l),0),this._stashUsed+=o,this._stashByteStart=t+l);else if(0===this._stashUsed){var o;(l=this._dispatchChunks(e,t))<e.byteLength&&((o=e.byteLength-l)>this._bufferSize&&this._expandBuffer(o),(a=new Uint8Array(this._stashBuffer,0,this._bufferSize)).set(new Uint8Array(e,l),0),this._stashUsed+=o,this._stashByteStart=t+l)}else{var a,l;if(this._stashUsed+e.byteLength>this._bufferSize&&this._expandBuffer(this._stashUsed+e.byteLength),(a=new Uint8Array(this._stashBuffer,0,this._bufferSize)).set(new Uint8Array(e),this._stashUsed),this._stashUsed+=e.byteLength,(l=this._dispatchChunks(this._stashBuffer.slice(0,this._stashUsed),this._stashByteStart))<this._stashUsed&&l>0){var d=new Uint8Array(this._stashBuffer,l);a.set(d,0)}this._stashUsed-=l,this._stashByteStart+=l}}},e.prototype._flushStashBuffer=function(e){if(this._stashUsed>0){var t=this._stashBuffer.slice(0,this._stashUsed),i=this._dispatchChunks(t,this._stashByteStart),r=t.byteLength-i;if(i<t.byteLength){if(!e){if(i>0){var s=new Uint8Array(this._stashBuffer,0,this._bufferSize),o=new Uint8Array(t,i);s.set(o,0),this._stashUsed=o.byteLength,this._stashByteStart+=i}return 0}n.a.w(this.TAG,r+" bytes unconsumed data remain when flush buffer, dropped")}return this._stashUsed=0,this._stashByteStart=0,r}return 0},e.prototype._onLoaderComplete=function(e,t){this._flushStashBuffer(!0),this._onComplete&&this._onComplete(this._extraData)},e.prototype._onLoaderError=function(e,t){switch(n.a.e(this.TAG,"Loader error, code = "+t.code+", msg = "+t.msg),this._flushStashBuffer(!1),this._isEarlyEofReconnecting&&(this._isEarlyEofReconnecting=!1,e=o.b.UNRECOVERABLE_EARLY_EOF),e){case o.b.EARLY_EOF:if(!this._config.isLive&&this._totalLength){var i=this._currentRange.to+1;return void(i<this._totalLength&&(n.a.w(this.TAG,"Connection lost, trying reconnect..."),this._isEarlyEofReconnecting=!0,this._internalSeek(i,!1)))}e=o.b.UNRECOVERABLE_EARLY_EOF;case o.b.UNRECOVERABLE_EARLY_EOF:case o.b.CONNECTING_TIMEOUT:case o.b.HTTP_STATUS_CODE_INVALID:case o.b.EXCEPTION:}if(!this._onError)throw new h.d("IOException: "+t.msg);this._onError(e,t)},e}();t.a=y},function(e,t,i){var r=function(){function e(){}return e.install=function(){Object.setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Object.assign=Object.assign||function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),i=1;i<arguments.length;i++){var r=arguments[i];if(null!=r)for(var n in r)r.hasOwnProperty(n)&&(t[n]=r[n])}return t},"function"!=typeof self.Promise&&i(15).polyfill()},e}();r.install(),t.a=r},function(e,t,i){function r(e){var t={};function i(r){if(t[r])return t[r].exports;var n=t[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,i),n.l=!0,n.exports}i.m=e,i.c=t,i.i=function(e){return e},i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},i.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="/",i.oe=function(e){throw e};var r=i(i.s=ENTRY_MODULE);return r.default||r}function n(e){return(e+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function s(e,t,r){var s={};s[r]=[];var o=t.toString(),a=o.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!a)return s;for(var h,l=a[1],d=new RegExp("(\\\\n|\\W)"+n(l)+"\\(\\s*(/\\*.*?\\*/)?\\s*.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)","g");h=d.exec(o);)"dll-reference"!==h[3]&&s[r].push(h[3]);for(d=new RegExp("\\("+n(l)+'\\("(dll-reference\\s([\\.|\\-|\\+|\\w|/|@]+))"\\)\\)\\(\\s*(/\\*.*?\\*/)?\\s*.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)',"g");h=d.exec(o);)e[h[2]]||(s[r].push(h[1]),e[h[2]]=i(h[1]).m),s[h[2]]=s[h[2]]||[],s[h[2]].push(h[4]);for(var u,A=Object.keys(s),c=0;c<A.length;c++)for(var p=0;p<s[A[c]].length;p++)u=s[A[c]][p],isNaN(1*u)||(s[A[c]][p]=1*s[A[c]][p]);return s}function o(e){return Object.keys(e).reduce((function(t,i){return t||e[i].length>0}),!1)}e.exports=function(e,t){t=t||{};var n={main:i.m},a=t.all?{main:Object.keys(n.main)}:function(e,t){for(var i={main:[t]},r={main:[]},n={main:{}};o(i);)for(var a=Object.keys(i),h=0;h<a.length;h++){var l=a[h],d=i[l].pop();if(n[l]=n[l]||{},!n[l][d]&&e[l][d]){n[l][d]=!0,r[l]=r[l]||[],r[l].push(d);for(var u=s(e,e[l][d],l),A=Object.keys(u),c=0;c<A.length;c++)i[A[c]]=i[A[c]]||[],i[A[c]]=i[A[c]].concat(u[A[c]])}}return r}(n,e),h="";Object.keys(a).filter((function(e){return"main"!==e})).forEach((function(e){for(var t=0;a[e][t];)t++;a[e].push(t),n[e][t]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",h=h+"var "+e+" = ("+r.toString().replace("ENTRY_MODULE",JSON.stringify(t))+")({"+a[e].map((function(t){return JSON.stringify(t)+": "+n[e][t].toString()})).join(",")+"});\n"})),h=h+"new (("+r.toString().replace("ENTRY_MODULE",JSON.stringify(e))+")({"+a.main.map((function(e){return JSON.stringify(e)+": "+n.main[e].toString()})).join(",")+"}))(self);";var l=new window.Blob([h],{type:"text/javascript"});if(t.bare)return l;var d=(window.URL||window.webkitURL||window.mozURL||window.msURL).createObjectURL(l),u=new window.Worker(d);return u.objectURL=d,u}},function(e,t,i){e.exports=i(19).default},function(e,t,i){(function(t,i){
7
7
  /*!
8
8
  * @overview es6-promise - a tiny implementation of Promises/A+.
9
9
  * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
@@ -11,5 +11,4 @@
11
11
  * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
12
12
  * @version v4.2.8+1e68dce6
13
13
  */
14
- var r;r=function(){function e(e){return"function"==typeof e}var r=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},n=0,s=void 0,o=void 0,a=function(e,t){p[n]=e,p[n+1]=t,2===(n+=2)&&(o?o(f):v())},h="undefined"!=typeof window?window:void 0,l=h||{},d=l.MutationObserver||l.WebKitMutationObserver,u="undefined"==typeof self&&void 0!==t&&"[object process]"==={}.toString.call(t),A="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function c(){var e=setTimeout;return function(){return e(f,1)}}var p=new Array(1e3);function f(){for(var e=0;e<n;e+=2)(0,p[e])(p[e+1]),p[e]=void 0,p[e+1]=void 0;n=0}var m,_,g,y,v=void 0;function E(e,t){var i=this,r=new this.constructor(w);void 0===r[S]&&x(r);var n=i._state;if(n){var s=arguments[n-1];a((function(){return D(n,r,s,i._result)}))}else L(i,r,e,t);return r}function b(e){if(e&&"object"==typeof e&&e.constructor===this)return e;var t=new this(w);return R(t,e),t}u?v=function(){return t.nextTick(f)}:d?(_=0,g=new d(f),y=document.createTextNode(""),g.observe(y,{characterData:!0}),v=function(){y.data=_=++_%2}):A?((m=new MessageChannel).port1.onmessage=f,v=function(){return m.port2.postMessage(0)}):v=void 0===h?function(){try{var e=Function("return this")().require("vertx");return void 0!==(s=e.runOnLoop||e.runOnContext)?function(){s(f)}:c()}catch(e){return c()}}():c();var S=Math.random().toString(36).substring(2);function w(){}function T(t,i,r){i.constructor===t.constructor&&r===E&&i.constructor.resolve===b?function(e,t){1===t._state?k(e,t._result):2===t._state?I(e,t._result):L(t,void 0,(function(t){return R(e,t)}),(function(t){return I(e,t)}))}(t,i):void 0===r?k(t,i):e(r)?function(e,t,i){a((function(e){var r=!1,n=function(e,t,i,r){try{e.call(t,i,r)}catch(e){return e}}(i,t,(function(i){r||(r=!0,t!==i?R(e,i):k(e,i))}),(function(t){r||(r=!0,I(e,t))}),e._label);!r&&n&&(r=!0,I(e,n))}),e)}(t,i,r):k(t,i)}function R(e,t){if(e===t)I(e,new TypeError("You cannot resolve a promise with itself"));else if(n=typeof(r=t),null===r||"object"!==n&&"function"!==n)k(e,t);else{var i=void 0;try{i=t.then}catch(t){return void I(e,t)}T(e,t,i)}var r,n}function C(e){e._onerror&&e._onerror(e._result),O(e)}function k(e,t){void 0===e._state&&(e._result=t,e._state=1,0!==e._subscribers.length&&a(O,e))}function I(e,t){void 0===e._state&&(e._state=2,e._result=t,a(C,e))}function L(e,t,i,r){var n=e._subscribers,s=n.length;e._onerror=null,n[s]=t,n[s+1]=i,n[s+2]=r,0===s&&e._state&&a(O,e)}function O(e){var t=e._subscribers,i=e._state;if(0!==t.length){for(var r=void 0,n=void 0,s=e._result,o=0;o<t.length;o+=3)r=t[o],n=t[o+i],r?D(i,r,n,s):n(s);e._subscribers.length=0}}function D(t,i,r,n){var s=e(r),o=void 0,a=void 0,h=!0;if(s){try{o=r(n)}catch(e){h=!1,a=e}if(i===o)return void I(i,new TypeError("A promises callback cannot return that same promise."))}else o=n;void 0!==i._state||(s&&h?R(i,o):!1===h?I(i,a):1===t?k(i,o):2===t&&I(i,o))}var B=0;function x(e){e[S]=B++,e._state=void 0,e._result=void 0,e._subscribers=[]}var M=function(){function e(e,t){this._instanceConstructor=e,this.promise=new e(w),this.promise[S]||x(this.promise),r(t)?(this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0===this.length?k(this.promise,this._result):(this.length=this.length||0,this._enumerate(t),0===this._remaining&&k(this.promise,this._result))):I(this.promise,new Error("Array Methods must be provided an Array"))}return e.prototype._enumerate=function(e){for(var t=0;void 0===this._state&&t<e.length;t++)this._eachEntry(e[t],t)},e.prototype._eachEntry=function(e,t){var i=this._instanceConstructor,r=i.resolve;if(r===b){var n=void 0,s=void 0,o=!1;try{n=e.then}catch(e){o=!0,s=e}if(n===E&&void 0!==e._state)this._settledAt(e._state,t,e._result);else if("function"!=typeof n)this._remaining--,this._result[t]=e;else if(i===P){var a=new i(w);o?I(a,s):T(a,e,n),this._willSettleAt(a,t)}else this._willSettleAt(new i((function(t){return t(e)})),t)}else this._willSettleAt(r(e),t)},e.prototype._settledAt=function(e,t,i){var r=this.promise;void 0===r._state&&(this._remaining--,2===e?I(r,i):this._result[t]=i),0===this._remaining&&k(r,this._result)},e.prototype._willSettleAt=function(e,t){var i=this;L(e,void 0,(function(e){return i._settledAt(1,t,e)}),(function(e){return i._settledAt(2,t,e)}))},e}(),P=function(){function t(e){this[S]=B++,this._result=this._state=void 0,this._subscribers=[],w!==e&&("function"!=typeof e&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof t?function(e,t){try{t((function(t){R(e,t)}),(function(t){I(e,t)}))}catch(t){I(e,t)}}(this,e):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return t.prototype.catch=function(e){return this.then(null,e)},t.prototype.finally=function(t){var i=this.constructor;return e(t)?this.then((function(e){return i.resolve(t()).then((function(){return e}))}),(function(e){return i.resolve(t()).then((function(){throw e}))})):this.then(t,t)},t}();return P.prototype.then=E,P.all=function(e){return new M(this,e).promise},P.race=function(e){var t=this;return r(e)?new t((function(i,r){for(var n=e.length,s=0;s<n;s++)t.resolve(e[s]).then(i,r)})):new t((function(e,t){return t(new TypeError("You must pass an array to race."))}))},P.resolve=b,P.reject=function(e){var t=new this(w);return I(t,e),t},P._setScheduler=function(e){o=e},P._setAsap=function(e){a=e},P._asap=a,P.polyfill=function(){var e=void 0;if(void 0!==i)e=i;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var t=e.Promise;if(t){var r=null;try{r=Object.prototype.toString.call(t.resolve())}catch(e){}if("[object Promise]"===r&&!t.cast)return}e.Promise=P},P.Promise=P,P},e.exports=r()}).call(this,i(16),i(17))},function(e,t){var i,r,n=e.exports={};function s(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(e){if(i===setTimeout)return setTimeout(e,0);if((i===s||!i)&&setTimeout)return i=setTimeout,setTimeout(e,0);try{return i(e,0)}catch(t){try{return i.call(null,e,0)}catch(t){return i.call(this,e,0)}}}!function(){try{i="function"==typeof setTimeout?setTimeout:s}catch(e){i=s}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(e){r=o}}();var h,l=[],d=!1,u=-1;function A(){d&&h&&(d=!1,h.length?l=h.concat(l):u=-1,l.length&&c())}function c(){if(!d){var e=a(A);d=!0;for(var t=l.length;t;){for(h=l,l=[];++u<t;)h&&h[u].run();u=-1,t=l.length}h=null,d=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===o||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function f(){}n.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var i=1;i<arguments.length;i++)t[i-1]=arguments[i];l.push(new p(e,t)),1!==l.length||d||a(c)},p.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=f,n.addListener=f,n.once=f,n.off=f,n.removeListener=f,n.removeAllListeners=f,n.emit=f,n.prependListener=f,n.prependOnceListener=f,n.listeners=function(e){return[]},n.binding=function(e){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(e){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},function(e,t){var i;i=function(){return this}();try{i=i||new Function("return this")()}catch(e){"object"==typeof window&&(i=window)}e.exports=i},function(e,t,i){i.r(t);var r=i(9),n=i(12),s=i(10),o=i(1);t.default=function(e){var t=null,i=function(t,i){e.postMessage({msg:"logcat_callback",data:{type:t,logcat:i}})}.bind(this);function a(t,i){var r={msg:o.a.INIT_SEGMENT,data:{type:t,data:i}};e.postMessage(r,[i.data])}function h(t,i){var r={msg:o.a.MEDIA_SEGMENT,data:{type:t,data:i}};e.postMessage(r,[i.data])}function l(){var t={msg:o.a.LOADING_COMPLETE};e.postMessage(t)}function d(){var t={msg:o.a.RECOVERED_EARLY_EOF};e.postMessage(t)}function u(t){var i={msg:o.a.MEDIA_INFO,data:t};e.postMessage(i)}function A(t){var i={msg:o.a.METADATA_ARRIVED,data:t};e.postMessage(i)}function c(t){var i={msg:o.a.SCRIPTDATA_ARRIVED,data:t};e.postMessage(i)}function p(t){var i={msg:o.a.TIMED_ID3_METADATA_ARRIVED,data:t};e.postMessage(i)}function f(t){var i={msg:o.a.PES_PRIVATE_DATA_DESCRIPTOR,data:t};e.postMessage(i)}function m(t){var i={msg:o.a.PES_PRIVATE_DATA_ARRIVED,data:t};e.postMessage(i)}function _(t){var i={msg:o.a.STATISTICS_INFO,data:t};e.postMessage(i)}function g(t,i){e.postMessage({msg:o.a.IO_ERROR,data:{type:t,info:i}})}function y(t,i){e.postMessage({msg:o.a.DEMUX_ERROR,data:{type:t,info:i}})}function v(t){e.postMessage({msg:o.a.RECOMMEND_SEEKPOINT,data:t})}n.a.install(),e.addEventListener("message",(function(n){switch(n.data.cmd){case"init":(t=new s.a(n.data.param[0],n.data.param[1])).on(o.a.IO_ERROR,g.bind(this)),t.on(o.a.DEMUX_ERROR,y.bind(this)),t.on(o.a.INIT_SEGMENT,a.bind(this)),t.on(o.a.MEDIA_SEGMENT,h.bind(this)),t.on(o.a.LOADING_COMPLETE,l.bind(this)),t.on(o.a.RECOVERED_EARLY_EOF,d.bind(this)),t.on(o.a.MEDIA_INFO,u.bind(this)),t.on(o.a.METADATA_ARRIVED,A.bind(this)),t.on(o.a.SCRIPTDATA_ARRIVED,c.bind(this)),t.on(o.a.TIMED_ID3_METADATA_ARRIVED,p.bind(this)),t.on(o.a.PES_PRIVATE_DATA_DESCRIPTOR,f.bind(this)),t.on(o.a.PES_PRIVATE_DATA_ARRIVED,m.bind(this)),t.on(o.a.STATISTICS_INFO,_.bind(this)),t.on(o.a.RECOMMEND_SEEKPOINT,v.bind(this));break;case"destroy":t&&(t.destroy(),t=null),e.postMessage({msg:"destroyed"});break;case"start":t.start();break;case"stop":t.stop();break;case"seek":t.seek(n.data.param);break;case"pause":t.pause();break;case"resume":t.resume();break;case"logging_config":var E=n.data.param;r.a.applyConfig(E),!0===E.enableCallback?r.a.addLogListener(i):r.a.removeLogListener(i)}}))}},function(e,t,i){i.r(t);var r=i(12),n=i(11),s={enableWorker:!1,enableStashBuffer:!0,stashInitialSize:void 0,isLive:!1,liveBufferLatencyChasing:!1,liveBufferLatencyMaxLatency:1.5,liveBufferLatencyMinRemain:.5,lazyLoad:!0,lazyLoadMaxDuration:180,lazyLoadRecoverDuration:30,deferLoadAfterSourceOpen:!0,autoCleanupMaxBackwardDuration:180,autoCleanupMinBackwardDuration:120,statisticsInfoReportInterval:600,fixAudioTimestampGap:!0,accurateSeek:!1,seekType:"range",seekParamStart:"bstart",seekParamEnd:"bend",rangeLoadZeroStart:!1,customSeekHandler:void 0,reuseRedirectedURL:!1,headers:void 0,customLoader:void 0};function o(){return Object.assign({},s)}var a=function(){function e(){}return e.supportMSEH264Playback=function(){return window.MediaSource&&window.MediaSource.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"')},e.supportNetworkStreamIO=function(){var e=new n.a({},o()),t=e.loaderType;return e.destroy(),"fetch-stream-loader"==t||"xhr-moz-chunked-loader"==t},e.getNetworkLoaderTypeName=function(){var e=new n.a({},o()),t=e.loaderType;return e.destroy(),t},e.supportNativeMediaPlayback=function(t){null==e.videoElement&&(e.videoElement=window.document.createElement("video"));var i=e.videoElement.canPlayType(t);return"probably"===i||"maybe"==i},e.getFeatureList=function(){var t={msePlayback:!1,mseLivePlayback:!1,networkStreamIO:!1,networkLoaderName:"",nativeMP4H264Playback:!1,nativeWebmVP8Playback:!1,nativeWebmVP9Playback:!1};return t.msePlayback=e.supportMSEH264Playback(),t.networkStreamIO=e.supportNetworkStreamIO(),t.networkLoaderName=e.getNetworkLoaderTypeName(),t.mseLivePlayback=t.msePlayback&&t.networkStreamIO,t.nativeMP4H264Playback=e.supportNativeMediaPlayback('video/mp4; codecs="avc1.42001E, mp4a.40.2"'),t.nativeWebmVP8Playback=e.supportNativeMediaPlayback('video/webm; codecs="vp8.0, vorbis"'),t.nativeWebmVP9Playback=e.supportNativeMediaPlayback('video/webm; codecs="vp9"'),t},e}(),h=i(2),l=i(6),d=i.n(l),u=i(0),A=i(4),c={ERROR:"error",LOADING_COMPLETE:"loading_complete",RECOVERED_EARLY_EOF:"recovered_early_eof",MEDIA_INFO:"media_info",METADATA_ARRIVED:"metadata_arrived",SCRIPTDATA_ARRIVED:"scriptdata_arrived",TIMED_ID3_METADATA_ARRIVED:"timed_id3_metadata_arrived",PES_PRIVATE_DATA_DESCRIPTOR:"pes_private_data_descriptor",PES_PRIVATE_DATA_ARRIVED:"pes_private_data_arrived",STATISTICS_INFO:"statistics_info"},p=i(13),f=i.n(p),m=i(9),_=i(10),g=i(1),y=i(8),v=function(){function e(e,t){if(this.TAG="Transmuxer",this._emitter=new d.a,t.enableWorker&&"undefined"!=typeof Worker)try{this._worker=f()(18),this._workerDestroying=!1,this._worker.addEventListener("message",this._onWorkerMessage.bind(this)),this._worker.postMessage({cmd:"init",param:[e,t]}),this.e={onLoggingConfigChanged:this._onLoggingConfigChanged.bind(this)},m.a.registerListener(this.e.onLoggingConfigChanged),this._worker.postMessage({cmd:"logging_config",param:m.a.getConfig()})}catch(i){u.a.e(this.TAG,"Error while initialize transmuxing worker, fallback to inline transmuxing"),this._worker=null,this._controller=new _.a(e,t)}else this._controller=new _.a(e,t);if(this._controller){var i=this._controller;i.on(g.a.IO_ERROR,this._onIOError.bind(this)),i.on(g.a.DEMUX_ERROR,this._onDemuxError.bind(this)),i.on(g.a.INIT_SEGMENT,this._onInitSegment.bind(this)),i.on(g.a.MEDIA_SEGMENT,this._onMediaSegment.bind(this)),i.on(g.a.LOADING_COMPLETE,this._onLoadingComplete.bind(this)),i.on(g.a.RECOVERED_EARLY_EOF,this._onRecoveredEarlyEof.bind(this)),i.on(g.a.MEDIA_INFO,this._onMediaInfo.bind(this)),i.on(g.a.METADATA_ARRIVED,this._onMetaDataArrived.bind(this)),i.on(g.a.SCRIPTDATA_ARRIVED,this._onScriptDataArrived.bind(this)),i.on(g.a.TIMED_ID3_METADATA_ARRIVED,this._onTimedID3MetadataArrived.bind(this)),i.on(g.a.PES_PRIVATE_DATA_DESCRIPTOR,this._onPESPrivateDataDescriptor.bind(this)),i.on(g.a.PES_PRIVATE_DATA_ARRIVED,this._onPESPrivateDataArrived.bind(this)),i.on(g.a.STATISTICS_INFO,this._onStatisticsInfo.bind(this)),i.on(g.a.RECOMMEND_SEEKPOINT,this._onRecommendSeekpoint.bind(this))}}return e.prototype.destroy=function(){this._worker?this._workerDestroying||(this._workerDestroying=!0,this._worker.postMessage({cmd:"destroy"}),m.a.removeListener(this.e.onLoggingConfigChanged),this.e=null):(this._controller.destroy(),this._controller=null),this._emitter.removeAllListeners(),this._emitter=null},e.prototype.on=function(e,t){this._emitter.addListener(e,t)},e.prototype.off=function(e,t){this._emitter.removeListener(e,t)},e.prototype.hasWorker=function(){return null!=this._worker},e.prototype.open=function(){this._worker?this._worker.postMessage({cmd:"start"}):this._controller.start()},e.prototype.close=function(){this._worker?this._worker.postMessage({cmd:"stop"}):this._controller.stop()},e.prototype.seek=function(e){this._worker?this._worker.postMessage({cmd:"seek",param:e}):this._controller.seek(e)},e.prototype.pause=function(){this._worker?this._worker.postMessage({cmd:"pause"}):this._controller.pause()},e.prototype.resume=function(){this._worker?this._worker.postMessage({cmd:"resume"}):this._controller.resume()},e.prototype._onInitSegment=function(e,t){var i=this;Promise.resolve().then((function(){i._emitter.emit(g.a.INIT_SEGMENT,e,t)}))},e.prototype._onMediaSegment=function(e,t){var i=this;Promise.resolve().then((function(){i._emitter.emit(g.a.MEDIA_SEGMENT,e,t)}))},e.prototype._onLoadingComplete=function(){var e=this;Promise.resolve().then((function(){e._emitter.emit(g.a.LOADING_COMPLETE)}))},e.prototype._onRecoveredEarlyEof=function(){var e=this;Promise.resolve().then((function(){e._emitter.emit(g.a.RECOVERED_EARLY_EOF)}))},e.prototype._onMediaInfo=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(g.a.MEDIA_INFO,e)}))},e.prototype._onMetaDataArrived=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(g.a.METADATA_ARRIVED,e)}))},e.prototype._onScriptDataArrived=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(g.a.SCRIPTDATA_ARRIVED,e)}))},e.prototype._onTimedID3MetadataArrived=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(g.a.TIMED_ID3_METADATA_ARRIVED,e)}))},e.prototype._onPESPrivateDataDescriptor=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(g.a.PES_PRIVATE_DATA_DESCRIPTOR,e)}))},e.prototype._onPESPrivateDataArrived=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(g.a.PES_PRIVATE_DATA_ARRIVED,e)}))},e.prototype._onStatisticsInfo=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(g.a.STATISTICS_INFO,e)}))},e.prototype._onIOError=function(e,t){var i=this;Promise.resolve().then((function(){i._emitter.emit(g.a.IO_ERROR,e,t)}))},e.prototype._onDemuxError=function(e,t){var i=this;Promise.resolve().then((function(){i._emitter.emit(g.a.DEMUX_ERROR,e,t)}))},e.prototype._onRecommendSeekpoint=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(g.a.RECOMMEND_SEEKPOINT,e)}))},e.prototype._onLoggingConfigChanged=function(e){this._worker&&this._worker.postMessage({cmd:"logging_config",param:e})},e.prototype._onWorkerMessage=function(e){var t=e.data,i=t.data;if("destroyed"===t.msg||this._workerDestroying)return this._workerDestroying=!1,this._worker.terminate(),void(this._worker=null);switch(t.msg){case g.a.INIT_SEGMENT:case g.a.MEDIA_SEGMENT:this._emitter.emit(t.msg,i.type,i.data);break;case g.a.LOADING_COMPLETE:case g.a.RECOVERED_EARLY_EOF:this._emitter.emit(t.msg);break;case g.a.MEDIA_INFO:Object.setPrototypeOf(i,y.a.prototype),this._emitter.emit(t.msg,i);break;case g.a.METADATA_ARRIVED:case g.a.SCRIPTDATA_ARRIVED:case g.a.TIMED_ID3_METADATA_ARRIVED:case g.a.PES_PRIVATE_DATA_DESCRIPTOR:case g.a.PES_PRIVATE_DATA_ARRIVED:case g.a.STATISTICS_INFO:this._emitter.emit(t.msg,i);break;case g.a.IO_ERROR:case g.a.DEMUX_ERROR:this._emitter.emit(t.msg,i.type,i.info);break;case g.a.RECOMMEND_SEEKPOINT:this._emitter.emit(t.msg,i);break;case"logcat_callback":u.a.emitter.emit("log",i.type,i.logcat)}},e}(),E={ERROR:"error",SOURCE_OPEN:"source_open",UPDATE_END:"update_end",BUFFER_FULL:"buffer_full"},b=i(7),S=i(3),w=function(){function e(e){this.TAG="MSEController",this._config=e,this._emitter=new d.a,this._config.isLive&&null==this._config.autoCleanupSourceBuffer&&(this._config.autoCleanupSourceBuffer=!0),this.e={onSourceOpen:this._onSourceOpen.bind(this),onSourceEnded:this._onSourceEnded.bind(this),onSourceClose:this._onSourceClose.bind(this),onSourceBufferError:this._onSourceBufferError.bind(this),onSourceBufferUpdateEnd:this._onSourceBufferUpdateEnd.bind(this)},this._mediaSource=null,this._mediaSourceObjectURL=null,this._mediaElement=null,this._isBufferFull=!1,this._hasPendingEos=!1,this._requireSetMediaDuration=!1,this._pendingMediaDuration=0,this._pendingSourceBufferInit=[],this._mimeTypes={video:null,audio:null},this._sourceBuffers={video:null,audio:null},this._lastInitSegments={video:null,audio:null},this._pendingSegments={video:[],audio:[]},this._pendingRemoveRanges={video:[],audio:[]},this._idrList=new b.a}return e.prototype.destroy=function(){(this._mediaElement||this._mediaSource)&&this.detachMediaElement(),this.e=null,this._emitter.removeAllListeners(),this._emitter=null},e.prototype.on=function(e,t){this._emitter.addListener(e,t)},e.prototype.off=function(e,t){this._emitter.removeListener(e,t)},e.prototype.attachMediaElement=function(e){if(this._mediaSource)throw new S.a("MediaSource has been attached to an HTMLMediaElement!");var t=this._mediaSource=new window.MediaSource;t.addEventListener("sourceopen",this.e.onSourceOpen),t.addEventListener("sourceended",this.e.onSourceEnded),t.addEventListener("sourceclose",this.e.onSourceClose),this._mediaElement=e,this._mediaSourceObjectURL=window.URL.createObjectURL(this._mediaSource),e.src=this._mediaSourceObjectURL},e.prototype.detachMediaElement=function(){if(this._mediaSource){var e=this._mediaSource;for(var t in this._sourceBuffers){var i=this._pendingSegments[t];i.splice(0,i.length),this._pendingSegments[t]=null,this._pendingRemoveRanges[t]=null,this._lastInitSegments[t]=null;var r=this._sourceBuffers[t];if(r){if("closed"!==e.readyState){try{e.removeSourceBuffer(r)}catch(e){u.a.e(this.TAG,e.message)}r.removeEventListener("error",this.e.onSourceBufferError),r.removeEventListener("updateend",this.e.onSourceBufferUpdateEnd)}this._mimeTypes[t]=null,this._sourceBuffers[t]=null}}if("open"===e.readyState)try{e.endOfStream()}catch(e){u.a.e(this.TAG,e.message)}e.removeEventListener("sourceopen",this.e.onSourceOpen),e.removeEventListener("sourceended",this.e.onSourceEnded),e.removeEventListener("sourceclose",this.e.onSourceClose),this._pendingSourceBufferInit=[],this._isBufferFull=!1,this._idrList.clear(),this._mediaSource=null}this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src"),this._mediaElement=null),this._mediaSourceObjectURL&&(window.URL.revokeObjectURL(this._mediaSourceObjectURL),this._mediaSourceObjectURL=null)},e.prototype.appendInitSegment=function(e,t){if(!this._mediaSource||"open"!==this._mediaSource.readyState)return this._pendingSourceBufferInit.push(e),void this._pendingSegments[e.type].push(e);var i=e,r=""+i.container;i.codec&&i.codec.length>0&&(r+=";codecs="+i.codec);var n=!1;if(u.a.v(this.TAG,"Received Initialization Segment, mimeType: "+r),this._lastInitSegments[i.type]=i,r!==this._mimeTypes[i.type]){if(this._mimeTypes[i.type])u.a.v(this.TAG,"Notice: "+i.type+" mimeType changed, origin: "+this._mimeTypes[i.type]+", target: "+r);else{n=!0;try{var s=this._sourceBuffers[i.type]=this._mediaSource.addSourceBuffer(r);s.addEventListener("error",this.e.onSourceBufferError),s.addEventListener("updateend",this.e.onSourceBufferUpdateEnd)}catch(e){return u.a.e(this.TAG,e.message),void this._emitter.emit(E.ERROR,{code:e.code,msg:e.message})}}this._mimeTypes[i.type]=r}t||this._pendingSegments[i.type].push(i),n||this._sourceBuffers[i.type]&&!this._sourceBuffers[i.type].updating&&this._doAppendSegments(),A.a.safari&&"audio/mpeg"===i.container&&i.mediaDuration>0&&(this._requireSetMediaDuration=!0,this._pendingMediaDuration=i.mediaDuration/1e3,this._updateMediaSourceDuration())},e.prototype.appendMediaSegment=function(e){var t=e;this._pendingSegments[t.type].push(t),this._config.autoCleanupSourceBuffer&&this._needCleanupSourceBuffer()&&this._doCleanupSourceBuffer();var i=this._sourceBuffers[t.type];!i||i.updating||this._hasPendingRemoveRanges()||this._doAppendSegments()},e.prototype.seek=function(e){for(var t in this._sourceBuffers)if(this._sourceBuffers[t]){var i=this._sourceBuffers[t];if("open"===this._mediaSource.readyState)try{i.abort()}catch(e){u.a.e(this.TAG,e.message)}this._idrList.clear();var r=this._pendingSegments[t];if(r.splice(0,r.length),"closed"!==this._mediaSource.readyState){for(var n=0;n<i.buffered.length;n++){var s=i.buffered.start(n),o=i.buffered.end(n);this._pendingRemoveRanges[t].push({start:s,end:o})}if(i.updating||this._doRemoveRanges(),A.a.safari){var a=this._lastInitSegments[t];a&&(this._pendingSegments[t].push(a),i.updating||this._doAppendSegments())}}}},e.prototype.endOfStream=function(){var e=this._mediaSource,t=this._sourceBuffers;e&&"open"===e.readyState?t.video&&t.video.updating||t.audio&&t.audio.updating?this._hasPendingEos=!0:(this._hasPendingEos=!1,e.endOfStream()):e&&"closed"===e.readyState&&this._hasPendingSegments()&&(this._hasPendingEos=!0)},e.prototype.getNearestKeyframe=function(e){return this._idrList.getLastSyncPointBeforeDts(e)},e.prototype._needCleanupSourceBuffer=function(){if(!this._config.autoCleanupSourceBuffer)return!1;var e=this._mediaElement.currentTime;for(var t in this._sourceBuffers){var i=this._sourceBuffers[t];if(i){var r=i.buffered;if(r.length>=1&&e-r.start(0)>=this._config.autoCleanupMaxBackwardDuration)return!0}}return!1},e.prototype._doCleanupSourceBuffer=function(){var e=this._mediaElement.currentTime;for(var t in this._sourceBuffers){var i=this._sourceBuffers[t];if(i){for(var r=i.buffered,n=!1,s=0;s<r.length;s++){var o=r.start(s),a=r.end(s);if(o<=e&&e<a+3){if(e-o>=this._config.autoCleanupMaxBackwardDuration){n=!0;var h=e-this._config.autoCleanupMinBackwardDuration;this._pendingRemoveRanges[t].push({start:o,end:h})}}else a<e&&(n=!0,this._pendingRemoveRanges[t].push({start:o,end:a}))}n&&!i.updating&&this._doRemoveRanges()}}},e.prototype._updateMediaSourceDuration=function(){var e=this._sourceBuffers;if(0!==this._mediaElement.readyState&&"open"===this._mediaSource.readyState&&!(e.video&&e.video.updating||e.audio&&e.audio.updating)){var t=this._mediaSource.duration,i=this._pendingMediaDuration;i>0&&(isNaN(t)||i>t)&&(u.a.v(this.TAG,"Update MediaSource duration from "+t+" to "+i),this._mediaSource.duration=i),this._requireSetMediaDuration=!1,this._pendingMediaDuration=0}},e.prototype._doRemoveRanges=function(){for(var e in this._pendingRemoveRanges)if(this._sourceBuffers[e]&&!this._sourceBuffers[e].updating)for(var t=this._sourceBuffers[e],i=this._pendingRemoveRanges[e];i.length&&!t.updating;){var r=i.shift();t.remove(r.start,r.end)}},e.prototype._doAppendSegments=function(){var e=this._pendingSegments;for(var t in e)if(this._sourceBuffers[t]&&!this._sourceBuffers[t].updating&&e[t].length>0){var i=e[t].shift();if(i.timestampOffset){var r=this._sourceBuffers[t].timestampOffset,n=i.timestampOffset/1e3;Math.abs(r-n)>.1&&(u.a.v(this.TAG,"Update MPEG audio timestampOffset from "+r+" to "+n),this._sourceBuffers[t].timestampOffset=n),delete i.timestampOffset}if(!i.data||0===i.data.byteLength)continue;try{this._sourceBuffers[t].appendBuffer(i.data),this._isBufferFull=!1,"video"===t&&i.hasOwnProperty("info")&&this._idrList.appendArray(i.info.syncPoints)}catch(e){this._pendingSegments[t].unshift(i),22===e.code?(this._isBufferFull||this._emitter.emit(E.BUFFER_FULL),this._isBufferFull=!0):(u.a.e(this.TAG,e.message),this._emitter.emit(E.ERROR,{code:e.code,msg:e.message}))}}},e.prototype._onSourceOpen=function(){if(u.a.v(this.TAG,"MediaSource onSourceOpen"),this._mediaSource.removeEventListener("sourceopen",this.e.onSourceOpen),this._pendingSourceBufferInit.length>0)for(var e=this._pendingSourceBufferInit;e.length;){var t=e.shift();this.appendInitSegment(t,!0)}this._hasPendingSegments()&&this._doAppendSegments(),this._emitter.emit(E.SOURCE_OPEN)},e.prototype._onSourceEnded=function(){u.a.v(this.TAG,"MediaSource onSourceEnded")},e.prototype._onSourceClose=function(){u.a.v(this.TAG,"MediaSource onSourceClose"),this._mediaSource&&null!=this.e&&(this._mediaSource.removeEventListener("sourceopen",this.e.onSourceOpen),this._mediaSource.removeEventListener("sourceended",this.e.onSourceEnded),this._mediaSource.removeEventListener("sourceclose",this.e.onSourceClose))},e.prototype._hasPendingSegments=function(){var e=this._pendingSegments;return e.video.length>0||e.audio.length>0},e.prototype._hasPendingRemoveRanges=function(){var e=this._pendingRemoveRanges;return e.video.length>0||e.audio.length>0},e.prototype._onSourceBufferUpdateEnd=function(){this._requireSetMediaDuration?this._updateMediaSourceDuration():this._hasPendingRemoveRanges()?this._doRemoveRanges():this._hasPendingSegments()?this._doAppendSegments():this._hasPendingEos&&this.endOfStream(),this._emitter.emit(E.UPDATE_END)},e.prototype._onSourceBufferError=function(e){u.a.e(this.TAG,"SourceBuffer Error: "+e)},e}(),T=i(5),R={NETWORK_ERROR:"NetworkError",MEDIA_ERROR:"MediaError",OTHER_ERROR:"OtherError"},C={NETWORK_EXCEPTION:h.b.EXCEPTION,NETWORK_STATUS_CODE_INVALID:h.b.HTTP_STATUS_CODE_INVALID,NETWORK_TIMEOUT:h.b.CONNECTING_TIMEOUT,NETWORK_UNRECOVERABLE_EARLY_EOF:h.b.UNRECOVERABLE_EARLY_EOF,MEDIA_MSE_ERROR:"MediaMSEError",MEDIA_FORMAT_ERROR:T.a.FORMAT_ERROR,MEDIA_FORMAT_UNSUPPORTED:T.a.FORMAT_UNSUPPORTED,MEDIA_CODEC_UNSUPPORTED:T.a.CODEC_UNSUPPORTED},k=function(){function e(e,t){this.TAG="MSEPlayer",this._type="MSEPlayer",this._emitter=new d.a,this._config=o(),"object"==typeof t&&Object.assign(this._config,t);var i=e.type.toLowerCase();if("mse"!==i&&"mpegts"!==i&&"m2ts"!==i&&"flv"!==i)throw new S.b("MSEPlayer requires an mpegts/m2ts/flv MediaDataSource input!");!0===e.isLive&&(this._config.isLive=!0),this.e={onvLoadedMetadata:this._onvLoadedMetadata.bind(this),onvSeeking:this._onvSeeking.bind(this),onvCanPlay:this._onvCanPlay.bind(this),onvStalled:this._onvStalled.bind(this),onvProgress:this._onvProgress.bind(this)},self.performance&&self.performance.now?this._now=self.performance.now.bind(self.performance):this._now=Date.now,this._pendingSeekTime=null,this._requestSetTime=!1,this._seekpointRecord=null,this._progressChecker=null,this._mediaDataSource=e,this._mediaElement=null,this._msectl=null,this._transmuxer=null,this._mseSourceOpened=!1,this._hasPendingLoad=!1,this._receivedCanPlay=!1,this._mediaInfo=null,this._statisticsInfo=null;var r=A.a.chrome&&(A.a.version.major<50||50===A.a.version.major&&A.a.version.build<2661);this._alwaysSeekKeyframe=!!(r||A.a.msedge||A.a.msie),this._alwaysSeekKeyframe&&(this._config.accurateSeek=!1)}return e.prototype.destroy=function(){null!=this._progressChecker&&(window.clearInterval(this._progressChecker),this._progressChecker=null),this._transmuxer&&this.unload(),this._mediaElement&&this.detachMediaElement(),this.e=null,this._mediaDataSource=null,this._emitter.removeAllListeners(),this._emitter=null},e.prototype.on=function(e,t){var i=this;e===c.MEDIA_INFO?null!=this._mediaInfo&&Promise.resolve().then((function(){i._emitter.emit(c.MEDIA_INFO,i.mediaInfo)})):e===c.STATISTICS_INFO&&null!=this._statisticsInfo&&Promise.resolve().then((function(){i._emitter.emit(c.STATISTICS_INFO,i.statisticsInfo)})),this._emitter.addListener(e,t)},e.prototype.off=function(e,t){this._emitter.removeListener(e,t)},e.prototype.attachMediaElement=function(e){var t=this;if(this._mediaElement=e,e.addEventListener("loadedmetadata",this.e.onvLoadedMetadata),e.addEventListener("seeking",this.e.onvSeeking),e.addEventListener("canplay",this.e.onvCanPlay),e.addEventListener("stalled",this.e.onvStalled),e.addEventListener("progress",this.e.onvProgress),this._msectl=new w(this._config),this._msectl.on(E.UPDATE_END,this._onmseUpdateEnd.bind(this)),this._msectl.on(E.BUFFER_FULL,this._onmseBufferFull.bind(this)),this._msectl.on(E.SOURCE_OPEN,(function(){t._mseSourceOpened=!0,t._hasPendingLoad&&(t._hasPendingLoad=!1,t.load())})),this._msectl.on(E.ERROR,(function(e){t._emitter.emit(c.ERROR,R.MEDIA_ERROR,C.MEDIA_MSE_ERROR,e)})),this._msectl.attachMediaElement(e),null!=this._pendingSeekTime)try{e.currentTime=this._pendingSeekTime,this._pendingSeekTime=null}catch(e){}},e.prototype.detachMediaElement=function(){this._mediaElement&&(this._msectl.detachMediaElement(),this._mediaElement.removeEventListener("loadedmetadata",this.e.onvLoadedMetadata),this._mediaElement.removeEventListener("seeking",this.e.onvSeeking),this._mediaElement.removeEventListener("canplay",this.e.onvCanPlay),this._mediaElement.removeEventListener("stalled",this.e.onvStalled),this._mediaElement.removeEventListener("progress",this.e.onvProgress),this._mediaElement=null),this._msectl&&(this._msectl.destroy(),this._msectl=null)},e.prototype.load=function(){var e=this;if(!this._mediaElement)throw new S.a("HTMLMediaElement must be attached before load()!");if(this._transmuxer)throw new S.a("MSEPlayer.load() has been called, please call unload() first!");this._hasPendingLoad||(this._config.deferLoadAfterSourceOpen&&!1===this._mseSourceOpened?this._hasPendingLoad=!0:(this._mediaElement.readyState>0&&(this._requestSetTime=!0,this._mediaElement.currentTime=0),this._transmuxer=new v(this._mediaDataSource,this._config),this._transmuxer.on(g.a.INIT_SEGMENT,(function(t,i){e._msectl.appendInitSegment(i)})),this._transmuxer.on(g.a.MEDIA_SEGMENT,(function(t,i){if(e._msectl.appendMediaSegment(i),e._config.lazyLoad&&!e._config.isLive){var r=e._mediaElement.currentTime;i.info.endDts>=1e3*(r+e._config.lazyLoadMaxDuration)&&null==e._progressChecker&&(u.a.v(e.TAG,"Maximum buffering duration exceeded, suspend transmuxing task"),e._suspendTransmuxer())}})),this._transmuxer.on(g.a.LOADING_COMPLETE,(function(){e._msectl.endOfStream(),e._emitter.emit(c.LOADING_COMPLETE)})),this._transmuxer.on(g.a.RECOVERED_EARLY_EOF,(function(){e._emitter.emit(c.RECOVERED_EARLY_EOF)})),this._transmuxer.on(g.a.IO_ERROR,(function(t,i){e._emitter.emit(c.ERROR,R.NETWORK_ERROR,t,i)})),this._transmuxer.on(g.a.DEMUX_ERROR,(function(t,i){e._emitter.emit(c.ERROR,R.MEDIA_ERROR,t,{code:-1,msg:i})})),this._transmuxer.on(g.a.MEDIA_INFO,(function(t){e._mediaInfo=t,e._emitter.emit(c.MEDIA_INFO,Object.assign({},t))})),this._transmuxer.on(g.a.METADATA_ARRIVED,(function(t){e._emitter.emit(c.METADATA_ARRIVED,t)})),this._transmuxer.on(g.a.SCRIPTDATA_ARRIVED,(function(t){e._emitter.emit(c.SCRIPTDATA_ARRIVED,t)})),this._transmuxer.on(g.a.TIMED_ID3_METADATA_ARRIVED,(function(t){e._emitter.emit(c.TIMED_ID3_METADATA_ARRIVED,t)})),this._transmuxer.on(g.a.PES_PRIVATE_DATA_DESCRIPTOR,(function(t){e._emitter.emit(c.PES_PRIVATE_DATA_DESCRIPTOR,t)})),this._transmuxer.on(g.a.PES_PRIVATE_DATA_ARRIVED,(function(t){e._emitter.emit(c.PES_PRIVATE_DATA_ARRIVED,t)})),this._transmuxer.on(g.a.STATISTICS_INFO,(function(t){e._statisticsInfo=e._fillStatisticsInfo(t),e._emitter.emit(c.STATISTICS_INFO,Object.assign({},e._statisticsInfo))})),this._transmuxer.on(g.a.RECOMMEND_SEEKPOINT,(function(t){e._mediaElement&&!e._config.accurateSeek&&(e._requestSetTime=!0,e._mediaElement.currentTime=t/1e3)})),this._transmuxer.open()))},e.prototype.unload=function(){this._mediaElement&&this._mediaElement.pause(),this._msectl&&this._msectl.seek(0),this._transmuxer&&(this._transmuxer.close(),this._transmuxer.destroy(),this._transmuxer=null)},e.prototype.play=function(){return this._mediaElement.play()},e.prototype.pause=function(){this._mediaElement.pause()},Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"buffered",{get:function(){return this._mediaElement.buffered},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"duration",{get:function(){return this._mediaElement.duration},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"volume",{get:function(){return this._mediaElement.volume},set:function(e){this._mediaElement.volume=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"muted",{get:function(){return this._mediaElement.muted},set:function(e){this._mediaElement.muted=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentTime",{get:function(){return this._mediaElement?this._mediaElement.currentTime:0},set:function(e){this._mediaElement?this._internalSeek(e):this._pendingSeekTime=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mediaInfo",{get:function(){return Object.assign({},this._mediaInfo)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"statisticsInfo",{get:function(){return null==this._statisticsInfo&&(this._statisticsInfo={}),this._statisticsInfo=this._fillStatisticsInfo(this._statisticsInfo),Object.assign({},this._statisticsInfo)},enumerable:!1,configurable:!0}),e.prototype._fillStatisticsInfo=function(e){if(e.playerType=this._type,!(this._mediaElement instanceof HTMLVideoElement))return e;var t=!0,i=0,r=0;if(this._mediaElement.getVideoPlaybackQuality){var n=this._mediaElement.getVideoPlaybackQuality();i=n.totalVideoFrames,r=n.droppedVideoFrames}else null!=this._mediaElement.webkitDecodedFrameCount?(i=this._mediaElement.webkitDecodedFrameCount,r=this._mediaElement.webkitDroppedFrameCount):t=!1;return t&&(e.decodedFrames=i,e.droppedFrames=r),e},e.prototype._onmseUpdateEnd=function(){var e=this._mediaElement.buffered,t=this._mediaElement.currentTime;if(this._config.isLive&&this._config.liveBufferLatencyChasing&&e.length>0&&!this._mediaElement.paused){var i=e.end(e.length-1);if(i>this._config.liveBufferLatencyMaxLatency&&i-t>this._config.liveBufferLatencyMaxLatency){var r=i-this._config.liveBufferLatencyMinRemain;this.currentTime=r}}if(this._config.lazyLoad&&!this._config.isLive){for(var n=0,s=0;s<e.length;s++){var o=e.start(s),a=e.end(s);if(o<=t&&t<a){n=a;break}}n>=t+this._config.lazyLoadMaxDuration&&null==this._progressChecker&&(u.a.v(this.TAG,"Maximum buffering duration exceeded, suspend transmuxing task"),this._suspendTransmuxer())}},e.prototype._onmseBufferFull=function(){u.a.v(this.TAG,"MSE SourceBuffer is full, suspend transmuxing task"),null==this._progressChecker&&this._suspendTransmuxer()},e.prototype._suspendTransmuxer=function(){this._transmuxer&&(this._transmuxer.pause(),null==this._progressChecker&&(this._progressChecker=window.setInterval(this._checkProgressAndResume.bind(this),1e3)))},e.prototype._checkProgressAndResume=function(){for(var e=this._mediaElement.currentTime,t=this._mediaElement.buffered,i=!1,r=0;r<t.length;r++){var n=t.start(r),s=t.end(r);if(e>=n&&e<s){e>=s-this._config.lazyLoadRecoverDuration&&(i=!0);break}}i&&(window.clearInterval(this._progressChecker),this._progressChecker=null,i&&(u.a.v(this.TAG,"Continue loading from paused position"),this._transmuxer.resume()))},e.prototype._isTimepointBuffered=function(e){for(var t=this._mediaElement.buffered,i=0;i<t.length;i++){var r=t.start(i),n=t.end(i);if(e>=r&&e<n)return!0}return!1},e.prototype._internalSeek=function(e){var t=this._isTimepointBuffered(e),i=!1,r=0;if(e<1&&this._mediaElement.buffered.length>0){var n=this._mediaElement.buffered.start(0);(n<1&&e<n||A.a.safari)&&(i=!0,r=A.a.safari?.1:n)}if(i)this._requestSetTime=!0,this._mediaElement.currentTime=r;else if(t){if(this._alwaysSeekKeyframe){var s=this._msectl.getNearestKeyframe(Math.floor(1e3*e));this._requestSetTime=!0,this._mediaElement.currentTime=null!=s?s.dts/1e3:e}else this._requestSetTime=!0,this._mediaElement.currentTime=e;null!=this._progressChecker&&this._checkProgressAndResume()}else null!=this._progressChecker&&(window.clearInterval(this._progressChecker),this._progressChecker=null),this._msectl.seek(e),this._transmuxer.seek(Math.floor(1e3*e)),this._config.accurateSeek&&(this._requestSetTime=!0,this._mediaElement.currentTime=e)},e.prototype._checkAndApplyUnbufferedSeekpoint=function(){if(this._seekpointRecord)if(this._seekpointRecord.recordTime<=this._now()-100){var e=this._mediaElement.currentTime;this._seekpointRecord=null,this._isTimepointBuffered(e)||(null!=this._progressChecker&&(window.clearTimeout(this._progressChecker),this._progressChecker=null),this._msectl.seek(e),this._transmuxer.seek(Math.floor(1e3*e)),this._config.accurateSeek&&(this._requestSetTime=!0,this._mediaElement.currentTime=e))}else window.setTimeout(this._checkAndApplyUnbufferedSeekpoint.bind(this),50)},e.prototype._checkAndResumeStuckPlayback=function(e){var t=this._mediaElement;if(e||!this._receivedCanPlay||t.readyState<2){var i=t.buffered;i.length>0&&t.currentTime<i.start(0)&&(u.a.w(this.TAG,"Playback seems stuck at "+t.currentTime+", seek to "+i.start(0)),this._requestSetTime=!0,this._mediaElement.currentTime=i.start(0),this._mediaElement.removeEventListener("progress",this.e.onvProgress))}else this._mediaElement.removeEventListener("progress",this.e.onvProgress)},e.prototype._onvLoadedMetadata=function(e){null!=this._pendingSeekTime&&(this._mediaElement.currentTime=this._pendingSeekTime,this._pendingSeekTime=null)},e.prototype._onvSeeking=function(e){var t=this._mediaElement.currentTime,i=this._mediaElement.buffered;if(this._requestSetTime)this._requestSetTime=!1;else{if(t<1&&i.length>0){var r=i.start(0);if(r<1&&t<r||A.a.safari)return this._requestSetTime=!0,void(this._mediaElement.currentTime=A.a.safari?.1:r)}if(this._isTimepointBuffered(t)){if(this._alwaysSeekKeyframe){var n=this._msectl.getNearestKeyframe(Math.floor(1e3*t));null!=n&&(this._requestSetTime=!0,this._mediaElement.currentTime=n.dts/1e3)}null!=this._progressChecker&&this._checkProgressAndResume()}else this._seekpointRecord={seekPoint:t,recordTime:this._now()},window.setTimeout(this._checkAndApplyUnbufferedSeekpoint.bind(this),50)}},e.prototype._onvCanPlay=function(e){this._receivedCanPlay=!0,this._mediaElement.removeEventListener("canplay",this.e.onvCanPlay)},e.prototype._onvStalled=function(e){this._checkAndResumeStuckPlayback(!0)},e.prototype._onvProgress=function(e){this._checkAndResumeStuckPlayback()},e}(),I=function(){function e(e,t){this.TAG="NativePlayer",this._type="NativePlayer",this._emitter=new d.a,this._config=o(),"object"==typeof t&&Object.assign(this._config,t);var i=e.type.toLowerCase();if("mse"===i||"mpegts"===i||"m2ts"===i||"flv"===i)throw new S.b("NativePlayer does't support mse/mpegts/m2ts/flv MediaDataSource input!");if(e.hasOwnProperty("segments"))throw new S.b("NativePlayer("+e.type+") doesn't support multipart playback!");this.e={onvLoadedMetadata:this._onvLoadedMetadata.bind(this)},this._pendingSeekTime=null,this._statisticsReporter=null,this._mediaDataSource=e,this._mediaElement=null}return e.prototype.destroy=function(){this._mediaElement&&(this.unload(),this.detachMediaElement()),this.e=null,this._mediaDataSource=null,this._emitter.removeAllListeners(),this._emitter=null},e.prototype.on=function(e,t){var i=this;e===c.MEDIA_INFO?null!=this._mediaElement&&0!==this._mediaElement.readyState&&Promise.resolve().then((function(){i._emitter.emit(c.MEDIA_INFO,i.mediaInfo)})):e===c.STATISTICS_INFO&&null!=this._mediaElement&&0!==this._mediaElement.readyState&&Promise.resolve().then((function(){i._emitter.emit(c.STATISTICS_INFO,i.statisticsInfo)})),this._emitter.addListener(e,t)},e.prototype.off=function(e,t){this._emitter.removeListener(e,t)},e.prototype.attachMediaElement=function(e){if(this._mediaElement=e,e.addEventListener("loadedmetadata",this.e.onvLoadedMetadata),null!=this._pendingSeekTime)try{e.currentTime=this._pendingSeekTime,this._pendingSeekTime=null}catch(e){}},e.prototype.detachMediaElement=function(){this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src"),this._mediaElement.removeEventListener("loadedmetadata",this.e.onvLoadedMetadata),this._mediaElement=null),null!=this._statisticsReporter&&(window.clearInterval(this._statisticsReporter),this._statisticsReporter=null)},e.prototype.load=function(){if(!this._mediaElement)throw new S.a("HTMLMediaElement must be attached before load()!");this._mediaElement.src=this._mediaDataSource.url,this._mediaElement.readyState>0&&(this._mediaElement.currentTime=0),this._mediaElement.preload="auto",this._mediaElement.load(),this._statisticsReporter=window.setInterval(this._reportStatisticsInfo.bind(this),this._config.statisticsInfoReportInterval)},e.prototype.unload=function(){this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src")),null!=this._statisticsReporter&&(window.clearInterval(this._statisticsReporter),this._statisticsReporter=null)},e.prototype.play=function(){return this._mediaElement.play()},e.prototype.pause=function(){this._mediaElement.pause()},Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"buffered",{get:function(){return this._mediaElement.buffered},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"duration",{get:function(){return this._mediaElement.duration},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"volume",{get:function(){return this._mediaElement.volume},set:function(e){this._mediaElement.volume=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"muted",{get:function(){return this._mediaElement.muted},set:function(e){this._mediaElement.muted=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentTime",{get:function(){return this._mediaElement?this._mediaElement.currentTime:0},set:function(e){this._mediaElement?this._mediaElement.currentTime=e:this._pendingSeekTime=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mediaInfo",{get:function(){var e={mimeType:(this._mediaElement instanceof HTMLAudioElement?"audio/":"video/")+this._mediaDataSource.type};return this._mediaElement&&(e.duration=Math.floor(1e3*this._mediaElement.duration),this._mediaElement instanceof HTMLVideoElement&&(e.width=this._mediaElement.videoWidth,e.height=this._mediaElement.videoHeight)),e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"statisticsInfo",{get:function(){var e={playerType:this._type,url:this._mediaDataSource.url};if(!(this._mediaElement instanceof HTMLVideoElement))return e;var t=!0,i=0,r=0;if(this._mediaElement.getVideoPlaybackQuality){var n=this._mediaElement.getVideoPlaybackQuality();i=n.totalVideoFrames,r=n.droppedVideoFrames}else null!=this._mediaElement.webkitDecodedFrameCount?(i=this._mediaElement.webkitDecodedFrameCount,r=this._mediaElement.webkitDroppedFrameCount):t=!1;return t&&(e.decodedFrames=i,e.droppedFrames=r),e},enumerable:!1,configurable:!0}),e.prototype._onvLoadedMetadata=function(e){null!=this._pendingSeekTime&&(this._mediaElement.currentTime=this._pendingSeekTime,this._pendingSeekTime=null),this._emitter.emit(c.MEDIA_INFO,this.mediaInfo)},e.prototype._reportStatisticsInfo=function(){this._emitter.emit(c.STATISTICS_INFO,this.statisticsInfo)},e}();r.a.install();var L={createPlayer:function(e,t){var i=e;if(null==i||"object"!=typeof i)throw new S.b("MediaDataSource must be an javascript object!");if(!i.hasOwnProperty("type"))throw new S.b("MediaDataSource must has type field to indicate video file type!");switch(i.type){case"mse":case"mpegts":case"m2ts":case"flv":return new k(i,t);default:return new I(i,t)}},isSupported:function(){return a.supportMSEH264Playback()},getFeatureList:function(){return a.getFeatureList()}};L.BaseLoader=h.a,L.LoaderStatus=h.c,L.LoaderErrors=h.b,L.Events=c,L.ErrorTypes=R,L.ErrorDetails=C,L.MSEPlayer=k,L.NativePlayer=I,L.LoggingControl=m.a,Object.defineProperty(L,"version",{enumerable:!0,get:function(){return"1.6.7"}}),t.default=L}])}(Wt);var Qt=Wt.exports;class zt extends re{constructor(e){super(),this.player=e;const t=document.createElement("video"),i=document.createElement("canvas");this.$posterElement=document.createElement("img"),t.volume=0,this.player._opt.hasAudio||(t.muted=!0),t.style.position="absolute",t.style.top="0px",t.style.left="0px",this._delayPlay=!1,e.$container.appendChild(t),this.videoInfo={width:"",height:"",encType:""},this.$videoElement=t,this.$canvasElement=i,this.canvasContext=i.getContext("2d"),this.fixChromeVideoFlashBug(),this.resize();const{proxy:r}=this.player.events;r(this.$videoElement,"canplay",(()=>{this.player.debug.log("Video",`canplay and _delayPlay is ${this._delayPlay}`),this._delayPlay&&this._play(),this.player.$container.contains(this.$posterElement)&&this.$posterElement&&this.player.$container.removeChild(this.$posterElement)})),r(this.$videoElement,"waiting",(()=>{this.player.emit(w.videoWaiting)})),r(this.$videoElement,"timeupdate",(e=>{const t=parseInt(e.timeStamp,10);this.player.emit(w.timeUpdate,t),!this.isPlaying()&&this.init&&(this.player.debug.log("Video","timeupdate and this.isPlaying is false and retry play"),this.$videoElement.play())})),this.player.debug.log("Video","init")}destroy(){super.destroy(),this.$canvasElement=null,this.canvasContext=null,this.$videoElement&&(this.$videoElement.pause(),this.$videoElement.currentTime=0,this.$videoElement.src="",this.$videoElement.removeAttribute("src"),this.$videoElement=null),this.trackGenerator&&(this.trackGenerator.stop(),this.trackGenerator=null),this.vwriter&&(this.vwriter.close(),this.vwriter=null),this.player.$container.contains(this.$posterElement)&&this.$posterElement&&this.player.$container.removeChild(this.$posterElement),this.player.debug.log("Video","destroy")}fixChromeVideoFlashBug(){const e=function(){const e=navigator.userAgent.toLowerCase(),t={},i={IE:window.ActiveXObject||"ActiveXObject"in window,Chrome:e.indexOf("chrome")>-1&&e.indexOf("safari")>-1,Firefox:e.indexOf("firefox")>-1,Opera:e.indexOf("opera")>-1,Safari:e.indexOf("safari")>-1&&-1===e.indexOf("chrome"),Edge:e.indexOf("edge")>-1,QQBrowser:/qqbrowser/.test(e),WeixinBrowser:/MicroMessenger/i.test(e)};for(let r in i)if(i[r]){let i="";if("IE"===r)i=e.match(/(msie\s|trident.*rv:)([\w.]+)/)[2];else if("Chrome"===r){for(const e in navigator.mimeTypes)"application/360softmgrplugin"===navigator.mimeTypes[e].type&&(r="360");i=e.match(/chrome\/([\d.]+)/)[1]}else"Firefox"===r?i=e.match(/firefox\/([\d.]+)/)[1]:"Opera"===r?i=e.match(/opera\/([\d.]+)/)[1]:"Safari"===r?i=e.match(/version\/([\d.]+)/)[1]:"Edge"===r?i=e.match(/edge\/([\d.]+)/)[1]:"QQBrowser"===r&&(i=e.match(/qqbrowser\/([\d.]+)/)[1]);t.type=r,t.version=parseInt(i)}return t}().type.toLowerCase();if("chrome"===e||"edge"===e){this.player.$container.style.backdropFilter="blur(0px)"}}play(){if(this.$videoElement){const e=this._getVideoReadyState();if(this.player.debug.log("Video",`play and readyState: ${e}`),0===e)return this.player.debug.warn("Video","readyState is 0 and set _delayPlay to true"),void(this._delayPlay=!0);this._play()}}_getVideoReadyState(){let e=0;return this.$videoElement&&(e=this.$videoElement.readyState),e}_play(){this.$videoElement&&this.$videoElement.play().then((()=>{this._delayPlay=!1,this.player.debug.log("Video","_play success"),setTimeout((()=>{this.isPlaying()||(this.player.debug.warn("Video","play failed and retry play"),this._play())}),100)})).catch((e=>{this.player.debug.error("Video","_play error",e)}))}pause(e){e?this.$videoElement&&this.$videoElement.pause():setTimeout((()=>{this.$videoElement&&this.$videoElement.pause()}),100),this._poster()}clearView(){}screenshot(e,t,i,r){var n,s;e=e||q()+"",r=r||O.download,t=t||"png";const o={png:"image/png",jpeg:"image/jpeg",webp:"image/webp"};"number"!=typeof i&&(i=Number(i||.92));const a=this.$videoElement,h=this.$canvasElement;h.width=a.videoWidth,h.height=a.videoHeight,null===(n=this.canvasContext)||void 0===n||n.drawImage(a,0,0,h.width,h.height);const l=h.toDataURL(o[t]||o.png,i);if(null===(s=this.canvasContext)||void 0===s||s.clearRect(0,0,h.width,h.height),h.width=0,h.height=0,r===O.base64)return l;{const t=H(l);if(r===O.blob)return t;r===O.download&&le(t,e)}}initCanvasViewSize(){this.resize()}_poster(){const e=this.screenshot("poster","png",.92,O.base64);this.$posterElement.src=e,this.$posterElement.style.position="absolute",this.$posterElement.style.top="0px",this.$posterElement.style.left="0px",this.$posterElement.style.zIndex="1",this.$posterElement.style.objectFit="contain",this.$posterElement.style.pointerEvents="none",this.player.$container.appendChild(this.$posterElement),this.resize()}render(e){this.vwriter&&this.vwriter.write(e.videoFrame)}resize(){this._resizeElement(this.$videoElement),this._resizeElement(this.$posterElement)}_resizeElement(e){const t=this.player.width,i=this.player.height,r=this.player._opt,n=r.rotate;e.width=t,e.height=i,270!==n&&90!==n||(e.width=i,e.height=t);const s=(t-e.width)/2,o=(i-e.height)/2;let a="contain";r.scaleMode===x.full&&(a="fill"),r.scaleMode===x.fullAuto&&(a="cover"),e.style.objectFit=a,e.style.transform="rotate("+n+"deg)",e.style.left=s+"px",e.style.top=o+"px"}isPlaying(){return this.$videoElement&&!this.$videoElement.paused}}class Ht extends Ce{constructor(e,t){super(e,t,zt),this._opt=t,this._opt.useMSE=!1,this._createPlayer(t),this.debug.log("Hard Player options",this._opt)}close(){throw new Error("Method not implemented.")}_createPlayer(e){var t;this._opt=Object.assign({},this._opt,e),this.events||(this.events=new Te(this)),this.video||(this.video=new zt(this)),null===(t=Qt.LoggingControl)||void 0===t||t.applyConfig({globalTag:"EzuikitFlv",enableVerbose:!!this._opt.debug,enableDebug:!!this._opt.debug,enableInfo:!!this._opt.debug,enableWarn:!!this._opt.debug,enableError:!0}),this.player=Qt.createPlayer({type:"flv",url:e.url,isLive:!0},{stashInitialSize:128,enableWorker:!0,liveBufferLatencyChasing:!0}),this.player.attachMediaElement(this.video.$videoElement),this.loaded=!0,this._flvEvents()}_flvEvents(){this.player&&(this.player.on(Qt.Events.ERROR,((e,t,i)=>{"MediaError"===e&&"MediaMSEError"===t&&9===i.code?this.emit(R.mediaSourceH265NotSupport,i):"NetworkError"===e?(this.emit(R.fetchError,i),this.player&&(this.destroy(),this._createPlayer(this._opt))):"OTHER_ERROR"===e&&this.emit(R.websocketError,i),Gt.report("error",{event:e,value:i}),this.debug.error(`${Qt.Events.ERROR}`,e,t,i)})),this.player.on(Qt.Events.LOADING_COMPLETE,(e=>{this.debug.log(`${Qt.Events.LOADING_COMPLETE}`,e)})),this.player.on(Qt.Events.RECOVERED_EARLY_EOF,(e=>{this.debug.log(`${Qt.Events.RECOVERED_EARLY_EOF}`,e)})),this.player.on(Qt.Events.MEDIA_INFO,(e=>{this.video.updateVideoInfo({encTypeCode:(null==e?void 0:e.videoCodec.indexOf("avc"))>=0?7:12,width:e.width,height:e.height})})),this.player.on(Qt.Events.STATISTICS_INFO,(e=>{})),this.player.on(Qt.Events.DESTROYING,(e=>{this.debug.log(`${Qt.Events.DESTROYING}`,e)})))}getOption(){return this._opt}emitError(e,t=""){this.emit(w.error,e,t),this.emit(e,t)}destroy(){this.player&&(this.player.pause(),this.player.unload(),this.player.detachMediaElement(),this.player.destroy(),this.player=null),this._loading=!1,this._playing=!1,this._hasLoaded=!1,this._lastVolume=null,this._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},this.video&&(this.video.destroy(),this.video=null),this.events&&(this.events.destroy(),this.events=null),this.resetStats(),this._audioTimestamp=0,this._videoTimestamp=0,this.emit("destroy"),this.off(),this.debug.log("play","destroy end")}resetStats(){}set fullscreen(e){Z()&&this._opt.useWebFullScreen?(this.emit(w.webFullscreen,e),setTimeout((()=>{this.updateOption({rotate:e?270:0}),this.resize()}),10)):this.emit(w.fullscreen,e)}get fullscreen(){return K()||this.webFullscreen}set webFullscreen(e){this.emit(w.webFullscreen,e)}get webFullscreen(){return this.$container.classList.contains("flv-fullscreen-web")}set loaded(e){this._hasLoaded=e}get loaded(){return this._hasLoaded}set playing(e){e&&(this.loading=!1),this.playing!==e&&(this._playing=e,this.emit(w.playing,e),this.emit(w.volumechange,this.volume),e?this.emit(w.play):this.emit(w.pause))}get playing(){return this._playing}get volume(){return this.video&&this.video.$videoElement.volume||0}set volume(e){e!==this.volume&&this.video&&(this.video.$videoElement.muted=!1,this.video.$videoElement.volume=e,this._lastVolume=e),0===e?this.emit(w.mute,!0):this.emit(w.mute,!1)}get lastVolume(){return this._lastVolume}set loading(e){this.loading!==e&&(this._loading=e,this.emit(w.loading,this._loading))}get loading(){return this._loading}set audioTimestamp(e){null!==e&&(this._audioTimestamp=e)}get audioTimestamp(){return this._audioTimestamp}set videoTimestamp(e){null!==e&&(this._videoTimestamp=e)}get videoTimestamp(){return this._videoTimestamp}get isDebug(){return!0===this._opt.debug}checkHeart(){this.clearCheckHeartTimeout(),this.checkHeartTimeout()}clearCheckHeartTimeout(){}checkHeartTimeout(){this._checkHeartTimeout=setTimeout((()=>{if(this.playing){if(0!==this._stats.fps)return;this.pause().then((()=>{this.emit(w.timeout,w.delayTimeout),this.emit(w.delayTimeout)}))}}),1e3*this._opt.heartTimeout)}checkLoadingTimeout(){this._checkLoadingTimeout=setTimeout((()=>{this.playing||this.pause().then((()=>{this.emit(w.timeout,w.loadingTimeout),this.emit(w.loadingTimeout)}))}),1e3*this._opt.loadingTimeout)}handleRender(){this.loading&&(this.emit(w.start),this.loading=!1,this.clearCheckLoadingTimeout()),this.playing||(this.playing=!0),this.checkHeart()}clearCheckLoadingTimeout(){throw new Error("Method not implemented.")}updateOption(e){var t;null===(t=Qt.LoggingControl)||void 0===t||t.applyConfig({globalTag:"EzuikitFlv",enableVerbose:!!e.debug,enableDebug:!!e.debug,enableInfo:!!e.debug,enableWarn:!!e.debug,enableError:!0}),this._opt=Object.assign({},this._opt,e)}play(){return this.player&&this.player.playing?this.pause().then((e=>this._play())):this._play()}_play(){return this.loading=!0,this.playing=!1,this._times.playInitStart=q(),this.clearCheckHeartTimeout(),this.player?(this.player.load(),new Promise(((e,t)=>this.player.play().then((()=>{e(),this.loading=!1,this.playing=!0,this._opt.isNotMute&&this.mute(!1)})).catch((e=>{t(e)}))))):Promise.reject()}_close(){return new Promise((e=>{this._loading=!1,this._playing=!1,this._hasLoaded=!1,this._lastVolume=null,this._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},this.video&&(this.video.resetInit(),this.video.pause(!0)),this.player&&(this.player.pause(),this.player.unload(),this.player.detachMediaElement(),this.player.destroy()),this.resetStats(),this._audioTimestamp=0,this._videoTimestamp=0,this._createPlayer(this._opt),setTimeout((()=>{e()}),0)}))}pause(){return this._close()}resumeAudioAfterPause(){}mute(e){this.volume=e?0:.5}resize(){this.video.resize()}}class qt{constructor(e,t){this._opt=Object.assign({},s,t),Z()&&(this._opt.useMSE=!1);return new(qt.getLoaderFactory(this._opt.useMSE))(e,this._opt)}static getLoaderFactory(e){return Gt.report("player-loader",{event:e?"hard":"soft"}),e?Ht:jt}}Gt.initMonitor();class $t extends ie{constructor(e){super();const t=e;let i=e.container;if("string"==typeof e.container&&(i=document.querySelector(e.container)),!i)throw new Error("Flv need container option");if("CANVAS"===i.nodeName||"VIDEO"===i.nodeName)throw new Error(`Flv container type can not be ${i.nodeName} type`);if(!e.url)throw new Error("Flv url is empty");if(t.videoBuffer>=t.heartTimeout)throw new Error(`Flv videoBuffer ${t.videoBuffer}s must be less than heartTimeout ${t.heartTimeout}s`);i.classList.add("flv-container"),i.style.position="relative",delete t.container,t.forceNoOffscreen=!0,ee(t.videoBuffer)&&(t.videoBuffer=1e3*Number(t.videoBuffer)),ee(t.timeout)&&(J(t.loadingTimeout)&&(t.loadingTimeout=t.timeout),J(t.heartTimeout)&&(t.heartTimeout=t.timeout)),this._opt=t,this.$container=i,this._loadingTimeoutReplayTimes=0,this._heartTimeoutReplayTimes=0,this.events=new Te(this),this._initPlayer(i,t)}destroy(){this.events&&(this.events.destroy(),this.events=null),this.player&&(this.player.destroy(),this.player=null),this.$container=null,this._opt={},this._loadingTimeoutReplayTimes=0,this._heartTimeoutReplayTimes=0,this.off(),Gt.report("api",{event:"destroy"})}_initPlayer(e,t){t.url&&(t.url=Vt(t.url)),this.player=new qt(e,t),this._bindEvents()}_resetPlayer(e={}){this.player.destroy(),this.player=null,this._opt=Object.assign(this._opt,e),this._initPlayer(this.$container,this._opt)}_bindEvents(){Object.keys(T).forEach((e=>{this.player.on(T[e],(t=>{this.emit(e,t)}))}))}setDebug(e){this.player.updateOption({debug:e}),Gt.report("api",{event:"setDebug"})}closeSound(){this.player&&this.player.mute(!0),Gt.report("api",{event:"closeSound"})}openSound(){this.player&&this.player.mute(!1),Gt.report("api",{event:"openSound"})}setVolume(e){this.player.volume=e,Gt.report("api",{event:"setVolume",value:e})}getVolume(){return Gt.report("api",{event:"getVolume"}),this.player.volume}audioResume(){this.player.audio&&this.player.audio.audioEnabled(!0),Gt.report("api",{event:"audioResume"})}setTimeout(e){e=Number(e),this.player.updateOption({timeout:e,loadingTimeout:e,heartTimeout:e})}setScaleMode(e){return new Promise(((t,i)=>{try{e=Number(e)}catch(e){return void i(e)}[x.full,x.auto,x.fullAuto].includes(e)?(this.player.updateOption({scaleMode:e}),this.resize(),t(),Gt.report("api",{event:"setScaleMode"})):i("scale mode 0 | 1 | 2")}))}pause(){return Gt.report("api",{event:"pause"}),this.player&&this.player.pause()}close(){return this._opt.url="",this._opt.playOptions={},this._opt.urlQuery={},Gt.report("api",{event:"close"}),this.player.close()}clearView(){this.player.video.clearView(),Gt.report("api",{event:"clearView"})}play(e={}){const t=Vt(e.url||this._opt.url);return this._opt=Object.assign({},this._opt,e||{},{url:t}),this._opt.urlQuery=function(e){if(/http[s]?:\/\/|ws[s]?:\/\//.test(e)){const t=e.split("?")[1],i=t?t.split("&"):[],r={};for(let e=0;e<i.length;++e){const[t,n]=i[e].split("=");r[t]=r[t]||decodeURIComponent(n)}try{const t=e.split(".flv")[0].split("/"),i=t[t.length-1].split("_");t.length>0&&i[0]&&i[1]&&i[2]&&(r.DeviceSerial=i[0],r.ChannelNo=i[1],r.Bitstream=i[2])}catch(e){}return r}return{}}(e.url),Gt.report("api",{event:"play"}),new Promise(((e,t)=>{if(!this._opt.url)return this.emit(w.error,R.playError),void t("play url is empty");this.player&&this.player.playing?(this.clearView(),this.player.play(this._opt).then((()=>{e(),this.player.resumeAudioAfterPause()})).catch((e=>{this.player.debug.warn("Flv","pause -> play and play error",e),this.player.pause().then((()=>{t(e)}))}))):this._play(this._opt).then((()=>{e()})).catch((e=>{t(e)}))}))}_play(e={}){return new Promise(((s,o)=>{const a=0===e.url.indexOf("http"),h=a?i:t,l=a||-1!==e.url.indexOf(".flv")||this._opt.isFlv?r:n;this.player.updateOption({protocol:h,demuxType:l}),this.player.once(R.webglAlignmentError,(()=>{this.pause().then((()=>{this.player.debug.log("Flv","webglAlignmentError"),this._resetPlayer({openWebglAlignment:!0}),this.play(e).then((()=>{this.player.debug.log("Flv","webglAlignmentError and play success")})).catch((()=>{this.player.debug.log("Flv","webglAlignmentError and play error")}))}))})),this.player.once(R.mediaSourceH265NotSupport,(()=>{this.pause().then((()=>{this.player._opt.autoWasm&&(this.player.debug.log("Flv","auto wasm [mse-> wasm] reset player and play"),this._resetPlayer({useMSE:!1}),this.play(e).then((()=>{this.player.debug.log("Flv","auto wasm [mse-> wasm] reset player and play success")})).catch((()=>{this.player.debug.log("Flv","auto wasm [mse-> wasm] reset player and play error")})))}))})),this.player.once(R.mediaSourceFull,(()=>{this.pause().then((()=>{this.player.debug.log("Flv","media source full"),this._resetPlayer(),this.play(e).then((()=>{this.player.debug.log("Flv","media source full and reset player and play success")})).catch((()=>{this.player.debug.warn("Flv","media source full and reset player and play error")}))}))})),this.player.once(R.mediaSourceAppendBufferError,(()=>{this.pause().then((()=>{this.player.debug.log("Flv","media source append buffer error"),this._resetPlayer(),this.play(e).then((()=>{this.player.debug.log("Flv","media source append buffer error and reset player and play success")})).catch((()=>{this.player.debug.warn("Flv","media source append buffer error and reset player and play error")}))}))})),this.player.once(R.mediaSourceBufferListLarge,(()=>{this.pause().then((()=>{this.player.debug.log("Flv","media source buffer list large"),this._resetPlayer(),this.play(e).then((()=>{this.player.debug.log("Flv","media source buffer list large and reset player and play success")})).catch((()=>{this.player.debug.warn("Flv","media source buffer list large and reset player and play error")}))}))})),this.player.once(R.mediaSourceAppendBufferEndTimeout,(()=>{this.pause().then((()=>{this.player.debug.log("Flv","media source append buffer end timeout"),this._resetPlayer(),this.play(e).then((()=>{this.player.debug.log("Flv","media source append buffer end timeout and reset player and play success")})).catch((()=>{this.player.debug.warn("Flv","media source append buffer end timeout and reset player and play error")}))}))})),this.player.once(R.mseSourceBufferError,(()=>{this.pause().then((()=>{this.player.debug.log("Flv","mseSourceBufferError close success")}))})),this.player.once(R.webcodecsH265NotSupport,(()=>{this.pause().then((()=>{this.player._opt.autoWasm&&(this.player.debug.log("Flv","auto wasm [wcs-> wasm] reset player and play"),this._resetPlayer({useWCS:!1}),this.play(e).then((()=>{this.player.debug.log("Flv","auto wasm [wcs-> wasm] reset player and play success")})).catch((()=>{this.player.debug.warn("Flv","auto wasm [wcs-> wasm] reset player and play error")})))}))})),this.player.once(R.webcodecsWidthOrHeightChange,(()=>{this.pause().then((()=>{this.player.debug.log("Flv","webcodecs Width Or Height Change reset player and play"),this._resetPlayer({useWCS:!0}),this.play(e).then((()=>{this.player.debug.log("Flv","webcodecs Width Or Height Change reset player and play success")})).catch((()=>{this.player.debug.warn("Flv","webcodecs Width Or Height Change reset player and play error")}))}))})),this.player.once(R.webcodecsDecodeError,(()=>{this.pause().then((()=>{this.player._opt.autoWasm&&(this.player.debug.log("Flv","webcodecs decode error reset player and play"),this._resetPlayer({useWCS:!1}),this.play(e).then((()=>{this.player.debug.log("Flv","webcodecs decode error reset player and play success")})).catch((()=>{this.player.debug.warn("Flv","webcodecs decode error reset player and play error")})))}))})),this.player.once(R.wasmDecodeError,(()=>{this.player._opt.wasmDecodeErrorReplay&&this.pause().then((()=>{this.player.debug.log("Flv","wasm decode error and reset player and play"),this._resetPlayer({useWCS:!1}),this.play(e).then((()=>{this.player.debug.log("Flv","wasm decode error and reset player and play success")})).catch((()=>{this.player.debug.warn("Flv","wasm decode error and reset player and play error")}))}))})),this.player.on(w.delayTimeout,(()=>{this.player._opt.heartTimeoutReplay&&(this._heartTimeoutReplayTimes<this.player._opt.heartTimeoutReplayTimes||-1===this.player._opt.heartTimeoutReplayTimes)&&(this.player.debug.log("Flv",`delay timeout replay time is ${this._heartTimeoutReplayTimes}`),this._heartTimeoutReplayTimes+=1,this.play(e).then((()=>{this._heartTimeoutReplayTimes=0})).catch((()=>{})))})),this.player.on(w.loadingTimeout,(()=>{this.player._opt.loadingTimeoutReplay&&(this._loadingTimeoutReplayTimes<this.player._opt.loadingTimeoutReplayTimes||-1===this.player._opt.loadingTimeoutReplayTimes)&&(this.player.debug.log("Flv",`loading timeout replay time is ${this._loadingTimeoutReplayTimes}`),this._loadingTimeoutReplayTimes+=1,this.play(e).then((()=>{this._loadingTimeoutReplayTimes=0})).catch((()=>{})))})),this.hasLoaded()?this.player.play(e).then((()=>{s()})).catch((e=>{this.player.debug.warn("Flv","hasLoaded and play error",e),this.player.pause().then((()=>{o(e)}))})):this.player.once(w.decoderWorkerInit,(()=>{this.player.play(e).then((()=>{s()})).catch((e=>{this.player.debug.warn("Flv","decoderWorkerInit and play error",e),this.player.pause().then((()=>{o(e)}))}))}))}))}resize(){this.player.resize(),Gt.report("api",{event:"resize"})}setBufferTime(e){e=Number(e),this.player.updateOption({videoBuffer:1e3*e}),this.player.decoderWorker&&this.player.decoderWorker.updateWorkConfig({key:"videoBuffer",value:1e3*e})}setRotate(e){Gt.report("api",{event:"setRotate",value:e});try{e=parseInt(e,10)}catch(e){return Promise.reject("rotate 0 | 90 | 180 | 270")}const t=[0,90,180,270];return new Promise(((i,r)=>{t.includes(e)?(this.player.updateOption({rotate:e}),this.resize(),i()):r("rotate 0 | 90 | 180 | 270")}))}hasLoaded(){return this.player.loaded}setKeepScreenOn(){this.player.updateOption({keepScreenOn:!0}),Gt.report("api",{event:"setKeepScreenOn"})}_setFullscreen(e){const t=!!e;this.player.fullscreen!==t&&(this.player.fullscreen=t)}fullScreen(){this._setFullscreen(!0),Gt.report("api",{event:"fullScreen"})}cancelFullScreen(){this._setFullscreen(!1),Gt.report("api",{event:"cancelFullScreen"})}getState(){return{playing:!!this.player&&this.player.playing,mute:!(this.player&&this.player.volume>0),fullscreen:!!this.player&&this.player.fullscreen,webFullscreen:!!this.player&&this.player.webFullscreen,loaded:!!this.player&&this.player.loaded,volume:this.player?parseFloat(this.player.volume).toFixed(2):0,isDebug:!!this.player&&this.player.isDebug}}getVersion(){return Gt.report("api",{event:"getVersion",value:"1.0.0-alpha.0"}),"1.0.0-alpha.0"}}return e($t,"ERROR",R),e($t,"TIMEOUT",{loadingTimeout:w.loadingTimeout,delayTimeout:w.delayTimeout}),$t}));
15
- //# sourceMappingURL=index.js.map
14
+ var r;r=function(){function e(e){return"function"==typeof e}var r=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},n=0,s=void 0,o=void 0,a=function(e,t){p[n]=e,p[n+1]=t,2===(n+=2)&&(o?o(f):v())},h="undefined"!=typeof window?window:void 0,l=h||{},d=l.MutationObserver||l.WebKitMutationObserver,u="undefined"==typeof self&&void 0!==t&&"[object process]"==={}.toString.call(t),A="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function c(){var e=setTimeout;return function(){return e(f,1)}}var p=new Array(1e3);function f(){for(var e=0;e<n;e+=2)(0,p[e])(p[e+1]),p[e]=void 0,p[e+1]=void 0;n=0}var m,_,g,y,v=void 0;function E(e,t){var i=this,r=new this.constructor(w);void 0===r[S]&&x(r);var n=i._state;if(n){var s=arguments[n-1];a((function(){return D(n,r,s,i._result)}))}else L(i,r,e,t);return r}function b(e){if(e&&"object"==typeof e&&e.constructor===this)return e;var t=new this(w);return R(t,e),t}u?v=function(){return t.nextTick(f)}:d?(_=0,g=new d(f),y=document.createTextNode(""),g.observe(y,{characterData:!0}),v=function(){y.data=_=++_%2}):A?((m=new MessageChannel).port1.onmessage=f,v=function(){return m.port2.postMessage(0)}):v=void 0===h?function(){try{var e=Function("return this")().require("vertx");return void 0!==(s=e.runOnLoop||e.runOnContext)?function(){s(f)}:c()}catch(e){return c()}}():c();var S=Math.random().toString(36).substring(2);function w(){}function T(t,i,r){i.constructor===t.constructor&&r===E&&i.constructor.resolve===b?function(e,t){1===t._state?k(e,t._result):2===t._state?I(e,t._result):L(t,void 0,(function(t){return R(e,t)}),(function(t){return I(e,t)}))}(t,i):void 0===r?k(t,i):e(r)?function(e,t,i){a((function(e){var r=!1,n=function(e,t,i,r){try{e.call(t,i,r)}catch(e){return e}}(i,t,(function(i){r||(r=!0,t!==i?R(e,i):k(e,i))}),(function(t){r||(r=!0,I(e,t))}),e._label);!r&&n&&(r=!0,I(e,n))}),e)}(t,i,r):k(t,i)}function R(e,t){if(e===t)I(e,new TypeError("You cannot resolve a promise with itself"));else if(n=typeof(r=t),null===r||"object"!==n&&"function"!==n)k(e,t);else{var i=void 0;try{i=t.then}catch(t){return void I(e,t)}T(e,t,i)}var r,n}function C(e){e._onerror&&e._onerror(e._result),O(e)}function k(e,t){void 0===e._state&&(e._result=t,e._state=1,0!==e._subscribers.length&&a(O,e))}function I(e,t){void 0===e._state&&(e._state=2,e._result=t,a(C,e))}function L(e,t,i,r){var n=e._subscribers,s=n.length;e._onerror=null,n[s]=t,n[s+1]=i,n[s+2]=r,0===s&&e._state&&a(O,e)}function O(e){var t=e._subscribers,i=e._state;if(0!==t.length){for(var r=void 0,n=void 0,s=e._result,o=0;o<t.length;o+=3)r=t[o],n=t[o+i],r?D(i,r,n,s):n(s);e._subscribers.length=0}}function D(t,i,r,n){var s=e(r),o=void 0,a=void 0,h=!0;if(s){try{o=r(n)}catch(e){h=!1,a=e}if(i===o)return void I(i,new TypeError("A promises callback cannot return that same promise."))}else o=n;void 0!==i._state||(s&&h?R(i,o):!1===h?I(i,a):1===t?k(i,o):2===t&&I(i,o))}var B=0;function x(e){e[S]=B++,e._state=void 0,e._result=void 0,e._subscribers=[]}var M=function(){function e(e,t){this._instanceConstructor=e,this.promise=new e(w),this.promise[S]||x(this.promise),r(t)?(this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0===this.length?k(this.promise,this._result):(this.length=this.length||0,this._enumerate(t),0===this._remaining&&k(this.promise,this._result))):I(this.promise,new Error("Array Methods must be provided an Array"))}return e.prototype._enumerate=function(e){for(var t=0;void 0===this._state&&t<e.length;t++)this._eachEntry(e[t],t)},e.prototype._eachEntry=function(e,t){var i=this._instanceConstructor,r=i.resolve;if(r===b){var n=void 0,s=void 0,o=!1;try{n=e.then}catch(e){o=!0,s=e}if(n===E&&void 0!==e._state)this._settledAt(e._state,t,e._result);else if("function"!=typeof n)this._remaining--,this._result[t]=e;else if(i===P){var a=new i(w);o?I(a,s):T(a,e,n),this._willSettleAt(a,t)}else this._willSettleAt(new i((function(t){return t(e)})),t)}else this._willSettleAt(r(e),t)},e.prototype._settledAt=function(e,t,i){var r=this.promise;void 0===r._state&&(this._remaining--,2===e?I(r,i):this._result[t]=i),0===this._remaining&&k(r,this._result)},e.prototype._willSettleAt=function(e,t){var i=this;L(e,void 0,(function(e){return i._settledAt(1,t,e)}),(function(e){return i._settledAt(2,t,e)}))},e}(),P=function(){function t(e){this[S]=B++,this._result=this._state=void 0,this._subscribers=[],w!==e&&("function"!=typeof e&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof t?function(e,t){try{t((function(t){R(e,t)}),(function(t){I(e,t)}))}catch(t){I(e,t)}}(this,e):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return t.prototype.catch=function(e){return this.then(null,e)},t.prototype.finally=function(t){var i=this.constructor;return e(t)?this.then((function(e){return i.resolve(t()).then((function(){return e}))}),(function(e){return i.resolve(t()).then((function(){throw e}))})):this.then(t,t)},t}();return P.prototype.then=E,P.all=function(e){return new M(this,e).promise},P.race=function(e){var t=this;return r(e)?new t((function(i,r){for(var n=e.length,s=0;s<n;s++)t.resolve(e[s]).then(i,r)})):new t((function(e,t){return t(new TypeError("You must pass an array to race."))}))},P.resolve=b,P.reject=function(e){var t=new this(w);return I(t,e),t},P._setScheduler=function(e){o=e},P._setAsap=function(e){a=e},P._asap=a,P.polyfill=function(){var e=void 0;if(void 0!==i)e=i;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var t=e.Promise;if(t){var r=null;try{r=Object.prototype.toString.call(t.resolve())}catch(e){}if("[object Promise]"===r&&!t.cast)return}e.Promise=P},P.Promise=P,P},e.exports=r()}).call(this,i(16),i(17))},function(e,t){var i,r,n=e.exports={};function s(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(e){if(i===setTimeout)return setTimeout(e,0);if((i===s||!i)&&setTimeout)return i=setTimeout,setTimeout(e,0);try{return i(e,0)}catch(t){try{return i.call(null,e,0)}catch(t){return i.call(this,e,0)}}}!function(){try{i="function"==typeof setTimeout?setTimeout:s}catch(e){i=s}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(e){r=o}}();var h,l=[],d=!1,u=-1;function A(){d&&h&&(d=!1,h.length?l=h.concat(l):u=-1,l.length&&c())}function c(){if(!d){var e=a(A);d=!0;for(var t=l.length;t;){for(h=l,l=[];++u<t;)h&&h[u].run();u=-1,t=l.length}h=null,d=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===o||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function f(){}n.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var i=1;i<arguments.length;i++)t[i-1]=arguments[i];l.push(new p(e,t)),1!==l.length||d||a(c)},p.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=f,n.addListener=f,n.once=f,n.off=f,n.removeListener=f,n.removeAllListeners=f,n.emit=f,n.prependListener=f,n.prependOnceListener=f,n.listeners=function(e){return[]},n.binding=function(e){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(e){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},function(e,t){var i;i=function(){return this}();try{i=i||new Function("return this")()}catch(e){"object"==typeof window&&(i=window)}e.exports=i},function(e,t,i){i.r(t);var r=i(9),n=i(12),s=i(10),o=i(1);t.default=function(e){var t=null,i=function(t,i){e.postMessage({msg:"logcat_callback",data:{type:t,logcat:i}})}.bind(this);function a(t,i){var r={msg:o.a.INIT_SEGMENT,data:{type:t,data:i}};e.postMessage(r,[i.data])}function h(t,i){var r={msg:o.a.MEDIA_SEGMENT,data:{type:t,data:i}};e.postMessage(r,[i.data])}function l(){var t={msg:o.a.LOADING_COMPLETE};e.postMessage(t)}function d(){var t={msg:o.a.RECOVERED_EARLY_EOF};e.postMessage(t)}function u(t){var i={msg:o.a.MEDIA_INFO,data:t};e.postMessage(i)}function A(t){var i={msg:o.a.METADATA_ARRIVED,data:t};e.postMessage(i)}function c(t){var i={msg:o.a.SCRIPTDATA_ARRIVED,data:t};e.postMessage(i)}function p(t){var i={msg:o.a.TIMED_ID3_METADATA_ARRIVED,data:t};e.postMessage(i)}function f(t){var i={msg:o.a.PES_PRIVATE_DATA_DESCRIPTOR,data:t};e.postMessage(i)}function m(t){var i={msg:o.a.PES_PRIVATE_DATA_ARRIVED,data:t};e.postMessage(i)}function _(t){var i={msg:o.a.STATISTICS_INFO,data:t};e.postMessage(i)}function g(t,i){e.postMessage({msg:o.a.IO_ERROR,data:{type:t,info:i}})}function y(t,i){e.postMessage({msg:o.a.DEMUX_ERROR,data:{type:t,info:i}})}function v(t){e.postMessage({msg:o.a.RECOMMEND_SEEKPOINT,data:t})}n.a.install(),e.addEventListener("message",(function(n){switch(n.data.cmd){case"init":(t=new s.a(n.data.param[0],n.data.param[1])).on(o.a.IO_ERROR,g.bind(this)),t.on(o.a.DEMUX_ERROR,y.bind(this)),t.on(o.a.INIT_SEGMENT,a.bind(this)),t.on(o.a.MEDIA_SEGMENT,h.bind(this)),t.on(o.a.LOADING_COMPLETE,l.bind(this)),t.on(o.a.RECOVERED_EARLY_EOF,d.bind(this)),t.on(o.a.MEDIA_INFO,u.bind(this)),t.on(o.a.METADATA_ARRIVED,A.bind(this)),t.on(o.a.SCRIPTDATA_ARRIVED,c.bind(this)),t.on(o.a.TIMED_ID3_METADATA_ARRIVED,p.bind(this)),t.on(o.a.PES_PRIVATE_DATA_DESCRIPTOR,f.bind(this)),t.on(o.a.PES_PRIVATE_DATA_ARRIVED,m.bind(this)),t.on(o.a.STATISTICS_INFO,_.bind(this)),t.on(o.a.RECOMMEND_SEEKPOINT,v.bind(this));break;case"destroy":t&&(t.destroy(),t=null),e.postMessage({msg:"destroyed"});break;case"start":t.start();break;case"stop":t.stop();break;case"seek":t.seek(n.data.param);break;case"pause":t.pause();break;case"resume":t.resume();break;case"logging_config":var E=n.data.param;r.a.applyConfig(E),!0===E.enableCallback?r.a.addLogListener(i):r.a.removeLogListener(i)}}))}},function(e,t,i){i.r(t);var r=i(12),n=i(11),s={enableWorker:!1,enableStashBuffer:!0,stashInitialSize:void 0,isLive:!1,liveBufferLatencyChasing:!1,liveBufferLatencyMaxLatency:1.5,liveBufferLatencyMinRemain:.5,lazyLoad:!0,lazyLoadMaxDuration:180,lazyLoadRecoverDuration:30,deferLoadAfterSourceOpen:!0,autoCleanupMaxBackwardDuration:180,autoCleanupMinBackwardDuration:120,statisticsInfoReportInterval:600,fixAudioTimestampGap:!0,accurateSeek:!1,seekType:"range",seekParamStart:"bstart",seekParamEnd:"bend",rangeLoadZeroStart:!1,customSeekHandler:void 0,reuseRedirectedURL:!1,headers:void 0,customLoader:void 0};function o(){return Object.assign({},s)}var a=function(){function e(){}return e.supportMSEH264Playback=function(){return window.MediaSource&&window.MediaSource.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"')},e.supportNetworkStreamIO=function(){var e=new n.a({},o()),t=e.loaderType;return e.destroy(),"fetch-stream-loader"==t||"xhr-moz-chunked-loader"==t},e.getNetworkLoaderTypeName=function(){var e=new n.a({},o()),t=e.loaderType;return e.destroy(),t},e.supportNativeMediaPlayback=function(t){null==e.videoElement&&(e.videoElement=window.document.createElement("video"));var i=e.videoElement.canPlayType(t);return"probably"===i||"maybe"==i},e.getFeatureList=function(){var t={msePlayback:!1,mseLivePlayback:!1,networkStreamIO:!1,networkLoaderName:"",nativeMP4H264Playback:!1,nativeWebmVP8Playback:!1,nativeWebmVP9Playback:!1};return t.msePlayback=e.supportMSEH264Playback(),t.networkStreamIO=e.supportNetworkStreamIO(),t.networkLoaderName=e.getNetworkLoaderTypeName(),t.mseLivePlayback=t.msePlayback&&t.networkStreamIO,t.nativeMP4H264Playback=e.supportNativeMediaPlayback('video/mp4; codecs="avc1.42001E, mp4a.40.2"'),t.nativeWebmVP8Playback=e.supportNativeMediaPlayback('video/webm; codecs="vp8.0, vorbis"'),t.nativeWebmVP9Playback=e.supportNativeMediaPlayback('video/webm; codecs="vp9"'),t},e}(),h=i(2),l=i(6),d=i.n(l),u=i(0),A=i(4),c={ERROR:"error",LOADING_COMPLETE:"loading_complete",RECOVERED_EARLY_EOF:"recovered_early_eof",MEDIA_INFO:"media_info",METADATA_ARRIVED:"metadata_arrived",SCRIPTDATA_ARRIVED:"scriptdata_arrived",TIMED_ID3_METADATA_ARRIVED:"timed_id3_metadata_arrived",PES_PRIVATE_DATA_DESCRIPTOR:"pes_private_data_descriptor",PES_PRIVATE_DATA_ARRIVED:"pes_private_data_arrived",STATISTICS_INFO:"statistics_info"},p=i(13),f=i.n(p),m=i(9),_=i(10),g=i(1),y=i(8),v=function(){function e(e,t){if(this.TAG="Transmuxer",this._emitter=new d.a,t.enableWorker&&"undefined"!=typeof Worker)try{this._worker=f()(18),this._workerDestroying=!1,this._worker.addEventListener("message",this._onWorkerMessage.bind(this)),this._worker.postMessage({cmd:"init",param:[e,t]}),this.e={onLoggingConfigChanged:this._onLoggingConfigChanged.bind(this)},m.a.registerListener(this.e.onLoggingConfigChanged),this._worker.postMessage({cmd:"logging_config",param:m.a.getConfig()})}catch(i){u.a.e(this.TAG,"Error while initialize transmuxing worker, fallback to inline transmuxing"),this._worker=null,this._controller=new _.a(e,t)}else this._controller=new _.a(e,t);if(this._controller){var i=this._controller;i.on(g.a.IO_ERROR,this._onIOError.bind(this)),i.on(g.a.DEMUX_ERROR,this._onDemuxError.bind(this)),i.on(g.a.INIT_SEGMENT,this._onInitSegment.bind(this)),i.on(g.a.MEDIA_SEGMENT,this._onMediaSegment.bind(this)),i.on(g.a.LOADING_COMPLETE,this._onLoadingComplete.bind(this)),i.on(g.a.RECOVERED_EARLY_EOF,this._onRecoveredEarlyEof.bind(this)),i.on(g.a.MEDIA_INFO,this._onMediaInfo.bind(this)),i.on(g.a.METADATA_ARRIVED,this._onMetaDataArrived.bind(this)),i.on(g.a.SCRIPTDATA_ARRIVED,this._onScriptDataArrived.bind(this)),i.on(g.a.TIMED_ID3_METADATA_ARRIVED,this._onTimedID3MetadataArrived.bind(this)),i.on(g.a.PES_PRIVATE_DATA_DESCRIPTOR,this._onPESPrivateDataDescriptor.bind(this)),i.on(g.a.PES_PRIVATE_DATA_ARRIVED,this._onPESPrivateDataArrived.bind(this)),i.on(g.a.STATISTICS_INFO,this._onStatisticsInfo.bind(this)),i.on(g.a.RECOMMEND_SEEKPOINT,this._onRecommendSeekpoint.bind(this))}}return e.prototype.destroy=function(){this._worker?this._workerDestroying||(this._workerDestroying=!0,this._worker.postMessage({cmd:"destroy"}),m.a.removeListener(this.e.onLoggingConfigChanged),this.e=null):(this._controller.destroy(),this._controller=null),this._emitter.removeAllListeners(),this._emitter=null},e.prototype.on=function(e,t){this._emitter.addListener(e,t)},e.prototype.off=function(e,t){this._emitter.removeListener(e,t)},e.prototype.hasWorker=function(){return null!=this._worker},e.prototype.open=function(){this._worker?this._worker.postMessage({cmd:"start"}):this._controller.start()},e.prototype.close=function(){this._worker?this._worker.postMessage({cmd:"stop"}):this._controller.stop()},e.prototype.seek=function(e){this._worker?this._worker.postMessage({cmd:"seek",param:e}):this._controller.seek(e)},e.prototype.pause=function(){this._worker?this._worker.postMessage({cmd:"pause"}):this._controller.pause()},e.prototype.resume=function(){this._worker?this._worker.postMessage({cmd:"resume"}):this._controller.resume()},e.prototype._onInitSegment=function(e,t){var i=this;Promise.resolve().then((function(){i._emitter.emit(g.a.INIT_SEGMENT,e,t)}))},e.prototype._onMediaSegment=function(e,t){var i=this;Promise.resolve().then((function(){i._emitter.emit(g.a.MEDIA_SEGMENT,e,t)}))},e.prototype._onLoadingComplete=function(){var e=this;Promise.resolve().then((function(){e._emitter.emit(g.a.LOADING_COMPLETE)}))},e.prototype._onRecoveredEarlyEof=function(){var e=this;Promise.resolve().then((function(){e._emitter.emit(g.a.RECOVERED_EARLY_EOF)}))},e.prototype._onMediaInfo=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(g.a.MEDIA_INFO,e)}))},e.prototype._onMetaDataArrived=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(g.a.METADATA_ARRIVED,e)}))},e.prototype._onScriptDataArrived=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(g.a.SCRIPTDATA_ARRIVED,e)}))},e.prototype._onTimedID3MetadataArrived=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(g.a.TIMED_ID3_METADATA_ARRIVED,e)}))},e.prototype._onPESPrivateDataDescriptor=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(g.a.PES_PRIVATE_DATA_DESCRIPTOR,e)}))},e.prototype._onPESPrivateDataArrived=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(g.a.PES_PRIVATE_DATA_ARRIVED,e)}))},e.prototype._onStatisticsInfo=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(g.a.STATISTICS_INFO,e)}))},e.prototype._onIOError=function(e,t){var i=this;Promise.resolve().then((function(){i._emitter.emit(g.a.IO_ERROR,e,t)}))},e.prototype._onDemuxError=function(e,t){var i=this;Promise.resolve().then((function(){i._emitter.emit(g.a.DEMUX_ERROR,e,t)}))},e.prototype._onRecommendSeekpoint=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(g.a.RECOMMEND_SEEKPOINT,e)}))},e.prototype._onLoggingConfigChanged=function(e){this._worker&&this._worker.postMessage({cmd:"logging_config",param:e})},e.prototype._onWorkerMessage=function(e){var t=e.data,i=t.data;if("destroyed"===t.msg||this._workerDestroying)return this._workerDestroying=!1,this._worker.terminate(),void(this._worker=null);switch(t.msg){case g.a.INIT_SEGMENT:case g.a.MEDIA_SEGMENT:this._emitter.emit(t.msg,i.type,i.data);break;case g.a.LOADING_COMPLETE:case g.a.RECOVERED_EARLY_EOF:this._emitter.emit(t.msg);break;case g.a.MEDIA_INFO:Object.setPrototypeOf(i,y.a.prototype),this._emitter.emit(t.msg,i);break;case g.a.METADATA_ARRIVED:case g.a.SCRIPTDATA_ARRIVED:case g.a.TIMED_ID3_METADATA_ARRIVED:case g.a.PES_PRIVATE_DATA_DESCRIPTOR:case g.a.PES_PRIVATE_DATA_ARRIVED:case g.a.STATISTICS_INFO:this._emitter.emit(t.msg,i);break;case g.a.IO_ERROR:case g.a.DEMUX_ERROR:this._emitter.emit(t.msg,i.type,i.info);break;case g.a.RECOMMEND_SEEKPOINT:this._emitter.emit(t.msg,i);break;case"logcat_callback":u.a.emitter.emit("log",i.type,i.logcat)}},e}(),E={ERROR:"error",SOURCE_OPEN:"source_open",UPDATE_END:"update_end",BUFFER_FULL:"buffer_full"},b=i(7),S=i(3),w=function(){function e(e){this.TAG="MSEController",this._config=e,this._emitter=new d.a,this._config.isLive&&null==this._config.autoCleanupSourceBuffer&&(this._config.autoCleanupSourceBuffer=!0),this.e={onSourceOpen:this._onSourceOpen.bind(this),onSourceEnded:this._onSourceEnded.bind(this),onSourceClose:this._onSourceClose.bind(this),onSourceBufferError:this._onSourceBufferError.bind(this),onSourceBufferUpdateEnd:this._onSourceBufferUpdateEnd.bind(this)},this._mediaSource=null,this._mediaSourceObjectURL=null,this._mediaElement=null,this._isBufferFull=!1,this._hasPendingEos=!1,this._requireSetMediaDuration=!1,this._pendingMediaDuration=0,this._pendingSourceBufferInit=[],this._mimeTypes={video:null,audio:null},this._sourceBuffers={video:null,audio:null},this._lastInitSegments={video:null,audio:null},this._pendingSegments={video:[],audio:[]},this._pendingRemoveRanges={video:[],audio:[]},this._idrList=new b.a}return e.prototype.destroy=function(){(this._mediaElement||this._mediaSource)&&this.detachMediaElement(),this.e=null,this._emitter.removeAllListeners(),this._emitter=null},e.prototype.on=function(e,t){this._emitter.addListener(e,t)},e.prototype.off=function(e,t){this._emitter.removeListener(e,t)},e.prototype.attachMediaElement=function(e){if(this._mediaSource)throw new S.a("MediaSource has been attached to an HTMLMediaElement!");var t=this._mediaSource=new window.MediaSource;t.addEventListener("sourceopen",this.e.onSourceOpen),t.addEventListener("sourceended",this.e.onSourceEnded),t.addEventListener("sourceclose",this.e.onSourceClose),this._mediaElement=e,this._mediaSourceObjectURL=window.URL.createObjectURL(this._mediaSource),e.src=this._mediaSourceObjectURL},e.prototype.detachMediaElement=function(){if(this._mediaSource){var e=this._mediaSource;for(var t in this._sourceBuffers){var i=this._pendingSegments[t];i.splice(0,i.length),this._pendingSegments[t]=null,this._pendingRemoveRanges[t]=null,this._lastInitSegments[t]=null;var r=this._sourceBuffers[t];if(r){if("closed"!==e.readyState){try{e.removeSourceBuffer(r)}catch(e){u.a.e(this.TAG,e.message)}r.removeEventListener("error",this.e.onSourceBufferError),r.removeEventListener("updateend",this.e.onSourceBufferUpdateEnd)}this._mimeTypes[t]=null,this._sourceBuffers[t]=null}}if("open"===e.readyState)try{e.endOfStream()}catch(e){u.a.e(this.TAG,e.message)}e.removeEventListener("sourceopen",this.e.onSourceOpen),e.removeEventListener("sourceended",this.e.onSourceEnded),e.removeEventListener("sourceclose",this.e.onSourceClose),this._pendingSourceBufferInit=[],this._isBufferFull=!1,this._idrList.clear(),this._mediaSource=null}this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src"),this._mediaElement=null),this._mediaSourceObjectURL&&(window.URL.revokeObjectURL(this._mediaSourceObjectURL),this._mediaSourceObjectURL=null)},e.prototype.appendInitSegment=function(e,t){if(!this._mediaSource||"open"!==this._mediaSource.readyState)return this._pendingSourceBufferInit.push(e),void this._pendingSegments[e.type].push(e);var i=e,r=""+i.container;i.codec&&i.codec.length>0&&(r+=";codecs="+i.codec);var n=!1;if(u.a.v(this.TAG,"Received Initialization Segment, mimeType: "+r),this._lastInitSegments[i.type]=i,r!==this._mimeTypes[i.type]){if(this._mimeTypes[i.type])u.a.v(this.TAG,"Notice: "+i.type+" mimeType changed, origin: "+this._mimeTypes[i.type]+", target: "+r);else{n=!0;try{var s=this._sourceBuffers[i.type]=this._mediaSource.addSourceBuffer(r);s.addEventListener("error",this.e.onSourceBufferError),s.addEventListener("updateend",this.e.onSourceBufferUpdateEnd)}catch(e){return u.a.e(this.TAG,e.message),void this._emitter.emit(E.ERROR,{code:e.code,msg:e.message})}}this._mimeTypes[i.type]=r}t||this._pendingSegments[i.type].push(i),n||this._sourceBuffers[i.type]&&!this._sourceBuffers[i.type].updating&&this._doAppendSegments(),A.a.safari&&"audio/mpeg"===i.container&&i.mediaDuration>0&&(this._requireSetMediaDuration=!0,this._pendingMediaDuration=i.mediaDuration/1e3,this._updateMediaSourceDuration())},e.prototype.appendMediaSegment=function(e){var t=e;this._pendingSegments[t.type].push(t),this._config.autoCleanupSourceBuffer&&this._needCleanupSourceBuffer()&&this._doCleanupSourceBuffer();var i=this._sourceBuffers[t.type];!i||i.updating||this._hasPendingRemoveRanges()||this._doAppendSegments()},e.prototype.seek=function(e){for(var t in this._sourceBuffers)if(this._sourceBuffers[t]){var i=this._sourceBuffers[t];if("open"===this._mediaSource.readyState)try{i.abort()}catch(e){u.a.e(this.TAG,e.message)}this._idrList.clear();var r=this._pendingSegments[t];if(r.splice(0,r.length),"closed"!==this._mediaSource.readyState){for(var n=0;n<i.buffered.length;n++){var s=i.buffered.start(n),o=i.buffered.end(n);this._pendingRemoveRanges[t].push({start:s,end:o})}if(i.updating||this._doRemoveRanges(),A.a.safari){var a=this._lastInitSegments[t];a&&(this._pendingSegments[t].push(a),i.updating||this._doAppendSegments())}}}},e.prototype.endOfStream=function(){var e=this._mediaSource,t=this._sourceBuffers;e&&"open"===e.readyState?t.video&&t.video.updating||t.audio&&t.audio.updating?this._hasPendingEos=!0:(this._hasPendingEos=!1,e.endOfStream()):e&&"closed"===e.readyState&&this._hasPendingSegments()&&(this._hasPendingEos=!0)},e.prototype.getNearestKeyframe=function(e){return this._idrList.getLastSyncPointBeforeDts(e)},e.prototype._needCleanupSourceBuffer=function(){if(!this._config.autoCleanupSourceBuffer)return!1;var e=this._mediaElement.currentTime;for(var t in this._sourceBuffers){var i=this._sourceBuffers[t];if(i){var r=i.buffered;if(r.length>=1&&e-r.start(0)>=this._config.autoCleanupMaxBackwardDuration)return!0}}return!1},e.prototype._doCleanupSourceBuffer=function(){var e=this._mediaElement.currentTime;for(var t in this._sourceBuffers){var i=this._sourceBuffers[t];if(i){for(var r=i.buffered,n=!1,s=0;s<r.length;s++){var o=r.start(s),a=r.end(s);if(o<=e&&e<a+3){if(e-o>=this._config.autoCleanupMaxBackwardDuration){n=!0;var h=e-this._config.autoCleanupMinBackwardDuration;this._pendingRemoveRanges[t].push({start:o,end:h})}}else a<e&&(n=!0,this._pendingRemoveRanges[t].push({start:o,end:a}))}n&&!i.updating&&this._doRemoveRanges()}}},e.prototype._updateMediaSourceDuration=function(){var e=this._sourceBuffers;if(0!==this._mediaElement.readyState&&"open"===this._mediaSource.readyState&&!(e.video&&e.video.updating||e.audio&&e.audio.updating)){var t=this._mediaSource.duration,i=this._pendingMediaDuration;i>0&&(isNaN(t)||i>t)&&(u.a.v(this.TAG,"Update MediaSource duration from "+t+" to "+i),this._mediaSource.duration=i),this._requireSetMediaDuration=!1,this._pendingMediaDuration=0}},e.prototype._doRemoveRanges=function(){for(var e in this._pendingRemoveRanges)if(this._sourceBuffers[e]&&!this._sourceBuffers[e].updating)for(var t=this._sourceBuffers[e],i=this._pendingRemoveRanges[e];i.length&&!t.updating;){var r=i.shift();t.remove(r.start,r.end)}},e.prototype._doAppendSegments=function(){var e=this._pendingSegments;for(var t in e)if(this._sourceBuffers[t]&&!this._sourceBuffers[t].updating&&e[t].length>0){var i=e[t].shift();if(i.timestampOffset){var r=this._sourceBuffers[t].timestampOffset,n=i.timestampOffset/1e3;Math.abs(r-n)>.1&&(u.a.v(this.TAG,"Update MPEG audio timestampOffset from "+r+" to "+n),this._sourceBuffers[t].timestampOffset=n),delete i.timestampOffset}if(!i.data||0===i.data.byteLength)continue;try{this._sourceBuffers[t].appendBuffer(i.data),this._isBufferFull=!1,"video"===t&&i.hasOwnProperty("info")&&this._idrList.appendArray(i.info.syncPoints)}catch(e){this._pendingSegments[t].unshift(i),22===e.code?(this._isBufferFull||this._emitter.emit(E.BUFFER_FULL),this._isBufferFull=!0):(u.a.e(this.TAG,e.message),this._emitter.emit(E.ERROR,{code:e.code,msg:e.message}))}}},e.prototype._onSourceOpen=function(){if(u.a.v(this.TAG,"MediaSource onSourceOpen"),this._mediaSource.removeEventListener("sourceopen",this.e.onSourceOpen),this._pendingSourceBufferInit.length>0)for(var e=this._pendingSourceBufferInit;e.length;){var t=e.shift();this.appendInitSegment(t,!0)}this._hasPendingSegments()&&this._doAppendSegments(),this._emitter.emit(E.SOURCE_OPEN)},e.prototype._onSourceEnded=function(){u.a.v(this.TAG,"MediaSource onSourceEnded")},e.prototype._onSourceClose=function(){u.a.v(this.TAG,"MediaSource onSourceClose"),this._mediaSource&&null!=this.e&&(this._mediaSource.removeEventListener("sourceopen",this.e.onSourceOpen),this._mediaSource.removeEventListener("sourceended",this.e.onSourceEnded),this._mediaSource.removeEventListener("sourceclose",this.e.onSourceClose))},e.prototype._hasPendingSegments=function(){var e=this._pendingSegments;return e.video.length>0||e.audio.length>0},e.prototype._hasPendingRemoveRanges=function(){var e=this._pendingRemoveRanges;return e.video.length>0||e.audio.length>0},e.prototype._onSourceBufferUpdateEnd=function(){this._requireSetMediaDuration?this._updateMediaSourceDuration():this._hasPendingRemoveRanges()?this._doRemoveRanges():this._hasPendingSegments()?this._doAppendSegments():this._hasPendingEos&&this.endOfStream(),this._emitter.emit(E.UPDATE_END)},e.prototype._onSourceBufferError=function(e){u.a.e(this.TAG,"SourceBuffer Error: "+e)},e}(),T=i(5),R={NETWORK_ERROR:"NetworkError",MEDIA_ERROR:"MediaError",OTHER_ERROR:"OtherError"},C={NETWORK_EXCEPTION:h.b.EXCEPTION,NETWORK_STATUS_CODE_INVALID:h.b.HTTP_STATUS_CODE_INVALID,NETWORK_TIMEOUT:h.b.CONNECTING_TIMEOUT,NETWORK_UNRECOVERABLE_EARLY_EOF:h.b.UNRECOVERABLE_EARLY_EOF,MEDIA_MSE_ERROR:"MediaMSEError",MEDIA_FORMAT_ERROR:T.a.FORMAT_ERROR,MEDIA_FORMAT_UNSUPPORTED:T.a.FORMAT_UNSUPPORTED,MEDIA_CODEC_UNSUPPORTED:T.a.CODEC_UNSUPPORTED},k=function(){function e(e,t){this.TAG="MSEPlayer",this._type="MSEPlayer",this._emitter=new d.a,this._config=o(),"object"==typeof t&&Object.assign(this._config,t);var i=e.type.toLowerCase();if("mse"!==i&&"mpegts"!==i&&"m2ts"!==i&&"flv"!==i)throw new S.b("MSEPlayer requires an mpegts/m2ts/flv MediaDataSource input!");!0===e.isLive&&(this._config.isLive=!0),this.e={onvLoadedMetadata:this._onvLoadedMetadata.bind(this),onvSeeking:this._onvSeeking.bind(this),onvCanPlay:this._onvCanPlay.bind(this),onvStalled:this._onvStalled.bind(this),onvProgress:this._onvProgress.bind(this)},self.performance&&self.performance.now?this._now=self.performance.now.bind(self.performance):this._now=Date.now,this._pendingSeekTime=null,this._requestSetTime=!1,this._seekpointRecord=null,this._progressChecker=null,this._mediaDataSource=e,this._mediaElement=null,this._msectl=null,this._transmuxer=null,this._mseSourceOpened=!1,this._hasPendingLoad=!1,this._receivedCanPlay=!1,this._mediaInfo=null,this._statisticsInfo=null;var r=A.a.chrome&&(A.a.version.major<50||50===A.a.version.major&&A.a.version.build<2661);this._alwaysSeekKeyframe=!!(r||A.a.msedge||A.a.msie),this._alwaysSeekKeyframe&&(this._config.accurateSeek=!1)}return e.prototype.destroy=function(){null!=this._progressChecker&&(window.clearInterval(this._progressChecker),this._progressChecker=null),this._transmuxer&&this.unload(),this._mediaElement&&this.detachMediaElement(),this.e=null,this._mediaDataSource=null,this._emitter.removeAllListeners(),this._emitter=null},e.prototype.on=function(e,t){var i=this;e===c.MEDIA_INFO?null!=this._mediaInfo&&Promise.resolve().then((function(){i._emitter.emit(c.MEDIA_INFO,i.mediaInfo)})):e===c.STATISTICS_INFO&&null!=this._statisticsInfo&&Promise.resolve().then((function(){i._emitter.emit(c.STATISTICS_INFO,i.statisticsInfo)})),this._emitter.addListener(e,t)},e.prototype.off=function(e,t){this._emitter.removeListener(e,t)},e.prototype.attachMediaElement=function(e){var t=this;if(this._mediaElement=e,e.addEventListener("loadedmetadata",this.e.onvLoadedMetadata),e.addEventListener("seeking",this.e.onvSeeking),e.addEventListener("canplay",this.e.onvCanPlay),e.addEventListener("stalled",this.e.onvStalled),e.addEventListener("progress",this.e.onvProgress),this._msectl=new w(this._config),this._msectl.on(E.UPDATE_END,this._onmseUpdateEnd.bind(this)),this._msectl.on(E.BUFFER_FULL,this._onmseBufferFull.bind(this)),this._msectl.on(E.SOURCE_OPEN,(function(){t._mseSourceOpened=!0,t._hasPendingLoad&&(t._hasPendingLoad=!1,t.load())})),this._msectl.on(E.ERROR,(function(e){t._emitter.emit(c.ERROR,R.MEDIA_ERROR,C.MEDIA_MSE_ERROR,e)})),this._msectl.attachMediaElement(e),null!=this._pendingSeekTime)try{e.currentTime=this._pendingSeekTime,this._pendingSeekTime=null}catch(e){}},e.prototype.detachMediaElement=function(){this._mediaElement&&(this._msectl.detachMediaElement(),this._mediaElement.removeEventListener("loadedmetadata",this.e.onvLoadedMetadata),this._mediaElement.removeEventListener("seeking",this.e.onvSeeking),this._mediaElement.removeEventListener("canplay",this.e.onvCanPlay),this._mediaElement.removeEventListener("stalled",this.e.onvStalled),this._mediaElement.removeEventListener("progress",this.e.onvProgress),this._mediaElement=null),this._msectl&&(this._msectl.destroy(),this._msectl=null)},e.prototype.load=function(){var e=this;if(!this._mediaElement)throw new S.a("HTMLMediaElement must be attached before load()!");if(this._transmuxer)throw new S.a("MSEPlayer.load() has been called, please call unload() first!");this._hasPendingLoad||(this._config.deferLoadAfterSourceOpen&&!1===this._mseSourceOpened?this._hasPendingLoad=!0:(this._mediaElement.readyState>0&&(this._requestSetTime=!0,this._mediaElement.currentTime=0),this._transmuxer=new v(this._mediaDataSource,this._config),this._transmuxer.on(g.a.INIT_SEGMENT,(function(t,i){e._msectl.appendInitSegment(i)})),this._transmuxer.on(g.a.MEDIA_SEGMENT,(function(t,i){if(e._msectl.appendMediaSegment(i),e._config.lazyLoad&&!e._config.isLive){var r=e._mediaElement.currentTime;i.info.endDts>=1e3*(r+e._config.lazyLoadMaxDuration)&&null==e._progressChecker&&(u.a.v(e.TAG,"Maximum buffering duration exceeded, suspend transmuxing task"),e._suspendTransmuxer())}})),this._transmuxer.on(g.a.LOADING_COMPLETE,(function(){e._msectl.endOfStream(),e._emitter.emit(c.LOADING_COMPLETE)})),this._transmuxer.on(g.a.RECOVERED_EARLY_EOF,(function(){e._emitter.emit(c.RECOVERED_EARLY_EOF)})),this._transmuxer.on(g.a.IO_ERROR,(function(t,i){e._emitter.emit(c.ERROR,R.NETWORK_ERROR,t,i)})),this._transmuxer.on(g.a.DEMUX_ERROR,(function(t,i){e._emitter.emit(c.ERROR,R.MEDIA_ERROR,t,{code:-1,msg:i})})),this._transmuxer.on(g.a.MEDIA_INFO,(function(t){e._mediaInfo=t,e._emitter.emit(c.MEDIA_INFO,Object.assign({},t))})),this._transmuxer.on(g.a.METADATA_ARRIVED,(function(t){e._emitter.emit(c.METADATA_ARRIVED,t)})),this._transmuxer.on(g.a.SCRIPTDATA_ARRIVED,(function(t){e._emitter.emit(c.SCRIPTDATA_ARRIVED,t)})),this._transmuxer.on(g.a.TIMED_ID3_METADATA_ARRIVED,(function(t){e._emitter.emit(c.TIMED_ID3_METADATA_ARRIVED,t)})),this._transmuxer.on(g.a.PES_PRIVATE_DATA_DESCRIPTOR,(function(t){e._emitter.emit(c.PES_PRIVATE_DATA_DESCRIPTOR,t)})),this._transmuxer.on(g.a.PES_PRIVATE_DATA_ARRIVED,(function(t){e._emitter.emit(c.PES_PRIVATE_DATA_ARRIVED,t)})),this._transmuxer.on(g.a.STATISTICS_INFO,(function(t){e._statisticsInfo=e._fillStatisticsInfo(t),e._emitter.emit(c.STATISTICS_INFO,Object.assign({},e._statisticsInfo))})),this._transmuxer.on(g.a.RECOMMEND_SEEKPOINT,(function(t){e._mediaElement&&!e._config.accurateSeek&&(e._requestSetTime=!0,e._mediaElement.currentTime=t/1e3)})),this._transmuxer.open()))},e.prototype.unload=function(){this._mediaElement&&this._mediaElement.pause(),this._msectl&&this._msectl.seek(0),this._transmuxer&&(this._transmuxer.close(),this._transmuxer.destroy(),this._transmuxer=null)},e.prototype.play=function(){return this._mediaElement.play()},e.prototype.pause=function(){this._mediaElement.pause()},Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"buffered",{get:function(){return this._mediaElement.buffered},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"duration",{get:function(){return this._mediaElement.duration},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"volume",{get:function(){return this._mediaElement.volume},set:function(e){this._mediaElement.volume=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"muted",{get:function(){return this._mediaElement.muted},set:function(e){this._mediaElement.muted=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentTime",{get:function(){return this._mediaElement?this._mediaElement.currentTime:0},set:function(e){this._mediaElement?this._internalSeek(e):this._pendingSeekTime=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mediaInfo",{get:function(){return Object.assign({},this._mediaInfo)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"statisticsInfo",{get:function(){return null==this._statisticsInfo&&(this._statisticsInfo={}),this._statisticsInfo=this._fillStatisticsInfo(this._statisticsInfo),Object.assign({},this._statisticsInfo)},enumerable:!1,configurable:!0}),e.prototype._fillStatisticsInfo=function(e){if(e.playerType=this._type,!(this._mediaElement instanceof HTMLVideoElement))return e;var t=!0,i=0,r=0;if(this._mediaElement.getVideoPlaybackQuality){var n=this._mediaElement.getVideoPlaybackQuality();i=n.totalVideoFrames,r=n.droppedVideoFrames}else null!=this._mediaElement.webkitDecodedFrameCount?(i=this._mediaElement.webkitDecodedFrameCount,r=this._mediaElement.webkitDroppedFrameCount):t=!1;return t&&(e.decodedFrames=i,e.droppedFrames=r),e},e.prototype._onmseUpdateEnd=function(){var e=this._mediaElement.buffered,t=this._mediaElement.currentTime;if(this._config.isLive&&this._config.liveBufferLatencyChasing&&e.length>0&&!this._mediaElement.paused){var i=e.end(e.length-1);if(i>this._config.liveBufferLatencyMaxLatency&&i-t>this._config.liveBufferLatencyMaxLatency){var r=i-this._config.liveBufferLatencyMinRemain;this.currentTime=r}}if(this._config.lazyLoad&&!this._config.isLive){for(var n=0,s=0;s<e.length;s++){var o=e.start(s),a=e.end(s);if(o<=t&&t<a){n=a;break}}n>=t+this._config.lazyLoadMaxDuration&&null==this._progressChecker&&(u.a.v(this.TAG,"Maximum buffering duration exceeded, suspend transmuxing task"),this._suspendTransmuxer())}},e.prototype._onmseBufferFull=function(){u.a.v(this.TAG,"MSE SourceBuffer is full, suspend transmuxing task"),null==this._progressChecker&&this._suspendTransmuxer()},e.prototype._suspendTransmuxer=function(){this._transmuxer&&(this._transmuxer.pause(),null==this._progressChecker&&(this._progressChecker=window.setInterval(this._checkProgressAndResume.bind(this),1e3)))},e.prototype._checkProgressAndResume=function(){for(var e=this._mediaElement.currentTime,t=this._mediaElement.buffered,i=!1,r=0;r<t.length;r++){var n=t.start(r),s=t.end(r);if(e>=n&&e<s){e>=s-this._config.lazyLoadRecoverDuration&&(i=!0);break}}i&&(window.clearInterval(this._progressChecker),this._progressChecker=null,i&&(u.a.v(this.TAG,"Continue loading from paused position"),this._transmuxer.resume()))},e.prototype._isTimepointBuffered=function(e){for(var t=this._mediaElement.buffered,i=0;i<t.length;i++){var r=t.start(i),n=t.end(i);if(e>=r&&e<n)return!0}return!1},e.prototype._internalSeek=function(e){var t=this._isTimepointBuffered(e),i=!1,r=0;if(e<1&&this._mediaElement.buffered.length>0){var n=this._mediaElement.buffered.start(0);(n<1&&e<n||A.a.safari)&&(i=!0,r=A.a.safari?.1:n)}if(i)this._requestSetTime=!0,this._mediaElement.currentTime=r;else if(t){if(this._alwaysSeekKeyframe){var s=this._msectl.getNearestKeyframe(Math.floor(1e3*e));this._requestSetTime=!0,this._mediaElement.currentTime=null!=s?s.dts/1e3:e}else this._requestSetTime=!0,this._mediaElement.currentTime=e;null!=this._progressChecker&&this._checkProgressAndResume()}else null!=this._progressChecker&&(window.clearInterval(this._progressChecker),this._progressChecker=null),this._msectl.seek(e),this._transmuxer.seek(Math.floor(1e3*e)),this._config.accurateSeek&&(this._requestSetTime=!0,this._mediaElement.currentTime=e)},e.prototype._checkAndApplyUnbufferedSeekpoint=function(){if(this._seekpointRecord)if(this._seekpointRecord.recordTime<=this._now()-100){var e=this._mediaElement.currentTime;this._seekpointRecord=null,this._isTimepointBuffered(e)||(null!=this._progressChecker&&(window.clearTimeout(this._progressChecker),this._progressChecker=null),this._msectl.seek(e),this._transmuxer.seek(Math.floor(1e3*e)),this._config.accurateSeek&&(this._requestSetTime=!0,this._mediaElement.currentTime=e))}else window.setTimeout(this._checkAndApplyUnbufferedSeekpoint.bind(this),50)},e.prototype._checkAndResumeStuckPlayback=function(e){var t=this._mediaElement;if(e||!this._receivedCanPlay||t.readyState<2){var i=t.buffered;i.length>0&&t.currentTime<i.start(0)&&(u.a.w(this.TAG,"Playback seems stuck at "+t.currentTime+", seek to "+i.start(0)),this._requestSetTime=!0,this._mediaElement.currentTime=i.start(0),this._mediaElement.removeEventListener("progress",this.e.onvProgress))}else this._mediaElement.removeEventListener("progress",this.e.onvProgress)},e.prototype._onvLoadedMetadata=function(e){null!=this._pendingSeekTime&&(this._mediaElement.currentTime=this._pendingSeekTime,this._pendingSeekTime=null)},e.prototype._onvSeeking=function(e){var t=this._mediaElement.currentTime,i=this._mediaElement.buffered;if(this._requestSetTime)this._requestSetTime=!1;else{if(t<1&&i.length>0){var r=i.start(0);if(r<1&&t<r||A.a.safari)return this._requestSetTime=!0,void(this._mediaElement.currentTime=A.a.safari?.1:r)}if(this._isTimepointBuffered(t)){if(this._alwaysSeekKeyframe){var n=this._msectl.getNearestKeyframe(Math.floor(1e3*t));null!=n&&(this._requestSetTime=!0,this._mediaElement.currentTime=n.dts/1e3)}null!=this._progressChecker&&this._checkProgressAndResume()}else this._seekpointRecord={seekPoint:t,recordTime:this._now()},window.setTimeout(this._checkAndApplyUnbufferedSeekpoint.bind(this),50)}},e.prototype._onvCanPlay=function(e){this._receivedCanPlay=!0,this._mediaElement.removeEventListener("canplay",this.e.onvCanPlay)},e.prototype._onvStalled=function(e){this._checkAndResumeStuckPlayback(!0)},e.prototype._onvProgress=function(e){this._checkAndResumeStuckPlayback()},e}(),I=function(){function e(e,t){this.TAG="NativePlayer",this._type="NativePlayer",this._emitter=new d.a,this._config=o(),"object"==typeof t&&Object.assign(this._config,t);var i=e.type.toLowerCase();if("mse"===i||"mpegts"===i||"m2ts"===i||"flv"===i)throw new S.b("NativePlayer does't support mse/mpegts/m2ts/flv MediaDataSource input!");if(e.hasOwnProperty("segments"))throw new S.b("NativePlayer("+e.type+") doesn't support multipart playback!");this.e={onvLoadedMetadata:this._onvLoadedMetadata.bind(this)},this._pendingSeekTime=null,this._statisticsReporter=null,this._mediaDataSource=e,this._mediaElement=null}return e.prototype.destroy=function(){this._mediaElement&&(this.unload(),this.detachMediaElement()),this.e=null,this._mediaDataSource=null,this._emitter.removeAllListeners(),this._emitter=null},e.prototype.on=function(e,t){var i=this;e===c.MEDIA_INFO?null!=this._mediaElement&&0!==this._mediaElement.readyState&&Promise.resolve().then((function(){i._emitter.emit(c.MEDIA_INFO,i.mediaInfo)})):e===c.STATISTICS_INFO&&null!=this._mediaElement&&0!==this._mediaElement.readyState&&Promise.resolve().then((function(){i._emitter.emit(c.STATISTICS_INFO,i.statisticsInfo)})),this._emitter.addListener(e,t)},e.prototype.off=function(e,t){this._emitter.removeListener(e,t)},e.prototype.attachMediaElement=function(e){if(this._mediaElement=e,e.addEventListener("loadedmetadata",this.e.onvLoadedMetadata),null!=this._pendingSeekTime)try{e.currentTime=this._pendingSeekTime,this._pendingSeekTime=null}catch(e){}},e.prototype.detachMediaElement=function(){this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src"),this._mediaElement.removeEventListener("loadedmetadata",this.e.onvLoadedMetadata),this._mediaElement=null),null!=this._statisticsReporter&&(window.clearInterval(this._statisticsReporter),this._statisticsReporter=null)},e.prototype.load=function(){if(!this._mediaElement)throw new S.a("HTMLMediaElement must be attached before load()!");this._mediaElement.src=this._mediaDataSource.url,this._mediaElement.readyState>0&&(this._mediaElement.currentTime=0),this._mediaElement.preload="auto",this._mediaElement.load(),this._statisticsReporter=window.setInterval(this._reportStatisticsInfo.bind(this),this._config.statisticsInfoReportInterval)},e.prototype.unload=function(){this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src")),null!=this._statisticsReporter&&(window.clearInterval(this._statisticsReporter),this._statisticsReporter=null)},e.prototype.play=function(){return this._mediaElement.play()},e.prototype.pause=function(){this._mediaElement.pause()},Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"buffered",{get:function(){return this._mediaElement.buffered},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"duration",{get:function(){return this._mediaElement.duration},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"volume",{get:function(){return this._mediaElement.volume},set:function(e){this._mediaElement.volume=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"muted",{get:function(){return this._mediaElement.muted},set:function(e){this._mediaElement.muted=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentTime",{get:function(){return this._mediaElement?this._mediaElement.currentTime:0},set:function(e){this._mediaElement?this._mediaElement.currentTime=e:this._pendingSeekTime=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mediaInfo",{get:function(){var e={mimeType:(this._mediaElement instanceof HTMLAudioElement?"audio/":"video/")+this._mediaDataSource.type};return this._mediaElement&&(e.duration=Math.floor(1e3*this._mediaElement.duration),this._mediaElement instanceof HTMLVideoElement&&(e.width=this._mediaElement.videoWidth,e.height=this._mediaElement.videoHeight)),e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"statisticsInfo",{get:function(){var e={playerType:this._type,url:this._mediaDataSource.url};if(!(this._mediaElement instanceof HTMLVideoElement))return e;var t=!0,i=0,r=0;if(this._mediaElement.getVideoPlaybackQuality){var n=this._mediaElement.getVideoPlaybackQuality();i=n.totalVideoFrames,r=n.droppedVideoFrames}else null!=this._mediaElement.webkitDecodedFrameCount?(i=this._mediaElement.webkitDecodedFrameCount,r=this._mediaElement.webkitDroppedFrameCount):t=!1;return t&&(e.decodedFrames=i,e.droppedFrames=r),e},enumerable:!1,configurable:!0}),e.prototype._onvLoadedMetadata=function(e){null!=this._pendingSeekTime&&(this._mediaElement.currentTime=this._pendingSeekTime,this._pendingSeekTime=null),this._emitter.emit(c.MEDIA_INFO,this.mediaInfo)},e.prototype._reportStatisticsInfo=function(){this._emitter.emit(c.STATISTICS_INFO,this.statisticsInfo)},e}();r.a.install();var L={createPlayer:function(e,t){var i=e;if(null==i||"object"!=typeof i)throw new S.b("MediaDataSource must be an javascript object!");if(!i.hasOwnProperty("type"))throw new S.b("MediaDataSource must has type field to indicate video file type!");switch(i.type){case"mse":case"mpegts":case"m2ts":case"flv":return new k(i,t);default:return new I(i,t)}},isSupported:function(){return a.supportMSEH264Playback()},getFeatureList:function(){return a.getFeatureList()}};L.BaseLoader=h.a,L.LoaderStatus=h.c,L.LoaderErrors=h.b,L.Events=c,L.ErrorTypes=R,L.ErrorDetails=C,L.MSEPlayer=k,L.NativePlayer=I,L.LoggingControl=m.a,Object.defineProperty(L,"version",{enumerable:!0,get:function(){return"1.6.7"}}),t.default=L}])}(Wt);var Qt=Wt.exports;class zt extends re{constructor(e){super(),this.player=e;const t=document.createElement("video"),i=document.createElement("canvas");this.$posterElement=document.createElement("img"),t.volume=0,this.player._opt.hasAudio||(t.muted=!0),t.style.position="absolute",t.style.top="0px",t.style.left="0px",this._delayPlay=!1,e.$container.appendChild(t),this.videoInfo={width:"",height:"",encType:""},this.$videoElement=t,this.$canvasElement=i,this.canvasContext=i.getContext("2d"),this.fixChromeVideoFlashBug(),this.resize();const{proxy:r}=this.player.events;r(this.$videoElement,"canplay",(()=>{this.player.debug.log("Video",`canplay and _delayPlay is ${this._delayPlay}`),this._delayPlay&&this._play(),this.player.$container.contains(this.$posterElement)&&this.$posterElement&&this.player.$container.removeChild(this.$posterElement)})),r(this.$videoElement,"waiting",(()=>{this.player.emit(w.videoWaiting)})),r(this.$videoElement,"timeupdate",(e=>{const t=parseInt(e.timeStamp,10);this.player.emit(w.timeUpdate,t),!this.isPlaying()&&this.init&&(this.player.debug.log("Video","timeupdate and this.isPlaying is false and retry play"),this.$videoElement.play())})),this.player.debug.log("Video","init")}destroy(){super.destroy(),this.$canvasElement=null,this.canvasContext=null,this.$videoElement&&(this.$videoElement.pause(),this.$videoElement.currentTime=0,this.$videoElement.src="",this.$videoElement.removeAttribute("src"),this.$videoElement=null),this.trackGenerator&&(this.trackGenerator.stop(),this.trackGenerator=null),this.vwriter&&(this.vwriter.close(),this.vwriter=null),this.player.$container.contains(this.$posterElement)&&this.$posterElement&&this.player.$container.removeChild(this.$posterElement),this.player.debug.log("Video","destroy")}fixChromeVideoFlashBug(){const e=function(){const e=navigator.userAgent.toLowerCase(),t={},i={IE:window.ActiveXObject||"ActiveXObject"in window,Chrome:e.indexOf("chrome")>-1&&e.indexOf("safari")>-1,Firefox:e.indexOf("firefox")>-1,Opera:e.indexOf("opera")>-1,Safari:e.indexOf("safari")>-1&&-1===e.indexOf("chrome"),Edge:e.indexOf("edge")>-1,QQBrowser:/qqbrowser/.test(e),WeixinBrowser:/MicroMessenger/i.test(e)};for(let r in i)if(i[r]){let i="";if("IE"===r)i=e.match(/(msie\s|trident.*rv:)([\w.]+)/)[2];else if("Chrome"===r){for(const e in navigator.mimeTypes)"application/360softmgrplugin"===navigator.mimeTypes[e].type&&(r="360");i=e.match(/chrome\/([\d.]+)/)[1]}else"Firefox"===r?i=e.match(/firefox\/([\d.]+)/)[1]:"Opera"===r?i=e.match(/opera\/([\d.]+)/)[1]:"Safari"===r?i=e.match(/version\/([\d.]+)/)[1]:"Edge"===r?i=e.match(/edge\/([\d.]+)/)[1]:"QQBrowser"===r&&(i=e.match(/qqbrowser\/([\d.]+)/)[1]);t.type=r,t.version=parseInt(i)}return t}().type.toLowerCase();if("chrome"===e||"edge"===e){this.player.$container.style.backdropFilter="blur(0px)"}}play(){if(this.$videoElement){const e=this._getVideoReadyState();if(this.player.debug.log("Video",`play and readyState: ${e}`),0===e)return this.player.debug.warn("Video","readyState is 0 and set _delayPlay to true"),void(this._delayPlay=!0);this._play()}}_getVideoReadyState(){let e=0;return this.$videoElement&&(e=this.$videoElement.readyState),e}_play(){this.$videoElement&&this.$videoElement.play().then((()=>{this._delayPlay=!1,this.player.debug.log("Video","_play success"),setTimeout((()=>{this.isPlaying()||(this.player.debug.warn("Video","play failed and retry play"),this._play())}),100)})).catch((e=>{this.player.debug.error("Video","_play error",e)}))}pause(e){e?this.$videoElement&&this.$videoElement.pause():setTimeout((()=>{this.$videoElement&&this.$videoElement.pause()}),100),this._poster()}clearView(){}screenshot(e,t,i,r){var n,s;e=e||q()+"",r=r||O.download,t=t||"png";const o={png:"image/png",jpeg:"image/jpeg",webp:"image/webp"};"number"!=typeof i&&(i=Number(i||.92));const a=this.$videoElement,h=this.$canvasElement;h.width=a.videoWidth,h.height=a.videoHeight,null===(n=this.canvasContext)||void 0===n||n.drawImage(a,0,0,h.width,h.height);const l=h.toDataURL(o[t]||o.png,i);if(null===(s=this.canvasContext)||void 0===s||s.clearRect(0,0,h.width,h.height),h.width=0,h.height=0,r===O.base64)return l;{const t=H(l);if(r===O.blob)return t;r===O.download&&le(t,e)}}initCanvasViewSize(){this.resize()}_poster(){const e=this.screenshot("poster","png",.92,O.base64);this.$posterElement.src=e,this.$posterElement.style.position="absolute",this.$posterElement.style.top="0px",this.$posterElement.style.left="0px",this.$posterElement.style.zIndex="1",this.$posterElement.style.objectFit="contain",this.$posterElement.style.pointerEvents="none",this.player.$container.appendChild(this.$posterElement),this.resize()}render(e){this.vwriter&&this.vwriter.write(e.videoFrame)}resize(){this._resizeElement(this.$videoElement),this._resizeElement(this.$posterElement)}_resizeElement(e){const t=this.player.width,i=this.player.height,r=this.player._opt,n=r.rotate;e.width=t,e.height=i,270!==n&&90!==n||(e.width=i,e.height=t);const s=(t-e.width)/2,o=(i-e.height)/2;let a="contain";r.scaleMode===x.full&&(a="fill"),r.scaleMode===x.fullAuto&&(a="cover"),e.style.objectFit=a,e.style.transform="rotate("+n+"deg)",e.style.left=s+"px",e.style.top=o+"px"}isPlaying(){return this.$videoElement&&!this.$videoElement.paused}}class Ht extends Ce{constructor(e,t){super(e,t,zt),this._opt=t,this._opt.useMSE=!1,this._createPlayer(t),this.debug.log("Hard Player options",this._opt)}close(){throw new Error("Method not implemented.")}_createPlayer(e){var t;this._opt=Object.assign({},this._opt,e),this.events||(this.events=new Te(this)),this.video||(this.video=new zt(this)),null===(t=Qt.LoggingControl)||void 0===t||t.applyConfig({globalTag:"EzuikitFlv",enableVerbose:!!this._opt.debug,enableDebug:!!this._opt.debug,enableInfo:!!this._opt.debug,enableWarn:!!this._opt.debug,enableError:!0}),this.player=Qt.createPlayer({type:"flv",url:e.url,isLive:!0},{stashInitialSize:128,enableWorker:!0,liveBufferLatencyChasing:!0}),this.player.attachMediaElement(this.video.$videoElement),this.loaded=!0,this._flvEvents()}_flvEvents(){this.player&&(this.player.on(Qt.Events.ERROR,((e,t,i)=>{"MediaError"===e&&"MediaMSEError"===t&&9===i.code?this.emit(R.mediaSourceH265NotSupport,i):"NetworkError"===e?(this.emit(R.fetchError,i),this.player&&(this.destroy(),this._createPlayer(this._opt))):"OTHER_ERROR"===e&&this.emit(R.websocketError,i),Gt.report("error",{event:e,value:i}),this.debug.error(`${Qt.Events.ERROR}`,e,t,i)})),this.player.on(Qt.Events.LOADING_COMPLETE,(e=>{this.debug.log(`${Qt.Events.LOADING_COMPLETE}`,e)})),this.player.on(Qt.Events.RECOVERED_EARLY_EOF,(e=>{this.debug.log(`${Qt.Events.RECOVERED_EARLY_EOF}`,e)})),this.player.on(Qt.Events.MEDIA_INFO,(e=>{this.video.updateVideoInfo({encTypeCode:(null==e?void 0:e.videoCodec.indexOf("avc"))>=0?7:12,width:e.width,height:e.height})})),this.player.on(Qt.Events.STATISTICS_INFO,(e=>{})),this.player.on(Qt.Events.DESTROYING,(e=>{this.debug.log(`${Qt.Events.DESTROYING}`,e)})))}getOption(){return this._opt}emitError(e,t=""){this.emit(w.error,e,t),this.emit(e,t)}destroy(){this.player&&(this.player.pause(),this.player.unload(),this.player.detachMediaElement(),this.player.destroy(),this.player=null),this._loading=!1,this._playing=!1,this._hasLoaded=!1,this._lastVolume=null,this._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},this.video&&(this.video.destroy(),this.video=null),this.events&&(this.events.destroy(),this.events=null),this.resetStats(),this._audioTimestamp=0,this._videoTimestamp=0,this.emit("destroy"),this.off(),this.debug.log("play","destroy end")}resetStats(){}set fullscreen(e){Z()&&this._opt.useWebFullScreen?(this.emit(w.webFullscreen,e),setTimeout((()=>{this.updateOption({rotate:e?270:0}),this.resize()}),10)):this.emit(w.fullscreen,e)}get fullscreen(){return K()||this.webFullscreen}set webFullscreen(e){this.emit(w.webFullscreen,e)}get webFullscreen(){return this.$container.classList.contains("flv-fullscreen-web")}set loaded(e){this._hasLoaded=e}get loaded(){return this._hasLoaded}set playing(e){e&&(this.loading=!1),this.playing!==e&&(this._playing=e,this.emit(w.playing,e),this.emit(w.volumechange,this.volume),e?this.emit(w.play):this.emit(w.pause))}get playing(){return this._playing}get volume(){return this.video&&this.video.$videoElement.volume||0}set volume(e){e!==this.volume&&this.video&&(this.video.$videoElement.muted=!1,this.video.$videoElement.volume=e,this._lastVolume=e),0===e?this.emit(w.mute,!0):this.emit(w.mute,!1)}get lastVolume(){return this._lastVolume}set loading(e){this.loading!==e&&(this._loading=e,this.emit(w.loading,this._loading))}get loading(){return this._loading}set audioTimestamp(e){null!==e&&(this._audioTimestamp=e)}get audioTimestamp(){return this._audioTimestamp}set videoTimestamp(e){null!==e&&(this._videoTimestamp=e)}get videoTimestamp(){return this._videoTimestamp}get isDebug(){return!0===this._opt.debug}checkHeart(){this.clearCheckHeartTimeout(),this.checkHeartTimeout()}clearCheckHeartTimeout(){}checkHeartTimeout(){this._checkHeartTimeout=setTimeout((()=>{if(this.playing){if(0!==this._stats.fps)return;this.pause().then((()=>{this.emit(w.timeout,w.delayTimeout),this.emit(w.delayTimeout)}))}}),1e3*this._opt.heartTimeout)}checkLoadingTimeout(){this._checkLoadingTimeout=setTimeout((()=>{this.playing||this.pause().then((()=>{this.emit(w.timeout,w.loadingTimeout),this.emit(w.loadingTimeout)}))}),1e3*this._opt.loadingTimeout)}handleRender(){this.loading&&(this.emit(w.start),this.loading=!1,this.clearCheckLoadingTimeout()),this.playing||(this.playing=!0),this.checkHeart()}clearCheckLoadingTimeout(){throw new Error("Method not implemented.")}updateOption(e){var t;null===(t=Qt.LoggingControl)||void 0===t||t.applyConfig({globalTag:"EzuikitFlv",enableVerbose:!!e.debug,enableDebug:!!e.debug,enableInfo:!!e.debug,enableWarn:!!e.debug,enableError:!0}),this._opt=Object.assign({},this._opt,e)}play(){return this.player&&this.player.playing?this.pause().then((e=>this._play())):this._play()}_play(){return this.loading=!0,this.playing=!1,this._times.playInitStart=q(),this.clearCheckHeartTimeout(),this.player?(this.player.load(),new Promise(((e,t)=>this.player.play().then((()=>{e(),this.loading=!1,this.playing=!0,this._opt.isNotMute&&this.mute(!1)})).catch((e=>{t(e)}))))):Promise.reject()}_close(){return new Promise((e=>{this._loading=!1,this._playing=!1,this._hasLoaded=!1,this._lastVolume=null,this._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},this.video&&(this.video.resetInit(),this.video.pause(!0)),this.player&&(this.player.pause(),this.player.unload(),this.player.detachMediaElement(),this.player.destroy()),this.resetStats(),this._audioTimestamp=0,this._videoTimestamp=0,this._createPlayer(this._opt),setTimeout((()=>{e()}),0)}))}pause(){return this._close()}resumeAudioAfterPause(){}mute(e){this.volume=e?0:.5}resize(){this.video.resize()}}class qt{constructor(e,t){this._opt=Object.assign({},s,t),Z()&&(this._opt.useMSE=!1);return new(qt.getLoaderFactory(this._opt.useMSE))(e,this._opt)}static getLoaderFactory(e){return Gt.report("player-loader",{event:e?"hard":"soft"}),e?Ht:jt}}Gt.initMonitor();class $t extends ie{constructor(e){super();const t=e;let i=e.container;if("string"==typeof e.container&&(i=document.querySelector(e.container)),!i)throw new Error("Flv need container option");if("CANVAS"===i.nodeName||"VIDEO"===i.nodeName)throw new Error(`Flv container type can not be ${i.nodeName} type`);if(!e.url)throw new Error("Flv url is empty");if(t.videoBuffer>=t.heartTimeout)throw new Error(`Flv videoBuffer ${t.videoBuffer}s must be less than heartTimeout ${t.heartTimeout}s`);i.classList.add("flv-container"),i.style.position="relative",delete t.container,t.forceNoOffscreen=!0,ee(t.videoBuffer)&&(t.videoBuffer=1e3*Number(t.videoBuffer)),ee(t.timeout)&&(J(t.loadingTimeout)&&(t.loadingTimeout=t.timeout),J(t.heartTimeout)&&(t.heartTimeout=t.timeout)),this._opt=t,this.$container=i,this._loadingTimeoutReplayTimes=0,this._heartTimeoutReplayTimes=0,this.events=new Te(this),this._initPlayer(i,t)}destroy(){this.events&&(this.events.destroy(),this.events=null),this.player&&(this.player.destroy(),this.player=null),this.$container=null,this._opt={},this._loadingTimeoutReplayTimes=0,this._heartTimeoutReplayTimes=0,this.off(),Gt.report("api",{event:"destroy"})}_initPlayer(e,t){t.url&&(t.url=Vt(t.url)),this.player=new qt(e,t),this._bindEvents()}_resetPlayer(e={}){this.player.destroy(),this.player=null,this._opt=Object.assign(this._opt,e),this._initPlayer(this.$container,this._opt)}_bindEvents(){Object.keys(T).forEach((e=>{this.player.on(T[e],(t=>{this.emit(e,t)}))}))}setDebug(e){this.player.updateOption({debug:e}),Gt.report("api",{event:"setDebug"})}closeSound(){this.player&&this.player.mute(!0),Gt.report("api",{event:"closeSound"})}openSound(){this.player&&this.player.mute(!1),Gt.report("api",{event:"openSound"})}setVolume(e){this.player.volume=e,Gt.report("api",{event:"setVolume",value:e})}getVolume(){return Gt.report("api",{event:"getVolume"}),this.player.volume}audioResume(){this.player.audio&&this.player.audio.audioEnabled(!0),Gt.report("api",{event:"audioResume"})}setTimeout(e){e=Number(e),this.player.updateOption({timeout:e,loadingTimeout:e,heartTimeout:e})}setScaleMode(e){return new Promise(((t,i)=>{try{e=Number(e)}catch(e){return void i(e)}[x.full,x.auto,x.fullAuto].includes(e)?(this.player.updateOption({scaleMode:e}),this.resize(),t(),Gt.report("api",{event:"setScaleMode"})):i("scale mode 0 | 1 | 2")}))}pause(){return Gt.report("api",{event:"pause"}),this.player&&this.player.pause()}close(){return this._opt.url="",this._opt.playOptions={},this._opt.urlQuery={},Gt.report("api",{event:"close"}),this.player.close()}clearView(){this.player.video.clearView(),Gt.report("api",{event:"clearView"})}play(e={}){const t=Vt(e.url||this._opt.url);return this._opt=Object.assign({},this._opt,e||{},{url:t}),this._opt.urlQuery=function(e){if(/http[s]?:\/\/|ws[s]?:\/\//.test(e)){const t=e.split("?")[1],i=t?t.split("&"):[],r={};for(let e=0;e<i.length;++e){const[t,n]=i[e].split("=");r[t]=r[t]||decodeURIComponent(n)}try{const t=e.split(".flv")[0].split("/"),i=t[t.length-1].split("_");t.length>0&&i[0]&&i[1]&&i[2]&&(r.DeviceSerial=i[0],r.ChannelNo=i[1],r.Bitstream=i[2])}catch(e){}return r}return{}}(e.url),Gt.report("api",{event:"play"}),new Promise(((e,t)=>{if(!this._opt.url)return this.emit(w.error,R.playError),void t("play url is empty");this.player&&this.player.playing?(this.clearView(),this.player.play(this._opt).then((()=>{e(),this.player.resumeAudioAfterPause()})).catch((e=>{this.player.debug.warn("Flv","pause -> play and play error",e),this.player.pause().then((()=>{t(e)}))}))):this._play(this._opt).then((()=>{e()})).catch((e=>{t(e)}))}))}_play(e={}){return new Promise(((s,o)=>{const a=0===e.url.indexOf("http"),h=a?i:t,l=a||-1!==e.url.indexOf(".flv")||this._opt.isFlv?r:n;this.player.updateOption({protocol:h,demuxType:l}),this.player.once(R.webglAlignmentError,(()=>{this.pause().then((()=>{this.player.debug.log("Flv","webglAlignmentError"),this._resetPlayer({openWebglAlignment:!0}),this.play(e).then((()=>{this.player.debug.log("Flv","webglAlignmentError and play success")})).catch((()=>{this.player.debug.log("Flv","webglAlignmentError and play error")}))}))})),this.player.once(R.mediaSourceH265NotSupport,(()=>{this.pause().then((()=>{this.player._opt.autoWasm&&(this.player.debug.log("Flv","auto wasm [mse-> wasm] reset player and play"),this._resetPlayer({useMSE:!1}),this.play(e).then((()=>{this.player.debug.log("Flv","auto wasm [mse-> wasm] reset player and play success")})).catch((()=>{this.player.debug.log("Flv","auto wasm [mse-> wasm] reset player and play error")})))}))})),this.player.once(R.mediaSourceFull,(()=>{this.pause().then((()=>{this.player.debug.log("Flv","media source full"),this._resetPlayer(),this.play(e).then((()=>{this.player.debug.log("Flv","media source full and reset player and play success")})).catch((()=>{this.player.debug.warn("Flv","media source full and reset player and play error")}))}))})),this.player.once(R.mediaSourceAppendBufferError,(()=>{this.pause().then((()=>{this.player.debug.log("Flv","media source append buffer error"),this._resetPlayer(),this.play(e).then((()=>{this.player.debug.log("Flv","media source append buffer error and reset player and play success")})).catch((()=>{this.player.debug.warn("Flv","media source append buffer error and reset player and play error")}))}))})),this.player.once(R.mediaSourceBufferListLarge,(()=>{this.pause().then((()=>{this.player.debug.log("Flv","media source buffer list large"),this._resetPlayer(),this.play(e).then((()=>{this.player.debug.log("Flv","media source buffer list large and reset player and play success")})).catch((()=>{this.player.debug.warn("Flv","media source buffer list large and reset player and play error")}))}))})),this.player.once(R.mediaSourceAppendBufferEndTimeout,(()=>{this.pause().then((()=>{this.player.debug.log("Flv","media source append buffer end timeout"),this._resetPlayer(),this.play(e).then((()=>{this.player.debug.log("Flv","media source append buffer end timeout and reset player and play success")})).catch((()=>{this.player.debug.warn("Flv","media source append buffer end timeout and reset player and play error")}))}))})),this.player.once(R.mseSourceBufferError,(()=>{this.pause().then((()=>{this.player.debug.log("Flv","mseSourceBufferError close success")}))})),this.player.once(R.webcodecsH265NotSupport,(()=>{this.pause().then((()=>{this.player._opt.autoWasm&&(this.player.debug.log("Flv","auto wasm [wcs-> wasm] reset player and play"),this._resetPlayer({useWCS:!1}),this.play(e).then((()=>{this.player.debug.log("Flv","auto wasm [wcs-> wasm] reset player and play success")})).catch((()=>{this.player.debug.warn("Flv","auto wasm [wcs-> wasm] reset player and play error")})))}))})),this.player.once(R.webcodecsWidthOrHeightChange,(()=>{this.pause().then((()=>{this.player.debug.log("Flv","webcodecs Width Or Height Change reset player and play"),this._resetPlayer({useWCS:!0}),this.play(e).then((()=>{this.player.debug.log("Flv","webcodecs Width Or Height Change reset player and play success")})).catch((()=>{this.player.debug.warn("Flv","webcodecs Width Or Height Change reset player and play error")}))}))})),this.player.once(R.webcodecsDecodeError,(()=>{this.pause().then((()=>{this.player._opt.autoWasm&&(this.player.debug.log("Flv","webcodecs decode error reset player and play"),this._resetPlayer({useWCS:!1}),this.play(e).then((()=>{this.player.debug.log("Flv","webcodecs decode error reset player and play success")})).catch((()=>{this.player.debug.warn("Flv","webcodecs decode error reset player and play error")})))}))})),this.player.once(R.wasmDecodeError,(()=>{this.player._opt.wasmDecodeErrorReplay&&this.pause().then((()=>{this.player.debug.log("Flv","wasm decode error and reset player and play"),this._resetPlayer({useWCS:!1}),this.play(e).then((()=>{this.player.debug.log("Flv","wasm decode error and reset player and play success")})).catch((()=>{this.player.debug.warn("Flv","wasm decode error and reset player and play error")}))}))})),this.player.on(w.delayTimeout,(()=>{this.player._opt.heartTimeoutReplay&&(this._heartTimeoutReplayTimes<this.player._opt.heartTimeoutReplayTimes||-1===this.player._opt.heartTimeoutReplayTimes)&&(this.player.debug.log("Flv",`delay timeout replay time is ${this._heartTimeoutReplayTimes}`),this._heartTimeoutReplayTimes+=1,this.play(e).then((()=>{this._heartTimeoutReplayTimes=0})).catch((()=>{})))})),this.player.on(w.loadingTimeout,(()=>{this.player._opt.loadingTimeoutReplay&&(this._loadingTimeoutReplayTimes<this.player._opt.loadingTimeoutReplayTimes||-1===this.player._opt.loadingTimeoutReplayTimes)&&(this.player.debug.log("Flv",`loading timeout replay time is ${this._loadingTimeoutReplayTimes}`),this._loadingTimeoutReplayTimes+=1,this.play(e).then((()=>{this._loadingTimeoutReplayTimes=0})).catch((()=>{})))})),this.hasLoaded()?this.player.play(e).then((()=>{s()})).catch((e=>{this.player.debug.warn("Flv","hasLoaded and play error",e),this.player.pause().then((()=>{o(e)}))})):this.player.once(w.decoderWorkerInit,(()=>{this.player.play(e).then((()=>{s()})).catch((e=>{this.player.debug.warn("Flv","decoderWorkerInit and play error",e),this.player.pause().then((()=>{o(e)}))}))}))}))}resize(){this.player.resize(),Gt.report("api",{event:"resize"})}setBufferTime(e){e=Number(e),this.player.updateOption({videoBuffer:1e3*e}),this.player.decoderWorker&&this.player.decoderWorker.updateWorkConfig({key:"videoBuffer",value:1e3*e})}setRotate(e){Gt.report("api",{event:"setRotate",value:e});try{e=parseInt(e,10)}catch(e){return Promise.reject("rotate 0 | 90 | 180 | 270")}const t=[0,90,180,270];return new Promise(((i,r)=>{t.includes(e)?(this.player.updateOption({rotate:e}),this.resize(),i()):r("rotate 0 | 90 | 180 | 270")}))}hasLoaded(){return this.player.loaded}setKeepScreenOn(){this.player.updateOption({keepScreenOn:!0}),Gt.report("api",{event:"setKeepScreenOn"})}_setFullscreen(e){const t=!!e;this.player.fullscreen!==t&&(this.player.fullscreen=t)}fullScreen(){this._setFullscreen(!0),Gt.report("api",{event:"fullScreen"})}cancelFullScreen(){this._setFullscreen(!1),Gt.report("api",{event:"cancelFullScreen"})}getState(){return{playing:!!this.player&&this.player.playing,mute:!(this.player&&this.player.volume>0),fullscreen:!!this.player&&this.player.fullscreen,webFullscreen:!!this.player&&this.player.webFullscreen,loaded:!!this.player&&this.player.loaded,volume:this.player?parseFloat(this.player.volume).toFixed(2):0,isDebug:!!this.player&&this.player.isDebug}}getVersion(){return Gt.report("api",{event:"getVersion",value:"1.0.0-alpha.1"}),"1.0.0-alpha.1"}}return e($t,"ERROR",R),e($t,"TIMEOUT",{loadingTimeout:w.loadingTimeout,delayTimeout:w.delayTimeout}),$t}));