ezuikit-flv 2.1.1-beta.1 → 2.1.2-beta.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/decoder.js +2 -2
  2. package/index.js +3 -3
  3. package/package.json +1 -1
package/decoder.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  *
3
- * decoder.js v2.1.1-beta.1
4
- * Copyright (c) 2026-3-3 Ezviz-OpenBiz
3
+ * decoder.js v2.1.2-beta.1
4
+ * Copyright (c) 2026-7-22 Ezviz-OpenBiz
5
5
  *
6
6
  * https://github.com/Ezviz-OpenBiz/EZUIKit-flv
7
7
  *
package/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  *
3
- * EzuikitFlv.js v2.1.1-beta.1
4
- * Copyright (c) 2026-3-3 Ezviz-OpenBiz
3
+ * EzuikitFlv.js v2.1.2-beta.1
4
+ * Copyright (c) 2026-7-22 Ezviz-OpenBiz
5
5
  *
6
6
  * https://github.com/Ezviz-OpenBiz/EZUIKit-flv
7
7
  *
@@ -60,4 +60,4 @@
60
60
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
61
61
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
62
62
  PERFORMANCE OF THIS SOFTWARE.
63
- ***************************************************************************** */function xA(A,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function g(){this.constructor=A}ZA(A,e),A.prototype=null===e?Object.create(e):(g.prototype=e.prototype,new g)}var XA=function(){return XA=Object.assign||function(A){for(var e,g=1,t=arguments.length;g<t;g++)for(var i in e=arguments[g])Object.prototype.hasOwnProperty.call(e,i)&&(A[i]=e[i]);return A},XA.apply(this,arguments)};function jA(A,e,g){if(g||2===arguments.length)for(var t,i=0,o=e.length;i<o;i++)!t&&i in e||(t||(t=Array.prototype.slice.call(e,0,i)),t[i]=e[i]);return A.concat(t||Array.prototype.slice.call(e))}function PA(){}function zA(){let A=arguments.length>1?arguments[1]:void 0;const e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").split(","),g=atob(e[1]),t=e[0].replace("data:","").replace(";base64","");let i=g.length;const o=new Uint8Array(i);for(;i--;)o[i]=g.charCodeAt(i);return new File([o],A||"file",{type:t})}function $A(){return(new Date).getTime()}function Ae(A,e,g){if(A)return"object"==typeof e&&Object.keys(e).forEach((g=>{Ae(A,g,e[g])})),A.style[e]=g,A}function ee(){return performance&&"function"==typeof performance.now?performance.now():Date.now()}function ge(A){return!function(A){return null==A}(A)}"function"==typeof SuppressedError&&SuppressedError,(()=>{try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){const A=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(A instanceof WebAssembly.Module)return new WebAssembly.Instance(A)instanceof WebAssembly.Instance}}catch(A){}})();let te=function(){return t((function A(){e(this,A)}),[{key:"on",value:function(A,e,g){const t=this.e||(this.e={});return(t[A]||(t[A]=[])).push({fn:e,ctx:g}),this}},{key:"once",value:function(A,e,g){const t=this;function i(){t.off(A,i);for(var o=arguments.length,I=new Array(o),C=0;C<o;C++)I[C]=arguments[C];e.apply(g,I)}return i._=e,this.on(A,i,g)}},{key:"emit",value:function(A){const e=((this.e||(this.e={}))[A]||[]).slice();for(var g=arguments.length,t=new Array(g>1?g-1:0),i=1;i<g;i++)t[i-1]=arguments[i];for(let A=0;A<e.length;A+=1)e[A].fn.apply(e[A].ctx,t);return this}},{key:"off",value:function(A,e){const g=this.e||(this.e={});if(!A)return Object.keys(g).forEach((A=>{delete g[A]})),void delete this.e;const t=g[A],i=[];if(t&&e)for(let A=0,g=t.length;A<g;A+=1)t[A].fn!==e&&t[A].fn._!==e&&i.push(t[A]);return i.length?g[A]=i:delete g[A],this}}])}();var ie=function(A){function e(e){var g=A.call(this)||this;return g._isFullScreen=!1,g.resetInit(),g._orientation=e._opt.orientation||0,e.on(RA.fullscreenChange,(function(A){g._isFullScreen=A.isCurrentFullscreen})),e.on(RA.orientationChange,(function(A){g._orientation=A})),g}return xA(e,A),e.prototype.resetInit=function(){this.init=!1,this.videoInfo={width:0,height:0,encType:"",encTypeCode:0}},e.prototype.destroy=function(){var A;this.resetInit(),this.player.$container&&this.$videoElement&&(null===(A=this.player.$container)||void 0===A||A.removeChild(this.$videoElement)),this.$videoElement=null,this.off()},e.prototype.updateVideoInfo=function(A){var e,g,t,i,o,I,C,B,n,Q;(A.height&&A.height!==(null===(e=this.videoInfo)||void 0===e?void 0:e.height)||A.width&&A.width!==this.videoInfo.width||(null==A?void 0:A.encTypeCode)&&(null==A?void 0:A.encTypeCode)!==(null===(g=this.videoInfo)||void 0===g?void 0:g.encTypeCode))&&(this.videoInfo=Object.assign(this.videoInfo||{},A||{}),A.encTypeCode&&(this.videoInfo.encTypeCode=A.encTypeCode,this.videoInfo.encType=LA[A.encTypeCode]),A.width&&(this.videoInfo.width=A.width),A.height&&(this.videoInfo.height=A.height),(null===(t=this.videoInfo)||void 0===t?void 0:t.width)&&(null===(i=this.videoInfo)||void 0===i?void 0:i.width)>0&&(null===(o=this.videoInfo)||void 0===o?void 0:o.height)&&(null===(I=this.videoInfo)||void 0===I?void 0:I.height)>0&&(null===(C=this.videoInfo)||void 0===C?void 0:C.encTypeCode)&&this.player.emit(RA.videoInfo,this.videoInfo),(null===(B=this.videoInfo)||void 0===B?void 0:B.hasAudio)&&(null===(n=this.videoInfo)||void 0===n?void 0:n.audioCodec)&&this.player.emit(RA.audioInfo,{encType:this._flvToMp4Codec(null===(Q=this.videoInfo)||void 0===Q?void 0:Q.audioCodec),audioCodec:this.videoInfo.audioCodec,sampleRate:this.videoInfo.audioSampleRate}))},e.prototype._flvToMp4Codec=function(A){return{2:"mp3","mp4a.40.2":"AAC",10:"AAC"}[A]},e.prototype.play=function(){},e.prototype.pause=function(){},e.prototype.clearView=function(){},e}(te);const oe="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof global&&global.global===global?global:void 0;function Ie(A,e,g){const t=new XMLHttpRequest;t.open("GET",A),t.responseType="blob",t.onload=function(){Qe(t.response,e,g)},t.onerror=function(){},t.send()}function Ce(A){const e=new XMLHttpRequest;e.open("HEAD",A,!1);try{e.send()}catch(A){}return e.status>=200&&e.status<=299}function Be(A){try{A.dispatchEvent(new MouseEvent("click"))}catch(e){const g=document.createEvent("MouseEvents");g.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),A.dispatchEvent(g)}}const ne=oe.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent);var Qe="object"!=typeof window||window!==oe?function(){}:"download"in HTMLAnchorElement.prototype&&!ne?function(A,e,g){const t=oe.URL||oe.webkitURL,i=document.createElementNS("http://www.w3.org/1999/xhtml","a");e=e||A.name||"download",i.download=e,i.rel="noopener","string"==typeof A?(i.href=A,i.origin!==location.origin?Ce(i.href)?Ie(A,e,g):Be(i,i.target="_blank"):Be(i)):(i.href=t.createObjectURL(A),setTimeout((function(){t.revokeObjectURL(i.href)}),4e4),setTimeout((function(){Be(i)}),0))}:"msSaveOrOpenBlob"in navigator?function(A,e,g){if(e=e||A.name||"download","string"==typeof A)if(Ce(A))Ie(A,e,g);else{const e=document.createElement("a");e.href=A,e.target="_blank",setTimeout((function(){Be(e)}))}else navigator.msSaveOrOpenBlob(function(A,e){return void 0===e?e={autoBom:!1}:"object"!=typeof e&&(e={autoBom:!e}),e.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(A.type)?new Blob([String.fromCharCode(65279),A],{type:A.type}):A}(A,g),e)}:function(A,e,g,t){if((t=t||open("","_blank"))&&(t.document.title=t.document.body.innerText="downloading..."),"string"==typeof A)return Ie(A,e,g);const i="application/octet-stream"===A.type,o=/constructor/i.test(oe.HTMLElement)||oe.safari,I=/CriOS\/[\d]+/.test(navigator.userAgent);if((I||i&&o||ne)&&"undefined"!=typeof FileReader){const e=new FileReader;e.onloadend=function(){let A=e.result;A=I?A:A.replace(/^data:[^;]*;/,"data:attachment/file;"),t?t.location.href=A:location=A,t=null},e.readAsDataURL(A)}else{const e=oe.URL||oe.webkitURL,g=e.createObjectURL(A);t?t.location=g:location.href=g,t=null,setTimeout((function(){e.revokeObjectURL(g)}),4e4)}},re=function(A){function e(e){var g=A.call(this,e)||this;g._pageHide=!1,g.player=e;var t=document.createElement("canvas");return t.style.position="absolute",t.style.top="0",t.style.left="0",g.$videoElement=t,e.$container.appendChild(g.$videoElement),g.context2D=null,g.contextGl=null,g.contextGlRender=null,g.contextGlDestroy=null,g.bitmaprenderer=null,g.renderType=null,g._currentTime=0,g._initCanvasRender(),g._contextmenuEvent=function(A){A.target===g.$videoElement&&A.preventDefault()},document.addEventListener("contextmenu",g._contextmenuEvent),g.player.debug.log("CanvasVideo","init"),g._visibilitychange=g._visibilitychange.bind(g),document.addEventListener("visibilitychange",g._visibilitychange),g}return xA(e,A),e.prototype.destroy=function(){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._contextmenuEvent&&(document.removeEventListener("contextmenu",this._contextmenuEvent),this._contextmenuEvent=null),this._visibilitychange&&(document.removeEventListener("visibilitychange",this._visibilitychange),this._visibilitychange=null),this.renderType=null,A.prototype.destroy.call(this),this.player.debug.log("CanvasVideoLoader","destroy")},e.prototype._visibilitychange=function(){this.player.debug.log("document.hidden",document.hidden),this._pageHide=document.hidden},e.prototype._initContextGl=function(){this.contextGl=function(A){let e=null;const g=["webgl","experimental-webgl","moz-webgl","webkit-3d"];let t=0;for(;!e&&t<g.length;){const i=g[t];try{const g={preserveDrawingBuffer:!0};e=A.getContext(i,g)}catch(A){e=null}e&&"function"==typeof e.getParameter||(e=null),++t}return e}(this.$videoElement);var A=((A,e)=>{var g=["attribute vec4 vertexPos;","attribute vec4 texturePos;","varying vec2 textureCoord;","void main()","{","gl_Position = vertexPos;","textureCoord = texturePos.xy;","}"].join("\n"),t=["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");e&&A.pixelStorei(A.UNPACK_ALIGNMENT,1);var i=A.createShader(A.VERTEX_SHADER);A.shaderSource(i,g),A.compileShader(i),A.getShaderParameter(i,A.COMPILE_STATUS);var o=A.createShader(A.FRAGMENT_SHADER);A.shaderSource(o,t),A.compileShader(o),A.getShaderParameter(o,A.COMPILE_STATUS);var I=A.createProgram();A.attachShader(I,i),A.attachShader(I,o),A.linkProgram(I),A.getProgramParameter(I,A.LINK_STATUS),A.useProgram(I);var C=A.createBuffer();A.bindBuffer(A.ARRAY_BUFFER,C),A.bufferData(A.ARRAY_BUFFER,new Float32Array([1,1,-1,1,1,-1,-1,-1]),A.STATIC_DRAW);var B=A.getAttribLocation(I,"vertexPos");A.enableVertexAttribArray(B),A.vertexAttribPointer(B,2,A.FLOAT,!1,0,0);var n=A.createBuffer();A.bindBuffer(A.ARRAY_BUFFER,n),A.bufferData(A.ARRAY_BUFFER,new Float32Array([1,0,0,0,1,1,0,1]),A.STATIC_DRAW);var Q=A.getAttribLocation(I,"texturePos");function r(e,g){var t=A.createTexture();return A.bindTexture(A.TEXTURE_2D,t),A.texParameteri(A.TEXTURE_2D,A.TEXTURE_MAG_FILTER,A.LINEAR),A.texParameteri(A.TEXTURE_2D,A.TEXTURE_MIN_FILTER,A.LINEAR),A.texParameteri(A.TEXTURE_2D,A.TEXTURE_WRAP_S,A.CLAMP_TO_EDGE),A.texParameteri(A.TEXTURE_2D,A.TEXTURE_WRAP_T,A.CLAMP_TO_EDGE),A.bindTexture(A.TEXTURE_2D,null),A.uniform1i(A.getUniformLocation(I,e),g),t}A.enableVertexAttribArray(Q),A.vertexAttribPointer(Q,2,A.FLOAT,!1,0,0);var a=r("ySampler",0),E=r("uSampler",1),s=r("vSampler",2);return{render:function(e,g,t,i,o){A.viewport(0,0,e,g),A.activeTexture(A.TEXTURE0),A.bindTexture(A.TEXTURE_2D,a),A.texImage2D(A.TEXTURE_2D,0,A.LUMINANCE,e,g,0,A.LUMINANCE,A.UNSIGNED_BYTE,t),A.activeTexture(A.TEXTURE1),A.bindTexture(A.TEXTURE_2D,E),A.texImage2D(A.TEXTURE_2D,0,A.LUMINANCE,e/2,g/2,0,A.LUMINANCE,A.UNSIGNED_BYTE,i),A.activeTexture(A.TEXTURE2),A.bindTexture(A.TEXTURE_2D,s),A.texImage2D(A.TEXTURE_2D,0,A.LUMINANCE,e/2,g/2,0,A.LUMINANCE,A.UNSIGNED_BYTE,o),A.drawArrays(A.TRIANGLE_STRIP,0,4)},destroy:function(){try{A.deleteProgram(I),A.deleteBuffer(C),A.deleteBuffer(n),A.deleteTexture(a),A.deleteTexture(E),A.deleteTexture(s)}catch(A){}}}})(this.contextGl,this.player._opt.openWebglAlignment);this.contextGlRender=A.render,this.contextGlDestroy=A.destroy},e.prototype._initContext2D=function(){this.context2D=this.$videoElement.getContext("2d")},e.prototype._initCanvasRender=function(){this._supportOffscreen()?(this.renderType=bA,this._bindOffscreen()):(this.renderType=KA,this._initContextGl())},e.prototype._supportOffscreen=function(){return"function"==typeof this.$videoElement.transferControlToOffscreen&&this.player._opt.useOffscreen},e.prototype._bindOffscreen=function(){this.bitmaprenderer=this.$videoElement.getContext("bitmaprenderer")},e.prototype.initCanvasViewSize=function(){this.$videoElement.width=this.videoInfo.width,this.$videoElement.height=this.videoInfo.height,this.resize()},e.prototype.render=function(A){var e,g,t;switch(this.player.videoTimestamp=A.ts,this._currentTime=A.ts,this.renderType){case bA:null===(e=this.bitmaprenderer)||void 0===e||e.transferFromImageBitmap(A.buffer);break;case KA:this._pageHide||this.contextGlRender(this.$videoElement.width,this.$videoElement.height,A.output[0],A.output[1],A.output[2]);break;case HA:null===(g=this.context2D)||void 0===g||g.drawImage(A.videoFrame,0,0,this.$videoElement.width,this.$videoElement.height),(t=A.videoFrame).close?t.close():t.destroy&&t.destroy()}},e.prototype.screenshot=function(A,e,g,t){A=A||$A()+"",t=t||MA.download;var i={png:"image/png",jpeg:"image/jpeg",webp:"image/webp"},o=.92;!i[e]&&MA[e]&&(t=e,e="png",g=void 0),"string"==typeof g&&(t=g,g=void 0),void 0!==g&&(o=Number(g));var I=this.$videoElement.toDataURL(i[e]||i.png,o);if("data:,"!==I){if(t===MA.base64)return I;var C=zA(I,A+"."+e);return t===MA.blob?C:t===MA.download?(Qe(C,A),C):void 0}},e.prototype.clearView=function(){var A,e=this;switch(this.renderType){case bA:(function(A,e){const g=document.createElement("canvas");return g.width=A,g.height=e,window.createImageBitmap(g,0,0,A,e)})(this.$videoElement.width,this.$videoElement.height).then((function(A){var g;null===(g=e.bitmaprenderer)||void 0===g||g.transferFromImageBitmap(A)}));break;case KA:this.contextGl.clear(this.contextGl.COLOR_BUFFER_BIT);break;case HA:null===(A=this.context2D)||void 0===A||A.clearRect(0,0,this.$videoElement.width,this.$videoElement.height)}},e.prototype.resize=function(){},Object.defineProperty(e.prototype,"currentTime",{get:function(){return(this._currentTime||0)/1e3},enumerable:!1,configurable:!0}),e}(ie),ae=function(A){function e(e){var g=A.call(this)||this;g.bufferList=[],g.player=e,g.scriptNode=null,g.hasInitScriptNode=!1,g.audioContextChannel=null,g.audioContext=new(window.AudioContext||window.webkitAudioContext),g.gainNode=g.audioContext.createGain();var t=g.audioContext.createBufferSource();return t.buffer=g.audioContext.createBuffer(1,1,22050),t.connect(g.audioContext.destination),t.start(0),g.audioBufferSourceNode=t,g.mediaStreamAudioDestinationNode=g.audioContext.createMediaStreamDestination(),g.audioEnabled(!0),g.gainNode.gain.value=0,g.playing=!1,g.audioSyncVideoOption={diff:null},g.audioInfo={encType:"",channels:"",sampleRate:""},g.init=!1,g.hasAudio=!1,g._muted=g.player._opt.muted,g._volume=g.player._opt.volume,!g._muted&&g._volume&&(g.volume=g._volume),g.on(RA.videoSyncAudio,(function(A){g.audioSyncVideoOption=A})),g.player.debug.log("AudioContext","init"),g}return xA(e,A),e.prototype.resetInit=function(){this.init=!1,this.audioInfo={encType:"",channels:"",sampleRate:""}},e.prototype.destroy=function(){this.closeAudio(),this.resetInit(),this.audioContext.close(),this.audioContext=null,this.gainNode=null,this.hasAudio=!1,this.playing=!1,this.scriptNode&&(this.scriptNode.onaudioprocess=PA,this.scriptNode=null),this.audioBufferSourceNode=null,this.mediaStreamAudioDestinationNode=null,this.hasInitScriptNode=!1,this.audioSyncVideoOption={diff:null},this.off(),this.player.debug.log("AudioContext","destroy")},e.prototype.updateAudioInfo=function(A){A.encTypeCode&&(this.audioInfo.encType=JA[A.encTypeCode]),A.channels&&(this.audioInfo.channels=A.channels),A.sampleRate&&(this.audioInfo.sampleRate=A.sampleRate),this.audioInfo.sampleRate&&this.audioInfo.channels&&this.audioInfo.encType&&!this.init&&(this.player.emit(RA.audioInfo,this.audioInfo),this.init=!0)},Object.defineProperty(e.prototype,"isPlaying",{get:function(){return this.playing},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"muted",{get:function(){return this._muted},set:function(A){A?(this._setVolume(0),this.clear()):this._setVolume(this._volume),this._muted=A},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"volume",{get:function(){return this._volume},set:function(A){this.setVolume(A)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bufferSize",{get:function(){return this.bufferList.length},enumerable:!1,configurable:!0}),e.prototype.initScriptNode=function(){var A=this;if(this.playing=!0,!this.hasInitScriptNode){var e=this.audioInfo.channels,g=this.audioContext.createScriptProcessor(1024,0,e);g.onaudioprocess=function(g){var t=g.outputBuffer;if(A.bufferList.length&&A.playing){if(!A.player._opt.useWCS&&!A.player._opt.useMSE&&A.player._opt.wasmDecodeAudioSyncVideo){if(A.audioSyncVideoOption.diff>1e3)return void A.player.debug.warn("AudioContext","audioSyncVideoOption more than diff :".concat(A.audioSyncVideoOption.diff,", waiting"));if(A.audioSyncVideoOption.diff<-1e3){A.player.debug.warn("AudioContext","audioSyncVideoOption less than diff :".concat(A.audioSyncVideoOption.diff,", dropping"));for(var i=A.bufferList.shift();i.ts-A.player.videoTimestamp<-1e3&&A.bufferList.length>0;)i=A.bufferList.shift();if(0===A.bufferList.length)return}}if(0===A.bufferList.length)return;var o=A.bufferList.shift();o&&o.ts&&(A.player.audioTimestamp=o.ts);for(var I=0;I<e;I++)for(var C=null==o?void 0:o.buffer[I],B=t.getChannelData(I),n=0;n<1024;n++)B[n]=C[n]||0}},g.connect(this.gainNode),this.scriptNode=g,this.gainNode.connect(this.audioContext.destination),this.gainNode.connect(this.mediaStreamAudioDestinationNode),this.hasInitScriptNode=!0}},e.prototype.setVolume=function(A){A=parseFloat(A+"").toFixed(2),this._setVolume(A),this._volume=A},e.prototype._setVolume=function(A){var e,g,t;(A=parseFloat(A+"").toFixed(2),isNaN(A))||(this.audioEnabled(!0),e=A,g=0,t=1,A=Math.max(Math.min(e,Math.max(g,t)),Math.min(g,t)),this.gainNode.gain.value=A,this.gainNode.gain.setValueAtTime(A,this.audioContext.currentTime))},e.prototype.closeAudio=function(){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()},e.prototype.audioEnabled=function(A){var e,g;A?"suspended"===(null===(e=this.audioContext)||void 0===e?void 0:e.state)&&this.audioContext.resume():"running"===(null===(g=this.audioContext)||void 0===g?void 0:g.state)&&this.audioContext.suspend()},e.prototype.isStateRunning=function(){return"running"===this.audioContext.state},e.prototype.isStateSuspended=function(){return"suspended"===this.audioContext.state},e.prototype.clear=function(){this.bufferList=[]},e.prototype.play=function(A,e){this.muted||(this.hasAudio=!0,this.bufferList.push({buffer:A,ts:e}),this.bufferList.length>20&&this.bufferList.length>50&&this.bufferList.shift())},e.prototype.pause=function(){this.audioSyncVideoOption={diff:null},this.playing=!1,this.clear()},e.prototype.resume=function(){this.playing=!0},e}(te),Ee=function(){function A(e){return new(A.getLoaderFactory())(e)}return A.getLoaderFactory=function(){return ae},A}(),se=function(A){function e(e){var g=A.call(this)||this;return g.player=e,g.playing=!1,g.abortController=new AbortController,g.streamRate=(ee(),A=>{ee()}),e.debug.log("FetchStream","init"),g._streamSuccess=!1,g}return xA(e,A),e.prototype.destroy=function(){this.abort(),this.off(),this.streamRate=null,this.player.debug.log("FetchStream","destroy")},e.prototype.fetchStream=function(A,e){var g,t=this;void 0===e&&(e={}),this._streamSuccess=!1;var i=this.player.demux;this.player._times.streamStart=$A(),this.abortController||(this.abortController=new AbortController);var o=Object.assign({signal:null===(g=this.abortController)||void 0===g?void 0:g.signal},{headers:e.headers||{}});fetch(A,o).then((function(A){if(200!==A.status)return t.abort(),t.emit(RA.streamError),void t.player.emit(RA.error,RA.streamError);var e=A.body.getReader(),g=function(){e.read().then((function(A){var e=A.done,o=A.value;e?i.close():(t.streamRate&&t.streamRate(o.byteLength),t.emit(RA.flvStream,o),i.dispatch(o),t._streamSuccess||(t._streamSuccess=!0,t.emit(RA.streamSuccess)),g())})).catch((function(A){i.close();var g=A.toString();if(-1===g.indexOf(_A)&&-1===g.indexOf(TA)&&A.name!==WA){t.abort();try{e.cancel()}catch(A){}t.emit(RA.streamError,A),t.player.emit(RA.error,RA.streamError,A)}}))};g()})).catch((function(A){i.close(),t.abort(),t.emit(RA.streamError,A),t.player.emit(RA.error,RA.streamError),null==A||A.name}))},e.prototype.abort=function(){this._streamSuccess=!1,this.abortController&&(this.abortController.abort(),this.abortController=null)},e}(te);let le=function(){return t((function A(g){return e(this,A),new(A.getLoaderFactory(g._opt.protocol))(g)}),null,[{key:"getLoaderFactory",value:function(A){return se}}])}(),ce=function(){return t((function A(g){e(this,A),this.player=g,this.decoderWorker=new Worker((""===g._opt.staticPath?"":BA.getStaticPath(g._opt.staticPath))+g._opt.decoder),this._initDecoderWorker(),g.debug.log("decoderWorker","init")}),[{key:"destroy",value:function(){this.decoderWorker.postMessage({cmd:YA}),this.decoderWorker.terminate(),this.decoderWorker=null,this.player.debug.log("decoderWorker","destroy")}},{key:"_initDecoderWorker",value:function(){const{debug:A,events:{proxy:e}}=this.player;this.decoderWorker.onmessage=e=>{var g,t,i,o,I,C;const B=e.data;switch(B.cmd){case sA:A.log("decoderWorker","onmessage:",sA),this.player.loaded||this.player.emit(RA.load),this.player.emit(RA.decoderWorkerInit),this.player.emit(RA.decoderLoaded),this._initWork();break;case DA:A.log("decoderWorker","onmessage:",DA,B.code),this.player._times.decodeStart||(this.player._times.decodeStart=$A()),this.player.video.updateVideoInfo({encTypeCode:B.code});break;case uA:A.log("decoderWorker","onmessage:",uA,B.code),null===(g=this.player)||void 0===g||null===(g=g.audio)||void 0===g||null===(t=g.updateAudioInfo)||void 0===t||t.call(g,{encTypeCode:B.code});break;case lA:if(A.log("decoderWorker","onmessage:",lA,`width:${B.w},height:${B.h}`),null===(i=this.player)||void 0===i||null===(i=i.video)||void 0===i||null===(o=i.updateVideoInfo)||void 0===o||o.call(i,{width:B.w,height:B.h}),!this.player._opt.openWebglAlignment&&B.w/2%4!=0)return void this.player.emit(UA.webglAlignmentError);this.player.video.initCanvasViewSize();break;case dA:A.log("decoderWorker","onmessage:",dA,`channels:${B.channels},sampleRate:${B.sampleRate}`),this.player.audio&&(this.player.audio.updateAudioInfo(B),this.player.audio.initScriptNode(B));break;case cA:var n,Q,r;if(this.player.handleRender(),this.player.video.render(B),this.player.emit(RA.timeUpdate,B.ts/1e3),this.player.updateStats({fps:!0,ts:B.ts,buf:B.delay}),B.w&&B.h)null===(n=this.player)||void 0===n||null===(Q=(r=n.video).updateVideoInfo)||void 0===Q||Q.call(r,{width:B.w,height:B.h});this.player._times.videoStart||(this.player._times.videoStart=$A(),this.player.handlePlayToRenderTimes());break;case hA:this.player.playing&&this.player.audio&&this.player.audio.play(B.buffer,B.ts);break;case pA:B.message&&-1!==B.message.indexOf(fA)&&this.player.emitError(UA.wasmDecodeError);break;default:null===(I=(C=this.player)[B.cmd])||void 0===I||I.call(C,B)}}}},{key:"_initWork",value:function(){var A;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:kA,opt:JSON.stringify(e),sampleRate:(null===(A=this.player)||void 0===A||null===(A=A.audio)||void 0===A||null===(A=A.audioContext)||void 0===A?void 0:A.sampleRate)||0})}},{key:"decodeVideo",value:function(A,e,g){const t={type:yA,ts:Math.max(e,0),isIFrame:g};this.decoderWorker.postMessage({cmd:NA,buffer:A,options:t},[A.buffer])}},{key:"decodeAudio",value:function(A,e){this.player._opt.useWCS||this.player._opt.useMSE?this._decodeAudioNoDelay(A,e):this._decodeAudio(A,e)}},{key:"_decodeAudio",value:function(A,e){const g={type:wA,ts:Math.max(e,0)};this.decoderWorker.postMessage({cmd:NA,buffer:A,options:g},[A.buffer])}},{key:"_decodeAudioNoDelay",value:function(A,e){this.decoderWorker.postMessage({cmd:SA,buffer:A,ts:Math.max(e,0)},[A.buffer])}},{key:"updateWorkConfig",value:function(A){this.decoderWorker.postMessage({cmd:GA,key:A.key,value:A.value})}}])}(),he=function(g){function i(g){var t;return e(this,i),(t=A(this,i)).player=g,t.stopId=null,t.firstTimestamp=null,t.startTimestamp=null,t.delay=-1,t.bufferList=[],t.dropping=!1,t.initInterval(),t}return C(i,g),t(i,[{key:"destroy",value:function(){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")}},{key:"getDelay",value:function(A){if(!A)return-1;if(this.firstTimestamp){if(A){const e=Date.now()-this.startTimestamp,g=A-this.firstTimestamp;this.delay=e>=g?e-g:g-e}}else this.firstTimestamp=A,this.startTimestamp=Date.now(),this.delay=-1;return this.delay}},{key:"resetDelay",value:function(){this.firstTimestamp=null,this.startTimestamp=null,this.delay=-1,this.dropping=!1}},{key:"initInterval",value:function(){this.player.debug.log("common dumex","init Interval");const A=()=>{let A;const e=this.player._opt.videoBuffer,g=this.player._opt.videoBufferDelay;if(this.bufferList.length)if(this.dropping){for(A=this.bufferList.shift(),A.type===wA&&0===A.payload[1]&&this._doDecoderDecode(A);!A.isIFrame&&this.bufferList.length;)A=this.bufferList.shift(),A.type===wA&&0===A.payload[1]&&this._doDecoderDecode(A);A.isIFrame&&this.getDelay(A.ts)<=Math.min(e,200)&&(this.dropping=!1,this._doDecoderDecode(A))}else A=this.bufferList[0],-1===this.getDelay(A.ts)?(this.bufferList.shift(),this._doDecoderDecode(A)):this.delay>e+g?(this.resetDelay(),this.dropping=!0):(A=this.bufferList[0],this.getDelay(A.ts)>e&&(this.bufferList.shift(),this._doDecoderDecode(A)))};A(),this.stopId=setInterval(A,10)}},{key:"_doDecode",value:function(A,e,g,t,i){const o=this.player,I={ts:g,cts:i,type:e,isIFrame:!1};var C,B;if(o._opt.useWCS&&!o._opt.useOffscreen)e===yA&&(I.isIFrame=t),this.pushBuffer(A,I);else if(e===yA)null==o||null===(C=o.decoderWorker)||void 0===C||null===(B=C.decodeVideo)||void 0===B||B.call(C,A,g,t);else if(e===wA){var n,Q;if(o._opt.hasAudio)null==o||null===(n=o.decoderWorker)||void 0===n||null===(Q=n.decodeAudio)||void 0===Q||Q.call(n,A,g)}}},{key:"_doDecoderDecode",value:function(A){const e=this.player;var g,t;A.type===wA?e._opt.hasAudio&&(null===(g=e.decoderWorker)||void 0===g||null===(t=g.decodeAudio)||void 0===t||t.call(g,A.payload,A.ts)):A.type}},{key:"pushBuffer",value:function(A,e){e.type===wA?this.bufferList.push({ts:e.ts,payload:A,type:wA}):e.type===yA&&this.bufferList.push({ts:e.ts,cts:e.cts,payload:A,type:yA,isIFrame:e.isIFrame})}},{key:"close",value:function(){}}])}(te),de=function(g){function i(g){var t;return e(this,i),(t=A(this,i,[g])).input=t._inputFlv(),t.flvDemux=t.dispatchFlvData(t.input),g.debug.log("FlvDemux","init"),t}return C(i,g),t(i,[{key:"destroy",value:function(){Q(i,"destroy",this)([]),this.input=null,this.flvDemux=null,this.player.debug.log("FlvDemux","destroy")}},{key:"dispatch",value:function(A){this.flvDemux(A)}},{key:"_inputFlv",value:function*(){yield 9;const A=new ArrayBuffer(4),e=new Uint8Array(A),g=new Uint32Array(A),t=this.player;for(;;){e[3]=0;const A=yield 15,i=A[4];e[0]=A[7],e[1]=A[6],e[2]=A[5];const o=g[0];e[0]=A[10],e[1]=A[9],e[2]=A[8];let I=g[0];16777215===I&&(e[3]=A[11],I=g[0]);const C=yield o;switch(i){case mA:t._opt.hasAudio&&(t.updateStats({abps:C.byteLength}),C.byteLength>0&&this._doDecode(C,wA,I));break;case FA:if(t._times.demuxStart||(t._times.demuxStart=$A()),t._opt.hasVideo){t.updateStats({vbps:C.byteLength});const A=C[0]>>4==1;if(C.byteLength>0){g[0]=C[4],g[1]=C[3],g[2]=C[2],g[3]=0;const e=g[0];this._doDecode(C,yA,I,A,e)}}}}}},{key:"dispatchFlvData",value:function(A){let e=A.next(),g=null;return t=>{let i=new Uint8Array(t);if(g){const A=new Uint8Array(g.length+i.length);A.set(g),A.set(i,g.length),i=A,g=null}for(;i.length>=e.value;){const g=i.slice(e.value);e=A.next(i.slice(0,e.value)),i=g}i.length>0&&(g=i)}}},{key:"close",value:function(){var A,e;null===(A=this.input)||void 0===A||null===(e=A.return)||void 0===e||e.call(A,null)}}])}(he),ue=function(g){function i(g){var t;return e(this,i),t=A(this,i,[g]),g.debug.log("M7sDemux","init"),t}return C(i,g),t(i,[{key:"destroy",value:function(){Q(i,"destroy",this)([]),this.player.debug.log("M7sDemux","destroy"),this.player=null}},{key:"dispatch",value:function(A){const e=this.player,g=new DataView(A),t=g.getUint8(0),i=g.getUint32(1,!1);switch(t){case wA:if(e._opt.hasAudio){const g=new Uint8Array(A,5);e.updateStats({abps:g.byteLength}),g.byteLength>0&&this._doDecode(g,t,i)}break;case yA:if(e._opt.hasVideo)if(e._times.demuxStart||(e._times.demuxStart=$A()),g.byteLength>5){const o=new Uint8Array(A,5),I=g.getUint8(5)>>4==1;e.updateStats({vbps:o.byteLength}),o.byteLength>0&&this._doDecode(o,t,i,I)}else this.player.debug.warn("M7sDemux","dispatch","dv byteLength is",g.byteLength)}}}])}(he),De=function(){return t((function A(g){return e(this,A),new(A.getLoaderFactory(g._opt.demuxType))(g)}),null,[{key:"getLoaderFactory",value:function(A){return A===aA?ue:A===rA?de:void 0}}])}();const pe=()=>"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,fe=()=>"wakeLock"in navigator;let we=function(){return t((function A(g){if(e(this,A),this.player=g,this.enabled=!1,fe()){this._wakeLock=null;const A=()=>{null!==this._wakeLock&&"visible"===document.visibilityState&&this.enable()};document.addEventListener("visibilitychange",A),document.addEventListener("fullscreenchange",A)}else pe()?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,GkXfowEAAAAAAAA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AARAQABgAGFgv9AAIgEOYBgAAo4WCAXqADqOFggGPgA6jmYEBkwAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIBpIAOo4WCAbqADqOZgQG7ADECAAEQEAAYABhYL/QACIBDmAYAAKOFggHPgA6jmYEB4wAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIB5IAOo4WCAfqADqOZgQILADECAAEQEAAYABhYL/QACIBDmAYAAKOFggIPgA6jhYICJIAOo5mBAjMAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAjqADqOFggJPgA6jmYECWwAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYICZIAOo4WCAnqADqOZgQKDADECAAEQEAAYABhYL/QACIBDmAYAAKOFggKPgA6jhYICpIAOo5mBAqsAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCArqADqOFggLPgA6jmIEC0wARAgABEBAUYABhYL/QACIBDmAYAKOFggLkgA6jhYIC+oAOo5mBAvsAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAw+ADqOZgQMjADECAAEQEAAYABhYL/QACIBDmAYAAKOFggMkgA6jhYIDOoAOo5mBA0sAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCA0+ADqOFggNkgA6jmYEDcwAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIDeoAOo4WCA4+ADqOZgQObADECAAEQEAAYABhYL/QACIBDmAYAAKOFggOkgA6jhYIDuoAOo5mBA8MAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCA8+ADqOFggPkgA6jhYID+oAOo4WCBA+ADhxTu2sBAAAAAAAAEbuPs4EDt4r3gQHxghEr8IEK"),this._addSourceToVideo(this.noSleepVideo,"mp4","data:video/mp4;base64,AAAAHGZ0eXBNNFYgAAACAGlzb21pc28yYXZjMQAAAAhmcmVlAAAGF21kYXTeBAAAbGliZmFhYyAxLjI4AABCAJMgBDIARwAAArEGBf//rdxF6b3m2Ui3lizYINkj7u94MjY0IC0gY29yZSAxNDIgcjIgOTU2Yzhk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AAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAACMc3RjbwAAAAAAAAAfAAAALAAAA1UAAANyAAADhgAAA6IAAAO+AAAD0QAAA+0AAAQAAAAEHAAABC8AAARLAAAEZwAABHoAAASWAAAEqQAABMUAAATYAAAE9AAABRAAAAUjAAAFPwAABVIAAAVuAAAFgQAABZ0AAAWwAAAFzAAABegAAAX7AAAGFwAAAGJ1ZHRhAAAAWm1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAALWlsc3QAAAAlqXRvbwAAAB1kYXRhAAAAAQAAAABMYXZmNTUuMzMuMTAw"),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())}))})))}),[{key:"_addSourceToVideo",value:function(A,e,g){const t=document.createElement("source");t.src=g,t.type=`video/${e}`,A.appendChild(t)}},{key:"isEnabled",get:function(){return this.enabled}},{key:"enable",value:function(){const A=this.player.debug;if(fe())return navigator.wakeLock.request("screen").then((e=>{this._wakeLock=e,this.enabled=!0,A.log("wakeLock","Wake Lock active."),this._wakeLock.addEventListener("release",(()=>{A.log("wakeLock","Wake Lock released.")}))})).catch((e=>{throw this.enabled=!1,A.error("wakeLock",`${e.name}, ${e.message}`),e}));if(pe())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((A=>(this.enabled=!0,A))).catch((A=>{throw this.enabled=!1,A}))}},{key:"disable",value:function(){const A=this.player.debug;fe()?(this._wakeLock&&this._wakeLock.release(),this._wakeLock=null):pe()?this.noSleepTimer&&(A.warn("wakeLock","NoSleep now disabled for older iOS devices."),window.clearInterval(this.noSleepTimer),this.noSleepTimer=null):this.noSleepVideo.pause(),this.enabled=!1}}])}();var ye=E(H()),me=function(){function A(A){this.master=A,this.logger=new ye({name:"FLV",showTime:!0})}return A.prototype.info=function(A){for(var e,g=[],t=1;t<arguments.length;t++)g[t-1]=arguments[t];this._setLogger()>=4&&(e=this.logger).log.apply(e,jA([A],g,!1))},A.prototype.log=function(A){for(var e,g=[],t=1;t<arguments.length;t++)g[t-1]=arguments[t];this._setLogger()>=3&&(e=this.logger).log.apply(e,jA([A],g,!1))},A.prototype.warn=function(A){for(var e,g=[],t=1;t<arguments.length;t++)g[t-1]=arguments[t];this._setLogger()>=2&&(e=this.logger).warn.apply(e,jA([A],g,!1))},A.prototype.error=function(A){for(var e,g=[],t=1;t<arguments.length;t++)g[t-1]=arguments[t];(e=this.logger).error.apply(e,jA([A],g,!1))},A.prototype._setLogger=function(){var A,e,g,t,i;return this.master._opt.debug&&(null===(A=this.master._opt.loggerOptions)||void 0===A?void 0:A.level)?"INFO"===(null===(e=this.master._opt.loggerOptions)||void 0===e?void 0:e.level)?4:"LOG"===(null===(g=this.master._opt.loggerOptions)||void 0===g?void 0:g.level)?3:"WARN"===(null===(t=this.master._opt.loggerOptions)||void 0===t?void 0:t.level)?2:"ERROR"===(null===(i=this.master._opt.loggerOptions)||void 0===i?void 0:i.level)?1:5:-1},A}();let Fe=function(){return t((function A(g){e(this,A),this.destroys=[],this.proxy=this.proxy.bind(this),this.master=g}),[{key:"proxy",value:function(A,e,g){let t=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(!A)return;if(Array.isArray(e))return e.map((e=>this.proxy(A,e,g,t)));A.addEventListener(e,g,t);const i=()=>A.removeEventListener(e,g,t);return this.destroys.push(i),i}},{key:"destroy",value:function(){var A;null===(A=this.master.debug)||void 0===A||A.log("Events","destroy"),this.destroys.forEach((A=>A()))}}])}();var ke,Ne,Se=function(A){var e=A.events.proxy,g=document.createElement("object");g.setAttribute("aria-hidden","true"),g.setAttribute("tabindex","-1"),g.type="text/html",g.data="about:blank",Ae(g,{display:"block",position:"absolute",top:"0",left:"0",height:"100%",width:"100%",overflow:"hidden",pointerEvents:"none",zIndex:"-1"});var t=A.width,i=A.height;e(g,"load",(function(){var o;e(null===(o=g.contentDocument)||void 0===o?void 0:o.defaultView,"resize",(function(){A.width===t&&A.height===i||(t=A.width,i=A.height,A.emit(RA.resize))}))})),A.$container.appendChild(g),A.on(RA.destroy,(function(){A.$container.removeChild(g)}))},Ye=function(A){this.player=A,Se(A)},Ge=function(A){function e(e,g,t){var i,o=A.call(this)||this;return o.$container=e,o._opt=g,o.debug=new me(o),o._muted=g.muted,o._volume=g.volume||.8,o._loading=!1,o._playing=!1,o._hasLoaded=!1,o._checkHeartTimeout=null,o._checkStatsInterval=null,o._startBpsTime=null,o._isPlayingBeforePageHidden=!1,o._stats={buf:0,fps:0,abps:0,vbps:0,ts:0},o._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},o._videoTimestamp=0,o._audioTimestamp=0,i=o,Object.defineProperty(i,"rect",{get:function(){return i.$container.getBoundingClientRect()}}),["bottom","height","left","right","top","width"].forEach((function(A){Object.defineProperty(i,A,{get:function(){return i.rect[A]}})})),o.events=new Fe(o),o.video=new t(o),function(A){A.on(RA.decoderWorkerInit,(function(){A.debug.log("player","has loaded"),A.loaded=!0})),A.on(RA.play,(function(){A.loading=!1})),A.on(RA.resize,(function(){var e;null===(e=A.video)||void 0===e||e.resize()}));var e=[RA.timeUpdate,RA.flvStream];Object.keys(RA).forEach((function(g){A.on(RA[g],(function(t){e.includes(g)||("object"!=typeof t||"[object Object]"!==Object.prototype.toString.call(t)?A.debug.log("player events",RA[g],t):A.debug.log("player events",RA[g],JSON.stringify(t)))}))})),Object.keys(UA).forEach((function(e){A.on(UA[e],(function(g){A.debug.log("player event error",UA[e],g)}))}))}(o),function(A){var e=A._opt,g=A.debug,t=A.events.proxy;t(document,"visibilitychange",(function(){e.hiddenAutoPause&&(g.log("visibilitychange",document.visibilityState,A._isPlayingBeforePageHidden),"visible"===document.visibilityState?A._isPlayingBeforePageHidden&&A.play():(A._isPlayingBeforePageHidden=A.playing,A.playing&&A.pause()))})),t(window,"fullscreenchange",(function(){null!==A.keepScreenOn&&"visible"===document.visibilityState&&A.enableWakeLock&&A.enableWakeLock()}))}(o),o._fullscreen=!1,o.control=new Ye(o),o}return xA(e,A),Object.defineProperty(e.prototype,"muted",{get:function(){return this._muted},set:function(A){this._updateMuted(A)},enumerable:!1,configurable:!0}),e.prototype._updateMuted=function(A){this._muted!==A&&(this._muted=A,this.emit(RA.volumechange,this.volume,A))},Object.defineProperty(e.prototype,"volume",{get:function(){return this._volume},set:function(A){this._updateVolume(A)},enumerable:!1,configurable:!0}),e.prototype._updateVolume=function(A){A>=0&&A<=1&&this._volume!==A&&(this.emit(RA.volumechange,A,this._muted),this._volume=A)},e.prototype.destroy=function(){this._loading=!1,this._playing=!1,this._hasLoaded=!1,this._volume=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.emit("destroy"),this.off(),this.debug.log("play","destroy end")},e.prototype.updateOption=function(A){this._opt=Object.assign({},this._opt,A)},e.prototype.resize=function(){this.video.resize()},e}(te);var Re=function(){if(Ne)return ke;Ne=1;var A,e,g,t,i=(A="undefined"!=typeof self?self:window,e={navigator:void 0!==A.navigator?A.navigator:{userAgent:""},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"]}},g={getMatchMap:function(A){return{Trident:A.includes("Trident")||A.includes("NET CLR"),Presto:A.includes("Presto"),WebKit:A.includes("AppleWebKit"),Gecko:A.includes("Gecko/"),Safari:A.includes("Safari"),Chrome:A.includes("Chrome")||A.includes("CriOS"),IE:A.includes("MSIE")||A.includes("Trident"),Edge:A.includes("Edge"),Firefox:A.includes("Firefox")||A.includes("FxiOS"),"Firefox Focus":A.includes("Focus"),Chromium:A.includes("Chromium"),Opera:A.includes("Opera")||A.includes("OPR"),Vivaldi:A.includes("Vivaldi"),Yandex:A.includes("YaBrowser"),Arora:A.includes("Arora"),Lunascape:A.includes("Lunascape"),QupZilla:A.includes("QupZilla"),"Coc Coc":A.includes("coc_coc_browser"),Kindle:A.includes("Kindle")||A.includes("Silk/"),Iceweasel:A.includes("Iceweasel"),Konqueror:A.includes("Konqueror"),Iceape:A.includes("Iceape"),SeaMonkey:A.includes("SeaMonkey"),Epiphany:A.includes("Epiphany"),360:A.includes("QihooBrowser")||A.includes("QHBrowser"),"360EE":A.includes("360EE"),"360SE":A.includes("360SE"),UC:A.includes("UC")||A.includes(" UBrowser"),QQBrowser:A.includes("QQBrowser"),QQ:A.includes("QQ/"),Baidu:A.includes("Baidu")||A.includes("BIDUBrowser"),Maxthon:A.includes("Maxthon"),Sogou:A.includes("MetaSr")||A.includes("Sogou"),LBBROWSER:A.includes("LBBROWSER"),"2345Explorer":A.includes("2345Explorer"),TheWorld:A.includes("TheWorld"),XiaoMi:A.includes("MiuiBrowser"),Quark:A.includes("Quark"),Qiyu:A.includes("Qiyu"),Wechat:A.includes("MicroMessenger"),Taobao:A.includes("AliApp(TB"),Alipay:A.includes("AliApp(AP"),Weibo:A.includes("Weibo"),Douban:A.includes("com.douban.frodo"),Suning:A.includes("SNEBUY-APP"),iQiYi:A.includes("IqiyiApp"),Windows:A.includes("Windows"),Linux:A.includes("Linux")||A.includes("X11"),"Mac OS":A.includes("Macintosh"),Android:A.includes("Android")||A.includes("Adr"),Ubuntu:A.includes("Ubuntu"),FreeBSD:A.includes("FreeBSD"),Debian:A.includes("Debian"),"Windows Phone":A.includes("IEMobile")||A.includes("Windows Phone"),BlackBerry:A.includes("BlackBerry")||A.includes("RIM"),MeeGo:A.includes("MeeGo"),Symbian:A.includes("Symbian"),iOS:A.includes("like Mac OS X"),"Chrome OS":A.includes("CrOS"),WebOS:A.includes("hpwOS"),Mobile:A.includes("Mobi")||A.includes("iPh")||A.includes("480"),Tablet:A.includes("Tablet")||A.includes("Nexus 7"),iPad:A.includes("iPad")}},matchInfoMap:function(A){var t,i=(null==(t=e.navigator)?void 0:t.userAgent)||"",o=g.getMatchMap(i);for(var I in e.infoMap)for(var C=0;C<e.infoMap[I].length;C++){var B=e.infoMap[I][C];o[B]&&(A[I]=B)}},getOS:function(){return g.matchInfoMap(this),null==this?void 0:this.os},getOSVersion:function(){var A=e.navigator.userAgent||"";this.osVersion="";var g={Windows:function(){var e=A.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 A.replace(/^.*Android ([\d.]+);.*$/,"$1")},iOS:function(){return A.replace(/^.*OS ([\d_]+) like.*$/,"$1").replace(/_/g,".")},Debian:function(){return A.replace(/^.*Debian\/([\d.]+).*$/,"$1")},"Windows Phone":function(){return A.replace(/^.*Windows Phone( OS)? ([\d.]+);.*$/,"$2")},"Mac OS":function(){return A.replace(/^.*Mac OS X ([\d_]+).*$/,"$1").replace(/_/g,".")},WebOS:function(){return A.replace(/^.*hpwOS\/([\d.]+);.*$/,"$1")}};return"function"==typeof g[this.os]&&(this.osVersion=g[this.os](),this.osVersion==A&&(this.osVersion="")),this.osVersion},getOrientationStatu:function(){return window.matchMedia("(orientation: portrait)").matches?"vertical":"horizontal"},getDeviceType:function(){return this.device="PC",g.matchInfoMap(this),this.device},getNetwork:function(){var A,e,g,t;return null==(A=(null==(e=navigator)?void 0:e.connection)||(null==(g=navigator)?void 0:g.mozConnection)||(null==(t=navigator)?void 0:t.webkitConnection))?void 0:A.effectiveType},getLanguage:function(){var A,g,t;return this.language=((t=((null==(A=e.navigator)?void 0:A.browserLanguage)||(null==(g=e.navigator)?void 0:g.language)).split("-"))[1]&&(t[1]=t[1].toUpperCase()),t.join("_")),this.language},createFingerprint:function(A){var e=document.createElement("canvas"),g=e.getContext("2d"),t=A||window.location.host;g.textBaseline="top",g.font="14px 'Arial'",g.fillStyle="#f60",g.fillRect(125,1,62,20),g.fillStyle="#069",g.fillText(t,2,15),g.fillStyle="rgba(102, 204, 0, 0.7)",g.fillText(t,4,17);var i=e.toDataURL().replace("data:image/png;base64,","");return function(A){var e,g,t,i="";for(e=0,g=(A+="").length;e<g;e++)i+=(t=A.charCodeAt(e).toString(16)).length<2?"0"+t:t;return i}(atob(i).slice(-16,-12))},getBrowserInfo:function(){g.matchInfoMap(this);var t=e.navigator.userAgent||"",i=function(A,g){var t=e.navigator.mimeTypes;for(var i in t)if(t[i][A]==g)return!0;return!1},o=g.getMatchMap(t),I=!1;if(A.chrome){var C=t.replace(/^.*Chrome\/([\d]+).*$/,"$1");+C>36&&A.showModalDialog?I=!0:+C>45&&(I=i("type","application/vnd.chromium.remoting-viewer"))}if(o.Baidu&&o.Opera&&(o.Baidu=!1),o.Mobile&&(o.Mobile=!t.includes("iPad")),I&&(i("type","application/gameplugin")||e.navigator&&void 0===e.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 105:break;case 102:o["360EE"]=!0;break;case 104:o["360SE"]=!0}var B={Safari:function(){return t.replace(/^.*Version\/([\d.]+).*$/,"$1")},Chrome:function(){return t.replace(/^.*Chrome\/([\d.]+).*$/,"$1").replace(/^.*CriOS\/([\d.]+).*$/,"$1")},IE:function(){return t.replace(/^.*MSIE ([\d.]+).*$/,"$1").replace(/^.*rv:([\d.]+).*$/,"$1")},Edge:function(){return t.replace(/^.*Edge\/([\d.]+).*$/,"$1")},Firefox:function(){return t.replace(/^.*Firefox\/([\d.]+).*$/,"$1").replace(/^.*FxiOS\/([\d.]+).*$/,"$1")},"Firefox Focus":function(){return t.replace(/^.*Focus\/([\d.]+).*$/,"$1")},Chromium:function(){return t.replace(/^.*Chromium\/([\d.]+).*$/,"$1")},Opera:function(){return t.replace(/^.*Opera\/([\d.]+).*$/,"$1").replace(/^.*OPR\/([\d.]+).*$/,"$1")},Vivaldi:function(){return t.replace(/^.*Vivaldi\/([\d.]+).*$/,"$1")},Yandex:function(){return t.replace(/^.*YaBrowser\/([\d.]+).*$/,"$1")},Arora:function(){return t.replace(/^.*Arora\/([\d.]+).*$/,"$1")},Lunascape:function(){return t.replace(/^.*Lunascape[\/\s]([\d.]+).*$/,"$1")},QupZilla:function(){return t.replace(/^.*QupZilla[\/\s]([\d.]+).*$/,"$1")},"Coc Coc":function(){return t.replace(/^.*coc_coc_browser\/([\d.]+).*$/,"$1")},Kindle:function(){return t.replace(/^.*Version\/([\d.]+).*$/,"$1")},Iceweasel:function(){return t.replace(/^.*Iceweasel\/([\d.]+).*$/,"$1")},Konqueror:function(){return t.replace(/^.*Konqueror\/([\d.]+).*$/,"$1")},Iceape:function(){return t.replace(/^.*Iceape\/([\d.]+).*$/,"$1")},SeaMonkey:function(){return t.replace(/^.*SeaMonkey\/([\d.]+).*$/,"$1")},Epiphany:function(){return t.replace(/^.*Epiphany\/([\d.]+).*$/,"$1")},360:function(){return t.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"}[+t.replace(/^.*Chrome\/([\d]+).*$/,"$1")]||""},"360EE":function(){return{69:"11.0",63:"9.5",55:"9.0",50:"8.7",30:"7.5"}[+t.replace(/^.*Chrome\/([\d]+).*$/,"$1")]||""},Maxthon:function(){return t.replace(/^.*Maxthon\/([\d.]+).*$/,"$1")},QQBrowser:function(){return t.replace(/^.*QQBrowser\/([\d.]+).*$/,"$1")},QQ:function(){return t.replace(/^.*QQ\/([\d.]+).*$/,"$1")},Baidu:function(){return t.replace(/^.*BIDUBrowser[\s\/]([\d.]+).*$/,"$1")},UC:function(){return t.replace(/^.*UC?Browser\/([\d.]+).*$/,"$1")},Sogou:function(){return t.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 t.replace(/^.*2345Explorer\/([\d.]+).*$/,"$1")},TheWorld:function(){return t.replace(/^.*TheWorld ([\d.]+).*$/,"$1")},XiaoMi:function(){return t.replace(/^.*MiuiBrowser\/([\d.]+).*$/,"$1")},Quark:function(){return t.replace(/^.*Quark\/([\d.]+).*$/,"$1")},Qiyu:function(){return t.replace(/^.*Qiyu\/([\d.]+).*$/,"$1")},Wechat:function(){return t.replace(/^.*MicroMessenger\/([\d.]+).*$/,"$1")},Taobao:function(){return t.replace(/^.*AliApp\(TB\/([\d.]+).*$/,"$1")},Alipay:function(){return t.replace(/^.*AliApp\(AP\/([\d.]+).*$/,"$1")},Weibo:function(){return t.replace(/^.*weibo__([\d.]+).*$/,"$1")},Douban:function(){return t.replace(/^.*com.douban.frodo\/([\d.]+).*$/,"$1")},Suning:function(){return t.replace(/^.*SNEBUY-APP([\d.]+).*$/,"$1")},iQiYi:function(){return t.replace(/^.*IqiyiVersion\/([\d.]+).*$/,"$1")}};return this.browserVersion="",B[this.browser]&&(this.browserVersion=B[this.browser](),this.browserVersion==t&&(this.browserVersion="")),"Edge"==this.browser&&(this.engine="EdgeHTML"),"Chrome"==this.browser&&parseInt(this.browserVersion)>27&&(this.engine="Blink"),"Opera"==this.browser&&parseInt(this.browserVersion)>12&&(this.engine="Blink"),"Yandex"==this.browser&&(this.engine="Blink"),this.browser+" (version: "+this.browserVersion+"; kernel: "+this.engine+")"}},t={DeviceInfoObj:function(t){var i,o=function(A){var e;null==(e=t.info)||e.forEach((function(e){e.toLowerCase()===A.toLowerCase()&&(C[A]=I[A])}))};t=t||{domain:""};var I={deviceType:g.getDeviceType(),OS:g.getOS(),OSVersion:g.getOSVersion(),sh:A.screen.height,sw:A.screen.width,lang:g.getLanguage(),netWork:g.getNetwork(),orientation:g.getOrientationStatu(),browserInfo:g.getBrowserInfo(),fingerprint:g.createFingerprint(t.domain),userAgent:null==(i=e.navigator)?void 0:i.userAgent};if(!t.info||0===t.info.length)return I;var C={};for(var B in I)o(B);return C}},{getDeviceInfo:function(A){return t.DeviceInfoObj(A)}}),o=function(){function A(){}return A.add=function(e,g){A.queues.push({url:e,data:g})},A.fire=function(){if(A.queues&&0!==A.queues.length){A.isStop=!1;var e=A.queues[0];e.url&&A.api.report(e.data),A.queues.splice(0,1),A.fire()}else A.isStop=!0},A}();o.isStop=!0,o.queues=[];var I=function(){function A(A){this.url=A}var e=A.prototype;return e.report=function(A){this.checkUrl(this.url)&&this.sendInfo(A)},e.sendInfo=function(A){var e;"function"==typeof(null==(e=navigator)?void 0:e.sendBeacon)?this.sendBeacon(this.url,A):this.sendImage(this.url,A)},e.sendImage=function(A,e){var g=this.changeJSON2Query(e),t=new Image;t.onload=t.onerror=function(){t=null},t.src=A+"?"+g+"&random="+Math.random()},e.sendBeacon=function(A,e){try{navigator.sendBeacon(A,this.formatParamsByURLSearchParams(e))}catch(A){}},e.formatParamsByURLSearchParams=function(A){var e=new URLSearchParams;for(var g in A)"object"==typeof A[g]&&(A[g]=JSON.stringify(A[g])),e.append(g,A[g]);return e},e.changeJSON2Query=function(A){var e="";for(var g in A){""!=e&&(e+="&");var t=A[g];e+=g+"="+encodeURIComponent("object"==typeof t?JSON.stringify(t):t)}return e},e.checkUrl=function(A){return!!A&&/^[hH][tT][tT][pP]([sS]?):\/\//.test(A)},A}();function C(){return C=Object.assign||function(A){for(var e=1;e<arguments.length;e++){var g=arguments[e];for(var t in g)Object.prototype.hasOwnProperty.call(g,t)&&(A[t]=g[t])}return A},C.apply(this,arguments)}var B=function(){function A(A){this.options=A,this.extendsInfo=A.extendsInfo||{},this.clientInfo=this._getDeviceInfo(),o.api=new I(A.url),this.changeUrl=this.changeUrl.bind(this)}var e=A.prototype;return e.changeUrl=function(A){o.api=new I(A)},e.send=function(A){return this.options.forbidden||"object"!=typeof A||(this._handleRecordError(A),o.isStop&&o.fire()),this},e.setForbidden=function(A){this.options.forbidden=A},e.updateExtendsInfo=function(A){void 0===A&&(A={}),this.extendsInfo=C({},this.extendsInfo||{},A)},e._handleRecordError=function(A){try{var e=this._handleErrorInfo(A);o.add(this.options.url,e)}catch(A){}},e._handleErrorInfo=function(A){var e=this._getExtendsInfo(),g=C({st:(new Date).getTime()},e,A);return g.clientInfo=this.clientInfo,g},e._getExtendsInfo=function(){try{var A,e={},g=this.extendsInfo||{};for(var t in"function"==typeof g.getDynamic&&(A=g.getDynamic()),"[object Object]"===Object.prototype.toString.call(A)&&(g=C({},g,A)),g)"function"!=typeof g[t]&&(e[t]=g[t]);return e}catch(A){return{}}},e._getDeviceInfo=function(){try{var A=i.getDeviceInfo();return JSON.stringify(A)}catch(A){return""}},A}();return ke=B}(),ve=E(Re);function Ue(A){if(/http[s]?:\/\/|ws[s]?:\/\//.test(A)){const e=A.split("?")[1],g=e?e.split("&"):[],t={};for(let A=0;A<g.length;++A){const[e,i]=g[A].split("=");t[e]=t[e]||decodeURIComponent(i)}try{const e=A.split(".flv")[0].split("/"),g=e[e.length-1].split("_");e.length>0&&g[0]&&g[1]&&g[2]&&(t.serial=g[0],t.no=g[1],t.bitstream=g[2])}catch(A){}return t}return{}}let Me=function(){function A(){e(this,A)}return t(A,null,[{key:"initMonitor",value:function(e){A.collect=new ve({forbidden:e,url:"https://log.ys7.com/statistics.do/opensdk_ezuikit",jsError:!1,promiseError:!1,resourceError:!1,extendsInfo:{protocol:"flv",v:"2.1.1-beta.1"}})}},{key:"report",value:function(e){let g=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};A.collect||A.initMonitor();try{const t=Ue(A.url);A.collect.send({url:A.url,serial:t.serial,no:t.no,action:e,logInfo:g})}catch(A){}}}])}();var Le=function(A){function e(e,g){var t=A.call(this,e,g,re)||this;return t._opt.useMSE=!1,t._loadingTimeoutDelayTimer=null,t._opt.hasAudio&&(t.audio=new Ee(t)),t.decoderWorker=new ce(t),t.stream=null,t.demux=null,t._muted=t._opt.muted,BA.isMobile()&&(t.keepScreenOn=new we(t)),t._enableSoundOnUserInteraction=t._enableSoundOnUserInteraction.bind(t),window.addEventListener("click",t._enableSoundOnUserInteraction),window.addEventListener("pointerdown",t._enableSoundOnUserInteraction),window.addEventListener("touchstart",t._enableSoundOnUserInteraction),window.addEventListener("keydown",t._enableSoundOnUserInteraction),document.body.addEventListener("click",t._enableSoundOnUserInteraction),document.body.addEventListener("pointerdown",t._enableSoundOnUserInteraction),document.body.addEventListener("touchstart",t._enableSoundOnUserInteraction),document.body.addEventListener("keydown",t._enableSoundOnUserInteraction),t.on(RA.audioInfo,(function(A){var e;A.encType&&!t.muted&&(null===(e=t.audio)||void 0===e?void 0:e.isStateRunning())&&setTimeout((function(){var A,e;null===(e=(A=t.audio).audioEnabled)||void 0===e||e.call(A,!0)}),100)})),t}return xA(e,A),e.prototype.destroy=function(){var e,g,t,i,o,I;this._loading=!1,this._playing=!1,this._hasLoaded=!1,this.decoderWorker&&(this.decoderWorker.destroy(),this.decoderWorker=null),this.audio&&(null===(g=(e=this.audio).destroy)||void 0===g||g.call(e),this.audio=null),this.stream&&(null===(i=(t=this.stream).destroy)||void 0===i||i.call(t),this.stream=null),this.demux&&(null===(I=null===(o=this.demux)||void 0===o?void 0:o.destroy)||void 0===I||I.call(o),this.demux=null),this.clearCheckHeartTimeout(),this.clearCheckLoadingTimeout(),this.clearStatsInterval(),this.releaseWakeLock(),this.keepScreenOn=null,this.resetStats(),this._audioTimestamp=0,this._videoTimestamp=0,window.removeEventListener("click",this._enableSoundOnUserInteraction),window.removeEventListener("pointerdown",this._enableSoundOnUserInteraction),window.removeEventListener("touchstart",this._enableSoundOnUserInteraction),window.removeEventListener("keydown",this._enableSoundOnUserInteraction),document.body.removeEventListener("click",this._enableSoundOnUserInteraction),document.body.removeEventListener("pointerdown",this._enableSoundOnUserInteraction),document.body.removeEventListener("touchstart",this._enableSoundOnUserInteraction),document.body.removeEventListener("keydown",this._enableSoundOnUserInteraction),A.prototype.destroy.call(this)},Object.defineProperty(e.prototype,"loaded",{get:function(){return this._hasLoaded},set:function(A){this._hasLoaded=A},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"playing",{get:function(){return this._playing},set:function(A){A&&(this.loading=!1),this.playing!==A&&(this._playing=A,this.emit(RA.playing,A),this.emit(RA.volumechange,this.volume,this.muted),A?this.emit(RA.play):this.emit(RA.pause))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"muted",{get:function(){return this._muted},set:function(e){this.audio&&(this.audio.muted=e),A.prototype._updateMuted.call(this,e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"volume",{get:function(){return this._volume},set:function(e){this.audio&&(this.audio.volume=e),A.prototype._updateVolume.call(this,e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"loading",{get:function(){return this._loading},set:function(A){this.loading!==A&&(this._loading=A,this.emit(RA.loading,this._loading),A||this.emit(RA.loaded))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"audioTimestamp",{get:function(){return this._audioTimestamp},set:function(A){null!==A&&(this._audioTimestamp=A)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"videoTimestamp",{get:function(){return this._videoTimestamp},set:function(A){null!==A&&(this._videoTimestamp=A,this._opt.useWCS||this._opt.useMSE||this.audioTimestamp&&this.videoTimestamp&&this.audio&&this.audio.emit(RA.videoSyncAudio,{audioTimestamp:this.audioTimestamp,videoTimestamp:this.videoTimestamp,diff:this.audioTimestamp-this.videoTimestamp}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isDebug",{get:function(){return!0===this._opt.debug},enumerable:!1,configurable:!0}),e.prototype._init=function(){var A=this;return new Promise((function(e,g){A.stream||(A.stream=new le(A)),A.audio||A._opt.hasAudio&&(A.audio=new Ee(A)),A.demux||(A.demux=new De(A)),A.decoderWorker?e():(A.decoderWorker=new ce(A),A.once(RA.decoderWorkerInit,(function(){e()})))}))},e.prototype.play=function(A){var e=this;return this._opt=Object.assign({},this._opt,A||{}),this.clearCheckHeartTimeout(),new Promise((function(A,g){if(!e._opt.url)return g();e.loading=!0,e.playing=!1,e._times.playInitStart=$A(),e._init().then((function(){e._times.playStart=$A(),e._opt.muted||(e.muted=!1),e.enableWakeLock(),e.stream.on(RA.flvStream,(function(A){e.emit(RA.flvStream,A)}));try{e.stream.fetchStream(e._opt.url,e._opt)}catch(A){}e.checkLoadingTimeout(),e.stream.once(RA.streamError,(function(A){e.stream&&(e.stream.destroy(),e.stream=null),e.clearCheckLoadingTimeout(),e.emit(RA.streamError,A),e.emit(RA.delayTimeout,A),g(A)})),e.stream.once(RA.streamEnd,(function(){g()})),e.stream.once(RA.streamSuccess,(function(){e.clearCheckLoadingTimeout(),e.emit(RA.streamSuccess),A(),e._times.streamResponse=$A(),e.video.play(),e.checkStatsInterval()}))})).catch((function(A){g(A)})),e._resumeAudioAfterPause()}))},e.prototype.close=function(){var A=this;return new Promise((function(e){A._close().then((function(){var g,t;null===(t=null===(g=A.video)||void 0===g?void 0:g.clearView)||void 0===t||t.call(g),e()}))}))},e.prototype._resumeAudioAfterPause=function(){this._volume&&(this.volume=this._volume)},e.prototype._close=function(){var A=this;return new Promise((function(e){var g,t;A._loadingTimeoutDelayTimer&&(clearTimeout(A._loadingTimeoutDelayTimer),A._loadingTimeoutDelayTimer=null),A.stream&&(A.stream.destroy(),A.stream=null),A.demux&&(A.demux.destroy(),A.demux=null),A.decoderWorker&&(A.decoderWorker.destroy(),A.decoderWorker=null),A.audio&&(null===(t=(g=A.audio).pause)||void 0===t||t.call(g)),A.clearCheckHeartTimeout(),A.clearCheckLoadingTimeout(),A.clearStatsInterval(),A.playing=!1,A.loading=!1,A.video&&(A.video.resetInit(),A.video.pause(!0)),A.releaseWakeLock(),A.resetStats(),A._audioTimestamp=0,A._videoTimestamp=0,A._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},setTimeout((function(){e()}),0)}))},e.prototype.pause=function(A){return void 0===A&&(A=!1),A?this.close():this._close()},e.prototype.checkHeart=function(){this.clearCheckHeartTimeout(),this.checkHeartTimeout()},e.prototype.checkHeartTimeout=function(){var A,e=this;0!==this._opt.heartTimeout&&(this._checkHeartTimeout=setTimeout((function(){if(e._checkHeartTimeout&&e.clearCheckHeartTimeout(),e.playing){if(0!==e._stats.fps)return;e.pause().then((function(){e.emit(RA.timeout,RA.heartTimeout),e.emit(RA.heartTimeout)}))}}),1e3*((null===(A=this._opt)||void 0===A?void 0:A.heartTimeout)||5)))},e.prototype.checkStatsInterval=function(){var A=this;this._checkStatsInterval=setInterval((function(){A.updateStats()}),1e3)},e.prototype.clearCheckHeartTimeout=function(){this._checkHeartTimeout&&(clearTimeout(this._checkHeartTimeout),this._checkHeartTimeout=null)},e.prototype.checkLoadingTimeout=function(){var A=this;0!==this._opt.loadingTimeout&&(this._checkLoadingTimeout=setTimeout((function(){A.playing||(A.clearCheckLoadingTimeout(),A.pause().then((function(){A.emit(RA.timeout,RA.loadingTimeout),A.emit(RA.loadingTimeout)})).catch((function(){})))}),1e3*this._opt.loadingTimeout))},e.prototype.clearCheckLoadingTimeout=function(){this._checkLoadingTimeout&&(clearTimeout(this._checkLoadingTimeout),this._checkLoadingTimeout=null)},e.prototype.clearStatsInterval=function(){this._checkStatsInterval&&(clearInterval(this._checkStatsInterval),this._checkStatsInterval=null)},e.prototype.handleRender=function(){this.loading&&(this.emit(RA.start),this.loading=!1),this.clearCheckLoadingTimeout(),this.playing||(this.playing=!0),this.checkHeart()},e.prototype.updateStats=function(A){A=A||{},this._startBpsTime||(this._startBpsTime=$A()),ge(A.ts)&&(this._stats.ts=A.ts),ge(A.buf)&&(this._stats.buf=A.buf),A.fps&&(this._stats.fps+=1),A.abps&&(this._stats.abps+=A.abps),A.vbps&&(this._stats.vbps+=A.vbps);var e=$A();e-this._startBpsTime<1e3||(this.emit(RA.stats,this._stats),this._stats.fps=0,this._stats.abps=0,this._stats.vbps=0,this._startBpsTime=e)},e.prototype.resetStats=function(){this._startBpsTime=null,this._stats={buf:0,fps:0,abps:0,vbps:0,ts:0}},e.prototype.enableWakeLock=function(){this._opt.keepScreenOn&&this.keepScreenOn&&this.keepScreenOn.enable()},e.prototype.releaseWakeLock=function(){this._opt.keepScreenOn&&this.keepScreenOn&&this.keepScreenOn.disable()},e.prototype.handlePlayToRenderTimes=function(){var A=this._times;A.playTimestamp=A.playStart-A.playInitStart,A.streamTimestamp=A.streamStart-A.playStart,A.streamResponseTimestamp=A.streamResponse-A.streamStart,A.demuxTimestamp=A.demuxStart-A.streamResponse,A.decodeTimestamp=A.decodeStart-A.demuxStart,A.videoTimestamp=A.videoStart-A.decodeStart,A.allTimestamp=A.videoStart-A.playInitStart,this.emit(RA.playToRenderTimes,A)},e.prototype.getOption=function(){return this._opt},e.prototype.emitError=function(A,e){void 0===e&&(e=""),Me.report(51,{event:A,value:e}),this.emit(RA.error,A,e),this.emit(A,e)},e.prototype._enableSoundOnUserInteraction=function(){var A,e,g;this.muted||(null===(A=this.audio)||void 0===A?void 0:A.isStateSuspended())&&(null===(g=(e=this.audio).audioEnabled)||void 0===g||g.call(e,!0))},e}(Ge),Je=function(A){function e(e){var g,t,i=A.call(this,e)||this;i._videoMuted=!0,i.player=e;var o=document.createElement("video"),I=document.createElement("canvas");i.$posterElement=document.createElement("img"),o.oncontextmenu=function(A){A.preventDefault()},o.crossOrigin="anonymous",i._videoMuted=!window.___enableSoundOnUserInteraction___&&i.player._opt.autoPlay||i.player._opt.muted||!i.player._opt.hasAudio,o.muted=i._videoMuted,o.disablepictureinpicture=!0,o.setAttribute("disablepictureinpicture",""),o.style.position="absolute",o.style.top="0px",o.style.left="0px",o.style.height="100%",o.style.width="100%",i._delayPlay=!1,e.$container.appendChild(o),i.videoInfo={width:"",height:"",encType:""},i.$videoElement=o,i.$canvasElement=I,i.canvasContext=I.getContext("2d"),i.fixChromeVideoFlashBug(),i.resize();var C=i.player.events.proxy;return C(i.$videoElement,"loadstart",(function(){i.player.emit("loadstart")})),C(i.$videoElement,"loadeddata",(function(){i.player.debug.log("Video","loadeddata ".concat(i._delayPlay)),i.player.emit(RA.streamSuccess)})),C(i.$videoElement,"canplay",(function(){i.player.debug.log("Video","canplay and _delayPlay is ".concat(i._delayPlay)),i._delayPlay&&i._play(),i.player.$container.contains(i.$posterElement)&&i.$posterElement&&i.player.$container.removeChild(i.$posterElement)})),C(i.$videoElement,"waiting",(function(){i.player.emit(RA.videoWaiting)})),C(i.$videoElement,"timeupdate",(function(){i.player.emit(RA.timeUpdate,i.currentTime),!i.isPlaying()&&i.init&&(i.player.debug.log("Video","timeupdate and this.isPlaying is false and retry play"),i.$videoElement.play())})),C(i.$videoElement,"enterpictureinpicture",(function(A){A.preventDefault(),document.exitPictureInPicture()})),null===(t=null===(g=i.player.debug)||void 0===g?void 0:g.log)||void 0===t||t.call(g,"Video","init"),i._enableSoundOnUserInteraction=i._enableSoundOnUserInteraction.bind(i),window.addEventListener("mouseup",i._enableSoundOnUserInteraction),window.addEventListener("click",i._enableSoundOnUserInteraction),window.addEventListener("touchstart",i._enableSoundOnUserInteraction),window.addEventListener("keydown",i._enableSoundOnUserInteraction),i}return xA(e,A),e.prototype.destroy=function(){var e;this.$canvasElement=null,this.canvasContext=null,this.$videoElement&&(this.$videoElement.pause(),this.$videoElement.currentTime=0,this.$videoElement.src="",this.$videoElement.removeAttribute("src")),this.trackGenerator&&(this.trackGenerator.stop(),this.trackGenerator=null),this.vwriter&&(this.vwriter.close(),this.vwriter=null),(null===(e=this.player.$container)||void 0===e?void 0:e.contains(this.$posterElement))&&this.$posterElement&&this.player.$container.removeChild(this.$posterElement),A.prototype.destroy.call(this),this.player.debug.log("Video","destroy")},e.prototype.fixChromeVideoFlashBug=function(){var A=function(){const A=navigator.userAgent.toLowerCase(),e={},g={IE:window.ActiveXObject||"ActiveXObject"in window,Chrome:A.indexOf("chrome")>-1&&A.indexOf("safari")>-1,Firefox:A.indexOf("firefox")>-1,Opera:A.indexOf("opera")>-1,Safari:A.indexOf("safari")>-1&&-1===A.indexOf("chrome"),Edge:A.indexOf("edge")>-1,QQBrowser:/qqbrowser/.test(A),WeixinBrowser:/MicroMessenger/i.test(A)};for(let t in g)if(g[t]){let g="";if("IE"===t)g=A.match(/(msie\s|trident.*rv:)([\w.]+)/)[2];else if("Chrome"===t){for(const A in navigator.mimeTypes)"application/360softmgrplugin"===navigator.mimeTypes[A].type&&(t="360");g=A.match(/chrome\/([\d.]+)/)[1]}else"Firefox"===t?g=A.match(/firefox\/([\d.]+)/)[1]:"Opera"===t?g=A.match(/opera\/([\d.]+)/)[1]:"Safari"===t?g=A.match(/version\/([\d.]+)/)[1]:"Edge"===t?g=A.match(/edge\/([\d.]+)/)[1]:"QQBrowser"===t&&(g=A.match(/qqbrowser\/([\d.]+)/)[1]);e.type=t,e.version=parseInt(g)}return e}().type.toLowerCase();"chrome"!==A&&"edge"!==A||(this.player.$container.style.backdropFilter="blur(0px)")},e.prototype.play=function(){if(this.$videoElement){var A=this._getVideoReadyState();if(this.player.debug.log("Video","play and readyState: ".concat(A)),0===A)return this.player.debug.warn("Video","readyState is 0 and set _delayPlay to true"),void(this._delayPlay=!0);this._play()}},e.prototype._getVideoReadyState=function(){var A=0;return this.$videoElement&&(A=this.$videoElement.readyState),A},e.prototype._play=function(){var A=this;if(this.$videoElement)var e=setTimeout((function(){A.$videoElement.play().then((function(){A._delayPlay=!1,A.player.debug.log("Video","_play success"),setTimeout((function(){A.isPlaying()||(A.player.debug.warn("Video","play failed and retry play"),A._play())}),100)})).catch((function(e){A.player.debug.error("Video","_play error",e)})).finally((function(){clearTimeout(e)}))}),20)},e.prototype.pause=function(A){var e=this;this._poster(),this.$videoElement.paused||(A?this.$videoElement&&this.$videoElement.pause():setTimeout((function(){e.$videoElement&&e.$videoElement.pause()}),100))},e.prototype.clearView=function(){},e.prototype.screenshot=function(A,e,g,t){var i,o=this;A=A||$A()+"",t=t||MA.download,e=e||"png";var I={png:"image/png",jpeg:"image/jpeg",webp:"image/webp"};"number"!=typeof g&&(g=Number(g||.92));var C=this.$videoElement,B=this.$canvasElement;B.width=C.videoWidth,B.height=C.videoHeight,null===(i=this.canvasContext)||void 0===i||i.drawImage(C,0,0,B.width,B.height);var n=B.toDataURL(I[e]||I.png,g);if(setTimeout((function(){var A;null===(A=o.canvasContext)||void 0===A||A.clearRect(0,0,B.width,B.height),B.width=0,B.height=0}),2e3),"data:,"!==n){if(t===MA.base64)return n;var Q=zA(n,A+"."+("jpeg"===e?"jpg":e));return t===MA.blob?Q:t===MA.download?(Qe(Q,A),Q):void 0}},e.prototype.initCanvasViewSize=function(){this.resize()},e.prototype._poster=function(){var A=this.screenshot("poster","png",.75,MA.base64);void 0===A||A.length<10||(this.$posterElement.src=A,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())},e.prototype.render=function(A){this.vwriter&&this.vwriter.write(A.videoFrame)},e.prototype.resize=function(){},e.prototype.isPlaying=function(){return this.$videoElement&&!this.$videoElement.paused},Object.defineProperty(e.prototype,"currentTime",{get:function(){var A;return(null===(A=this.$videoElement)||void 0===A?void 0:A.currentTime)||0},enumerable:!1,configurable:!0}),e.prototype._enableSoundOnUserInteraction=function(){!this.player._opt.autoPlay||this.player.muted||window.____enableSoundOnUserInteraction___||(this.$videoElement.muted=!1),window.____enableSoundOnUserInteraction___=!0,window.removeEventListener("mouseup",this._enableSoundOnUserInteraction),window.removeEventListener("click",this._enableSoundOnUserInteraction),window.removeEventListener("touchstart",this._enableSoundOnUserInteraction),window.removeEventListener("keydown",this._enableSoundOnUserInteraction)},e}(ie),He=function(A){function e(e,g){var t=A.call(this,e,g,Je)||this;return t._checkLoadingTimeout=null,t._opt.useMSE=!0,t.emit(RA.decoderLoaded),g.autoPlay&&t._createPlayer(g),t}return xA(e,A),e.prototype.close=function(){},e.prototype._createPlayer=function(A){var e,g=this;this._opt=Object.assign({},this._opt,A),this._removeFlvEvents(),this.player&&(this.player.unload(),this.player.detachMediaElement(),this.player.destroy(),this.player=null),this.events||(this.events=new Fe(this)),this.video||(this.video=new Je(this)),null===(e=qA.LoggingControl)||void 0===e||e.applyConfig({globalTag:"EzuikitFlv",enableVerbose:!!this._opt.debug,enableDebug:!!this._opt.debug,enableInfo:!!this._opt.debug,enableWarn:!!this._opt.debug,enableError:!0}),this.player=qA.createPlayer({type:"flv",url:A.url,isLive:A.isLive,isEzviz:A.isEzviz},{stashInitialSize:128,enableWorker:!0,autoCleanupSourceBuffer:!0,lazyLoadMaxDuration:86400,fixAudioTimestampGap:!1,referrerPolicy:A.referrerPolicy}),this.player.attachMediaElement(this.video.$videoElement),this.player.on("origin_stream",(function(A){g.emit(RA.flvStream,A)})),this._flvEvents(),A.isLive&&this.player.on(qA.Events.LOADING_COMPLETE,(function(){g.player.updateConfig({liveBufferLatencyChasing:!0})}))},e.prototype._removeFlvEvents=function(){this.player&&(this.player.off(qA.Events.ERROR),this.player.off(qA.Events.LOADING_COMPLETE),this.player.off(qA.Events.RECOVERED_EARLY_EOF),this.player.off("origin_stream"),this.player.off(qA.Events.MEDIA_INFO),this.player.off(qA.Events.STATISTICS_INFO),this.player.off(qA.Events.DESTROYING))},e.prototype._flvEvents=function(){var A=this;if(this.player){var e=0;this.player.on(qA.Events.ERROR,(function(g,t,i){var o;if("MediaError"===g&&"MediaMSEError"===t&&9===i.code&&A.emit(UA.mediaSourceH265NotSupport,i),A.emit(RA.error,{errorTypes:g,errorDetails:t,info:i}),g.indexOf("NetworkError")>-1&&(A.emit(RA.streamError,{errorTypes:g,errorDetails:t,info:i,api:A._opt.url,type:"stream"}),A.player))try{A.pause().then((function(){A.emit(RA.delayTimeout)})).catch((function(){A.emit(RA.delayTimeout)}))}catch(A){}if("MediaError"===g&&"CodecUnsupported"===t&&-1===i.code&&i.msg.indexOf("Unsupported audio codec"))0===e&&(Me.report(51,{event:g,value:i}),e=1,A.debug.error("".concat(qA.Events.ERROR),g,t,JSON.stringify(i)),A.emit(RA.audioCodecUnsupported,!0));else if(null===(o=i.msg)||void 0===o?void 0:o.includes("SourceBuffer is full")){var I=A.player._msectl._sourceBuffers[0];try{var C=A.video.$videoElement.currentTime;Math.max(0,C-5)>0&&I&&!I.updating&&I.remove(0,Math.max(0,C-5))}catch(A){}Me.report(51,{event:g,value:i}),A.debug.error("".concat(qA.Events.ERROR),g,t,JSON.stringify(i))}else"NetworkError"===g&&"UnrecoverableEarlyEof"===t||(Me.report(51,{event:g,value:i}),A.debug.error("".concat(qA.Events.ERROR),g,t,JSON.stringify(i)))})),this.player.on(qA.Events.LOADING_COMPLETE,(function(e){A.debug.warn("".concat(qA.Events.LOADING_COMPLETE),JSON.stringify(e))})),this.player.on(qA.Events.RECOVERED_EARLY_EOF,(function(e){A.debug.warn("".concat(qA.Events.RECOVERED_EARLY_EOF),e)})),this.player.on("media_info",(function(e){A.clearCheckLoadingTimeout(),A.video.updateVideoInfo(XA({encTypeCode:(null==e?void 0:e.videoCodec.indexOf("avc"))>=0?7:12},e))})),this.player.on(qA.Events.STATISTICS_INFO,(function(e){e.decodedFrames===A._decodedFrames&&null===A._checkHeartTimeout?A.checkHeartTimeout():e.decodedFrames!==A._decodedFrames&&(A.clearCheckHeartTimeout(),A._decodedFrames=e.decodedFrames)})),this.player.on(qA.Events.DESTROYING,(function(e){A.debug.log("".concat(qA.Events.DESTROYING),JSON.stringify(e))})),this.on(RA.videoWaiting,(function(){A.clearCheckHeartTimeout(),null===A._checkHeartTimeout&&A.handleRender()})),this._onVideoLoadstart=this._onVideoLoadstart.bind(this),this.off("loadstart"),this.on("loadstart",this._onVideoLoadstart),this.on(RA.timeUpdate,(function(){A.clearCheckHeartTimeout()})),this._onVideoStreamSuccess=this._onVideoStreamSuccess.bind(this),this.off(RA.streamSuccess,this._onVideoStreamSuccess),this.on(RA.streamSuccess,this._onVideoStreamSuccess)}},e.prototype._onVideoLoadstart=function(){this.checkLoadingTimeout()},e.prototype._onVideoStreamSuccess=function(){this.clearCheckLoadingTimeout()},e.prototype.getOption=function(){return this._opt},e.prototype.emitError=function(A,e){void 0===e&&(e=""),this.emit(RA.error,A,e),this.emit(A,e)},e.prototype.destroy=function(){this._destroy(),this.clearCheckHeartTimeout(),this.clearCheckLoadingTimeout(),this.video&&(this.video.destroy(),this.video=null),this.events&&(this.events.destroy(),this.events=null),this.emit("destroy"),this.off(),this.debug.log("play","destroy end")},e.prototype._destroy=function(){this.player&&this.playing&&this.player.pause(),this._flvPlayerDestroy(),this._loading=!1,this._playing=!1,this._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},this.resetStats(),this._audioTimestamp=0,this._videoTimestamp=0},e.prototype.resetStats=function(){},Object.defineProperty(e.prototype,"loaded",{get:function(){return!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"playing",{get:function(){return this._playing},set:function(A){A&&(this.loading=!1),this.playing!==A&&(this._playing=A,this.emit(RA.playing,A),A?this.emit(RA.play):this.emit(RA.pause))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"muted",{get:function(){return this._muted},set:function(e){this.video&&(this.video.$videoElement.muted=e,this.player&&(this.player.muted=e)),A.prototype._updateMuted.call(this,e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"volume",{get:function(){return this._volume},set:function(e){A.prototype._updateVolume.call(this,e),this.video&&(this.video.$videoElement.volume=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"loading",{get:function(){return this._loading},set:function(A){this.loading!==A&&(this._loading=A,this.emit(RA.loading,this._loading),A||this.emit(RA.loaded))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"audioTimestamp",{get:function(){return this._audioTimestamp},set:function(A){null!==A&&(this._audioTimestamp=A)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"videoTimestamp",{get:function(){return this._videoTimestamp},set:function(A){null!==A&&(this._videoTimestamp=A)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isDebug",{get:function(){return!!this._opt.debug},enumerable:!1,configurable:!0}),e.prototype.checkLoadingTimeout=function(){var A,e=this;0!==this._opt.loadingTimeout&&(this._checkLoadingTimeout=setTimeout((function(){e.clearCheckLoadingTimeout();try{e.pause().then((function(){e.emit(RA.timeout,RA.loadingTimeout),e.emit(RA.loadingTimeout)})).catch((function(){e.emit(RA.timeout,RA.loadingTimeout),e.emit(RA.loadingTimeout)}))}catch(A){}}),1e3*((null===(A=this._opt)||void 0===A?void 0:A.loadingTimeout)||10)))},e.prototype.clearCheckLoadingTimeout=function(){this._checkLoadingTimeout&&(clearTimeout(this._checkLoadingTimeout),this._checkLoadingTimeout=null)},e.prototype.checkHeart=function(){this.clearCheckHeartTimeout(),this.checkHeartTimeout()},e.prototype.clearCheckHeartTimeout=function(){this._checkHeartTimeout&&(clearTimeout(this._checkHeartTimeout),this._checkHeartTimeout=null)},e.prototype.checkHeartTimeout=function(){var A,e,g=this;if(0!==this._opt.heartTimeout){var t=(null===(A=this.video)||void 0===A?void 0:A.currentTime)||0;this._checkHeartTimeout=setTimeout((function(){var A;if(g._checkHeartTimeout&&g.clearCheckHeartTimeout(),g.playing&&g.video){if(t!==((null===(A=g.video)||void 0===A?void 0:A.currentTime)||0))return;try{g.pause().then((function(){g.emit(RA.timeout,RA.heartTimeout),g.emit(RA.heartTimeout)})).catch((function(){g.emit(RA.timeout,RA.heartTimeout),g.emit(RA.heartTimeout)}))}catch(A){}}}),1e3*((null===(e=this._opt)||void 0===e?void 0:e.heartTimeout)||5))}},e.prototype.handleRender=function(){this.loading&&(this.emit(RA.start),this.loading=!1),this.playing||(this.playing=!0),this.checkHeart()},e.prototype.updateOption=function(e){var g;A.prototype.updateOption.call(this,e),null===(g=qA.LoggingControl)||void 0===g||g.applyConfig({globalTag:"EzuikitFlv",enableVerbose:!!e.debug,enableDebug:!!e.debug,enableInfo:!!e.debug,enableWarn:!!e.debug,enableError:!0})},e.prototype.play=function(A){return void 0===A&&(A={}),this._play(A)},e.prototype._play=function(A){var e=this;return void 0===A&&(A={}),this.player&&this._destroy(),this.clearCheckHeartTimeout(),this._createPlayer(Object.assign({},this._opt,A)),this.loading=!0,this._playing=!1,this._times.playInitStart=$A(),this.player?(this.player.load(),new Promise((function(A,g){e.player.play().then((function(){e.loading=!1,e.playing=!0,e._opt.muted||(e.muted=!1),A()})).catch((function(A){g(A)}))}))):Promise.reject()},e.prototype._flvPlayerDestroy=function(){this.player&&(this.video.pause(),this.player.unload(),this._removeFlvEvents(),this.player.detachMediaElement(),this.player.destroy(),this.player=null)},e.prototype._close=function(){var A=this;return new Promise((function(e){A._loading=!1,A._playing=!1,A._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},A.video&&A.video.resetInit(),A.clearCheckHeartTimeout(),A.clearCheckLoadingTimeout(),A.player&&(A._flvPlayerDestroy(),A._pause=!0),A.resetStats(),A._audioTimestamp=0,A._videoTimestamp=0,setTimeout((function(){e()}),110)}))},e.prototype.pause=function(){return this._close()},e.prototype.resumeAudioAfterPause=function(){},e}(Ge);let Ke=function(){return t((function A(g,t){return e(this,A),this._opt=Object.assign({},EA,t),!BA.isMobile()&&"360EE"!==CA().browser&&qA.isSupported()||(this._opt.useMSE=!1),new(A.getLoaderFactory(this._opt.useMSE))(g,this._opt)}),null,[{key:"getLoaderFactory",value:function(A){return A?He:Le}}])}();var be=function(){function A(A){void 0===A&&(A={}),this.options=A}return A.prototype.inputData=function(A){var e,g,t=new DataView(A.buffer);if("FLV"===String.fromCharCode(t.getUint8(0),t.getUint8(1),t.getUint8(2))){if(this.firstChunk=A,this.lastTagChunk=new Uint8Array(0),A.length<13)throw new Error("not FLV");var i=this._parseFLVTagEndOffset(A.slice(13).buffer,1);this.firstHeadTagChunk=A.slice(0,i+13),this.lastTagChunk=A.slice(i+13),null===(g=(e=this.options).onHasAudio)||void 0===g||g.call(e,!!(4&A[4]))}else{this.lastTagChunk=this._concatTwoUint8Arrays(this.lastTagChunk,A),(i=this._parseFLVTagEndOffset(this.lastTagChunk.buffer))>0&&(this.lastTagChunk=this.lastTagChunk.slice(i))}},A.prototype._parseFLVTagEndOffset=function(A,e){var g,t;void 0===e&&(e=0);for(var i=new DataView(A),o=0,I=0;o+11+4<=i.byteLength;){var C=i.getUint8(o),B=o+11+this._readUint24(i,o+1);if(B+4>i.byteLength)break;if(9===C&&++I===e){o=B+4;break}8===C&&(null===(t=(g=this.options).onHasAudio)||void 0===t||t.call(g,!0)),o=B+4}return o},A.prototype._concatTwoUint8Arrays=function(A,e){var g=new Uint8Array(A.length+e.length);return g.set(A,0),g.set(e,A.length),g},A.prototype._readUint24=function(A,e){return A.getUint8(e)<<16|A.getUint8(e+1)<<8|A.getUint8(e+2)},A}();function _e(A){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const g=new URL(A),t=A.split("?")[1];let i={};if(t){const A=t.split("&");for(let e of A){if(""===e)continue;const A=e.split("=");A[0]&&(i[A[0]]=A[1])}}const o={protocol:g.protocol,hostname:g.hostname,port:g.port,pathname:g.pathname,search:g.search,query:i,url:A};if(e&&/_(\d+)_(\d+)\.flv/.test(A)){const A=g.pathname.split("/")[g.pathname.split("/").length-1].replace(/.flv$/,"").split("_");A[0].indexOf("-")>=0?(o.streamName=A[0].split("-")[0],o.deviceSerial=A[0].split("-")[1]):o.deviceSerial=A[0],o.channelNo=+A[1],o.streamTypeIn=+A[2]}return o}var Te,We={exports:{}},Ve=s(Object.freeze({__proto__:null,default:{}}));var Oe=E((Te||(Te=1,function(A){!function(){var e="input is invalid type",g="object"==typeof window,t=g?window:{};t.JS_MD5_NO_WINDOW&&(g=!1);var i=!g&&"object"==typeof self,o=!t.JS_MD5_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node;o?t=a:i&&(t=self);var I,C=!t.JS_MD5_NO_COMMON_JS&&A.exports,B=!t.JS_MD5_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,n="0123456789abcdef".split(""),Q=[128,32768,8388608,-2147483648],r=[0,8,16,24],E=["hex","array","digest","buffer","arrayBuffer","base64"],s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),l=[];if(B){var c=new ArrayBuffer(68);I=new Uint8Array(c),l=new Uint32Array(c)}var h=Array.isArray;!t.JS_MD5_NO_NODE_JS&&h||(h=function(A){return"[object Array]"===Object.prototype.toString.call(A)});var d=ArrayBuffer.isView;!B||!t.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW&&d||(d=function(A){return"object"==typeof A&&A.buffer&&A.buffer.constructor===ArrayBuffer});var u=function(A){var g=typeof A;if("string"===g)return[A,!0];if("object"!==g||null===A)throw new Error(e);if(B&&A.constructor===ArrayBuffer)return[new Uint8Array(A),!1];if(!h(A)&&!d(A))throw new Error(e);return[A,!1]},D=function(A){return function(e){return new w(!0).update(e)[A]()}},p=function(A){var g,i=Ve,o=Ve.Buffer;return g=o.from&&!t.JS_MD5_NO_BUFFER_FROM?o.from:function(A){return new o(A)},function(t){if("string"==typeof t)return i.createHash("md5").update(t,"utf8").digest("hex");if(null==t)throw new Error(e);return t.constructor===ArrayBuffer&&(t=new Uint8Array(t)),h(t)||d(t)||t.constructor===o?i.createHash("md5").update(g(t)).digest("hex"):A(t)}},f=function(A){return function(e,g){return new y(e,!0).update(g)[A]()}};function w(A){if(A)l[0]=l[16]=l[1]=l[2]=l[3]=l[4]=l[5]=l[6]=l[7]=l[8]=l[9]=l[10]=l[11]=l[12]=l[13]=l[14]=l[15]=0,this.blocks=l,this.buffer8=I;else if(B){var e=new ArrayBuffer(68);this.buffer8=new Uint8Array(e),this.blocks=new Uint32Array(e)}else this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.h0=this.h1=this.h2=this.h3=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0}function y(A,e){var g,t=u(A);if(A=t[0],t[1]){var i,o=[],I=A.length,C=0;for(g=0;g<I;++g)(i=A.charCodeAt(g))<128?o[C++]=i:i<2048?(o[C++]=192|i>>>6,o[C++]=128|63&i):i<55296||i>=57344?(o[C++]=224|i>>>12,o[C++]=128|i>>>6&63,o[C++]=128|63&i):(i=65536+((1023&i)<<10|1023&A.charCodeAt(++g)),o[C++]=240|i>>>18,o[C++]=128|i>>>12&63,o[C++]=128|i>>>6&63,o[C++]=128|63&i);A=o}A.length>64&&(A=new w(!0).update(A).array());var B=[],n=[];for(g=0;g<64;++g){var Q=A[g]||0;B[g]=92^Q,n[g]=54^Q}w.call(this,e),this.update(n),this.oKeyPad=B,this.inner=!0,this.sharedMemory=e}w.prototype.update=function(A){if(this.finalized)throw new Error("finalize already called");var e=u(A);A=e[0];for(var g,t,i=e[1],o=0,I=A.length,C=this.blocks,n=this.buffer8;o<I;){if(this.hashed&&(this.hashed=!1,C[0]=C[16],C[16]=C[1]=C[2]=C[3]=C[4]=C[5]=C[6]=C[7]=C[8]=C[9]=C[10]=C[11]=C[12]=C[13]=C[14]=C[15]=0),i)if(B)for(t=this.start;o<I&&t<64;++o)(g=A.charCodeAt(o))<128?n[t++]=g:g<2048?(n[t++]=192|g>>>6,n[t++]=128|63&g):g<55296||g>=57344?(n[t++]=224|g>>>12,n[t++]=128|g>>>6&63,n[t++]=128|63&g):(g=65536+((1023&g)<<10|1023&A.charCodeAt(++o)),n[t++]=240|g>>>18,n[t++]=128|g>>>12&63,n[t++]=128|g>>>6&63,n[t++]=128|63&g);else for(t=this.start;o<I&&t<64;++o)(g=A.charCodeAt(o))<128?C[t>>>2]|=g<<r[3&t++]:g<2048?(C[t>>>2]|=(192|g>>>6)<<r[3&t++],C[t>>>2]|=(128|63&g)<<r[3&t++]):g<55296||g>=57344?(C[t>>>2]|=(224|g>>>12)<<r[3&t++],C[t>>>2]|=(128|g>>>6&63)<<r[3&t++],C[t>>>2]|=(128|63&g)<<r[3&t++]):(g=65536+((1023&g)<<10|1023&A.charCodeAt(++o)),C[t>>>2]|=(240|g>>>18)<<r[3&t++],C[t>>>2]|=(128|g>>>12&63)<<r[3&t++],C[t>>>2]|=(128|g>>>6&63)<<r[3&t++],C[t>>>2]|=(128|63&g)<<r[3&t++]);else if(B)for(t=this.start;o<I&&t<64;++o)n[t++]=A[o];else for(t=this.start;o<I&&t<64;++o)C[t>>>2]|=A[o]<<r[3&t++];this.lastByteIndex=t,this.bytes+=t-this.start,t>=64?(this.start=t-64,this.hash(),this.hashed=!0):this.start=t}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this},w.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var A=this.blocks,e=this.lastByteIndex;A[e>>>2]|=Q[3&e],e>=56&&(this.hashed||this.hash(),A[0]=A[16],A[16]=A[1]=A[2]=A[3]=A[4]=A[5]=A[6]=A[7]=A[8]=A[9]=A[10]=A[11]=A[12]=A[13]=A[14]=A[15]=0),A[14]=this.bytes<<3,A[15]=this.hBytes<<3|this.bytes>>>29,this.hash()}},w.prototype.hash=function(){var A,e,g,t,i,o,I=this.blocks;this.first?e=((e=((A=((A=I[0]-680876937)<<7|A>>>25)-271733879|0)^(g=((g=(-271733879^(t=((t=(-1732584194^2004318071&A)+I[1]-117830708)<<12|t>>>20)+A|0)&(-271733879^A))+I[2]-1126478375)<<17|g>>>15)+t|0)&(t^A))+I[3]-1316259209)<<22|e>>>10)+g|0:(A=this.h0,e=this.h1,g=this.h2,e=((e+=((A=((A+=((t=this.h3)^e&(g^t))+I[0]-680876936)<<7|A>>>25)+e|0)^(g=((g+=(e^(t=((t+=(g^A&(e^g))+I[1]-389564586)<<12|t>>>20)+A|0)&(A^e))+I[2]+606105819)<<17|g>>>15)+t|0)&(t^A))+I[3]-1044525330)<<22|e>>>10)+g|0),e=((e+=((A=((A+=(t^e&(g^t))+I[4]-176418897)<<7|A>>>25)+e|0)^(g=((g+=(e^(t=((t+=(g^A&(e^g))+I[5]+1200080426)<<12|t>>>20)+A|0)&(A^e))+I[6]-1473231341)<<17|g>>>15)+t|0)&(t^A))+I[7]-45705983)<<22|e>>>10)+g|0,e=((e+=((A=((A+=(t^e&(g^t))+I[8]+1770035416)<<7|A>>>25)+e|0)^(g=((g+=(e^(t=((t+=(g^A&(e^g))+I[9]-1958414417)<<12|t>>>20)+A|0)&(A^e))+I[10]-42063)<<17|g>>>15)+t|0)&(t^A))+I[11]-1990404162)<<22|e>>>10)+g|0,e=((e+=((A=((A+=(t^e&(g^t))+I[12]+1804603682)<<7|A>>>25)+e|0)^(g=((g+=(e^(t=((t+=(g^A&(e^g))+I[13]-40341101)<<12|t>>>20)+A|0)&(A^e))+I[14]-1502002290)<<17|g>>>15)+t|0)&(t^A))+I[15]+1236535329)<<22|e>>>10)+g|0,e=((e+=((t=((t+=(e^g&((A=((A+=(g^t&(e^g))+I[1]-165796510)<<5|A>>>27)+e|0)^e))+I[6]-1069501632)<<9|t>>>23)+A|0)^A&((g=((g+=(A^e&(t^A))+I[11]+643717713)<<14|g>>>18)+t|0)^t))+I[0]-373897302)<<20|e>>>12)+g|0,e=((e+=((t=((t+=(e^g&((A=((A+=(g^t&(e^g))+I[5]-701558691)<<5|A>>>27)+e|0)^e))+I[10]+38016083)<<9|t>>>23)+A|0)^A&((g=((g+=(A^e&(t^A))+I[15]-660478335)<<14|g>>>18)+t|0)^t))+I[4]-405537848)<<20|e>>>12)+g|0,e=((e+=((t=((t+=(e^g&((A=((A+=(g^t&(e^g))+I[9]+568446438)<<5|A>>>27)+e|0)^e))+I[14]-1019803690)<<9|t>>>23)+A|0)^A&((g=((g+=(A^e&(t^A))+I[3]-187363961)<<14|g>>>18)+t|0)^t))+I[8]+1163531501)<<20|e>>>12)+g|0,e=((e+=((t=((t+=(e^g&((A=((A+=(g^t&(e^g))+I[13]-1444681467)<<5|A>>>27)+e|0)^e))+I[2]-51403784)<<9|t>>>23)+A|0)^A&((g=((g+=(A^e&(t^A))+I[7]+1735328473)<<14|g>>>18)+t|0)^t))+I[12]-1926607734)<<20|e>>>12)+g|0,e=((e+=((o=(t=((t+=((i=e^g)^(A=((A+=(i^t)+I[5]-378558)<<4|A>>>28)+e|0))+I[8]-2022574463)<<11|t>>>21)+A|0)^A)^(g=((g+=(o^e)+I[11]+1839030562)<<16|g>>>16)+t|0))+I[14]-35309556)<<23|e>>>9)+g|0,e=((e+=((o=(t=((t+=((i=e^g)^(A=((A+=(i^t)+I[1]-1530992060)<<4|A>>>28)+e|0))+I[4]+1272893353)<<11|t>>>21)+A|0)^A)^(g=((g+=(o^e)+I[7]-155497632)<<16|g>>>16)+t|0))+I[10]-1094730640)<<23|e>>>9)+g|0,e=((e+=((o=(t=((t+=((i=e^g)^(A=((A+=(i^t)+I[13]+681279174)<<4|A>>>28)+e|0))+I[0]-358537222)<<11|t>>>21)+A|0)^A)^(g=((g+=(o^e)+I[3]-722521979)<<16|g>>>16)+t|0))+I[6]+76029189)<<23|e>>>9)+g|0,e=((e+=((o=(t=((t+=((i=e^g)^(A=((A+=(i^t)+I[9]-640364487)<<4|A>>>28)+e|0))+I[12]-421815835)<<11|t>>>21)+A|0)^A)^(g=((g+=(o^e)+I[15]+530742520)<<16|g>>>16)+t|0))+I[2]-995338651)<<23|e>>>9)+g|0,e=((e+=((t=((t+=(e^((A=((A+=(g^(e|~t))+I[0]-198630844)<<6|A>>>26)+e|0)|~g))+I[7]+1126891415)<<10|t>>>22)+A|0)^((g=((g+=(A^(t|~e))+I[14]-1416354905)<<15|g>>>17)+t|0)|~A))+I[5]-57434055)<<21|e>>>11)+g|0,e=((e+=((t=((t+=(e^((A=((A+=(g^(e|~t))+I[12]+1700485571)<<6|A>>>26)+e|0)|~g))+I[3]-1894986606)<<10|t>>>22)+A|0)^((g=((g+=(A^(t|~e))+I[10]-1051523)<<15|g>>>17)+t|0)|~A))+I[1]-2054922799)<<21|e>>>11)+g|0,e=((e+=((t=((t+=(e^((A=((A+=(g^(e|~t))+I[8]+1873313359)<<6|A>>>26)+e|0)|~g))+I[15]-30611744)<<10|t>>>22)+A|0)^((g=((g+=(A^(t|~e))+I[6]-1560198380)<<15|g>>>17)+t|0)|~A))+I[13]+1309151649)<<21|e>>>11)+g|0,e=((e+=((t=((t+=(e^((A=((A+=(g^(e|~t))+I[4]-145523070)<<6|A>>>26)+e|0)|~g))+I[11]-1120210379)<<10|t>>>22)+A|0)^((g=((g+=(A^(t|~e))+I[2]+718787259)<<15|g>>>17)+t|0)|~A))+I[9]-343485551)<<21|e>>>11)+g|0,this.first?(this.h0=A+1732584193|0,this.h1=e-271733879|0,this.h2=g-1732584194|0,this.h3=t+271733878|0,this.first=!1):(this.h0=this.h0+A|0,this.h1=this.h1+e|0,this.h2=this.h2+g|0,this.h3=this.h3+t|0)},w.prototype.hex=function(){this.finalize();var A=this.h0,e=this.h1,g=this.h2,t=this.h3;return n[A>>>4&15]+n[15&A]+n[A>>>12&15]+n[A>>>8&15]+n[A>>>20&15]+n[A>>>16&15]+n[A>>>28&15]+n[A>>>24&15]+n[e>>>4&15]+n[15&e]+n[e>>>12&15]+n[e>>>8&15]+n[e>>>20&15]+n[e>>>16&15]+n[e>>>28&15]+n[e>>>24&15]+n[g>>>4&15]+n[15&g]+n[g>>>12&15]+n[g>>>8&15]+n[g>>>20&15]+n[g>>>16&15]+n[g>>>28&15]+n[g>>>24&15]+n[t>>>4&15]+n[15&t]+n[t>>>12&15]+n[t>>>8&15]+n[t>>>20&15]+n[t>>>16&15]+n[t>>>28&15]+n[t>>>24&15]},w.prototype.toString=w.prototype.hex,w.prototype.digest=function(){this.finalize();var A=this.h0,e=this.h1,g=this.h2,t=this.h3;return[255&A,A>>>8&255,A>>>16&255,A>>>24&255,255&e,e>>>8&255,e>>>16&255,e>>>24&255,255&g,g>>>8&255,g>>>16&255,g>>>24&255,255&t,t>>>8&255,t>>>16&255,t>>>24&255]},w.prototype.array=w.prototype.digest,w.prototype.arrayBuffer=function(){this.finalize();var A=new ArrayBuffer(16),e=new Uint32Array(A);return e[0]=this.h0,e[1]=this.h1,e[2]=this.h2,e[3]=this.h3,A},w.prototype.buffer=w.prototype.arrayBuffer,w.prototype.base64=function(){for(var A,e,g,t="",i=this.array(),o=0;o<15;)A=i[o++],e=i[o++],g=i[o++],t+=s[A>>>2]+s[63&(A<<4|e>>>4)]+s[63&(e<<2|g>>>6)]+s[63&g];return A=i[o],t+=s[A>>>2]+s[A<<4&63]+"=="},y.prototype=new w,y.prototype.finalize=function(){if(w.prototype.finalize.call(this),this.inner){this.inner=!1;var A=this.array();w.call(this,this.sharedMemory),this.update(this.oKeyPad),this.update(A),w.prototype.finalize.call(this)}};var m=function(){var A=D("hex");o&&(A=p(A)),A.create=function(){return new w},A.update=function(e){return A.create().update(e)};for(var e=0;e<E.length;++e){var g=E[e];A[g]=D(g)}return A}();m.md5=m,m.md5.hmac=function(){var A=f("hex");A.create=function(A){return new y(A)},A.update=function(e,g){return A.create(e).update(g)};for(var e=0;e<E.length;++e){var g=E[e];A[g]=f(g)}return A}(),C?A.exports=m:t.md5=m}()}(We)),We.exports));const qe="/api/v3/device/local/video/unify/query",Ze="/api/service/device/capacity/video/quality",xe="/api/v3/device/setVideoLevel",Xe="/api/lapp/v2/live/address/get",je="/api/service/media/live/cdn/config",Pe="/api/service/media/live/record/cdn/config",ze="/api/service/media/streammanage/interrupt/info";function $e(A){return A<10?"0"+A:A+""}const Ag={0:"流畅",1:"标清",2:"高清",3:"超清",4:"极清",5:"3K",6:"4K"},eg=[{videoLevel:1,name:Ag[1],streamTypeIn:2,type:"compatible"},{videoLevel:2,name:Ag[2],streamTypeIn:1,type:"compatible"}];let gg=function(){return t((function A(g,t){e(this,A),this._player=g,this.baseURL=(t.baseURL||"https://open.ys7.com").replace(/\/$/,""),this.accessToken=t.accessToken,this.deviceSerial=t.deviceSerial,this.channelNo=t.channelNo,this.appName=t.appName,this.v=t.v}),[{key:"fetch",value:function(A){function e(e){return A.apply(this,arguments)}return e.toString=function(){return A.toString()},e}((function(A){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const g=/http[s]?:\/\//.test(A)?A:`${this.baseURL}${A}`,t=e.headers;return delete e.headers,fetch(g,{...e||{},...null===t?{}:{headers:{clientType:"ezuikit-flv",accessToken:this.accessToken,deviceSerial:this.deviceSerial,localIndex:this.channelNo,...t||{}}}})}))},{key:"get",value:function(A){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.fetch(A,{...e||{},method:"get"})}},{key:"post",value:function(A){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.fetch(A,{...e||{},method:"post"})}},{key:"setVideoLevelService",value:function(A){const e=new FormData;return e.append("videoLevel",parseInt(A)),this.post(`${xe}`,{body:e}).then((A=>A.json())).catch((A=>{var e,g;null===(e=(g=this._player).emit)||void 0===e||e.call(g,UA.fetchError,{api:xe,error:A})}))}},{key:"getLocalVideoUnifyQueryService",value:async function(A){var e,g,t,i;const o=(A.startTime+36e5*((null===(e=this._player._opt)||void 0===e?void 0:e.timeZone)||0))/1e3,I=(A.endTime+36e5*((null===(g=this._player._opt)||void 0===g?void 0:g.timeZone)||0))/1e3,C=async A=>{let e=[];try{var g,t,i;const n=await this.get(`${qe}?startTime=${A.startTime}&endTime=${A.endTime}&pageSize=${A.pageSize||200}`).then((A=>A.json())).catch((A=>{var e,g;null===(e=(g=this._player).emit)||void 0===e||e.call(g,UA.fetchError,{api:qe,error:A})}));var o,I,B;if(200!==(null==n||null===(g=n.meta)||void 0===g?void 0:g.code))return null===(o=(I=this._player).emit)||void 0===o||o.call(I,UA.fetchError,{api:qe,error:null==n?void 0:n.meta}),e;if(null!=n&&null!==(t=n.data)&&void 0!==t&&null!==(t=t.records)&&void 0!==t&&t.length&&(e=e.concat(n.data.records||[])),null!=n&&null!==(i=n.data)&&void 0!==i&&i.hasMore)e=e.concat(await C({...A,startTime:null==n||null===(B=n.data)||void 0===B?void 0:B.nextFileTime}))}catch(A){}return e},B=await C({...A,startTime:o,endTime:I})||[];return this._player.playbackRecords=(B||[]).map((A=>{var e,g;return{...A,startTime:A.startTime-3600*((null===(e=this._player._opt)||void 0===e?void 0:e.timeZone)||0),endTime:A.endTime-3600*((null===(g=this._player._opt)||void 0===g?void 0:g.timeZone)||0)}})).reduce(((A,e)=>{const g=A[A.length-1];return g&&g.endTime===e.startTime?g.endTime=e.endTime:A.push(e),A}),[]),null===(t=(i=this._player).emit)||void 0===t||t.call(i,RA.localVideoRecords,this._player.playbackRecords),B}},{key:"getVideoQualityService",value:async function(){let A=eg;try{var e,g;const o=await this.get(`${Ze}?deviceSerial=${this.deviceSerial}`).then((A=>A.json())).catch((A=>{this._player.emit(UA.fetchError,{api:Ze,error:A})}));var t,i;if(200!==(null==o||null===(e=o.meta)||void 0===e?void 0:e.code))return null===(t=(i=this._player).emit)||void 0===t||t.call(i,UA.fetchError,{api:Ze,error:null==o?void 0:o.meta}),A;null!=o&&null!==(g=o.data)&&void 0!==g&&g.length&&(A=o.data)}catch(A){}return A=A.map((A=>({...A,name:Ag[A.videoLevel]||"未知"}))),A}},{key:"getPlayAddressService",value:function(){let A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e=new FormData;return Object.keys(A).forEach((g=>{e.append(g,A[g])})),e.append("protocol",4),e.append("accessToken",this.accessToken),e.append("deviceSerial",this.deviceSerial),e.append("channelNo",this.channelNo),this.post(`${Xe}`,{body:e}).then((A=>A.json())).then((A=>{var e;return 200==+A.code?null==A||null===(e=A.data)||void 0===e?void 0:e.url:""}))}},{key:"getRecordAddressService",value:function(){let A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.appName&&this.v?(delete A.expireTime,this.getCDNRecordAddressService(A)):this.getPlayAddressService({...A,type:2})}},{key:"getLiveAddressService",value:function(){let A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.appName&&this.v?(delete A.expireTime,this.getCDNLiveAddressService(A)):this.getPlayAddressService({...A,type:1})}},{key:"getCDNPlayAddressService",value:function(A){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const g=new FormData,t=new Date,i=`${t.getFullYear()}-${$e(t.getMonth()+1)}-${$e(t.getDate())} 00:00:00`,o=`${t.getFullYear()}-${$e(t.getMonth()+1)}-${$e(t.getDate())} 23:59:59`;return g.append("startTime",i),g.append("endTime",o),g.append("playProtocol",2),g.append("streamName",Oe((function(A,e){var g,t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),i=[];for(e=e||t.length,g=0;g<A;g++)i[g]=t[0|Math.random()*e];return i.join("")}(32)+"_"+(new Date).getTime()).replace(/-/gi,"")+"_"+this.deviceSerial+"_"+this.channelNo+"_"+e.quality)),g.append("supportH265",1),g.append("appName",this.appName),Object.keys(e).forEach((A=>{g.append(A,e[A])})),this.post(A,{body:g}).then((A=>A.json())).then((A=>{var e,g;return 200==+(null===(e=A.meta)||void 0===e?void 0:e.code)?null===(g=A.data)||void 0===g?void 0:g.cdnUrl:""}))}},{key:"getCDNLiveAddressService",value:async function(A){return this.getCDNPlayAddressService(`${je}`,A)}},{key:"getCDNRecordAddressService",value:async function(A){return this.getCDNPlayAddressService(`${Pe}`,{recordStartTime:A.startTime,recordEndTime:A.stopTime,quality:A.quality,type:A.type||1})}},{key:"getStreamInterreputInfo",value:async function(A){const e=new FormData;return e.append("streamId",A),this.post(ze,{body:e,headers:null}).then((A=>A.json()))}}])}();function tg(A){return new Date(ig(A,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/"))}function ig(A){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/";return`${(A=A.replace(/\//gi,"").replace(/-/gi,"").replace(/:/gi,"").replace(/ /gi,"")).substring(0,4)}${e}${A.substring(4,6)}${e}${A.substring(6,8)} ${A.substring(8,10)}:${A.substring(10,12)}:${A.substring(12,14)}`}function og(A){let e=null;if(e="string"==typeof A?document.querySelector("#"+A.replace(/^#/,"")):A,!e)throw new Error("Flv required node can be a string (dom id) or dom (HTMLElement node)");if("CANVAS"===e.nodeName||"VIDEO"===e.nodeName)throw new Error(`Flv container type can not be ${e.nodeName} type`);return e}var Ig={95e3:"服务端内部处理异常",95400:"私有化协议vtm检测私有化协议中码流类型小于0或者设备序列号为空等非法参数场景返回(app不重试取流)",95402:"回放找不到录像文件",95403:"操作码或信令密钥与设备不匹配",95404:"设备不在线\t检查设备网络",95405:"流媒体向设备发送或接受信令超时/cas响应超时",95406:"token失效",95407:"客户端的URL格式错误",95409:"预览开启隐私保护",95411:"token无权限",95412:"session不存在",95413:"token验证失败\t刷新重试",95415:"设备通道错",95416:"设备资源受限\t刷新重试",95417:"设备4G流量耗尽",95451:"设备不支持的码流类型",95452:"设备链接流媒体服务器失败",95454:"流媒体中关于设备取流会话不存在",95455:"设备通道未关联",95456:"设备通道关联设备不在线",95457:"客户端不支持端到端加密",95458:"设备不支持当前并发ECDH密",95459:"VTDU 处理ECDH 加密失败",95460:"手表正在拍照或录像",95461:"手表正在视频聊天",95462:"手表正在识图",95463:"手表正在QQ视频",95464:"手表正在坐姿检测",95465:"手表温度过高",95466:"设备视频通话中,不支持预览",95492:"设备不支持的命令",95500:"服务器处理失败",95503:"vtm返回分配vtdu失败, 请稍后重试",95504:"服务器负载达到上限,请稍后重试",95505:"vtm ecdh解密失败",95506:"vtm 返回IPC不支持取流(需要IPC添加NVR后支持)",95507:"不支持该4G卡套餐在非萤石App取流",95544:"设备返回无视频源",95545:"视频分享时间已经结束",95546:"取流并发路数限制",95547:"开放平台用户并发限制",95556:"ticket校验失败",95557:"回放服务器等待流头超时, 刷新重试,检测设备网络,重启设备",95558:"查找录像开始时间错误",95560:"群组分享取流二次验证失败",95561:"分享群组用户被锁住",95562:"群组分享用户权限变更",95563:"认证服务连接失败",95564:"认证超时",95565:"缓存无效",95566:"不在分享时间内预览",95567:"分享通道被锁定",95568:"未找到认证类型",95569:"认证返回的参数异常",95600:"分享设备不在分享时间内",95601:"群组分享用户没权限",95602:"群组分享权限变更",95530:"机房故障不可用, 刷新重试",95610:"接收流头失败",95620:"心跳超时",95701:"cas信令返回格式错误",95702:"SPGW请求Cas、Status透传超时,刷新重试",95703:"SPGW请求http不通,刷新重试",96001:"客户端参数出错",96002:"等待客户端侧心跳超时(20秒无心跳包)",96099:"客户端默认错误",96101:"不支持的命令",96102:"设备流头发送失败, 刷新重试",96103:"cas/设备返回错误1, 刷新重试",96104:"cas/设备返回错误-1, 刷新重试",96105:"设备返回错误码3, 刷新重试",96106:"设备返回错误码4, 刷新重试",96107:"设备返回错误码5, 刷新重试",96108:"cas信令回应重复, 刷新重试",96109:"视频广场取消分享",96110:"设备信令默认错误\t设备错返回的错误码,不具体\t刷新重试,或者重启设备",96501:"设备数据链路和实际链路不匹配, 刷新重试",96502:"设备数据链路重复建立连接, 刷新重试",96503:"设备数据链路端口不匹配, 刷新重试",96504:"缓存设备数据链路失败, 刷新重试",96505:"设备发送确认头消息重复, 刷新重试",96506:"设备数据先于确定头部到达, 刷新重试",96508:"设备数据头部长度非法, 刷新重试,或者重启设备",96509:"索引找不到设备数据管理块, 刷新重试",96510:"设备数据链路vtdu内存块协议状态不匹配",96511:"设备数据头部没有streamkey错误",96512:"设备数据头部非法",96513:"设备数据长度过小",96514:"设备老协议推流头部没有streamkey错误",96515:"设备老协议推流数据非法",96516:"设备老协议索引找不到内存管理块",96517:"设备老协议推流数据非法",96518:"设备数据包过大, 刷新重试,或者重启设备",96519:"设备推流链路网络不稳定, 设备长时间未推流超时",96520:"设备推流链路网络不稳定, 设备网络异常",90601:"流ID不存在",90602:"流被禁用",90603:"不在可用时间区间",90604:"用户设备关系验证失败",90605:"通道被隐藏",90606:"4G无限流量卡",4050:"服务内部调用向vtdu取流的接口失败",4054:"服务内部生成ticket失败",4056:"vtm服务信息为空",4057:"取流url非法(可能是格式、参数错误)",4058:"取流url过期(不在可用时间)",9048:"并发限制",9049:"带宽限制",9053:"不支持H265",9057:"设备码流加密",9060:"设备取流校验不通过",9061:"auth认证不通过",9062:"auth认证网络有问题",httpFetchStreamError:"取流失败,请检查网络"},Cg={95e3:"Internal server processing error",95400:"Private protocol VTM detection failed: Invalid parameters (stream type < 0 or empty device serial number), (App should not retry streaming)",95402:"Playback failed: Recording file not found",95403:"Operation code/signaling key mismatch with the device",95404:"Device offline, Check device network",95405:"Stream server timeout when sending/receiving device signaling or CAS response timeout, Check device network or restart device",95406:"Token expired, Refresh token or restart device",95407:"Invalid client URL format",95409:"Privacy protection enabled during preview",95411:"Token lacks permissions/user unauthorized",95412:"Session does not exist",95413:"Token verification failed, Refresh token",95415:"Invalid device channel",95416:"Device resource limit reached, Retry later",95417:"Device 4G data quota exhausted",95451:"Unsupported stream type by device",95452:"Device failed to connect to stream server",95454:"Streaming session not found in stream server",95455:"Device channel not associated",95456:"Associated device channel offline",95457:"Client does not support end-to-end encryption",95458:"Device does not support current concurrent ECDH encryption",95459:"VTDU failed to process ECDH encryption",95460:"Watch is capturing photos/video",95461:"Watch is in video chat",95462:"Watch is performing image recognition",95463:"Watch is in QQ video call",95464:"Watch is performing posture detection",95465:"Watch temperature too high",95466:"Device in video call; preview not supported",95492:"Unsupported command by device",95500:"Server processing failure",95503:"VTM failed to allocate VTDU, Retry later (VTDU service issue)",95504:"Server overloaded, Retry later",95505:"VTM ECDH decryption failed",95506:"IPC streaming not supported (requires NVR binding)",95507:"4G plan does not support non-EZVIZ app streaming",95544:"No video source from device",95545:"Video sharing period ended",95546:"Stream concurrency limit reached",95547:"Open platform user concurrency limit exceeded",95556:"Ticket validation failed",95557:"Playback server timeout waiting for stream header, Retry later or check device network.",95558:"Invalid playback start time",95560:"Group sharing stream secondary validation failed",95561:"Group shared user locked",95562:"Group sharing permissions modified",95563:"Authentication service connection failed",95564:"Authentication timeout",95565:"Invalid cache",95566:"Preview outside sharing period",95567:"Shared channel locked",95568:"Authentication type not found",95569:"Invalid authentication parameters",95600:"Shared device not in sharing period",95601:"Group user lacks permissions",95602:"Group sharing permissions modified",95530:"Data center outage, Retry later",95610:"Failed to receive stream header",95620:"Heartbeat timeout",95701:"CAS signaling format error",95702:"SPGW request to CAS/Status timeout, Retry later",95703:"SPGW HTTP request failed, Retry later",96001:"Client parameter error",96002:"Client heartbeat timeout (20s no packet)",96099:"Default client error",96101:"Unsupported command",96102:"Device stream header delivery failed, Retry later",96103:"CAS/device returned error code 1, Retry later",96104:"CAS/device returned error code -1, Retry later",96105:"Device returned error code 3, Retry later",96106:"Device returned error code 4, Retry later",96107:"Device returned error code 5, Retry later",96108:"Duplicate CAS signaling response, Retry later",96109:"Video sharing canceled by platform",96110:"Default device signaling error, Retry or restart device",96501:"Device data path mismatch, Retry later",96502:"Duplicate device data path connection, Retry later",96503:"Device data port mismatch, Retry later",96504:"Failed to cache device data path (insufficient memory), Retry later",96505:"Duplicate device acknowledgment header, Retry later",96506:"Device data arrived before header confirmation, Retry later",96508:"Invalid device data header length, Retry or restart device",96509:"Data management block not found, Retry later",96510:"VTDU protocol state mismatch for device data path",96511:"Missing stream key in device data header",96512:"Invalid device data header",96513:"Device data length too small",96514:"Legacy protocol: Missing stream key in push header",96515:"Invalid legacy protocol push data",96516:"Legacy protocol: Data management block not found",96517:"Invalid legacy protocol push data",96518:"Device data packet too large, Retry or restart device",96519:"Unstable device push stream (timeout due to inactivity)",96520:"Unstable device push stream (network issue)",90601:"Stream ID does not exist",90602:"Stream is disabled",90603:"Not within the available time range",90604:"User-device relationship verification failed",90605:"Channel is hidden",90606:"4G unlimited data plan",4050:"Internal service call to VTDU for stream retrieval failed",4054:"Internal service failed to generate ticket",4056:"VTM service information is empty",4057:"Stream retrieval URL is invalid (possibly due to format or parameter error)",4058:"Stream retrieval URL has expired (not within valid time range)",9048:"Concurrency limit exceeded",9049:"Bandwidth limit exceeded",9053:"H265 encoding not supported",9057:"Device stream is encrypted",9060:"Device stream retrieval validation failed",9061:"Auth authentication failed",9062:"Auth authentication network issue",httpFetchStreamError:"Stream retrieval failed, please check the network"};function Bg(A,e){const g=["h264","h265"];return e||/_(\d+)_(\d+)\.flv\?/.test(A)?BA.addVc(A,g):A}const ng=[.5,1,2,4,8];let Qg=function(g){function o(g){var t,I,C,B,n,Q;e(this,o),i(Q=A(this,o,[{...tA.all([EA,g],{clone:!1}),volumeOptions:{muted:null!==(t=g.muted)&&void 0!==t?t:EA.muted,volume:null!==(I=g.volume)&&void 0!==I?I:EA.volume,...g.volumeOptions||{}},scaleMode:[0,1,2].includes(g.scaleMode)?g.scaleMode:EA.scaleMode,container:og(g.id||g.container),type:"flv"}]),"urlInfo",{}),i(Q,"_record",null),i(Q,"services",null),i(Q,"destoryed",!1),i(Q,"_loadingTimeoutDelayTimer",null),i(Q,"_heartTimeoutDelayTimer",null),i(Q,"_flvRecordFlag",!1),null===(C=Q.i18n)||void 0===C||null===(B=C.appendTranslations)||void 0===B||B.call(C,{zh:Ig,en:Cg}),Q._record=new gA.Record({downloadRecord:Q.options.downloadRecord}),Q._flvParseChunk=new be({onHasAudio:A=>{}}),Me.initMonitor(g.ignoreMonitor||g.disableColect);const r=Object.assign({},{isLive:!0,timeZone:0},EA,g),a=og(g.id||g.container);if(!g.url)throw new Error("Flv url is empty");var E;return Me.url=g.url,Me.report(1,{name:"constructor"}),a.classList.add("ezui-player-container","ezui-flv-container"),delete r.container,r.forceNoOffscreen=!0,ge(r.videoBuffer)&&(r.videoBuffer=1e3*Number(r.videoBuffer)),Q._opt=r,Q.urlInfo=_e(r.url,Q._opt.isEzviz),Q.$container=a,Q._heartTimeoutDelayTimes=0,Q._loadingTimeoutReplayTimes=0,Q.events=new Fe(Q),Q._initPlayer(a,r),Q._videoInfo={},Q._audioInfo={},Q._currentPlayDate=null,Q.definitionList=[],Q.definition={},Q._playbackRate=1,Q.playbackRateList=ng,Q.playbackRecords=[],Q.services=new gg(Q,{baseURL:(null===(n=Q._opt.env)||void 0===n?void 0:n.domain)||VA,accessToken:Q._opt.accessToken,deviceSerial:Q.urlInfo.deviceSerial,channelNo:Q.urlInfo.channelNo}),Q._httpServices(),(E=Q).on(RA.volumechange,((A,e)=>{var g,t;(null===(g=E.player)||void 0===g?void 0:g.volume)!==A&&(E.player.volume=A),(null===(t=E.player)||void 0===t?void 0:t.muted)!==e&&(E.player.muted=e)})),E.on(RA.control.play,(A=>{A?E.play():E.pause()})),E.on(RA.fullscreenChange,(A=>{E.player.emit(RA.fullscreenChange,A)})),E.on(RA.orientationChange,(A=>{E.player.emit(RA.orientationChange,A)})),E.on(RA.videoInfo,(A=>{})),E.on(RA.audioInfo,(A=>{})),E.on(RA.control.recordingChange,(A=>{A?E.startRecord():E.stopRecord()})),function(A){var e,g;null===(e=A.player)||void 0===e||e.on(RA.volumechange,((e,g)=>{A.volume!==e&&(A.volume=e),A.muted!==g&&(A.muted=g)})),null===(g=A.player)||void 0===g||g.on(RA.audioCodecUnsupported,(e=>{A.emit(RA.audioCodecUnsupported,e)}))}(Q),Q.options.useMSE&&(Q._onvisibilitychange=Q._onvisibilitychange.bind(Q),document.addEventListener("visibilitychange",Q._onvisibilitychange)),Q}return C(o,g),t(o,[{key:"_httpServices",value:function(){try{var A,e,g;if(this._opt.isEzviz&&null!==(A=this._opt)&&void 0!==A&&A.accessToken&&this.urlInfo.deviceSerial&&this.urlInfo.channelNo>=0&&this.urlInfo.streamTypeIn)if(this.services=new gg(this,{baseURL:((null===(e=this._opt.env)||void 0===e?void 0:e.domain)||VA).replace(/\/$/,""),accessToken:this._opt.accessToken,deviceSerial:this.urlInfo.deviceSerial,channelNo:this.urlInfo.channelNo,appName:this._opt.appName,v:null===(g=this.urlInfo.query)||void 0===g?void 0:g.v}),this._isEzvizPlayback(this._opt.url)&&!this._opt.isLive){var t,i,o,I;this._playbackRate=+((null===(t=this.urlInfo)||void 0===t||null===(t=t.query)||void 0===t?void 0:t.playbackSpeed)||1),null===(i=this.services)||void 0===i||i.getLocalVideoUnifyQueryService({startTime:tg(null===(o=this.urlInfo)||void 0===o||null===(o=o.query)||void 0===o?void 0:o.begin).getTime(),endTime:tg(null===(I=this.urlInfo)||void 0===I||null===(I=I.query)||void 0===I?void 0:I.end).getTime()});let A=null,e=0;this.on(RA.timeUpdate,(g=>{const t=this.playbackRecords.length;if(t>0){var i,o;const n=tg(this.urlInfo.query.begin).getTime()/1e3;let Q=null===(i=this.playbackRecords[e])||void 0===i?void 0:i.startTime,r=null===(o=this.playbackRecords[e])||void 0===o?void 0:o.endTime;if(n<=this.playbackRecords[0].startTime)e=0;else{if(n>=this.playbackRecords[this.playbackRecords.length-1].endTime)return;for(let A=0;A<t;A++){const g=this.playbackRecords[A];if(n>=g.startTime&&n<=g.endTime){var I;e=A,Q=n,r=null===(I=this.playbackRecords[e])||void 0===I?void 0:I.endTime;break}{const t=this.playbackRecords[A+1];if(n>=g.endTime&&n<=t.startTime){var C,B;e=A+1,Q=null===(C=this.playbackRecords[e])||void 0===C?void 0:C.startTime,r=null===(B=this.playbackRecords[e])||void 0===B?void 0:B.endTime;break}}}}let a=parseInt(Q+g,10);if(0===g)return;this.emit(RA.timeUpdateOSD,{currentTime:g,currentFragmentPlayEnd:Q+g>=r,currentSliceIndex:e,osd:a}),a+3>=this.playbackRecords[t-1].endTime&&(A&&clearTimeout(A),A=setTimeout((()=>{this.emit(RA.end),clearTimeout(A),this.pause()}),3e3)),Q+g>=r&&e<t-1&&e++;const E=new Date(1e3*a);this._currentPlayDate=`${E.getFullYear()}${$e(E.getMonth()+1)}${$e(E.getDate())}${$e(E.getHours())}${$e(E.getMinutes())}${$e(E.getSeconds())}`}}))}else if(!this._isEzvizPlayback(this._opt.url)&&this._opt.isLive){var C,B,n,Q;const A=null!==(C=this.urlInfo)&&void 0!==C&&null!==(C=C.query)&&void 0!==C&&C.expire?parseInt((1e3*this.urlInfo.query.expire-(new Date).getTime())/1e3):void 0;Promise.all([null===(B=this.services)||void 0===B?void 0:B.getVideoQualityService(),null===(n=this.services)||void 0===n?void 0:n.getLiveAddressService({quality:"1"==(null===(Q=this.urlInfo)||void 0===Q?void 0:Q.streamTypeIn)?2:1,expireTime:A})]).then((A=>{let e=[this.urlInfo.url,A[1]].sort(((A,e)=>{const g=A=>{const e=A.match(/_(\d+)\.flv/);return e?parseInt(e[1],10):0};return g(A)-g(e)}));const g=A[0].map(((A,g)=>({...A,url:1===A.streamTypeIn?e[0]:e[1]})));this.definitionList=g,this.emit(RA.getDefinitionListResult,g),this.emit(RA.definitionListChange,g)}))}}catch(A){var r,a;null===(r=this.player)||void 0===r||null===(r=r.debug)||void 0===r||null===(a=r.error)||void 0===a||a.call(r,A)}}},{key:"setDefinitionList",value:function(A){this.player&&(this.definitionList=A,this.emit(RA.definitionListChange,A))}},{key:"switchDefinition",value:function(A){if(this.player){if(A.videoLevel>=0&&[1,2].includes(A.streamTypeIn)){const i=this.definitionList.find((e=>e.videoLevel===A.videoLevel));if(i){if(this.emit(RA.definitionChange,i),this.definition=i,i.url){var e;if("compatible"!==i.type)null===(e=this.services)||void 0===e||e.setVideoLevelService(i.videoLevel);return this.playing?this.pause().then((()=>{this.play({url:i.url})})):this.play({url:i.url}),Promise.resolve(0)}var g;return null===(g=this.player.debug)||void 0===g||g.warn("play url is not found"),Promise.resolve(1)}var t;return null===(t=this.player.debug)||void 0===t||t.warn("definition is not found"),Promise.resolve(1)}var i;return null===(i=this.player.debug)||void 0===i||i.warn(`not support ${null==A?void 0:A.videoLevel}`),Promise.resolve(1)}}},{key:"setPlaybackRateList",value:function(A){this.player&&(this.playbackRateList=A,this.emit(RA.playbackRateListChange,A))}},{key:"playbackRate",get:function(){return this._playbackRate},set:function(A){this.switchPlaybackRate(A)}},{key:"switchPlaybackRate",value:function(A){var e,g,t;return this.player&&this._isEzvizPlayback(this._opt.url)?(A=+A,null!==(e=this.playbackRateList)&&void 0!==e&&e.includes(A)?this._getNewRecordPlayUrl({playbackRate:A}).then((e=>e?(this._playbackRate=A,this.emit(RA.playbackRateChange,A),this.playing?this.pause().then((A=>{this.play({url:e})})):this.play({url:e}),0):1)):(null===(g=this.player)||void 0===g||null===(g=g.debug)||void 0===g||g.warn(`not support ${A}`),Promise.resolve(1))):(null===(t=this.player)||void 0===t||null===(t=t.debug)||void 0===t||t.warn(`not support ${A}`),Promise.resolve(1))}},{key:"_getNewRecordPlayUrl",value:function(){let A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.player&&this._isEzvizPlayback(this._opt.url)){var e,g,t,i;const o=tg(this._currentPlayDate||(null===(e=this.urlInfo)||void 0===e||null===(e=e.query)||void 0===e?void 0:e.begin)),I=tg(null===(g=this.urlInfo)||void 0===g||null===(g=g.query)||void 0===g?void 0:g.end);return null===(t=this.services)||void 0===t?void 0:t.getRecordAddressService({expireTime:parseInt((new Date(1e3*(null===(i=this.urlInfo.query)||void 0===i?void 0:i.expire)).getTime()-(new Date).getTime())/1e3,10),startTime:`${o.getFullYear()}-${$e(o.getMonth()+1)}-${$e(o.getDate())} ${$e(o.getHours())}:${$e(o.getMinutes())}:${$e(o.getSeconds())}`,stopTime:`${I.getFullYear()}-${$e(I.getMonth()+1)}-${$e(I.getDate())} ${$e(I.getHours())}:${$e(I.getMinutes())}:${$e(I.getSeconds())}`,playbackSpeed:A.playbackRate||this.playbackRate,quality:this.urlInfo.streamTypeIn})}return Promise.resolve("")}},{key:"_isEzvizPlayback",value:function(A){return this._opt.isEzviz&&/rec=(local|cloud)/.test(this._opt.url)}},{key:"startRecord",value:function(A,e){var g;const t=this._HKHead;var i;return A=A||`${Date.now()}`,this._record&&t.length&&(null===(g=this._flvParseChunk.firstHeadTagChunk)||void 0===g?void 0:g.length)>0?null===(i=this._record)||void 0===i?void 0:i.startRecord(t,A,((A,g)=>{var t;null===(t=this.emit)||void 0===t||t.call(this,"recordResult",A,g),"function"==typeof e&&e(A,g)})).then((()=>{var A;null===(A=this.emit)||void 0===A||A.call(this,$.Theme.EVENTS.recordingChange,!0),this._record.inputData(this._flvParseChunk.firstHeadTagChunk),this._record.inputData(this._flvParseChunk.lastTagChunk),this._flvRecordFlag=!0})).catch((()=>{var A;null===(A=this.emit)||void 0===A||A.call(this,$.Theme.EVENTS.recordingChange,!1)})):Promise.resolve("")}},{key:"stopRecord",value:function(){var A;return this._flvRecordFlag=!1,this._record?(null===(A=this.emit)||void 0===A||A.call(this,$.Theme.EVENTS.recordingChange,!1),this._record.stopRecord()):Promise.resolve("")}},{key:"destroy",value:function(){this.destoryed=!0,this.events&&(this.events.destroy(),this.events=null),Q(o,"destroy",this)([]),this._record&&(this._flvRecordFlag&&this.stopRecord(),this._record.destroy(),this._record=null),this.player&&(this.player.destroy(),this.player=null),this.$container&&(this.$container.classList.remove("ezui-flv-container"),this.$container.classList.remove("ezui-player-container"),this.$container=null),this.definitionList=[],this.definition={},this._videoInfo={},this._audioInfo={},this._currentPlayDate=null,this.urlInfo={},this._playbackRate=1,this.playbackRateList=[],this.playbackRecords=[],this.$container=null,this._opt={},this._loadingTimeoutReplayTimes=0,this.removeAllListeners(),document.removeEventListener("visibilitychange",this._onvisibilitychange),Me.report(50,{name:"destroy"})}},{key:"_handlevideoInfo",value:function(A){this._videoInfo=A||{}}},{key:"_handleAudioInfo",value:function(A){this._audioInfo=A||{}}},{key:"_initPlayer",value:function(A,e){var g,t,i,I,C,B;e.url&&(e.url=Bg(e.url,this._opt.isEzviz)),this.player=new Ke(this.contentControl.$video,Object.assign({},e,{orientation:this.orientationAngle})),null===(g=this.player.debug)||void 0===g||g.log("Flv","version",o.version),null===(t=this.player.debug)||void 0===t||t.log("Flv","_initPlayer",JSON.stringify(e)),this._bindEvents(),e.autoPlay&&this.play(),this._handlevideoInfo=this._handlevideoInfo.bind(this),this._handleAudioInfo=this._handleAudioInfo.bind(this),null===(i=this.player)||void 0===i||i.off(RA.videoInfo,this._handlevideoInfo),null===(I=this.player)||void 0===I||I.on(RA.videoInfo,this._handlevideoInfo),null===(C=this.player)||void 0===C||C.off(RA.audioInfo,this._handleAudioInfo),null===(B=this.player)||void 0===B||B.on(RA.audioInfo,this._handleAudioInfo)}},{key:"_resetPlayer",value:function(){let A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.player.destroy(),this.player=null,this._opt=Object.assign(this._opt,A),this._initPlayer(this.$container,this._opt)}},{key:"_bindEvents",value:function(){Object.keys(vA).forEach((A=>{[RA.volumechange,RA.play].includes(A)||this.player.on(vA[A],(e=>{this.emit(A,e)}))})),this.player.on(vA.flvStream,(A=>{this._flvParseChunk&&A&&(this._flvRecordFlag&&this._record.inputData(A),this._flvParseChunk.inputData(A))}))}},{key:"setDebug",value:function(A){this.player.updateOption({debug:A}),Me.report(50,{name:"setDebug"})}},{key:"setLogger",value:function(){let A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.player.updateOption({loggerOptions:{...this.player._opt.loggerOptions||{},...A}})}},{key:"closeSound",value:function(){this.muted=!0,Me.report(50,{name:"closeSound"})}},{key:"openSound",value:function(){this.muted=!1,this.setVolume(.8),Me.report(50,{name:"openSound"})}},{key:"setVolume",value:function(A){this.volume=A}},{key:"getVolume",value:function(){return Me.report(50,{name:"getVolume"}),this.volume}},{key:"audioResume",value:function(){var A,e;null===(A=this.player)||void 0===A||null===(A=A.audio)||void 0===A||null===(e=A.audioEnabled)||void 0===e||e.call(A,!0),Me.report(50,{name:"audioResume"})}},{key:"pause",value:function(){return Me.report(50,{name:"pause"}),this._delayTimeoutTimer&&(clearTimeout(this._delayTimeoutTimer),this._delayTimeoutTimer=null),this._heartTimeoutDelayTimer&&(clearTimeout(this._heartTimeoutDelayTimer),this._heartTimeoutDelayTimer=null),this._loadingTimeoutDelayTimer&&(clearTimeout(this._loadingTimeoutDelayTimer),this._loadingTimeoutDelayTimer=null),this.playing=!1,this._playerPuase()}},{key:"_playerPuase",value:function(){var A,e;return this._flvRecordFlag&&this.stopRecord(),null===(A=this.player)||void 0===A||null===(e=A.pause)||void 0===e?void 0:e.call(A)}},{key:"clearView",value:function(){this.player.video.clearView(),Me.report(50,{name:"clearView"})}},{key:"play",value:async function(){let A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this._loadingTimeoutReplayTimes=0,this.__play(A)}},{key:"__play",value:async function(){let A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.loading=!0,A.url&&(Me.url=A.url),"string"==typeof A&&(A={url:A}),this._currentPlayDate&&!A.url&&this._isEzvizPlayback())try{A.url=await this.services.getRecordAddressService({expireTime:86400,quality:this.urlInfo.streamTypeIn,startTime:ig(this._currentPlayDate,"-"),stopTime:ig(this.urlInfo.query.end,"-"),playbackSpeed:this.playbackRate}),this._currentPlayDate=null}catch(A){}const e=Bg(A.url||this._opt.url,this._opt.isEzviz);return this.urlInfo=_e(e,this._opt.isEzviz),this._playbackRate=this.urlInfo.query.playbackSpeed||1,this._opt=Object.assign({},this._opt,A||{},{url:e}),this._opt.urlQuery=Ue(A.url),Me.report(50,{name:"play"}),this.playing=!0,await new Promise(((A,e)=>{var g;if(!this._opt.url)return this.emit(RA.error,UA.playError),void e("play url is empty");null!==(g=this.player)&&void 0!==g&&g.playing?(this.clearView(),this.player.play({...this._opt,muted:this.muted,volume:this.volume}).then((()=>{var e,g,t;this.loading=!1,null===(e=this.posterControl)||void 0===e||e.hide(),null!==(g=this.controls)&&void 0!==g&&g.recordControl&&null!==(t=this.controls)&&void 0!==t&&null!==(t=t.recordControl)&&void 0!==t&&t.disabled&&(this.controls.recordControl.disabled=!1),A()})).catch((A=>{this.player.debug.warn("Flv","pause -> play and play error",A),this._playerPuase().then((()=>{e(A)}))}))):this._play({...this._opt,muted:this.muted,volume:this.volume}).then((()=>{var e,g,t;this.loading=!1,null===(e=this.posterControl)||void 0===e||e.hide(),null!==(g=this.controls)&&void 0!==g&&g.recordControl&&null!==(t=this.controls)&&void 0!==t&&null!==(t=t.recordControl)&&void 0!==t&&t.disabled&&(this.controls.recordControl.disabled=!1),A()})).catch((A=>{this.player.debug.warn("Flv","this._play error",A),e(A)}))}))}},{key:"_play",value:function(){let A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new Promise(((e,g)=>{const t=0===A.url.indexOf("http"),i=t?QA:nA,o=t||-1!==A.url.indexOf(".flv")||this._opt.isFlv?rA:aA;this.player.updateOption({protocol:i,demuxType:o}),this.player.once(UA.webglAlignmentError,(()=>{this.player.off(UA.webglAlignmentError),this.pause().then((()=>{this.player.debug.log("Flv","webglAlignmentError"),this._resetPlayer({openWebglAlignment:!0}),this.play(A).then((()=>{this.player.debug.log("Flv","webglAlignmentError and play success")})).catch((()=>{this.player.debug.log("Flv","webglAlignmentError and play error")}))}))})),this.player.once(UA.mediaSourceH265NotSupport,(()=>{this.player.off(UA.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.player.once(UA.mediaSourceFull,(()=>{this.pause().then((()=>{this.player.debug.log("Flv","media source full"),this._resetPlayer(),this.play(A).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(UA.mediaSourceAppendBufferError,(()=>{this.pause().then((()=>{this.player.debug.log("Flv","media source append buffer error"),this._resetPlayer(),this.play(A).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(UA.mediaSourceBufferListLarge,(()=>{this.pause().then((()=>{this.player.debug.log("Flv","media source buffer list large"),this._resetPlayer(),this.play(A).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(UA.mediaSourceAppendBufferEndTimeout,(()=>{this.pause().then((()=>{this.player.debug.log("Flv","media source append buffer end timeout"),this._resetPlayer(),this.play(A).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(UA.mseSourceBufferError,(()=>{this.pause().then((()=>{this.player.debug.log("Flv","mseSourceBufferError close success")}))})),this.player.once(UA.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(A).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(UA.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(A).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.off(RA.delayTimeout,this._onDelayTimeout),this._onDelayTimeout=this._onDelayTimeout.bind(this),this.player.once(RA.delayTimeout,this._onDelayTimeout),this.player.off(RA.heartTimeout,this._onHeartTimeout),this._onHeartTimeout=this._onHeartTimeout.bind(this),this.player.once(RA.heartTimeout,this._onHeartTimeout),this.player.off(RA.loadingTimeout,this._onLoadingTimeout),this._onLoadingTimeout=this._onLoadingTimeout.bind(this),this.player.once(RA.loadingTimeout,this._onLoadingTimeout),this.player.off(RA.streamSuccess,this._onStreamSuccess),this._onStreamSuccess=this._onStreamSuccess.bind(this),this.player.once(RA.streamSuccess,this._onStreamSuccess),this.player.off(RA.streamError,this._onStreamError),this._onStreamError=this._onStreamError.bind(this),this.player.once(RA.streamError,this._onStreamError),this.hasLoaded()?this.player.play(A).then((()=>{var A,g;null!==(A=this.player)&&void 0!==A&&null!==(A=A.video)&&void 0!==A&&A.$videoElement&&(null===(g=this.urlInfo.query)||void 0===g?void 0:g.playbackSpeed)>=1&&(this.player.video.$videoElement.playbackRate=this.urlInfo.query.playbackSpeed),e()})).catch((A=>{if(this.player){this.player.debug.warn("Flv","hasLoaded and play error",A),null==A||A.name;try{this._playerPuase().then((()=>{g(A)}))}catch(A){}}})):this.player.once(RA.decoderWorkerInit,(()=>{this.player.play(A).then((()=>{var A,g;null!==(A=this.player)&&void 0!==A&&null!==(A=A.video)&&void 0!==A&&A.$videoElement&&(null===(g=this.urlInfo.query)||void 0===g?void 0:g.playbackSpeed)>=1&&(this.player.video.$videoElement.playbackRate=this.urlInfo.query.playbackSpeed),e()})).catch((A=>{if(this.player){this.player.debug.warn("Flv","decoderWorkerInit and play error",A);try{this._playerPuase().then((()=>{g(A)}))}catch(A){}}}))}))}))}},{key:"_onDelayTimeout",value:function(A){this._delayTimeoutTimer=setTimeout((()=>{this._delayTimeoutTimer&&(clearTimeout(this._delayTimeoutTimer),this._delayTimeoutTimer=null),this._loadingTimeoutReplayTimes<+this._opt.loadingTimeoutReplayTimes||-1==+this._opt.loadingTimeoutReplayTimes?(this._loadingTimeoutReplayTimes+=1,this.player.debug.warn("Flv",`delay timeout replay time is ${this._loadingTimeoutReplayTimes}`),this.player.off(RA.delayTimeout,this._onDelayTimeout),this.emit(RA.loadingRetryTimes,this._loadingTimeoutReplayTimes),this.__play(this._opt).then((()=>{this._loadingTimeoutReplayTimes=0}))):this._getDeviceStreamErrorInfo()}),1e3*(this._opt.loadingTimeoutDelay||3))}},{key:"_onHeartTimeout",value:function(){this._heartTimeoutDelayTimes<+this.player._opt.heartTimeoutReplayTimes||-1==+this.player._opt.heartTimeoutReplayTimes?(this._heartTimeoutDelayTimes+=1,this.player.debug.warn("Flv",`heart timeout replay time is ${this._heartTimeoutDelayTimes}`),this.player.off(RA.heartTimeout,this._onLoadingTimeout),this.emit(RA.heartRetryTimes,this._heartTimeoutDelayTimes),this.__play(this._opt).then((()=>{this._heartTimeoutDelayTimes=0}))):this._getDeviceStreamErrorInfo()}},{key:"_onLoadingTimeout",value:function(){this._loadingTimeoutDelayTimer=setTimeout((()=>{this._loadingTimeoutDelayTimer&&(clearTimeout(this._loadingTimeoutDelayTimer),this._loadingTimeoutDelayTimer=null),this._loadingTimeoutReplayTimes<+this._opt.loadingTimeoutReplayTimes||-1==+this._opt.loadingTimeoutReplayTimes?(this._loadingTimeoutReplayTimes+=1,this.player.debug.warn("Flv",`loading timeout replay time is ${this._loadingTimeoutReplayTimes}`),this.player.off(RA.delayTimeout,this._onLoadingTimeout),this.emit(RA.loadingRetryTimes,this._loadingTimeoutReplayTimes),this.__play(this._opt).then((()=>{this._loadingTimeoutReplayTimes=0}))):this._getDeviceStreamErrorInfo()}),1e3*(this._opt.loadingTimeoutDelay||3))}},{key:"_getDeviceStreamErrorInfo",value:function(){var A,e,g,t,i;this.destoryed||(this.services&&null!==(A=this.urlInfo)&&void 0!==A&&null!==(A=A.query)&&void 0!==A&&A.sid?this.services.getStreamInterreputInfo(null===(e=this.urlInfo)||void 0===e||null===(e=e.query)||void 0===e?void 0:e.sid).then((A=>{if(!this.destoryed)if(this.playing=!1,200===A.meta.code){var e,g;let t=this.i18n.t(null===(e=A.data)||void 0===e?void 0:e.intrCode);/^\[missing /.test(t)?null!==(g=A.data)&&void 0!==g&&g.intrCode?this.emit(RA.message,this.i18n.t("httpFetchStreamError")+` [${A.data.intrCode}]`,"fetchError"):this.emit(RA.message,this.i18n.t("httpFetchStreamError"),"fetchError"):this.emit(RA.message,t+` [${A.data.intrCode}]`,"fetchError")}else this.emit(RA.message,this.i18n.t("httpFetchStreamError"),"fetchError")})).catch((()=>{var A,e,g;this.playing=!1,null===(A=this.emit)||void 0===A||A.call(this,RA.message,null===(e=this.i18n)||void 0===e||null===(g=e.t)||void 0===g?void 0:g.call(e,"httpFetchStreamError"),"fetchError")})):(this.playing=!1,null===(g=this.emit)||void 0===g||g.call(this,RA.message,null===(t=this.i18n)||void 0===t||null===(i=t.t)||void 0===i?void 0:i.call(t,"httpFetchStreamError"),"fetchError")))}},{key:"_onStreamSuccess",value:function(){this.emit(RA.streamSuccess)}},{key:"_onStreamError",value:function(){this.emit(RA.streamError)}},{key:"setBufferTime",value:function(A){var e,g;A=Number(A),this.player.updateOption({videoBuffer:1e3*A}),null===(e=this.player)||void 0===e||null===(e=e.decoderWorker)||void 0===e||null===(g=e.updateWorkConfig)||void 0===g||g.call(e,{key:"videoBuffer",value:1e3*A})}},{key:"hasLoaded",value:function(){return this.player.loaded}},{key:"setKeepScreenOn",value:function(){this.player.updateOption({keepScreenOn:!0}),Me.report(50,{name:"setKeepScreenOn"})}},{key:"videoInfo",get:function(){return this._videoInfo}},{key:"currentTime",get:function(){return this.player.video?this.player.video.currentTime:0}},{key:"screenshot",value:function(A){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"png",g=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.92,t=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"download";if(this.player.video)return g=+g,this.player.video.screenshot(A,e,g,t)}},{key:"getState",value:function(){return{playing:!!this.player&&this.player.playing,muted:!(!this.player||!this.muted),fullscreen:this.currentFullscreen,loaded:!!this.player&&this.player.loaded,volume:this.player?parseFloat(this.player.volume).toFixed(2):0,isDebug:!!this.player&&this.player.isDebug}}},{key:"getOptions",value:function(){return this.player?this.player._opt:{}}},{key:"getVersion",value:function(){return Me.report(50,{name:"getVersion"}),"2.1.1-beta.1"}},{key:"_onvisibilitychange",value:function(){!document.hidden&&this.playing&&this.muted&&this.options.isLive&&this.options.mutedShowAutoReload&&!this._flvRecordFlag&&this.pause().finally((()=>{var A;null===(A=this.play)||void 0===A||A.call(this).catch((A=>{}))}))}},{key:"_HKHead",get:function(){return this._videoInfo.encType?gA.Record.getHKHead("flv","h264","aac","16000"):[]}}],[{key:"_setOptions",value:function(A){const e=og((A=Object.assign({},{isLive:!0,timeZone:0},EA,A)).id||A.container);return A.container=e,A}},{key:"supportType",value:function(A){if("flv"===A.type)return!0;if(A.url){let e=A.url;e.startsWith("http://")||e.startsWith("https://")||(e=/^\/\//.test(e)?"http:"+e:location.origin+location.pathname+e);try{return/\.flv$/i.test(new URL(e).pathname)}catch(A){}}return!1}}])}($.Theme);return i(Qg,"ERROR",UA),i(Qg,"EVENTS",RA),i(Qg,"QUALITY_ENUM",Ag),i(Qg,"TIMEOUT",{delayTimeout:RA.delayTimeout}),i(Qg,"version","2.1.1-beta.1"),Qg}));
63
+ ***************************************************************************** */function xA(A,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function g(){this.constructor=A}ZA(A,e),A.prototype=null===e?Object.create(e):(g.prototype=e.prototype,new g)}var XA=function(){return XA=Object.assign||function(A){for(var e,g=1,t=arguments.length;g<t;g++)for(var i in e=arguments[g])Object.prototype.hasOwnProperty.call(e,i)&&(A[i]=e[i]);return A},XA.apply(this,arguments)};function jA(A,e,g){if(g||2===arguments.length)for(var t,i=0,o=e.length;i<o;i++)!t&&i in e||(t||(t=Array.prototype.slice.call(e,0,i)),t[i]=e[i]);return A.concat(t||Array.prototype.slice.call(e))}function PA(){}function zA(){let A=arguments.length>1?arguments[1]:void 0;const e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").split(","),g=atob(e[1]),t=e[0].replace("data:","").replace(";base64","");let i=g.length;const o=new Uint8Array(i);for(;i--;)o[i]=g.charCodeAt(i);return new File([o],A||"file",{type:t})}function $A(){return(new Date).getTime()}function Ae(A,e,g){if(A)return"object"==typeof e&&Object.keys(e).forEach((g=>{Ae(A,g,e[g])})),A.style[e]=g,A}function ee(){return performance&&"function"==typeof performance.now?performance.now():Date.now()}function ge(A){return!function(A){return null==A}(A)}"function"==typeof SuppressedError&&SuppressedError,(()=>{try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){const A=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(A instanceof WebAssembly.Module)return new WebAssembly.Instance(A)instanceof WebAssembly.Instance}}catch(A){}})();let te=function(){return t((function A(){e(this,A)}),[{key:"on",value:function(A,e,g){const t=this.e||(this.e={});return(t[A]||(t[A]=[])).push({fn:e,ctx:g}),this}},{key:"once",value:function(A,e,g){const t=this;function i(){t.off(A,i);for(var o=arguments.length,I=new Array(o),C=0;C<o;C++)I[C]=arguments[C];e.apply(g,I)}return i._=e,this.on(A,i,g)}},{key:"emit",value:function(A){const e=((this.e||(this.e={}))[A]||[]).slice();for(var g=arguments.length,t=new Array(g>1?g-1:0),i=1;i<g;i++)t[i-1]=arguments[i];for(let A=0;A<e.length;A+=1)e[A].fn.apply(e[A].ctx,t);return this}},{key:"off",value:function(A,e){const g=this.e||(this.e={});if(!A)return Object.keys(g).forEach((A=>{delete g[A]})),void delete this.e;const t=g[A],i=[];if(t&&e)for(let A=0,g=t.length;A<g;A+=1)t[A].fn!==e&&t[A].fn._!==e&&i.push(t[A]);return i.length?g[A]=i:delete g[A],this}}])}();var ie=function(A){function e(e){var g=A.call(this)||this;return g._isFullScreen=!1,g.resetInit(),g._orientation=e._opt.orientation||0,e.on(RA.fullscreenChange,(function(A){g._isFullScreen=A.isCurrentFullscreen})),e.on(RA.orientationChange,(function(A){g._orientation=A})),g}return xA(e,A),e.prototype.resetInit=function(){this.init=!1,this.videoInfo={width:0,height:0,encType:"",encTypeCode:0}},e.prototype.destroy=function(){var A;this.resetInit(),this.player.$container&&this.$videoElement&&(null===(A=this.player.$container)||void 0===A||A.removeChild(this.$videoElement)),this.$videoElement=null,this.off()},e.prototype.updateVideoInfo=function(A){var e,g,t,i,o,I,C,B,n,Q;(A.height&&A.height!==(null===(e=this.videoInfo)||void 0===e?void 0:e.height)||A.width&&A.width!==this.videoInfo.width||(null==A?void 0:A.encTypeCode)&&(null==A?void 0:A.encTypeCode)!==(null===(g=this.videoInfo)||void 0===g?void 0:g.encTypeCode))&&(this.videoInfo=Object.assign(this.videoInfo||{},A||{}),A.encTypeCode&&(this.videoInfo.encTypeCode=A.encTypeCode,this.videoInfo.encType=LA[A.encTypeCode]),A.width&&(this.videoInfo.width=A.width),A.height&&(this.videoInfo.height=A.height),(null===(t=this.videoInfo)||void 0===t?void 0:t.width)&&(null===(i=this.videoInfo)||void 0===i?void 0:i.width)>0&&(null===(o=this.videoInfo)||void 0===o?void 0:o.height)&&(null===(I=this.videoInfo)||void 0===I?void 0:I.height)>0&&(null===(C=this.videoInfo)||void 0===C?void 0:C.encTypeCode)&&this.player.emit(RA.videoInfo,this.videoInfo),(null===(B=this.videoInfo)||void 0===B?void 0:B.hasAudio)&&(null===(n=this.videoInfo)||void 0===n?void 0:n.audioCodec)&&this.player.emit(RA.audioInfo,{encType:this._flvToMp4Codec(null===(Q=this.videoInfo)||void 0===Q?void 0:Q.audioCodec),audioCodec:this.videoInfo.audioCodec,sampleRate:this.videoInfo.audioSampleRate}))},e.prototype._flvToMp4Codec=function(A){return{2:"mp3","mp4a.40.2":"AAC",10:"AAC"}[A]},e.prototype.play=function(){},e.prototype.pause=function(){},e.prototype.clearView=function(){},e}(te);const oe="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof global&&global.global===global?global:void 0;function Ie(A,e,g){const t=new XMLHttpRequest;t.open("GET",A),t.responseType="blob",t.onload=function(){Qe(t.response,e,g)},t.onerror=function(){},t.send()}function Ce(A){const e=new XMLHttpRequest;e.open("HEAD",A,!1);try{e.send()}catch(A){}return e.status>=200&&e.status<=299}function Be(A){try{A.dispatchEvent(new MouseEvent("click"))}catch(e){const g=document.createEvent("MouseEvents");g.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),A.dispatchEvent(g)}}const ne=oe.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent);var Qe="object"!=typeof window||window!==oe?function(){}:"download"in HTMLAnchorElement.prototype&&!ne?function(A,e,g){const t=oe.URL||oe.webkitURL,i=document.createElementNS("http://www.w3.org/1999/xhtml","a");e=e||A.name||"download",i.download=e,i.rel="noopener","string"==typeof A?(i.href=A,i.origin!==location.origin?Ce(i.href)?Ie(A,e,g):Be(i,i.target="_blank"):Be(i)):(i.href=t.createObjectURL(A),setTimeout((function(){t.revokeObjectURL(i.href)}),4e4),setTimeout((function(){Be(i)}),0))}:"msSaveOrOpenBlob"in navigator?function(A,e,g){if(e=e||A.name||"download","string"==typeof A)if(Ce(A))Ie(A,e,g);else{const e=document.createElement("a");e.href=A,e.target="_blank",setTimeout((function(){Be(e)}))}else navigator.msSaveOrOpenBlob(function(A,e){return void 0===e?e={autoBom:!1}:"object"!=typeof e&&(e={autoBom:!e}),e.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(A.type)?new Blob([String.fromCharCode(65279),A],{type:A.type}):A}(A,g),e)}:function(A,e,g,t){if((t=t||open("","_blank"))&&(t.document.title=t.document.body.innerText="downloading..."),"string"==typeof A)return Ie(A,e,g);const i="application/octet-stream"===A.type,o=/constructor/i.test(oe.HTMLElement)||oe.safari,I=/CriOS\/[\d]+/.test(navigator.userAgent);if((I||i&&o||ne)&&"undefined"!=typeof FileReader){const e=new FileReader;e.onloadend=function(){let A=e.result;A=I?A:A.replace(/^data:[^;]*;/,"data:attachment/file;"),t?t.location.href=A:location=A,t=null},e.readAsDataURL(A)}else{const e=oe.URL||oe.webkitURL,g=e.createObjectURL(A);t?t.location=g:location.href=g,t=null,setTimeout((function(){e.revokeObjectURL(g)}),4e4)}},re=function(A){function e(e){var g=A.call(this,e)||this;g._pageHide=!1,g.player=e;var t=document.createElement("canvas");return t.style.position="absolute",t.style.top="0",t.style.left="0",g.$videoElement=t,e.$container.appendChild(g.$videoElement),g.context2D=null,g.contextGl=null,g.contextGlRender=null,g.contextGlDestroy=null,g.bitmaprenderer=null,g.renderType=null,g._currentTime=0,g._initCanvasRender(),g._contextmenuEvent=function(A){A.target===g.$videoElement&&A.preventDefault()},document.addEventListener("contextmenu",g._contextmenuEvent),g.player.debug.log("CanvasVideo","init"),g._visibilitychange=g._visibilitychange.bind(g),document.addEventListener("visibilitychange",g._visibilitychange),g}return xA(e,A),e.prototype.destroy=function(){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._contextmenuEvent&&(document.removeEventListener("contextmenu",this._contextmenuEvent),this._contextmenuEvent=null),this._visibilitychange&&(document.removeEventListener("visibilitychange",this._visibilitychange),this._visibilitychange=null),this.renderType=null,A.prototype.destroy.call(this),this.player.debug.log("CanvasVideoLoader","destroy")},e.prototype._visibilitychange=function(){this.player.debug.log("document.hidden",document.hidden),this._pageHide=document.hidden},e.prototype._initContextGl=function(){this.contextGl=function(A){let e=null;const g=["webgl","experimental-webgl","moz-webgl","webkit-3d"];let t=0;for(;!e&&t<g.length;){const i=g[t];try{const g={preserveDrawingBuffer:!0};e=A.getContext(i,g)}catch(A){e=null}e&&"function"==typeof e.getParameter||(e=null),++t}return e}(this.$videoElement);var A=((A,e)=>{var g=["attribute vec4 vertexPos;","attribute vec4 texturePos;","varying vec2 textureCoord;","void main()","{","gl_Position = vertexPos;","textureCoord = texturePos.xy;","}"].join("\n"),t=["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");e&&A.pixelStorei(A.UNPACK_ALIGNMENT,1);var i=A.createShader(A.VERTEX_SHADER);A.shaderSource(i,g),A.compileShader(i),A.getShaderParameter(i,A.COMPILE_STATUS);var o=A.createShader(A.FRAGMENT_SHADER);A.shaderSource(o,t),A.compileShader(o),A.getShaderParameter(o,A.COMPILE_STATUS);var I=A.createProgram();A.attachShader(I,i),A.attachShader(I,o),A.linkProgram(I),A.getProgramParameter(I,A.LINK_STATUS),A.useProgram(I);var C=A.createBuffer();A.bindBuffer(A.ARRAY_BUFFER,C),A.bufferData(A.ARRAY_BUFFER,new Float32Array([1,1,-1,1,1,-1,-1,-1]),A.STATIC_DRAW);var B=A.getAttribLocation(I,"vertexPos");A.enableVertexAttribArray(B),A.vertexAttribPointer(B,2,A.FLOAT,!1,0,0);var n=A.createBuffer();A.bindBuffer(A.ARRAY_BUFFER,n),A.bufferData(A.ARRAY_BUFFER,new Float32Array([1,0,0,0,1,1,0,1]),A.STATIC_DRAW);var Q=A.getAttribLocation(I,"texturePos");function r(e,g){var t=A.createTexture();return A.bindTexture(A.TEXTURE_2D,t),A.texParameteri(A.TEXTURE_2D,A.TEXTURE_MAG_FILTER,A.LINEAR),A.texParameteri(A.TEXTURE_2D,A.TEXTURE_MIN_FILTER,A.LINEAR),A.texParameteri(A.TEXTURE_2D,A.TEXTURE_WRAP_S,A.CLAMP_TO_EDGE),A.texParameteri(A.TEXTURE_2D,A.TEXTURE_WRAP_T,A.CLAMP_TO_EDGE),A.bindTexture(A.TEXTURE_2D,null),A.uniform1i(A.getUniformLocation(I,e),g),t}A.enableVertexAttribArray(Q),A.vertexAttribPointer(Q,2,A.FLOAT,!1,0,0);var a=r("ySampler",0),E=r("uSampler",1),s=r("vSampler",2);return{render:function(e,g,t,i,o){A.viewport(0,0,e,g),A.activeTexture(A.TEXTURE0),A.bindTexture(A.TEXTURE_2D,a),A.texImage2D(A.TEXTURE_2D,0,A.LUMINANCE,e,g,0,A.LUMINANCE,A.UNSIGNED_BYTE,t),A.activeTexture(A.TEXTURE1),A.bindTexture(A.TEXTURE_2D,E),A.texImage2D(A.TEXTURE_2D,0,A.LUMINANCE,e/2,g/2,0,A.LUMINANCE,A.UNSIGNED_BYTE,i),A.activeTexture(A.TEXTURE2),A.bindTexture(A.TEXTURE_2D,s),A.texImage2D(A.TEXTURE_2D,0,A.LUMINANCE,e/2,g/2,0,A.LUMINANCE,A.UNSIGNED_BYTE,o),A.drawArrays(A.TRIANGLE_STRIP,0,4)},destroy:function(){try{A.deleteProgram(I),A.deleteBuffer(C),A.deleteBuffer(n),A.deleteTexture(a),A.deleteTexture(E),A.deleteTexture(s)}catch(A){}}}})(this.contextGl,this.player._opt.openWebglAlignment);this.contextGlRender=A.render,this.contextGlDestroy=A.destroy},e.prototype._initContext2D=function(){this.context2D=this.$videoElement.getContext("2d")},e.prototype._initCanvasRender=function(){this._supportOffscreen()?(this.renderType=bA,this._bindOffscreen()):(this.renderType=KA,this._initContextGl())},e.prototype._supportOffscreen=function(){return"function"==typeof this.$videoElement.transferControlToOffscreen&&this.player._opt.useOffscreen},e.prototype._bindOffscreen=function(){this.bitmaprenderer=this.$videoElement.getContext("bitmaprenderer")},e.prototype.initCanvasViewSize=function(){this.$videoElement.width=this.videoInfo.width,this.$videoElement.height=this.videoInfo.height,this.resize()},e.prototype.render=function(A){var e,g,t;switch(this.player.videoTimestamp=A.ts,this._currentTime=A.ts,this.renderType){case bA:null===(e=this.bitmaprenderer)||void 0===e||e.transferFromImageBitmap(A.buffer);break;case KA:this._pageHide||this.contextGlRender(this.$videoElement.width,this.$videoElement.height,A.output[0],A.output[1],A.output[2]);break;case HA:null===(g=this.context2D)||void 0===g||g.drawImage(A.videoFrame,0,0,this.$videoElement.width,this.$videoElement.height),(t=A.videoFrame).close?t.close():t.destroy&&t.destroy()}},e.prototype.screenshot=function(A,e,g,t){A=A||$A()+"",t=t||MA.download;var i={png:"image/png",jpeg:"image/jpeg",webp:"image/webp"},o=.92;!i[e]&&MA[e]&&(t=e,e="png",g=void 0),"string"==typeof g&&(t=g,g=void 0),void 0!==g&&(o=Number(g));var I=this.$videoElement.toDataURL(i[e]||i.png,o);if("data:,"!==I){if(t===MA.base64)return I;var C=zA(I,A+"."+e);return t===MA.blob?C:t===MA.download?(Qe(C,A),C):void 0}},e.prototype.clearView=function(){var A,e=this;switch(this.renderType){case bA:(function(A,e){const g=document.createElement("canvas");return g.width=A,g.height=e,window.createImageBitmap(g,0,0,A,e)})(this.$videoElement.width,this.$videoElement.height).then((function(A){var g;null===(g=e.bitmaprenderer)||void 0===g||g.transferFromImageBitmap(A)}));break;case KA:this.contextGl.clear(this.contextGl.COLOR_BUFFER_BIT);break;case HA:null===(A=this.context2D)||void 0===A||A.clearRect(0,0,this.$videoElement.width,this.$videoElement.height)}},e.prototype.resize=function(){},Object.defineProperty(e.prototype,"currentTime",{get:function(){return(this._currentTime||0)/1e3},enumerable:!1,configurable:!0}),e}(ie),ae=function(A){function e(e){var g=A.call(this)||this;g.bufferList=[],g.player=e,g.scriptNode=null,g.hasInitScriptNode=!1,g.audioContextChannel=null,g.audioContext=new(window.AudioContext||window.webkitAudioContext),g.gainNode=g.audioContext.createGain();var t=g.audioContext.createBufferSource();return t.buffer=g.audioContext.createBuffer(1,1,22050),t.connect(g.audioContext.destination),t.start(0),g.audioBufferSourceNode=t,g.mediaStreamAudioDestinationNode=g.audioContext.createMediaStreamDestination(),g.audioEnabled(!0),g.gainNode.gain.value=0,g.playing=!1,g.audioSyncVideoOption={diff:null},g.audioInfo={encType:"",channels:"",sampleRate:""},g.init=!1,g.hasAudio=!1,g._muted=g.player._opt.muted,g._volume=g.player._opt.volume,!g._muted&&g._volume&&(g.volume=g._volume),g.on(RA.videoSyncAudio,(function(A){g.audioSyncVideoOption=A})),g.player.debug.log("AudioContext","init"),g}return xA(e,A),e.prototype.resetInit=function(){this.init=!1,this.audioInfo={encType:"",channels:"",sampleRate:""}},e.prototype.destroy=function(){this.closeAudio(),this.resetInit(),this.audioContext.close(),this.audioContext=null,this.gainNode=null,this.hasAudio=!1,this.playing=!1,this.scriptNode&&(this.scriptNode.onaudioprocess=PA,this.scriptNode=null),this.audioBufferSourceNode=null,this.mediaStreamAudioDestinationNode=null,this.hasInitScriptNode=!1,this.audioSyncVideoOption={diff:null},this.off(),this.player.debug.log("AudioContext","destroy")},e.prototype.updateAudioInfo=function(A){A.encTypeCode&&(this.audioInfo.encType=JA[A.encTypeCode]),A.channels&&(this.audioInfo.channels=A.channels),A.sampleRate&&(this.audioInfo.sampleRate=A.sampleRate),this.audioInfo.sampleRate&&this.audioInfo.channels&&this.audioInfo.encType&&!this.init&&(this.player.emit(RA.audioInfo,this.audioInfo),this.init=!0)},Object.defineProperty(e.prototype,"isPlaying",{get:function(){return this.playing},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"muted",{get:function(){return this._muted},set:function(A){A?(this._setVolume(0),this.clear()):this._setVolume(this._volume),this._muted=A},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"volume",{get:function(){return this._volume},set:function(A){this.setVolume(A)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bufferSize",{get:function(){return this.bufferList.length},enumerable:!1,configurable:!0}),e.prototype.initScriptNode=function(){var A=this;if(this.playing=!0,!this.hasInitScriptNode){var e=this.audioInfo.channels,g=this.audioContext.createScriptProcessor(1024,0,e);g.onaudioprocess=function(g){var t=g.outputBuffer;if(A.bufferList.length&&A.playing){if(!A.player._opt.useWCS&&!A.player._opt.useMSE&&A.player._opt.wasmDecodeAudioSyncVideo){if(A.audioSyncVideoOption.diff>1e3)return void A.player.debug.warn("AudioContext","audioSyncVideoOption more than diff :".concat(A.audioSyncVideoOption.diff,", waiting"));if(A.audioSyncVideoOption.diff<-1e3){A.player.debug.warn("AudioContext","audioSyncVideoOption less than diff :".concat(A.audioSyncVideoOption.diff,", dropping"));for(var i=A.bufferList.shift();i.ts-A.player.videoTimestamp<-1e3&&A.bufferList.length>0;)i=A.bufferList.shift();if(0===A.bufferList.length)return}}if(0===A.bufferList.length)return;var o=A.bufferList.shift();o&&o.ts&&(A.player.audioTimestamp=o.ts);for(var I=0;I<e;I++)for(var C=null==o?void 0:o.buffer[I],B=t.getChannelData(I),n=0;n<1024;n++)B[n]=C[n]||0}},g.connect(this.gainNode),this.scriptNode=g,this.gainNode.connect(this.audioContext.destination),this.gainNode.connect(this.mediaStreamAudioDestinationNode),this.hasInitScriptNode=!0}},e.prototype.setVolume=function(A){A=parseFloat(A+"").toFixed(2),this._setVolume(A),this._volume=A},e.prototype._setVolume=function(A){var e,g,t;(A=parseFloat(A+"").toFixed(2),isNaN(A))||(this.audioEnabled(!0),e=A,g=0,t=1,A=Math.max(Math.min(e,Math.max(g,t)),Math.min(g,t)),this.gainNode.gain.value=A,this.gainNode.gain.setValueAtTime(A,this.audioContext.currentTime))},e.prototype.closeAudio=function(){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()},e.prototype.audioEnabled=function(A){var e,g;A?"suspended"===(null===(e=this.audioContext)||void 0===e?void 0:e.state)&&this.audioContext.resume():"running"===(null===(g=this.audioContext)||void 0===g?void 0:g.state)&&this.audioContext.suspend()},e.prototype.isStateRunning=function(){return"running"===this.audioContext.state},e.prototype.isStateSuspended=function(){return"suspended"===this.audioContext.state},e.prototype.clear=function(){this.bufferList=[]},e.prototype.play=function(A,e){this.muted||(this.hasAudio=!0,this.bufferList.push({buffer:A,ts:e}),this.bufferList.length>20&&this.bufferList.length>50&&this.bufferList.shift())},e.prototype.pause=function(){this.audioSyncVideoOption={diff:null},this.playing=!1,this.clear()},e.prototype.resume=function(){this.playing=!0},e}(te),Ee=function(){function A(e){return new(A.getLoaderFactory())(e)}return A.getLoaderFactory=function(){return ae},A}(),se=function(A){function e(e){var g=A.call(this)||this;return g.player=e,g.playing=!1,g.abortController=new AbortController,g.streamRate=(ee(),A=>{ee()}),e.debug.log("FetchStream","init"),g._streamSuccess=!1,g}return xA(e,A),e.prototype.destroy=function(){this.abort(),this.off(),this.streamRate=null,this.player.debug.log("FetchStream","destroy")},e.prototype.fetchStream=function(A,e){var g,t=this;void 0===e&&(e={}),this._streamSuccess=!1;var i=this.player.demux;this.player._times.streamStart=$A(),this.abortController||(this.abortController=new AbortController);var o=Object.assign({signal:null===(g=this.abortController)||void 0===g?void 0:g.signal},{headers:e.headers||{}});fetch(A,o).then((function(A){if(200!==A.status)return t.abort(),t.emit(RA.streamError),void t.player.emit(RA.error,RA.streamError);var e=A.body.getReader(),g=function(){e.read().then((function(A){var e=A.done,o=A.value;e?i.close():(t.streamRate&&t.streamRate(o.byteLength),t.emit(RA.flvStream,o),i.dispatch(o),t._streamSuccess||(t._streamSuccess=!0,t.emit(RA.streamSuccess)),g())})).catch((function(A){i.close();var g=A.toString();if(-1===g.indexOf(_A)&&-1===g.indexOf(TA)&&A.name!==WA){t.abort();try{e.cancel()}catch(A){}t.emit(RA.streamError,A),t.player.emit(RA.error,RA.streamError,A)}}))};g()})).catch((function(A){i.close(),t.abort(),t.emit(RA.streamError,A),t.player.emit(RA.error,RA.streamError),null==A||A.name}))},e.prototype.abort=function(){this._streamSuccess=!1,this.abortController&&(this.abortController.abort(),this.abortController=null)},e}(te);let le=function(){return t((function A(g){return e(this,A),new(A.getLoaderFactory(g._opt.protocol))(g)}),null,[{key:"getLoaderFactory",value:function(A){return se}}])}(),ce=function(){return t((function A(g){e(this,A),this.player=g,this.decoderWorker=new Worker((""===g._opt.staticPath?"":BA.getStaticPath(g._opt.staticPath))+g._opt.decoder),this._initDecoderWorker(),g.debug.log("decoderWorker","init")}),[{key:"destroy",value:function(){this.decoderWorker.postMessage({cmd:YA}),this.decoderWorker.terminate(),this.decoderWorker=null,this.player.debug.log("decoderWorker","destroy")}},{key:"_initDecoderWorker",value:function(){const{debug:A,events:{proxy:e}}=this.player;this.decoderWorker.onmessage=e=>{var g,t,i,o,I,C;const B=e.data;switch(B.cmd){case sA:A.log("decoderWorker","onmessage:",sA),this.player.loaded||this.player.emit(RA.load),this.player.emit(RA.decoderWorkerInit),this.player.emit(RA.decoderLoaded),this._initWork();break;case DA:A.log("decoderWorker","onmessage:",DA,B.code),this.player._times.decodeStart||(this.player._times.decodeStart=$A()),this.player.video.updateVideoInfo({encTypeCode:B.code});break;case uA:A.log("decoderWorker","onmessage:",uA,B.code),null===(g=this.player)||void 0===g||null===(g=g.audio)||void 0===g||null===(t=g.updateAudioInfo)||void 0===t||t.call(g,{encTypeCode:B.code});break;case lA:if(A.log("decoderWorker","onmessage:",lA,`width:${B.w},height:${B.h}`),null===(i=this.player)||void 0===i||null===(i=i.video)||void 0===i||null===(o=i.updateVideoInfo)||void 0===o||o.call(i,{width:B.w,height:B.h}),!this.player._opt.openWebglAlignment&&B.w/2%4!=0)return void this.player.emit(UA.webglAlignmentError);this.player.video.initCanvasViewSize();break;case dA:A.log("decoderWorker","onmessage:",dA,`channels:${B.channels},sampleRate:${B.sampleRate}`),this.player.audio&&(this.player.audio.updateAudioInfo(B),this.player.audio.initScriptNode(B));break;case cA:var n,Q,r;if(this.player.handleRender(),this.player.video.render(B),this.player.emit(RA.timeUpdate,B.ts/1e3),this.player.updateStats({fps:!0,ts:B.ts,buf:B.delay}),B.w&&B.h)null===(n=this.player)||void 0===n||null===(Q=(r=n.video).updateVideoInfo)||void 0===Q||Q.call(r,{width:B.w,height:B.h});this.player._times.videoStart||(this.player._times.videoStart=$A(),this.player.handlePlayToRenderTimes());break;case hA:this.player.playing&&this.player.audio&&this.player.audio.play(B.buffer,B.ts);break;case pA:B.message&&-1!==B.message.indexOf(fA)&&this.player.emitError(UA.wasmDecodeError);break;default:null===(I=(C=this.player)[B.cmd])||void 0===I||I.call(C,B)}}}},{key:"_initWork",value:function(){var A;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:kA,opt:JSON.stringify(e),sampleRate:(null===(A=this.player)||void 0===A||null===(A=A.audio)||void 0===A||null===(A=A.audioContext)||void 0===A?void 0:A.sampleRate)||0})}},{key:"decodeVideo",value:function(A,e,g){const t={type:yA,ts:Math.max(e,0),isIFrame:g};this.decoderWorker.postMessage({cmd:NA,buffer:A,options:t},[A.buffer])}},{key:"decodeAudio",value:function(A,e){this.player._opt.useWCS||this.player._opt.useMSE?this._decodeAudioNoDelay(A,e):this._decodeAudio(A,e)}},{key:"_decodeAudio",value:function(A,e){const g={type:wA,ts:Math.max(e,0)};this.decoderWorker.postMessage({cmd:NA,buffer:A,options:g},[A.buffer])}},{key:"_decodeAudioNoDelay",value:function(A,e){this.decoderWorker.postMessage({cmd:SA,buffer:A,ts:Math.max(e,0)},[A.buffer])}},{key:"updateWorkConfig",value:function(A){this.decoderWorker.postMessage({cmd:GA,key:A.key,value:A.value})}}])}(),he=function(g){function i(g){var t;return e(this,i),(t=A(this,i)).player=g,t.stopId=null,t.firstTimestamp=null,t.startTimestamp=null,t.delay=-1,t.bufferList=[],t.dropping=!1,t.initInterval(),t}return C(i,g),t(i,[{key:"destroy",value:function(){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")}},{key:"getDelay",value:function(A){if(!A)return-1;if(this.firstTimestamp){if(A){const e=Date.now()-this.startTimestamp,g=A-this.firstTimestamp;this.delay=e>=g?e-g:g-e}}else this.firstTimestamp=A,this.startTimestamp=Date.now(),this.delay=-1;return this.delay}},{key:"resetDelay",value:function(){this.firstTimestamp=null,this.startTimestamp=null,this.delay=-1,this.dropping=!1}},{key:"initInterval",value:function(){this.player.debug.log("common dumex","init Interval");const A=()=>{let A;const e=this.player._opt.videoBuffer,g=this.player._opt.videoBufferDelay;if(this.bufferList.length)if(this.dropping){for(A=this.bufferList.shift(),A.type===wA&&0===A.payload[1]&&this._doDecoderDecode(A);!A.isIFrame&&this.bufferList.length;)A=this.bufferList.shift(),A.type===wA&&0===A.payload[1]&&this._doDecoderDecode(A);A.isIFrame&&this.getDelay(A.ts)<=Math.min(e,200)&&(this.dropping=!1,this._doDecoderDecode(A))}else A=this.bufferList[0],-1===this.getDelay(A.ts)?(this.bufferList.shift(),this._doDecoderDecode(A)):this.delay>e+g?(this.resetDelay(),this.dropping=!0):(A=this.bufferList[0],this.getDelay(A.ts)>e&&(this.bufferList.shift(),this._doDecoderDecode(A)))};A(),this.stopId=setInterval(A,10)}},{key:"_doDecode",value:function(A,e,g,t,i){const o=this.player,I={ts:g,cts:i,type:e,isIFrame:!1};var C,B;if(o._opt.useWCS&&!o._opt.useOffscreen)e===yA&&(I.isIFrame=t),this.pushBuffer(A,I);else if(e===yA)null==o||null===(C=o.decoderWorker)||void 0===C||null===(B=C.decodeVideo)||void 0===B||B.call(C,A,g,t);else if(e===wA){var n,Q;if(o._opt.hasAudio)null==o||null===(n=o.decoderWorker)||void 0===n||null===(Q=n.decodeAudio)||void 0===Q||Q.call(n,A,g)}}},{key:"_doDecoderDecode",value:function(A){const e=this.player;var g,t;A.type===wA?e._opt.hasAudio&&(null===(g=e.decoderWorker)||void 0===g||null===(t=g.decodeAudio)||void 0===t||t.call(g,A.payload,A.ts)):A.type}},{key:"pushBuffer",value:function(A,e){e.type===wA?this.bufferList.push({ts:e.ts,payload:A,type:wA}):e.type===yA&&this.bufferList.push({ts:e.ts,cts:e.cts,payload:A,type:yA,isIFrame:e.isIFrame})}},{key:"close",value:function(){}}])}(te),de=function(g){function i(g){var t;return e(this,i),(t=A(this,i,[g])).input=t._inputFlv(),t.flvDemux=t.dispatchFlvData(t.input),g.debug.log("FlvDemux","init"),t}return C(i,g),t(i,[{key:"destroy",value:function(){Q(i,"destroy",this)([]),this.input=null,this.flvDemux=null,this.player.debug.log("FlvDemux","destroy")}},{key:"dispatch",value:function(A){this.flvDemux(A)}},{key:"_inputFlv",value:function*(){yield 9;const A=new ArrayBuffer(4),e=new Uint8Array(A),g=new Uint32Array(A),t=this.player;for(;;){e[3]=0;const A=yield 15,i=A[4];e[0]=A[7],e[1]=A[6],e[2]=A[5];const o=g[0];e[0]=A[10],e[1]=A[9],e[2]=A[8];let I=g[0];16777215===I&&(e[3]=A[11],I=g[0]);const C=yield o;switch(i){case mA:t._opt.hasAudio&&(t.updateStats({abps:C.byteLength}),C.byteLength>0&&this._doDecode(C,wA,I));break;case FA:if(t._times.demuxStart||(t._times.demuxStart=$A()),t._opt.hasVideo){t.updateStats({vbps:C.byteLength});const A=C[0]>>4==1;if(C.byteLength>0){g[0]=C[4],g[1]=C[3],g[2]=C[2],g[3]=0;const e=g[0];this._doDecode(C,yA,I,A,e)}}}}}},{key:"dispatchFlvData",value:function(A){let e=A.next(),g=null;return t=>{let i=new Uint8Array(t);if(g){const A=new Uint8Array(g.length+i.length);A.set(g),A.set(i,g.length),i=A,g=null}for(;i.length>=e.value;){const g=i.slice(e.value);e=A.next(i.slice(0,e.value)),i=g}i.length>0&&(g=i)}}},{key:"close",value:function(){var A,e;null===(A=this.input)||void 0===A||null===(e=A.return)||void 0===e||e.call(A,null)}}])}(he),ue=function(g){function i(g){var t;return e(this,i),t=A(this,i,[g]),g.debug.log("M7sDemux","init"),t}return C(i,g),t(i,[{key:"destroy",value:function(){Q(i,"destroy",this)([]),this.player.debug.log("M7sDemux","destroy"),this.player=null}},{key:"dispatch",value:function(A){const e=this.player,g=new DataView(A),t=g.getUint8(0),i=g.getUint32(1,!1);switch(t){case wA:if(e._opt.hasAudio){const g=new Uint8Array(A,5);e.updateStats({abps:g.byteLength}),g.byteLength>0&&this._doDecode(g,t,i)}break;case yA:if(e._opt.hasVideo)if(e._times.demuxStart||(e._times.demuxStart=$A()),g.byteLength>5){const o=new Uint8Array(A,5),I=g.getUint8(5)>>4==1;e.updateStats({vbps:o.byteLength}),o.byteLength>0&&this._doDecode(o,t,i,I)}else this.player.debug.warn("M7sDemux","dispatch","dv byteLength is",g.byteLength)}}}])}(he),De=function(){return t((function A(g){return e(this,A),new(A.getLoaderFactory(g._opt.demuxType))(g)}),null,[{key:"getLoaderFactory",value:function(A){return A===aA?ue:A===rA?de:void 0}}])}();const pe=()=>"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,fe=()=>"wakeLock"in navigator;let we=function(){return t((function A(g){if(e(this,A),this.player=g,this.enabled=!1,fe()){this._wakeLock=null;const A=()=>{null!==this._wakeLock&&"visible"===document.visibilityState&&this.enable()};document.addEventListener("visibilitychange",A),document.addEventListener("fullscreenchange",A)}else pe()?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,GkXfowEAAAAAAAAfQoaBAUL3gQFC8oEEQvOBCEKChHdlYm1Ch4EEQoWBAhhTgGcBAAAAAAAVkhFNm3RALE27i1OrhBVJqWZTrIHfTbuMU6uEFlSua1OsggEwTbuMU6uEHFO7a1OsghV17AEAAAAAAACkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmAQAAAAAAAEUq17GDD0JATYCNTGF2ZjU1LjMzLjEwMFdBjUxhdmY1NS4zMy4xMDBzpJBlrrXf3DCDVB8KcgbMpcr+RImIQJBgAAAAAAAWVK5rAQAAAAAAD++uAQAAAAAAADLXgQFzxYEBnIEAIrWcg3VuZIaFVl9WUDiDgQEj44OEAmJaAOABAAAAAAAABrCBsLqBkK4BAAAAAAAPq9eBAnPFgQKcgQAitZyDdW5khohBX1ZPUkJJU4OBAuEBAAAAAAAAEZ+BArWIQOdwAAAAAABiZIEgY6JPbwIeVgF2b3JiaXMAAAAAAoC7AAAAAAAAgLUBAAAAAAC4AQN2b3JiaXMtAAAAWGlwaC5PcmcgbGliVm9yYmlzIEkgMjAxMDExMDEgKFNjaGF1ZmVudWdnZXQpAQAAABUAAABlbmNvZGVyPUxhdmM1NS41Mi4xMDIBBXZvcmJpcyVCQ1YBAEAAACRzGCpGpXMWhBA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HsSzgOJYFJMmyAJYF0DyApgFEEQAIAAAocAAACLBBU2JxgEJDVgIAUQAABsWxLE0TRZKkaZoniiRJ0zxPFGma53meacLzPM80IYqiaJoQRVE0TZimaaoqME1VFQAAUOAAABBgg6bE4gCFhqwEAEICAByKYlma5nmeJ4qmqZokSdM8TxRF0TRNU1VJkqZ5niiKommapqqyLE3zPFEURdNUVVWFpnmeKIqiaaqq6sLzPE8URdE0VdV14XmeJ4qiaJqq6roQRVE0TdNUTVV1XSCKpmmaqqqqrgtETxRNU1Vd13WB54miaaqqq7ouEE3TVFVVdV1ZBpimaaqq68oyQFVV1XVdV5YBqqqqruu6sgxQVdd1XVmWZQCu67qyLMsCAAAOHAAAAoygk4wqi7DRhAsPQKEhKwKAKAAAwBimFFPKMCYhpBAaxiSEFEImJaXSUqogpFJSKRWEVEoqJaOUUmopVRBSKamUCkIqJZVSAADYgQMA2IGFUGjISgAgDwCAMEYpxhhzTiKkFGPOOScRUoox55yTSjHmnHPOSSkZc8w556SUzjnnnHNSSuacc845KaVzzjnnnJRSSuecc05KKSWEzkEnpZTSOeecEwAAVOAAABBgo8jmBCNBhYasBABSAQAMjmNZmuZ5omialiRpmud5niiapiZJmuZ5nieKqsnzPE8URdE0VZXneZ4oiqJpqirXFUXTNE1VVV2yLIqmaZqq6rowTdNUVdd1XZimaaqq67oubFtVVdV1ZRm2raqq6rqyDFzXdWXZloEsu67s2rIAAPAEBwCgAhtWRzgpGgssNGQlAJABAEAYg5BCCCFlEEIKIYSUUggJAAAYcAAACDChDBQashIASAUAAIyx1lprrbXWQGettdZaa62AzFprrbXWWmuttdZaa6211lJrrbXWWmuttdZaa6211lprrbXWWmuttdZaa6211lprrbXWWmuttdZaa6211lprrbXWWmstpZRSSimllFJKKaWUUkoppZRSSgUA+lU4APg/2LA6wknRWGChISsBgHAAAMAYpRhzDEIppVQIMeacdFRai7FCiDHnJKTUWmzFc85BKCGV1mIsnnMOQikpxVZjUSmEUlJKLbZYi0qho5JSSq3VWIw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wAAAAIAAAABAAAAGAAAAAEAAAABAAAAGQAAAAIAAAABAAAAGgAAAAEAAAABAAAAGwAAAAIAAAABAAAAHQAAAAEAAAABAAAAHgAAAAIAAAABAAAAHwAAAAQAAAABAAAA4HN0c3oAAAAAAAAAAAAAADMAAAAaAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAACMc3RjbwAAAAAAAAAfAAAALAAAA1UAAANyAAADhgAAA6IAAAO+AAAD0QAAA+0AAAQAAAAEHAAABC8AAARLAAAEZwAABHoAAASWAAAEqQAABMUAAATYAAAE9AAABRAAAAUjAAAFPwAABVIAAAVuAAAFgQAABZ0AAAWwAAAFzAAABegAAAX7AAAGFwAAAGJ1ZHRhAAAAWm1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAALWlsc3QAAAAlqXRvbwAAAB1kYXRhAAAAAQAAAABMYXZmNTUuMzMuMTAw"),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())}))})))}),[{key:"_addSourceToVideo",value:function(A,e,g){const t=document.createElement("source");t.src=g,t.type=`video/${e}`,A.appendChild(t)}},{key:"isEnabled",get:function(){return this.enabled}},{key:"enable",value:function(){const A=this.player.debug;if(fe())return navigator.wakeLock.request("screen").then((e=>{this._wakeLock=e,this.enabled=!0,A.log("wakeLock","Wake Lock active."),this._wakeLock.addEventListener("release",(()=>{A.log("wakeLock","Wake Lock released.")}))})).catch((e=>{throw this.enabled=!1,A.error("wakeLock",`${e.name}, ${e.message}`),e}));if(pe())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((A=>(this.enabled=!0,A))).catch((A=>{throw this.enabled=!1,A}))}},{key:"disable",value:function(){const A=this.player.debug;fe()?(this._wakeLock&&this._wakeLock.release(),this._wakeLock=null):pe()?this.noSleepTimer&&(A.warn("wakeLock","NoSleep now disabled for older iOS devices."),window.clearInterval(this.noSleepTimer),this.noSleepTimer=null):this.noSleepVideo.pause(),this.enabled=!1}}])}();var ye=E(H()),me=function(){function A(A){this.master=A,this.logger=new ye({name:"FLV",showTime:!0})}return A.prototype.info=function(A){for(var e,g=[],t=1;t<arguments.length;t++)g[t-1]=arguments[t];this._setLogger()>=4&&(e=this.logger).log.apply(e,jA([A],g,!1))},A.prototype.log=function(A){for(var e,g=[],t=1;t<arguments.length;t++)g[t-1]=arguments[t];this._setLogger()>=3&&(e=this.logger).log.apply(e,jA([A],g,!1))},A.prototype.warn=function(A){for(var e,g=[],t=1;t<arguments.length;t++)g[t-1]=arguments[t];this._setLogger()>=2&&(e=this.logger).warn.apply(e,jA([A],g,!1))},A.prototype.error=function(A){for(var e,g=[],t=1;t<arguments.length;t++)g[t-1]=arguments[t];(e=this.logger).error.apply(e,jA([A],g,!1))},A.prototype._setLogger=function(){var A,e,g,t,i;return this.master._opt.debug&&(null===(A=this.master._opt.loggerOptions)||void 0===A?void 0:A.level)?"INFO"===(null===(e=this.master._opt.loggerOptions)||void 0===e?void 0:e.level)?4:"LOG"===(null===(g=this.master._opt.loggerOptions)||void 0===g?void 0:g.level)?3:"WARN"===(null===(t=this.master._opt.loggerOptions)||void 0===t?void 0:t.level)?2:"ERROR"===(null===(i=this.master._opt.loggerOptions)||void 0===i?void 0:i.level)?1:5:-1},A}();let Fe=function(){return t((function A(g){e(this,A),this.destroys=[],this.proxy=this.proxy.bind(this),this.master=g}),[{key:"proxy",value:function(A,e,g){let t=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(!A)return;if(Array.isArray(e))return e.map((e=>this.proxy(A,e,g,t)));A.addEventListener(e,g,t);const i=()=>A.removeEventListener(e,g,t);return this.destroys.push(i),i}},{key:"destroy",value:function(){var A;null===(A=this.master.debug)||void 0===A||A.log("Events","destroy"),this.destroys.forEach((A=>A()))}}])}();var ke,Ne,Se=function(A){var e=A.events.proxy,g=document.createElement("object");g.setAttribute("aria-hidden","true"),g.setAttribute("tabindex","-1"),g.type="text/html",g.data="about:blank",Ae(g,{display:"block",position:"absolute",top:"0",left:"0",height:"100%",width:"100%",overflow:"hidden",pointerEvents:"none",zIndex:"-1"});var t=A.width,i=A.height;e(g,"load",(function(){var o;e(null===(o=g.contentDocument)||void 0===o?void 0:o.defaultView,"resize",(function(){A.width===t&&A.height===i||(t=A.width,i=A.height,A.emit(RA.resize))}))})),A.$container.appendChild(g),A.on(RA.destroy,(function(){A.$container.removeChild(g)}))},Ye=function(A){this.player=A,Se(A)},Ge=function(A){function e(e,g,t){var i,o=A.call(this)||this;return o.$container=e,o._opt=g,o.debug=new me(o),o._muted=g.muted,o._volume=g.volume||.8,o._loading=!1,o._playing=!1,o._hasLoaded=!1,o._checkHeartTimeout=null,o._checkStatsInterval=null,o._startBpsTime=null,o._isPlayingBeforePageHidden=!1,o._stats={buf:0,fps:0,abps:0,vbps:0,ts:0},o._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},o._videoTimestamp=0,o._audioTimestamp=0,i=o,Object.defineProperty(i,"rect",{get:function(){return i.$container.getBoundingClientRect()}}),["bottom","height","left","right","top","width"].forEach((function(A){Object.defineProperty(i,A,{get:function(){return i.rect[A]}})})),o.events=new Fe(o),o.video=new t(o),function(A){A.on(RA.decoderWorkerInit,(function(){A.debug.log("player","has loaded"),A.loaded=!0})),A.on(RA.play,(function(){A.loading=!1})),A.on(RA.resize,(function(){var e;null===(e=A.video)||void 0===e||e.resize()}));var e=[RA.timeUpdate,RA.flvStream];Object.keys(RA).forEach((function(g){A.on(RA[g],(function(t){e.includes(g)||("object"!=typeof t||"[object Object]"!==Object.prototype.toString.call(t)?A.debug.log("player events",RA[g],t):A.debug.log("player events",RA[g],JSON.stringify(t)))}))})),Object.keys(UA).forEach((function(e){A.on(UA[e],(function(g){A.debug.log("player event error",UA[e],g)}))}))}(o),function(A){var e=A._opt,g=A.debug,t=A.events.proxy;t(document,"visibilitychange",(function(){e.hiddenAutoPause&&(g.log("visibilitychange",document.visibilityState,A._isPlayingBeforePageHidden),"visible"===document.visibilityState?A._isPlayingBeforePageHidden&&A.play():(A._isPlayingBeforePageHidden=A.playing,A.playing&&A.pause()))})),t(window,"fullscreenchange",(function(){null!==A.keepScreenOn&&"visible"===document.visibilityState&&A.enableWakeLock&&A.enableWakeLock()}))}(o),o._fullscreen=!1,o.control=new Ye(o),o}return xA(e,A),Object.defineProperty(e.prototype,"muted",{get:function(){return this._muted},set:function(A){this._updateMuted(A)},enumerable:!1,configurable:!0}),e.prototype._updateMuted=function(A){this._muted!==A&&(this._muted=A,this.emit(RA.volumechange,this.volume,A))},Object.defineProperty(e.prototype,"volume",{get:function(){return this._volume},set:function(A){this._updateVolume(A)},enumerable:!1,configurable:!0}),e.prototype._updateVolume=function(A){A>=0&&A<=1&&this._volume!==A&&(this.emit(RA.volumechange,A,this._muted),this._volume=A)},e.prototype.destroy=function(){this._loading=!1,this._playing=!1,this._hasLoaded=!1,this._volume=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.emit("destroy"),this.off(),this.debug.log("play","destroy end")},e.prototype.updateOption=function(A){this._opt=Object.assign({},this._opt,A)},e.prototype.resize=function(){this.video.resize()},e}(te);var Re=function(){if(Ne)return ke;Ne=1;var A,e,g,t,i=(A="undefined"!=typeof self?self:window,e={navigator:void 0!==A.navigator?A.navigator:{userAgent:""},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"]}},g={getMatchMap:function(A){return{Trident:A.includes("Trident")||A.includes("NET CLR"),Presto:A.includes("Presto"),WebKit:A.includes("AppleWebKit"),Gecko:A.includes("Gecko/"),Safari:A.includes("Safari"),Chrome:A.includes("Chrome")||A.includes("CriOS"),IE:A.includes("MSIE")||A.includes("Trident"),Edge:A.includes("Edge"),Firefox:A.includes("Firefox")||A.includes("FxiOS"),"Firefox Focus":A.includes("Focus"),Chromium:A.includes("Chromium"),Opera:A.includes("Opera")||A.includes("OPR"),Vivaldi:A.includes("Vivaldi"),Yandex:A.includes("YaBrowser"),Arora:A.includes("Arora"),Lunascape:A.includes("Lunascape"),QupZilla:A.includes("QupZilla"),"Coc Coc":A.includes("coc_coc_browser"),Kindle:A.includes("Kindle")||A.includes("Silk/"),Iceweasel:A.includes("Iceweasel"),Konqueror:A.includes("Konqueror"),Iceape:A.includes("Iceape"),SeaMonkey:A.includes("SeaMonkey"),Epiphany:A.includes("Epiphany"),360:A.includes("QihooBrowser")||A.includes("QHBrowser"),"360EE":A.includes("360EE"),"360SE":A.includes("360SE"),UC:A.includes("UC")||A.includes(" UBrowser"),QQBrowser:A.includes("QQBrowser"),QQ:A.includes("QQ/"),Baidu:A.includes("Baidu")||A.includes("BIDUBrowser"),Maxthon:A.includes("Maxthon"),Sogou:A.includes("MetaSr")||A.includes("Sogou"),LBBROWSER:A.includes("LBBROWSER"),"2345Explorer":A.includes("2345Explorer"),TheWorld:A.includes("TheWorld"),XiaoMi:A.includes("MiuiBrowser"),Quark:A.includes("Quark"),Qiyu:A.includes("Qiyu"),Wechat:A.includes("MicroMessenger"),Taobao:A.includes("AliApp(TB"),Alipay:A.includes("AliApp(AP"),Weibo:A.includes("Weibo"),Douban:A.includes("com.douban.frodo"),Suning:A.includes("SNEBUY-APP"),iQiYi:A.includes("IqiyiApp"),Windows:A.includes("Windows"),Linux:A.includes("Linux")||A.includes("X11"),"Mac OS":A.includes("Macintosh"),Android:A.includes("Android")||A.includes("Adr"),Ubuntu:A.includes("Ubuntu"),FreeBSD:A.includes("FreeBSD"),Debian:A.includes("Debian"),"Windows Phone":A.includes("IEMobile")||A.includes("Windows Phone"),BlackBerry:A.includes("BlackBerry")||A.includes("RIM"),MeeGo:A.includes("MeeGo"),Symbian:A.includes("Symbian"),iOS:A.includes("like Mac OS X"),"Chrome OS":A.includes("CrOS"),WebOS:A.includes("hpwOS"),Mobile:A.includes("Mobi")||A.includes("iPh")||A.includes("480"),Tablet:A.includes("Tablet")||A.includes("Nexus 7"),iPad:A.includes("iPad")}},matchInfoMap:function(A){var t,i=(null==(t=e.navigator)?void 0:t.userAgent)||"",o=g.getMatchMap(i);for(var I in e.infoMap)for(var C=0;C<e.infoMap[I].length;C++){var B=e.infoMap[I][C];o[B]&&(A[I]=B)}},getOS:function(){return g.matchInfoMap(this),null==this?void 0:this.os},getOSVersion:function(){var A=e.navigator.userAgent||"";this.osVersion="";var g={Windows:function(){var e=A.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 A.replace(/^.*Android ([\d.]+);.*$/,"$1")},iOS:function(){return A.replace(/^.*OS ([\d_]+) like.*$/,"$1").replace(/_/g,".")},Debian:function(){return A.replace(/^.*Debian\/([\d.]+).*$/,"$1")},"Windows Phone":function(){return A.replace(/^.*Windows Phone( OS)? ([\d.]+);.*$/,"$2")},"Mac OS":function(){return A.replace(/^.*Mac OS X ([\d_]+).*$/,"$1").replace(/_/g,".")},WebOS:function(){return A.replace(/^.*hpwOS\/([\d.]+);.*$/,"$1")}};return"function"==typeof g[this.os]&&(this.osVersion=g[this.os](),this.osVersion==A&&(this.osVersion="")),this.osVersion},getOrientationStatu:function(){return window.matchMedia("(orientation: portrait)").matches?"vertical":"horizontal"},getDeviceType:function(){return this.device="PC",g.matchInfoMap(this),this.device},getNetwork:function(){var A,e,g,t;return null==(A=(null==(e=navigator)?void 0:e.connection)||(null==(g=navigator)?void 0:g.mozConnection)||(null==(t=navigator)?void 0:t.webkitConnection))?void 0:A.effectiveType},getLanguage:function(){var A,g,t;return this.language=((t=((null==(A=e.navigator)?void 0:A.browserLanguage)||(null==(g=e.navigator)?void 0:g.language)).split("-"))[1]&&(t[1]=t[1].toUpperCase()),t.join("_")),this.language},createFingerprint:function(A){var e=document.createElement("canvas"),g=e.getContext("2d"),t=A||window.location.host;g.textBaseline="top",g.font="14px 'Arial'",g.fillStyle="#f60",g.fillRect(125,1,62,20),g.fillStyle="#069",g.fillText(t,2,15),g.fillStyle="rgba(102, 204, 0, 0.7)",g.fillText(t,4,17);var i=e.toDataURL().replace("data:image/png;base64,","");return function(A){var e,g,t,i="";for(e=0,g=(A+="").length;e<g;e++)i+=(t=A.charCodeAt(e).toString(16)).length<2?"0"+t:t;return i}(atob(i).slice(-16,-12))},getBrowserInfo:function(){g.matchInfoMap(this);var t=e.navigator.userAgent||"",i=function(A,g){var t=e.navigator.mimeTypes;for(var i in t)if(t[i][A]==g)return!0;return!1},o=g.getMatchMap(t),I=!1;if(A.chrome){var C=t.replace(/^.*Chrome\/([\d]+).*$/,"$1");+C>36&&A.showModalDialog?I=!0:+C>45&&(I=i("type","application/vnd.chromium.remoting-viewer"))}if(o.Baidu&&o.Opera&&(o.Baidu=!1),o.Mobile&&(o.Mobile=!t.includes("iPad")),I&&(i("type","application/gameplugin")||e.navigator&&void 0===e.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 105:break;case 102:o["360EE"]=!0;break;case 104:o["360SE"]=!0}var B={Safari:function(){return t.replace(/^.*Version\/([\d.]+).*$/,"$1")},Chrome:function(){return t.replace(/^.*Chrome\/([\d.]+).*$/,"$1").replace(/^.*CriOS\/([\d.]+).*$/,"$1")},IE:function(){return t.replace(/^.*MSIE ([\d.]+).*$/,"$1").replace(/^.*rv:([\d.]+).*$/,"$1")},Edge:function(){return t.replace(/^.*Edge\/([\d.]+).*$/,"$1")},Firefox:function(){return t.replace(/^.*Firefox\/([\d.]+).*$/,"$1").replace(/^.*FxiOS\/([\d.]+).*$/,"$1")},"Firefox Focus":function(){return t.replace(/^.*Focus\/([\d.]+).*$/,"$1")},Chromium:function(){return t.replace(/^.*Chromium\/([\d.]+).*$/,"$1")},Opera:function(){return t.replace(/^.*Opera\/([\d.]+).*$/,"$1").replace(/^.*OPR\/([\d.]+).*$/,"$1")},Vivaldi:function(){return t.replace(/^.*Vivaldi\/([\d.]+).*$/,"$1")},Yandex:function(){return t.replace(/^.*YaBrowser\/([\d.]+).*$/,"$1")},Arora:function(){return t.replace(/^.*Arora\/([\d.]+).*$/,"$1")},Lunascape:function(){return t.replace(/^.*Lunascape[\/\s]([\d.]+).*$/,"$1")},QupZilla:function(){return t.replace(/^.*QupZilla[\/\s]([\d.]+).*$/,"$1")},"Coc Coc":function(){return t.replace(/^.*coc_coc_browser\/([\d.]+).*$/,"$1")},Kindle:function(){return t.replace(/^.*Version\/([\d.]+).*$/,"$1")},Iceweasel:function(){return t.replace(/^.*Iceweasel\/([\d.]+).*$/,"$1")},Konqueror:function(){return t.replace(/^.*Konqueror\/([\d.]+).*$/,"$1")},Iceape:function(){return t.replace(/^.*Iceape\/([\d.]+).*$/,"$1")},SeaMonkey:function(){return t.replace(/^.*SeaMonkey\/([\d.]+).*$/,"$1")},Epiphany:function(){return t.replace(/^.*Epiphany\/([\d.]+).*$/,"$1")},360:function(){return t.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"}[+t.replace(/^.*Chrome\/([\d]+).*$/,"$1")]||""},"360EE":function(){return{69:"11.0",63:"9.5",55:"9.0",50:"8.7",30:"7.5"}[+t.replace(/^.*Chrome\/([\d]+).*$/,"$1")]||""},Maxthon:function(){return t.replace(/^.*Maxthon\/([\d.]+).*$/,"$1")},QQBrowser:function(){return t.replace(/^.*QQBrowser\/([\d.]+).*$/,"$1")},QQ:function(){return t.replace(/^.*QQ\/([\d.]+).*$/,"$1")},Baidu:function(){return t.replace(/^.*BIDUBrowser[\s\/]([\d.]+).*$/,"$1")},UC:function(){return t.replace(/^.*UC?Browser\/([\d.]+).*$/,"$1")},Sogou:function(){return t.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 t.replace(/^.*2345Explorer\/([\d.]+).*$/,"$1")},TheWorld:function(){return t.replace(/^.*TheWorld ([\d.]+).*$/,"$1")},XiaoMi:function(){return t.replace(/^.*MiuiBrowser\/([\d.]+).*$/,"$1")},Quark:function(){return t.replace(/^.*Quark\/([\d.]+).*$/,"$1")},Qiyu:function(){return t.replace(/^.*Qiyu\/([\d.]+).*$/,"$1")},Wechat:function(){return t.replace(/^.*MicroMessenger\/([\d.]+).*$/,"$1")},Taobao:function(){return t.replace(/^.*AliApp\(TB\/([\d.]+).*$/,"$1")},Alipay:function(){return t.replace(/^.*AliApp\(AP\/([\d.]+).*$/,"$1")},Weibo:function(){return t.replace(/^.*weibo__([\d.]+).*$/,"$1")},Douban:function(){return t.replace(/^.*com.douban.frodo\/([\d.]+).*$/,"$1")},Suning:function(){return t.replace(/^.*SNEBUY-APP([\d.]+).*$/,"$1")},iQiYi:function(){return t.replace(/^.*IqiyiVersion\/([\d.]+).*$/,"$1")}};return this.browserVersion="",B[this.browser]&&(this.browserVersion=B[this.browser](),this.browserVersion==t&&(this.browserVersion="")),"Edge"==this.browser&&(this.engine="EdgeHTML"),"Chrome"==this.browser&&parseInt(this.browserVersion)>27&&(this.engine="Blink"),"Opera"==this.browser&&parseInt(this.browserVersion)>12&&(this.engine="Blink"),"Yandex"==this.browser&&(this.engine="Blink"),this.browser+" (version: "+this.browserVersion+"; kernel: "+this.engine+")"}},t={DeviceInfoObj:function(t){var i,o=function(A){var e;null==(e=t.info)||e.forEach((function(e){e.toLowerCase()===A.toLowerCase()&&(C[A]=I[A])}))};t=t||{domain:""};var I={deviceType:g.getDeviceType(),OS:g.getOS(),OSVersion:g.getOSVersion(),sh:A.screen.height,sw:A.screen.width,lang:g.getLanguage(),netWork:g.getNetwork(),orientation:g.getOrientationStatu(),browserInfo:g.getBrowserInfo(),fingerprint:g.createFingerprint(t.domain),userAgent:null==(i=e.navigator)?void 0:i.userAgent};if(!t.info||0===t.info.length)return I;var C={};for(var B in I)o(B);return C}},{getDeviceInfo:function(A){return t.DeviceInfoObj(A)}}),o=function(){function A(){}return A.add=function(e,g){A.queues.push({url:e,data:g})},A.fire=function(){if(A.queues&&0!==A.queues.length){A.isStop=!1;var e=A.queues[0];e.url&&A.api.report(e.data),A.queues.splice(0,1),A.fire()}else A.isStop=!0},A}();o.isStop=!0,o.queues=[];var I=function(){function A(A){this.url=A}var e=A.prototype;return e.report=function(A){this.checkUrl(this.url)&&this.sendInfo(A)},e.sendInfo=function(A){var e;"function"==typeof(null==(e=navigator)?void 0:e.sendBeacon)?this.sendBeacon(this.url,A):this.sendImage(this.url,A)},e.sendImage=function(A,e){var g=this.changeJSON2Query(e),t=new Image;t.onload=t.onerror=function(){t=null},t.src=A+"?"+g+"&random="+Math.random()},e.sendBeacon=function(A,e){try{navigator.sendBeacon(A,this.formatParamsByURLSearchParams(e))}catch(A){}},e.formatParamsByURLSearchParams=function(A){var e=new URLSearchParams;for(var g in A)"object"==typeof A[g]&&(A[g]=JSON.stringify(A[g])),e.append(g,A[g]);return e},e.changeJSON2Query=function(A){var e="";for(var g in A){""!=e&&(e+="&");var t=A[g];e+=g+"="+encodeURIComponent("object"==typeof t?JSON.stringify(t):t)}return e},e.checkUrl=function(A){return!!A&&/^[hH][tT][tT][pP]([sS]?):\/\//.test(A)},A}();function C(){return C=Object.assign||function(A){for(var e=1;e<arguments.length;e++){var g=arguments[e];for(var t in g)Object.prototype.hasOwnProperty.call(g,t)&&(A[t]=g[t])}return A},C.apply(this,arguments)}var B=function(){function A(A){this.options=A,this.extendsInfo=A.extendsInfo||{},this.clientInfo=this._getDeviceInfo(),o.api=new I(A.url),this.changeUrl=this.changeUrl.bind(this)}var e=A.prototype;return e.changeUrl=function(A){o.api=new I(A)},e.send=function(A){return this.options.forbidden||"object"!=typeof A||(this._handleRecordError(A),o.isStop&&o.fire()),this},e.setForbidden=function(A){this.options.forbidden=A},e.updateExtendsInfo=function(A){void 0===A&&(A={}),this.extendsInfo=C({},this.extendsInfo||{},A)},e._handleRecordError=function(A){try{var e=this._handleErrorInfo(A);o.add(this.options.url,e)}catch(A){}},e._handleErrorInfo=function(A){var e=this._getExtendsInfo(),g=C({st:(new Date).getTime()},e,A);return g.clientInfo=this.clientInfo,g},e._getExtendsInfo=function(){try{var A,e={},g=this.extendsInfo||{};for(var t in"function"==typeof g.getDynamic&&(A=g.getDynamic()),"[object Object]"===Object.prototype.toString.call(A)&&(g=C({},g,A)),g)"function"!=typeof g[t]&&(e[t]=g[t]);return e}catch(A){return{}}},e._getDeviceInfo=function(){try{var A=i.getDeviceInfo();return JSON.stringify(A)}catch(A){return""}},A}();return ke=B}(),ve=E(Re);function Ue(A){if(/http[s]?:\/\/|ws[s]?:\/\//.test(A)){const e=A.split("?")[1],g=e?e.split("&"):[],t={};for(let A=0;A<g.length;++A){const[e,i]=g[A].split("=");t[e]=t[e]||decodeURIComponent(i)}try{const e=A.split(".flv")[0].split("/"),g=e[e.length-1].split("_");e.length>0&&g[0]&&g[1]&&g[2]&&(t.serial=g[0],t.no=g[1],t.bitstream=g[2])}catch(A){}return t}return{}}let Me=function(){function A(){e(this,A)}return t(A,null,[{key:"initMonitor",value:function(e){A.collect=new ve({forbidden:e,url:"https://log.ys7.com/statistics.do/opensdk_ezuikit",jsError:!1,promiseError:!1,resourceError:!1,extendsInfo:{protocol:"flv",v:"2.1.2-beta.1"}})}},{key:"report",value:function(e){let g=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};A.collect||A.initMonitor();try{const t=Ue(A.url);A.collect.send({url:A.url,serial:t.serial,no:t.no,action:e,logInfo:g})}catch(A){}}}])}();var Le=function(A){function e(e,g){var t=A.call(this,e,g,re)||this;return t._opt.useMSE=!1,t._loadingTimeoutDelayTimer=null,t._opt.hasAudio&&(t.audio=new Ee(t)),t.decoderWorker=new ce(t),t.stream=null,t.demux=null,t._muted=t._opt.muted,BA.isMobile()&&(t.keepScreenOn=new we(t)),t._enableSoundOnUserInteraction=t._enableSoundOnUserInteraction.bind(t),window.addEventListener("click",t._enableSoundOnUserInteraction),window.addEventListener("pointerdown",t._enableSoundOnUserInteraction),window.addEventListener("touchstart",t._enableSoundOnUserInteraction),window.addEventListener("keydown",t._enableSoundOnUserInteraction),document.body.addEventListener("click",t._enableSoundOnUserInteraction),document.body.addEventListener("pointerdown",t._enableSoundOnUserInteraction),document.body.addEventListener("touchstart",t._enableSoundOnUserInteraction),document.body.addEventListener("keydown",t._enableSoundOnUserInteraction),t.on(RA.audioInfo,(function(A){var e;A.encType&&!t.muted&&(null===(e=t.audio)||void 0===e?void 0:e.isStateRunning())&&setTimeout((function(){var A,e;null===(e=(A=t.audio).audioEnabled)||void 0===e||e.call(A,!0)}),100)})),t}return xA(e,A),e.prototype.destroy=function(){var e,g,t,i,o,I;this._loading=!1,this._playing=!1,this._hasLoaded=!1,this.decoderWorker&&(this.decoderWorker.destroy(),this.decoderWorker=null),this.audio&&(null===(g=(e=this.audio).destroy)||void 0===g||g.call(e),this.audio=null),this.stream&&(null===(i=(t=this.stream).destroy)||void 0===i||i.call(t),this.stream=null),this.demux&&(null===(I=null===(o=this.demux)||void 0===o?void 0:o.destroy)||void 0===I||I.call(o),this.demux=null),this.clearCheckHeartTimeout(),this.clearCheckLoadingTimeout(),this.clearStatsInterval(),this.releaseWakeLock(),this.keepScreenOn=null,this.resetStats(),this._audioTimestamp=0,this._videoTimestamp=0,window.removeEventListener("click",this._enableSoundOnUserInteraction),window.removeEventListener("pointerdown",this._enableSoundOnUserInteraction),window.removeEventListener("touchstart",this._enableSoundOnUserInteraction),window.removeEventListener("keydown",this._enableSoundOnUserInteraction),document.body.removeEventListener("click",this._enableSoundOnUserInteraction),document.body.removeEventListener("pointerdown",this._enableSoundOnUserInteraction),document.body.removeEventListener("touchstart",this._enableSoundOnUserInteraction),document.body.removeEventListener("keydown",this._enableSoundOnUserInteraction),A.prototype.destroy.call(this)},Object.defineProperty(e.prototype,"loaded",{get:function(){return this._hasLoaded},set:function(A){this._hasLoaded=A},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"playing",{get:function(){return this._playing},set:function(A){A&&(this.loading=!1),this.playing!==A&&(this._playing=A,this.emit(RA.playing,A),this.emit(RA.volumechange,this.volume,this.muted),A?this.emit(RA.play):this.emit(RA.pause))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"muted",{get:function(){return this._muted},set:function(e){this.audio&&(this.audio.muted=e),A.prototype._updateMuted.call(this,e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"volume",{get:function(){return this._volume},set:function(e){this.audio&&(this.audio.volume=e),A.prototype._updateVolume.call(this,e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"loading",{get:function(){return this._loading},set:function(A){this.loading!==A&&(this._loading=A,this.emit(RA.loading,this._loading),A||this.emit(RA.loaded))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"audioTimestamp",{get:function(){return this._audioTimestamp},set:function(A){null!==A&&(this._audioTimestamp=A)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"videoTimestamp",{get:function(){return this._videoTimestamp},set:function(A){null!==A&&(this._videoTimestamp=A,this._opt.useWCS||this._opt.useMSE||this.audioTimestamp&&this.videoTimestamp&&this.audio&&this.audio.emit(RA.videoSyncAudio,{audioTimestamp:this.audioTimestamp,videoTimestamp:this.videoTimestamp,diff:this.audioTimestamp-this.videoTimestamp}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isDebug",{get:function(){return!0===this._opt.debug},enumerable:!1,configurable:!0}),e.prototype._init=function(){var A=this;return new Promise((function(e,g){A.stream||(A.stream=new le(A)),A.audio||A._opt.hasAudio&&(A.audio=new Ee(A)),A.demux||(A.demux=new De(A)),A.decoderWorker?e():(A.decoderWorker=new ce(A),A.once(RA.decoderWorkerInit,(function(){e()})))}))},e.prototype.play=function(A){var e=this;return this._opt=Object.assign({},this._opt,A||{}),this.clearCheckHeartTimeout(),new Promise((function(A,g){if(!e._opt.url)return g();e.loading=!0,e.playing=!1,e._times.playInitStart=$A(),e._init().then((function(){e._times.playStart=$A(),e._opt.muted||(e.muted=!1),e.enableWakeLock(),e.stream.on(RA.flvStream,(function(A){e.emit(RA.flvStream,A)}));try{e.stream.fetchStream(e._opt.url,e._opt)}catch(A){}e.checkLoadingTimeout(),e.stream.once(RA.streamError,(function(A){e.stream&&(e.stream.destroy(),e.stream=null),e.clearCheckLoadingTimeout(),e.emit(RA.streamError,A),e.emit(RA.delayTimeout,A),g(A)})),e.stream.once(RA.streamEnd,(function(){g()})),e.stream.once(RA.streamSuccess,(function(){e.clearCheckLoadingTimeout(),e.emit(RA.streamSuccess),A(),e._times.streamResponse=$A(),e.video.play(),e.checkStatsInterval()}))})).catch((function(A){g(A)})),e._resumeAudioAfterPause()}))},e.prototype.close=function(){var A=this;return new Promise((function(e){A._close().then((function(){var g,t;null===(t=null===(g=A.video)||void 0===g?void 0:g.clearView)||void 0===t||t.call(g),e()}))}))},e.prototype._resumeAudioAfterPause=function(){this._volume&&(this.volume=this._volume)},e.prototype._close=function(){var A=this;return new Promise((function(e){var g,t;A._loadingTimeoutDelayTimer&&(clearTimeout(A._loadingTimeoutDelayTimer),A._loadingTimeoutDelayTimer=null),A.stream&&(A.stream.destroy(),A.stream=null),A.demux&&(A.demux.destroy(),A.demux=null),A.decoderWorker&&(A.decoderWorker.destroy(),A.decoderWorker=null),A.audio&&(null===(t=(g=A.audio).pause)||void 0===t||t.call(g)),A.clearCheckHeartTimeout(),A.clearCheckLoadingTimeout(),A.clearStatsInterval(),A.playing=!1,A.loading=!1,A.video&&(A.video.resetInit(),A.video.pause(!0)),A.releaseWakeLock(),A.resetStats(),A._audioTimestamp=0,A._videoTimestamp=0,A._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},setTimeout((function(){e()}),0)}))},e.prototype.pause=function(A){return void 0===A&&(A=!1),A?this.close():this._close()},e.prototype.checkHeart=function(){this.clearCheckHeartTimeout(),this.checkHeartTimeout()},e.prototype.checkHeartTimeout=function(){var A,e=this;0!==this._opt.heartTimeout&&(this._checkHeartTimeout=setTimeout((function(){if(e._checkHeartTimeout&&e.clearCheckHeartTimeout(),e.playing){if(0!==e._stats.fps)return;e.pause().then((function(){e.emit(RA.timeout,RA.heartTimeout),e.emit(RA.heartTimeout)}))}}),1e3*((null===(A=this._opt)||void 0===A?void 0:A.heartTimeout)||5)))},e.prototype.checkStatsInterval=function(){var A=this;this._checkStatsInterval=setInterval((function(){A.updateStats()}),1e3)},e.prototype.clearCheckHeartTimeout=function(){this._checkHeartTimeout&&(clearTimeout(this._checkHeartTimeout),this._checkHeartTimeout=null)},e.prototype.checkLoadingTimeout=function(){var A=this;0!==this._opt.loadingTimeout&&(this._checkLoadingTimeout=setTimeout((function(){A.playing||(A.clearCheckLoadingTimeout(),A.pause().then((function(){A.emit(RA.timeout,RA.loadingTimeout),A.emit(RA.loadingTimeout)})).catch((function(){})))}),1e3*this._opt.loadingTimeout))},e.prototype.clearCheckLoadingTimeout=function(){this._checkLoadingTimeout&&(clearTimeout(this._checkLoadingTimeout),this._checkLoadingTimeout=null)},e.prototype.clearStatsInterval=function(){this._checkStatsInterval&&(clearInterval(this._checkStatsInterval),this._checkStatsInterval=null)},e.prototype.handleRender=function(){this.loading&&(this.emit(RA.start),this.loading=!1),this.clearCheckLoadingTimeout(),this.playing||(this.playing=!0),this.checkHeart()},e.prototype.updateStats=function(A){A=A||{},this._startBpsTime||(this._startBpsTime=$A()),ge(A.ts)&&(this._stats.ts=A.ts),ge(A.buf)&&(this._stats.buf=A.buf),A.fps&&(this._stats.fps+=1),A.abps&&(this._stats.abps+=A.abps),A.vbps&&(this._stats.vbps+=A.vbps);var e=$A();e-this._startBpsTime<1e3||(this.emit(RA.stats,this._stats),this._stats.fps=0,this._stats.abps=0,this._stats.vbps=0,this._startBpsTime=e)},e.prototype.resetStats=function(){this._startBpsTime=null,this._stats={buf:0,fps:0,abps:0,vbps:0,ts:0}},e.prototype.enableWakeLock=function(){this._opt.keepScreenOn&&this.keepScreenOn&&this.keepScreenOn.enable()},e.prototype.releaseWakeLock=function(){this._opt.keepScreenOn&&this.keepScreenOn&&this.keepScreenOn.disable()},e.prototype.handlePlayToRenderTimes=function(){var A=this._times;A.playTimestamp=A.playStart-A.playInitStart,A.streamTimestamp=A.streamStart-A.playStart,A.streamResponseTimestamp=A.streamResponse-A.streamStart,A.demuxTimestamp=A.demuxStart-A.streamResponse,A.decodeTimestamp=A.decodeStart-A.demuxStart,A.videoTimestamp=A.videoStart-A.decodeStart,A.allTimestamp=A.videoStart-A.playInitStart,this.emit(RA.playToRenderTimes,A)},e.prototype.getOption=function(){return this._opt},e.prototype.emitError=function(A,e){void 0===e&&(e=""),Me.report(51,{event:A,value:e}),this.emit(RA.error,A,e),this.emit(A,e)},e.prototype._enableSoundOnUserInteraction=function(){var A,e,g;this.muted||(null===(A=this.audio)||void 0===A?void 0:A.isStateSuspended())&&(null===(g=(e=this.audio).audioEnabled)||void 0===g||g.call(e,!0))},e}(Ge),Je=function(A){function e(e){var g,t,i=A.call(this,e)||this;i._videoMuted=!0,i.player=e;var o=document.createElement("video"),I=document.createElement("canvas");i.$posterElement=document.createElement("img"),o.oncontextmenu=function(A){A.preventDefault()},o.crossOrigin="anonymous",i._videoMuted=!window.___enableSoundOnUserInteraction___&&i.player._opt.autoPlay||i.player._opt.muted||!i.player._opt.hasAudio,o.muted=i._videoMuted,o.disablepictureinpicture=!0,o.setAttribute("disablepictureinpicture",""),o.style.position="absolute",o.style.top="0px",o.style.left="0px",o.style.height="100%",o.style.width="100%",i._delayPlay=!1,e.$container.appendChild(o),i.videoInfo={width:"",height:"",encType:""},i.$videoElement=o,i.$canvasElement=I,i.canvasContext=I.getContext("2d"),i.fixChromeVideoFlashBug(),i.resize();var C=i.player.events.proxy;return C(i.$videoElement,"loadstart",(function(){i.player.emit("loadstart")})),C(i.$videoElement,"loadeddata",(function(){i.player.debug.log("Video","loadeddata ".concat(i._delayPlay)),i.player.emit(RA.streamSuccess)})),C(i.$videoElement,"canplay",(function(){i.player.debug.log("Video","canplay and _delayPlay is ".concat(i._delayPlay)),i._delayPlay&&i._play(),i.player.$container.contains(i.$posterElement)&&i.$posterElement&&i.player.$container.removeChild(i.$posterElement)})),C(i.$videoElement,"waiting",(function(){i.player.emit(RA.videoWaiting)})),C(i.$videoElement,"timeupdate",(function(){i.player.emit(RA.timeUpdate,i.currentTime),!i.isPlaying()&&i.init&&(i.player.debug.log("Video","timeupdate and this.isPlaying is false and retry play"),i.$videoElement.play())})),C(i.$videoElement,"enterpictureinpicture",(function(A){A.preventDefault(),document.exitPictureInPicture()})),null===(t=null===(g=i.player.debug)||void 0===g?void 0:g.log)||void 0===t||t.call(g,"Video","init"),i._enableSoundOnUserInteraction=i._enableSoundOnUserInteraction.bind(i),window.addEventListener("mouseup",i._enableSoundOnUserInteraction),window.addEventListener("click",i._enableSoundOnUserInteraction),window.addEventListener("touchstart",i._enableSoundOnUserInteraction),window.addEventListener("keydown",i._enableSoundOnUserInteraction),i}return xA(e,A),e.prototype.destroy=function(){var e;this.$canvasElement=null,this.canvasContext=null,this.$videoElement&&(this.$videoElement.pause(),this.$videoElement.currentTime=0,this.$videoElement.src="",this.$videoElement.removeAttribute("src")),this.trackGenerator&&(this.trackGenerator.stop(),this.trackGenerator=null),this.vwriter&&(this.vwriter.close(),this.vwriter=null),(null===(e=this.player.$container)||void 0===e?void 0:e.contains(this.$posterElement))&&this.$posterElement&&this.player.$container.removeChild(this.$posterElement),A.prototype.destroy.call(this),this.player.debug.log("Video","destroy")},e.prototype.fixChromeVideoFlashBug=function(){var A=function(){const A=navigator.userAgent.toLowerCase(),e={},g={IE:window.ActiveXObject||"ActiveXObject"in window,Chrome:A.indexOf("chrome")>-1&&A.indexOf("safari")>-1,Firefox:A.indexOf("firefox")>-1,Opera:A.indexOf("opera")>-1,Safari:A.indexOf("safari")>-1&&-1===A.indexOf("chrome"),Edge:A.indexOf("edge")>-1,QQBrowser:/qqbrowser/.test(A),WeixinBrowser:/MicroMessenger/i.test(A)};for(let t in g)if(g[t]){let g="";if("IE"===t)g=A.match(/(msie\s|trident.*rv:)([\w.]+)/)[2];else if("Chrome"===t){for(const A in navigator.mimeTypes)"application/360softmgrplugin"===navigator.mimeTypes[A].type&&(t="360");g=A.match(/chrome\/([\d.]+)/)[1]}else"Firefox"===t?g=A.match(/firefox\/([\d.]+)/)[1]:"Opera"===t?g=A.match(/opera\/([\d.]+)/)[1]:"Safari"===t?g=A.match(/version\/([\d.]+)/)[1]:"Edge"===t?g=A.match(/edge\/([\d.]+)/)[1]:"QQBrowser"===t&&(g=A.match(/qqbrowser\/([\d.]+)/)[1]);e.type=t,e.version=parseInt(g)}return e}().type.toLowerCase();"chrome"!==A&&"edge"!==A||(this.player.$container.style.backdropFilter="blur(0px)")},e.prototype.play=function(){if(this.$videoElement){var A=this._getVideoReadyState();if(this.player.debug.log("Video","play and readyState: ".concat(A)),0===A)return this.player.debug.warn("Video","readyState is 0 and set _delayPlay to true"),void(this._delayPlay=!0);this._play()}},e.prototype._getVideoReadyState=function(){var A=0;return this.$videoElement&&(A=this.$videoElement.readyState),A},e.prototype._play=function(){var A=this;if(this.$videoElement)var e=setTimeout((function(){A.$videoElement.play().then((function(){A._delayPlay=!1,A.player.debug.log("Video","_play success"),setTimeout((function(){A.isPlaying()||(A.player.debug.warn("Video","play failed and retry play"),A._play())}),100)})).catch((function(e){A.player.debug.error("Video","_play error",e)})).finally((function(){clearTimeout(e)}))}),20)},e.prototype.pause=function(A){var e=this;this._poster(),this.$videoElement.paused||(A?this.$videoElement&&this.$videoElement.pause():setTimeout((function(){e.$videoElement&&e.$videoElement.pause()}),100))},e.prototype.clearView=function(){},e.prototype.screenshot=function(A,e,g,t){var i,o=this;A=A||$A()+"",t=t||MA.download,e=e||"png";var I={png:"image/png",jpeg:"image/jpeg",webp:"image/webp"};"number"!=typeof g&&(g=Number(g||.92));var C=this.$videoElement,B=this.$canvasElement;B.width=C.videoWidth,B.height=C.videoHeight,null===(i=this.canvasContext)||void 0===i||i.drawImage(C,0,0,B.width,B.height);var n=B.toDataURL(I[e]||I.png,g);if(setTimeout((function(){var A;null===(A=o.canvasContext)||void 0===A||A.clearRect(0,0,B.width,B.height),B.width=0,B.height=0}),2e3),"data:,"!==n){if(t===MA.base64)return n;var Q=zA(n,A+"."+("jpeg"===e?"jpg":e));return t===MA.blob?Q:t===MA.download?(Qe(Q,A),Q):void 0}},e.prototype.initCanvasViewSize=function(){this.resize()},e.prototype._poster=function(){var A=this.screenshot("poster","png",.75,MA.base64);void 0===A||A.length<10||(this.$posterElement.src=A,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())},e.prototype.render=function(A){this.vwriter&&this.vwriter.write(A.videoFrame)},e.prototype.resize=function(){},e.prototype.isPlaying=function(){return this.$videoElement&&!this.$videoElement.paused},Object.defineProperty(e.prototype,"currentTime",{get:function(){var A;return(null===(A=this.$videoElement)||void 0===A?void 0:A.currentTime)||0},enumerable:!1,configurable:!0}),e.prototype._enableSoundOnUserInteraction=function(){!this.player._opt.autoPlay||this.player.muted||window.____enableSoundOnUserInteraction___||(this.$videoElement.muted=!1),window.____enableSoundOnUserInteraction___=!0,window.removeEventListener("mouseup",this._enableSoundOnUserInteraction),window.removeEventListener("click",this._enableSoundOnUserInteraction),window.removeEventListener("touchstart",this._enableSoundOnUserInteraction),window.removeEventListener("keydown",this._enableSoundOnUserInteraction)},e}(ie),He=function(A){function e(e,g){var t=A.call(this,e,g,Je)||this;return t._checkLoadingTimeout=null,t._opt.useMSE=!0,t.emit(RA.decoderLoaded),g.autoPlay&&t._createPlayer(g),t}return xA(e,A),e.prototype.close=function(){},e.prototype._createPlayer=function(A){var e,g=this;this._opt=Object.assign({},this._opt,A),this._removeFlvEvents(),this.player&&(this.player.unload(),this.player.detachMediaElement(),this.player.destroy(),this.player=null),this.events||(this.events=new Fe(this)),this.video||(this.video=new Je(this)),null===(e=qA.LoggingControl)||void 0===e||e.applyConfig({globalTag:"EzuikitFlv",enableVerbose:!!this._opt.debug,enableDebug:!!this._opt.debug,enableInfo:!!this._opt.debug,enableWarn:!!this._opt.debug,enableError:!0}),this.player=qA.createPlayer({type:"flv",url:A.url,isLive:A.isLive,isEzviz:A.isEzviz},{stashInitialSize:128,enableWorker:!0,autoCleanupSourceBuffer:!0,lazyLoadMaxDuration:86400,fixAudioTimestampGap:!1,referrerPolicy:A.referrerPolicy}),this.player.attachMediaElement(this.video.$videoElement),this.player.on("origin_stream",(function(A){g.emit(RA.flvStream,A)})),this._flvEvents(),A.isLive&&this.player.on(qA.Events.LOADING_COMPLETE,(function(){var A,e;null===(e=(A=g.player).updateConfig)||void 0===e||e.call(A,{liveBufferLatencyChasing:!0})}))},e.prototype._removeFlvEvents=function(){this.player&&(this.player.off(qA.Events.ERROR),this.player.off(qA.Events.LOADING_COMPLETE),this.player.off(qA.Events.RECOVERED_EARLY_EOF),this.player.off("origin_stream"),this.player.off(qA.Events.MEDIA_INFO),this.player.off(qA.Events.STATISTICS_INFO),this.player.off(qA.Events.DESTROYING))},e.prototype._flvEvents=function(){var A=this;if(this.player){var e=0;this.player.on(qA.Events.ERROR,(function(g,t,i){var o;if("MediaError"===g&&"MediaMSEError"===t&&9===i.code&&A.emit(UA.mediaSourceH265NotSupport,i),A.emit(RA.error,{errorTypes:g,errorDetails:t,info:i}),g.indexOf("NetworkError")>-1&&(A.emit(RA.streamError,{errorTypes:g,errorDetails:t,info:i,api:A._opt.url,type:"stream"}),A.player))try{A.pause().then((function(){A.emit(RA.delayTimeout)})).catch((function(){A.emit(RA.delayTimeout)}))}catch(A){}if("MediaError"===g&&"CodecUnsupported"===t&&-1===i.code&&i.msg.indexOf("Unsupported audio codec"))0===e&&(Me.report(51,{event:g,value:i}),e=1,A.debug.error("".concat(qA.Events.ERROR),g,t,JSON.stringify(i)),A.emit(RA.audioCodecUnsupported,!0));else if(null===(o=i.msg)||void 0===o?void 0:o.includes("SourceBuffer is full")){var I=A.player._msectl._sourceBuffers[0];try{var C=A.video.$videoElement.currentTime;Math.max(0,C-5)>0&&I&&!I.updating&&I.remove(0,Math.max(0,C-5))}catch(A){}Me.report(51,{event:g,value:i}),A.debug.error("".concat(qA.Events.ERROR),g,t,JSON.stringify(i))}else"NetworkError"===g&&"UnrecoverableEarlyEof"===t||(Me.report(51,{event:g,value:i}),A.debug.error("".concat(qA.Events.ERROR),g,t,JSON.stringify(i)))})),this.player.on(qA.Events.LOADING_COMPLETE,(function(e){A.debug.warn("".concat(qA.Events.LOADING_COMPLETE),JSON.stringify(e))})),this.player.on(qA.Events.RECOVERED_EARLY_EOF,(function(e){A.debug.warn("".concat(qA.Events.RECOVERED_EARLY_EOF),e)})),this.player.on("media_info",(function(e){A.clearCheckLoadingTimeout(),A.video.updateVideoInfo(XA({encTypeCode:(null==e?void 0:e.videoCodec.indexOf("avc"))>=0?7:12},e))})),this.player.on(qA.Events.STATISTICS_INFO,(function(e){e.decodedFrames===A._decodedFrames&&null===A._checkHeartTimeout?A.checkHeartTimeout():e.decodedFrames!==A._decodedFrames&&(A.clearCheckHeartTimeout(),A._decodedFrames=e.decodedFrames)})),this.player.on(qA.Events.DESTROYING,(function(e){A.debug.log("".concat(qA.Events.DESTROYING),JSON.stringify(e))})),this.on(RA.videoWaiting,(function(){A.clearCheckHeartTimeout(),null===A._checkHeartTimeout&&A.handleRender()})),this._onVideoLoadstart=this._onVideoLoadstart.bind(this),this.off("loadstart"),this.on("loadstart",this._onVideoLoadstart),this.on(RA.timeUpdate,(function(){A.clearCheckHeartTimeout()})),this._onVideoStreamSuccess=this._onVideoStreamSuccess.bind(this),this.off(RA.streamSuccess,this._onVideoStreamSuccess),this.on(RA.streamSuccess,this._onVideoStreamSuccess)}},e.prototype._onVideoLoadstart=function(){this.checkLoadingTimeout()},e.prototype._onVideoStreamSuccess=function(){this.clearCheckLoadingTimeout()},e.prototype.getOption=function(){return this._opt},e.prototype.emitError=function(A,e){void 0===e&&(e=""),this.emit(RA.error,A,e),this.emit(A,e)},e.prototype.destroy=function(){this._destroy(),this.clearCheckHeartTimeout(),this.clearCheckLoadingTimeout(),this.video&&(this.video.destroy(),this.video=null),this.events&&(this.events.destroy(),this.events=null),this.emit("destroy"),this.off(),this.debug.log("play","destroy end")},e.prototype._destroy=function(){this.player&&this.playing&&this.player.pause(),this._flvPlayerDestroy(),this._loading=!1,this._playing=!1,this._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},this.resetStats(),this._audioTimestamp=0,this._videoTimestamp=0},e.prototype.resetStats=function(){},Object.defineProperty(e.prototype,"loaded",{get:function(){return!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"playing",{get:function(){return this._playing},set:function(A){A&&(this.loading=!1),this.playing!==A&&(this._playing=A,this.emit(RA.playing,A),A?this.emit(RA.play):this.emit(RA.pause))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"muted",{get:function(){return this._muted},set:function(e){this.video&&(this.video.$videoElement.muted=e,this.player&&(this.player.muted=e)),A.prototype._updateMuted.call(this,e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"volume",{get:function(){return this._volume},set:function(e){A.prototype._updateVolume.call(this,e),this.video&&(this.video.$videoElement.volume=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"loading",{get:function(){return this._loading},set:function(A){this.loading!==A&&(this._loading=A,this.emit(RA.loading,this._loading),A||this.emit(RA.loaded))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"audioTimestamp",{get:function(){return this._audioTimestamp},set:function(A){null!==A&&(this._audioTimestamp=A)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"videoTimestamp",{get:function(){return this._videoTimestamp},set:function(A){null!==A&&(this._videoTimestamp=A)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isDebug",{get:function(){return!!this._opt.debug},enumerable:!1,configurable:!0}),e.prototype.checkLoadingTimeout=function(){var A,e=this;0!==this._opt.loadingTimeout&&(this._checkLoadingTimeout=setTimeout((function(){e.clearCheckLoadingTimeout();try{e.pause().then((function(){e.emit(RA.timeout,RA.loadingTimeout),e.emit(RA.loadingTimeout)})).catch((function(){e.emit(RA.timeout,RA.loadingTimeout),e.emit(RA.loadingTimeout)}))}catch(A){}}),1e3*((null===(A=this._opt)||void 0===A?void 0:A.loadingTimeout)||10)))},e.prototype.clearCheckLoadingTimeout=function(){this._checkLoadingTimeout&&(clearTimeout(this._checkLoadingTimeout),this._checkLoadingTimeout=null)},e.prototype.checkHeart=function(){this.clearCheckHeartTimeout(),this.checkHeartTimeout()},e.prototype.clearCheckHeartTimeout=function(){this._checkHeartTimeout&&(clearTimeout(this._checkHeartTimeout),this._checkHeartTimeout=null)},e.prototype.checkHeartTimeout=function(){var A,e,g=this;if(0!==this._opt.heartTimeout){var t=(null===(A=this.video)||void 0===A?void 0:A.currentTime)||0;this._checkHeartTimeout=setTimeout((function(){var A;if(g._checkHeartTimeout&&g.clearCheckHeartTimeout(),g.playing&&g.video){if(t!==((null===(A=g.video)||void 0===A?void 0:A.currentTime)||0))return;try{g.pause().then((function(){g.emit(RA.timeout,RA.heartTimeout),g.emit(RA.heartTimeout)})).catch((function(){g.emit(RA.timeout,RA.heartTimeout),g.emit(RA.heartTimeout)}))}catch(A){}}}),1e3*((null===(e=this._opt)||void 0===e?void 0:e.heartTimeout)||5))}},e.prototype.handleRender=function(){this.loading&&(this.emit(RA.start),this.loading=!1),this.playing||(this.playing=!0),this.checkHeart()},e.prototype.updateOption=function(e){var g;A.prototype.updateOption.call(this,e),null===(g=qA.LoggingControl)||void 0===g||g.applyConfig({globalTag:"EzuikitFlv",enableVerbose:!!e.debug,enableDebug:!!e.debug,enableInfo:!!e.debug,enableWarn:!!e.debug,enableError:!0})},e.prototype.play=function(A){return void 0===A&&(A={}),this._play(A)},e.prototype._play=function(A){var e=this;return void 0===A&&(A={}),this.player&&this._destroy(),this.clearCheckHeartTimeout(),this._createPlayer(Object.assign({},this._opt,A)),this.loading=!0,this._playing=!1,this._times.playInitStart=$A(),this.player?(this.player.load(),new Promise((function(A,g){e.player.play().then((function(){e.loading=!1,e.playing=!0,e._opt.muted||(e.muted=!1),A()})).catch((function(A){g(A)}))}))):Promise.reject()},e.prototype._flvPlayerDestroy=function(){this.player&&(this.video.pause(),this.player.unload(),this._removeFlvEvents(),this.player.detachMediaElement(),this.player.destroy(),this.player=null)},e.prototype._close=function(){var A=this;return new Promise((function(e){A._loading=!1,A._playing=!1,A._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},A.video&&A.video.resetInit(),A.clearCheckHeartTimeout(),A.clearCheckLoadingTimeout(),A.player&&(A._flvPlayerDestroy(),A._pause=!0),A.resetStats(),A._audioTimestamp=0,A._videoTimestamp=0,setTimeout((function(){e()}),110)}))},e.prototype.pause=function(){return this._close()},e.prototype.resumeAudioAfterPause=function(){},e}(Ge);let Ke=function(){return t((function A(g,t){return e(this,A),this._opt=Object.assign({},EA,t),!BA.isMobile()&&"360EE"!==CA().browser&&qA.isSupported()||(this._opt.useMSE=!1),new(A.getLoaderFactory(this._opt.useMSE))(g,this._opt)}),null,[{key:"getLoaderFactory",value:function(A){return A?He:Le}}])}();var be=function(){function A(A){void 0===A&&(A={}),this.options=A}return A.prototype.inputData=function(A){var e,g,t=new DataView(A.buffer);if("FLV"===String.fromCharCode(t.getUint8(0),t.getUint8(1),t.getUint8(2))){if(this.firstChunk=A,this.lastTagChunk=new Uint8Array(0),A.length<13)throw new Error("not FLV");var i=this._parseFLVTagEndOffset(A.slice(13).buffer,1);this.firstHeadTagChunk=A.slice(0,i+13),this.lastTagChunk=A.slice(i+13),null===(g=(e=this.options).onHasAudio)||void 0===g||g.call(e,!!(4&A[4]))}else{this.lastTagChunk=this._concatTwoUint8Arrays(this.lastTagChunk,A),(i=this._parseFLVTagEndOffset(this.lastTagChunk.buffer))>0&&(this.lastTagChunk=this.lastTagChunk.slice(i))}},A.prototype._parseFLVTagEndOffset=function(A,e){var g,t;void 0===e&&(e=0);for(var i=new DataView(A),o=0,I=0;o+11+4<=i.byteLength;){var C=i.getUint8(o),B=o+11+this._readUint24(i,o+1);if(B+4>i.byteLength)break;if(9===C&&++I===e){o=B+4;break}8===C&&(null===(t=(g=this.options).onHasAudio)||void 0===t||t.call(g,!0)),o=B+4}return o},A.prototype._concatTwoUint8Arrays=function(A,e){var g=new Uint8Array(A.length+e.length);return g.set(A,0),g.set(e,A.length),g},A.prototype._readUint24=function(A,e){return A.getUint8(e)<<16|A.getUint8(e+1)<<8|A.getUint8(e+2)},A}();function _e(A){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const g=new URL(A),t=A.split("?")[1];let i={};if(t){const A=t.split("&");for(let e of A){if(""===e)continue;const A=e.split("=");A[0]&&(i[A[0]]=A[1])}}const o={protocol:g.protocol,hostname:g.hostname,port:g.port,pathname:g.pathname,search:g.search,query:i,url:A};if(e&&/_(\d+)_(\d+)\.flv/.test(A)){const A=g.pathname.split("/")[g.pathname.split("/").length-1].replace(/.flv$/,"").split("_");A[0].indexOf("-")>=0?(o.streamName=A[0].split("-")[0],o.deviceSerial=A[0].split("-")[1]):o.deviceSerial=A[0],o.channelNo=+A[1],o.streamTypeIn=+A[2]}return o}var Te,We={exports:{}},Ve=s(Object.freeze({__proto__:null,default:{}}));var Oe=E((Te||(Te=1,function(A){!function(){var e="input is invalid type",g="object"==typeof window,t=g?window:{};t.JS_MD5_NO_WINDOW&&(g=!1);var i=!g&&"object"==typeof self,o=!t.JS_MD5_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node;o?t=a:i&&(t=self);var I,C=!t.JS_MD5_NO_COMMON_JS&&A.exports,B=!t.JS_MD5_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,n="0123456789abcdef".split(""),Q=[128,32768,8388608,-2147483648],r=[0,8,16,24],E=["hex","array","digest","buffer","arrayBuffer","base64"],s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),l=[];if(B){var c=new ArrayBuffer(68);I=new Uint8Array(c),l=new Uint32Array(c)}var h=Array.isArray;!t.JS_MD5_NO_NODE_JS&&h||(h=function(A){return"[object Array]"===Object.prototype.toString.call(A)});var d=ArrayBuffer.isView;!B||!t.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW&&d||(d=function(A){return"object"==typeof A&&A.buffer&&A.buffer.constructor===ArrayBuffer});var u=function(A){var g=typeof A;if("string"===g)return[A,!0];if("object"!==g||null===A)throw new Error(e);if(B&&A.constructor===ArrayBuffer)return[new Uint8Array(A),!1];if(!h(A)&&!d(A))throw new Error(e);return[A,!1]},D=function(A){return function(e){return new w(!0).update(e)[A]()}},p=function(A){var g,i=Ve,o=Ve.Buffer;return g=o.from&&!t.JS_MD5_NO_BUFFER_FROM?o.from:function(A){return new o(A)},function(t){if("string"==typeof t)return i.createHash("md5").update(t,"utf8").digest("hex");if(null==t)throw new Error(e);return t.constructor===ArrayBuffer&&(t=new Uint8Array(t)),h(t)||d(t)||t.constructor===o?i.createHash("md5").update(g(t)).digest("hex"):A(t)}},f=function(A){return function(e,g){return new y(e,!0).update(g)[A]()}};function w(A){if(A)l[0]=l[16]=l[1]=l[2]=l[3]=l[4]=l[5]=l[6]=l[7]=l[8]=l[9]=l[10]=l[11]=l[12]=l[13]=l[14]=l[15]=0,this.blocks=l,this.buffer8=I;else if(B){var e=new ArrayBuffer(68);this.buffer8=new Uint8Array(e),this.blocks=new Uint32Array(e)}else this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.h0=this.h1=this.h2=this.h3=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0}function y(A,e){var g,t=u(A);if(A=t[0],t[1]){var i,o=[],I=A.length,C=0;for(g=0;g<I;++g)(i=A.charCodeAt(g))<128?o[C++]=i:i<2048?(o[C++]=192|i>>>6,o[C++]=128|63&i):i<55296||i>=57344?(o[C++]=224|i>>>12,o[C++]=128|i>>>6&63,o[C++]=128|63&i):(i=65536+((1023&i)<<10|1023&A.charCodeAt(++g)),o[C++]=240|i>>>18,o[C++]=128|i>>>12&63,o[C++]=128|i>>>6&63,o[C++]=128|63&i);A=o}A.length>64&&(A=new w(!0).update(A).array());var B=[],n=[];for(g=0;g<64;++g){var Q=A[g]||0;B[g]=92^Q,n[g]=54^Q}w.call(this,e),this.update(n),this.oKeyPad=B,this.inner=!0,this.sharedMemory=e}w.prototype.update=function(A){if(this.finalized)throw new Error("finalize already called");var e=u(A);A=e[0];for(var g,t,i=e[1],o=0,I=A.length,C=this.blocks,n=this.buffer8;o<I;){if(this.hashed&&(this.hashed=!1,C[0]=C[16],C[16]=C[1]=C[2]=C[3]=C[4]=C[5]=C[6]=C[7]=C[8]=C[9]=C[10]=C[11]=C[12]=C[13]=C[14]=C[15]=0),i)if(B)for(t=this.start;o<I&&t<64;++o)(g=A.charCodeAt(o))<128?n[t++]=g:g<2048?(n[t++]=192|g>>>6,n[t++]=128|63&g):g<55296||g>=57344?(n[t++]=224|g>>>12,n[t++]=128|g>>>6&63,n[t++]=128|63&g):(g=65536+((1023&g)<<10|1023&A.charCodeAt(++o)),n[t++]=240|g>>>18,n[t++]=128|g>>>12&63,n[t++]=128|g>>>6&63,n[t++]=128|63&g);else for(t=this.start;o<I&&t<64;++o)(g=A.charCodeAt(o))<128?C[t>>>2]|=g<<r[3&t++]:g<2048?(C[t>>>2]|=(192|g>>>6)<<r[3&t++],C[t>>>2]|=(128|63&g)<<r[3&t++]):g<55296||g>=57344?(C[t>>>2]|=(224|g>>>12)<<r[3&t++],C[t>>>2]|=(128|g>>>6&63)<<r[3&t++],C[t>>>2]|=(128|63&g)<<r[3&t++]):(g=65536+((1023&g)<<10|1023&A.charCodeAt(++o)),C[t>>>2]|=(240|g>>>18)<<r[3&t++],C[t>>>2]|=(128|g>>>12&63)<<r[3&t++],C[t>>>2]|=(128|g>>>6&63)<<r[3&t++],C[t>>>2]|=(128|63&g)<<r[3&t++]);else if(B)for(t=this.start;o<I&&t<64;++o)n[t++]=A[o];else for(t=this.start;o<I&&t<64;++o)C[t>>>2]|=A[o]<<r[3&t++];this.lastByteIndex=t,this.bytes+=t-this.start,t>=64?(this.start=t-64,this.hash(),this.hashed=!0):this.start=t}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this},w.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var A=this.blocks,e=this.lastByteIndex;A[e>>>2]|=Q[3&e],e>=56&&(this.hashed||this.hash(),A[0]=A[16],A[16]=A[1]=A[2]=A[3]=A[4]=A[5]=A[6]=A[7]=A[8]=A[9]=A[10]=A[11]=A[12]=A[13]=A[14]=A[15]=0),A[14]=this.bytes<<3,A[15]=this.hBytes<<3|this.bytes>>>29,this.hash()}},w.prototype.hash=function(){var A,e,g,t,i,o,I=this.blocks;this.first?e=((e=((A=((A=I[0]-680876937)<<7|A>>>25)-271733879|0)^(g=((g=(-271733879^(t=((t=(-1732584194^2004318071&A)+I[1]-117830708)<<12|t>>>20)+A|0)&(-271733879^A))+I[2]-1126478375)<<17|g>>>15)+t|0)&(t^A))+I[3]-1316259209)<<22|e>>>10)+g|0:(A=this.h0,e=this.h1,g=this.h2,e=((e+=((A=((A+=((t=this.h3)^e&(g^t))+I[0]-680876936)<<7|A>>>25)+e|0)^(g=((g+=(e^(t=((t+=(g^A&(e^g))+I[1]-389564586)<<12|t>>>20)+A|0)&(A^e))+I[2]+606105819)<<17|g>>>15)+t|0)&(t^A))+I[3]-1044525330)<<22|e>>>10)+g|0),e=((e+=((A=((A+=(t^e&(g^t))+I[4]-176418897)<<7|A>>>25)+e|0)^(g=((g+=(e^(t=((t+=(g^A&(e^g))+I[5]+1200080426)<<12|t>>>20)+A|0)&(A^e))+I[6]-1473231341)<<17|g>>>15)+t|0)&(t^A))+I[7]-45705983)<<22|e>>>10)+g|0,e=((e+=((A=((A+=(t^e&(g^t))+I[8]+1770035416)<<7|A>>>25)+e|0)^(g=((g+=(e^(t=((t+=(g^A&(e^g))+I[9]-1958414417)<<12|t>>>20)+A|0)&(A^e))+I[10]-42063)<<17|g>>>15)+t|0)&(t^A))+I[11]-1990404162)<<22|e>>>10)+g|0,e=((e+=((A=((A+=(t^e&(g^t))+I[12]+1804603682)<<7|A>>>25)+e|0)^(g=((g+=(e^(t=((t+=(g^A&(e^g))+I[13]-40341101)<<12|t>>>20)+A|0)&(A^e))+I[14]-1502002290)<<17|g>>>15)+t|0)&(t^A))+I[15]+1236535329)<<22|e>>>10)+g|0,e=((e+=((t=((t+=(e^g&((A=((A+=(g^t&(e^g))+I[1]-165796510)<<5|A>>>27)+e|0)^e))+I[6]-1069501632)<<9|t>>>23)+A|0)^A&((g=((g+=(A^e&(t^A))+I[11]+643717713)<<14|g>>>18)+t|0)^t))+I[0]-373897302)<<20|e>>>12)+g|0,e=((e+=((t=((t+=(e^g&((A=((A+=(g^t&(e^g))+I[5]-701558691)<<5|A>>>27)+e|0)^e))+I[10]+38016083)<<9|t>>>23)+A|0)^A&((g=((g+=(A^e&(t^A))+I[15]-660478335)<<14|g>>>18)+t|0)^t))+I[4]-405537848)<<20|e>>>12)+g|0,e=((e+=((t=((t+=(e^g&((A=((A+=(g^t&(e^g))+I[9]+568446438)<<5|A>>>27)+e|0)^e))+I[14]-1019803690)<<9|t>>>23)+A|0)^A&((g=((g+=(A^e&(t^A))+I[3]-187363961)<<14|g>>>18)+t|0)^t))+I[8]+1163531501)<<20|e>>>12)+g|0,e=((e+=((t=((t+=(e^g&((A=((A+=(g^t&(e^g))+I[13]-1444681467)<<5|A>>>27)+e|0)^e))+I[2]-51403784)<<9|t>>>23)+A|0)^A&((g=((g+=(A^e&(t^A))+I[7]+1735328473)<<14|g>>>18)+t|0)^t))+I[12]-1926607734)<<20|e>>>12)+g|0,e=((e+=((o=(t=((t+=((i=e^g)^(A=((A+=(i^t)+I[5]-378558)<<4|A>>>28)+e|0))+I[8]-2022574463)<<11|t>>>21)+A|0)^A)^(g=((g+=(o^e)+I[11]+1839030562)<<16|g>>>16)+t|0))+I[14]-35309556)<<23|e>>>9)+g|0,e=((e+=((o=(t=((t+=((i=e^g)^(A=((A+=(i^t)+I[1]-1530992060)<<4|A>>>28)+e|0))+I[4]+1272893353)<<11|t>>>21)+A|0)^A)^(g=((g+=(o^e)+I[7]-155497632)<<16|g>>>16)+t|0))+I[10]-1094730640)<<23|e>>>9)+g|0,e=((e+=((o=(t=((t+=((i=e^g)^(A=((A+=(i^t)+I[13]+681279174)<<4|A>>>28)+e|0))+I[0]-358537222)<<11|t>>>21)+A|0)^A)^(g=((g+=(o^e)+I[3]-722521979)<<16|g>>>16)+t|0))+I[6]+76029189)<<23|e>>>9)+g|0,e=((e+=((o=(t=((t+=((i=e^g)^(A=((A+=(i^t)+I[9]-640364487)<<4|A>>>28)+e|0))+I[12]-421815835)<<11|t>>>21)+A|0)^A)^(g=((g+=(o^e)+I[15]+530742520)<<16|g>>>16)+t|0))+I[2]-995338651)<<23|e>>>9)+g|0,e=((e+=((t=((t+=(e^((A=((A+=(g^(e|~t))+I[0]-198630844)<<6|A>>>26)+e|0)|~g))+I[7]+1126891415)<<10|t>>>22)+A|0)^((g=((g+=(A^(t|~e))+I[14]-1416354905)<<15|g>>>17)+t|0)|~A))+I[5]-57434055)<<21|e>>>11)+g|0,e=((e+=((t=((t+=(e^((A=((A+=(g^(e|~t))+I[12]+1700485571)<<6|A>>>26)+e|0)|~g))+I[3]-1894986606)<<10|t>>>22)+A|0)^((g=((g+=(A^(t|~e))+I[10]-1051523)<<15|g>>>17)+t|0)|~A))+I[1]-2054922799)<<21|e>>>11)+g|0,e=((e+=((t=((t+=(e^((A=((A+=(g^(e|~t))+I[8]+1873313359)<<6|A>>>26)+e|0)|~g))+I[15]-30611744)<<10|t>>>22)+A|0)^((g=((g+=(A^(t|~e))+I[6]-1560198380)<<15|g>>>17)+t|0)|~A))+I[13]+1309151649)<<21|e>>>11)+g|0,e=((e+=((t=((t+=(e^((A=((A+=(g^(e|~t))+I[4]-145523070)<<6|A>>>26)+e|0)|~g))+I[11]-1120210379)<<10|t>>>22)+A|0)^((g=((g+=(A^(t|~e))+I[2]+718787259)<<15|g>>>17)+t|0)|~A))+I[9]-343485551)<<21|e>>>11)+g|0,this.first?(this.h0=A+1732584193|0,this.h1=e-271733879|0,this.h2=g-1732584194|0,this.h3=t+271733878|0,this.first=!1):(this.h0=this.h0+A|0,this.h1=this.h1+e|0,this.h2=this.h2+g|0,this.h3=this.h3+t|0)},w.prototype.hex=function(){this.finalize();var A=this.h0,e=this.h1,g=this.h2,t=this.h3;return n[A>>>4&15]+n[15&A]+n[A>>>12&15]+n[A>>>8&15]+n[A>>>20&15]+n[A>>>16&15]+n[A>>>28&15]+n[A>>>24&15]+n[e>>>4&15]+n[15&e]+n[e>>>12&15]+n[e>>>8&15]+n[e>>>20&15]+n[e>>>16&15]+n[e>>>28&15]+n[e>>>24&15]+n[g>>>4&15]+n[15&g]+n[g>>>12&15]+n[g>>>8&15]+n[g>>>20&15]+n[g>>>16&15]+n[g>>>28&15]+n[g>>>24&15]+n[t>>>4&15]+n[15&t]+n[t>>>12&15]+n[t>>>8&15]+n[t>>>20&15]+n[t>>>16&15]+n[t>>>28&15]+n[t>>>24&15]},w.prototype.toString=w.prototype.hex,w.prototype.digest=function(){this.finalize();var A=this.h0,e=this.h1,g=this.h2,t=this.h3;return[255&A,A>>>8&255,A>>>16&255,A>>>24&255,255&e,e>>>8&255,e>>>16&255,e>>>24&255,255&g,g>>>8&255,g>>>16&255,g>>>24&255,255&t,t>>>8&255,t>>>16&255,t>>>24&255]},w.prototype.array=w.prototype.digest,w.prototype.arrayBuffer=function(){this.finalize();var A=new ArrayBuffer(16),e=new Uint32Array(A);return e[0]=this.h0,e[1]=this.h1,e[2]=this.h2,e[3]=this.h3,A},w.prototype.buffer=w.prototype.arrayBuffer,w.prototype.base64=function(){for(var A,e,g,t="",i=this.array(),o=0;o<15;)A=i[o++],e=i[o++],g=i[o++],t+=s[A>>>2]+s[63&(A<<4|e>>>4)]+s[63&(e<<2|g>>>6)]+s[63&g];return A=i[o],t+=s[A>>>2]+s[A<<4&63]+"=="},y.prototype=new w,y.prototype.finalize=function(){if(w.prototype.finalize.call(this),this.inner){this.inner=!1;var A=this.array();w.call(this,this.sharedMemory),this.update(this.oKeyPad),this.update(A),w.prototype.finalize.call(this)}};var m=function(){var A=D("hex");o&&(A=p(A)),A.create=function(){return new w},A.update=function(e){return A.create().update(e)};for(var e=0;e<E.length;++e){var g=E[e];A[g]=D(g)}return A}();m.md5=m,m.md5.hmac=function(){var A=f("hex");A.create=function(A){return new y(A)},A.update=function(e,g){return A.create(e).update(g)};for(var e=0;e<E.length;++e){var g=E[e];A[g]=f(g)}return A}(),C?A.exports=m:t.md5=m}()}(We)),We.exports));const qe="/api/v3/device/local/video/unify/query",Ze="/api/service/device/capacity/video/quality",xe="/api/v3/device/setVideoLevel",Xe="/api/lapp/v2/live/address/get",je="/api/service/media/live/cdn/config",Pe="/api/service/media/live/record/cdn/config",ze="/api/service/media/streammanage/interrupt/info";function $e(A){return A<10?"0"+A:A+""}const Ag={0:"流畅",1:"标清",2:"高清",3:"超清",4:"极清",5:"3K",6:"4K"},eg=[{videoLevel:1,name:Ag[1],streamTypeIn:2,type:"compatible"},{videoLevel:2,name:Ag[2],streamTypeIn:1,type:"compatible"}];let gg=function(){return t((function A(g,t){e(this,A),this._player=g,this.baseURL=(t.baseURL||"https://open.ys7.com").replace(/\/$/,""),this.accessToken=t.accessToken,this.deviceSerial=t.deviceSerial,this.channelNo=t.channelNo,this.appName=t.appName,this.v=t.v}),[{key:"fetch",value:function(A){function e(e){return A.apply(this,arguments)}return e.toString=function(){return A.toString()},e}((function(A){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const g=/http[s]?:\/\//.test(A)?A:`${this.baseURL}${A}`,t=e.headers;return delete e.headers,fetch(g,{...e||{},...null===t?{}:{headers:{clientType:"ezuikit-flv",accessToken:this.accessToken,deviceSerial:this.deviceSerial,localIndex:this.channelNo,...t||{}}}})}))},{key:"get",value:function(A){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.fetch(A,{...e||{},method:"get"})}},{key:"post",value:function(A){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.fetch(A,{...e||{},method:"post"})}},{key:"setVideoLevelService",value:function(A){const e=new FormData;return e.append("videoLevel",parseInt(A)),this.post(`${xe}`,{body:e}).then((A=>A.json())).catch((A=>{var e,g;null===(e=(g=this._player).emit)||void 0===e||e.call(g,UA.fetchError,{api:xe,error:A})}))}},{key:"getLocalVideoUnifyQueryService",value:async function(A){var e,g,t,i;const o=(A.startTime+36e5*((null===(e=this._player._opt)||void 0===e?void 0:e.timeZone)||0))/1e3,I=(A.endTime+36e5*((null===(g=this._player._opt)||void 0===g?void 0:g.timeZone)||0))/1e3,C=async A=>{let e=[];try{var g,t,i;const n=await this.get(`${qe}?startTime=${A.startTime}&endTime=${A.endTime}&pageSize=${A.pageSize||200}`).then((A=>A.json())).catch((A=>{var e,g;null===(e=(g=this._player).emit)||void 0===e||e.call(g,UA.fetchError,{api:qe,error:A})}));var o,I,B;if(200!==(null==n||null===(g=n.meta)||void 0===g?void 0:g.code))return null===(o=(I=this._player).emit)||void 0===o||o.call(I,UA.fetchError,{api:qe,error:null==n?void 0:n.meta}),e;if(null!=n&&null!==(t=n.data)&&void 0!==t&&null!==(t=t.records)&&void 0!==t&&t.length&&(e=e.concat(n.data.records||[])),null!=n&&null!==(i=n.data)&&void 0!==i&&i.hasMore)e=e.concat(await C({...A,startTime:null==n||null===(B=n.data)||void 0===B?void 0:B.nextFileTime}))}catch(A){}return e},B=await C({...A,startTime:o,endTime:I})||[];return this._player.playbackRecords=(B||[]).map((A=>{var e,g;return{...A,startTime:A.startTime-3600*((null===(e=this._player._opt)||void 0===e?void 0:e.timeZone)||0),endTime:A.endTime-3600*((null===(g=this._player._opt)||void 0===g?void 0:g.timeZone)||0)}})).reduce(((A,e)=>{const g=A[A.length-1];return g&&g.endTime===e.startTime?g.endTime=e.endTime:A.push(e),A}),[]),null===(t=(i=this._player).emit)||void 0===t||t.call(i,RA.localVideoRecords,this._player.playbackRecords),B}},{key:"getVideoQualityService",value:async function(){let A=eg;try{var e,g;const o=await this.get(`${Ze}?deviceSerial=${this.deviceSerial}`).then((A=>A.json())).catch((A=>{this._player.emit(UA.fetchError,{api:Ze,error:A})}));var t,i;if(200!==(null==o||null===(e=o.meta)||void 0===e?void 0:e.code))return null===(t=(i=this._player).emit)||void 0===t||t.call(i,UA.fetchError,{api:Ze,error:null==o?void 0:o.meta}),A;null!=o&&null!==(g=o.data)&&void 0!==g&&g.length&&(A=o.data)}catch(A){}return A=A.map((A=>({...A,name:Ag[A.videoLevel]||"未知"}))),A}},{key:"getPlayAddressService",value:function(){let A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e=new FormData;return Object.keys(A).forEach((g=>{e.append(g,A[g])})),e.append("protocol",4),e.append("accessToken",this.accessToken),e.append("deviceSerial",this.deviceSerial),e.append("channelNo",this.channelNo),this.post(`${Xe}`,{body:e}).then((A=>A.json())).then((A=>{var e;return 200==+A.code?null==A||null===(e=A.data)||void 0===e?void 0:e.url:""}))}},{key:"getRecordAddressService",value:function(){let A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.appName&&this.v?(delete A.expireTime,this.getCDNRecordAddressService(A)):this.getPlayAddressService({...A,type:2})}},{key:"getLiveAddressService",value:function(){let A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.appName&&this.v?(delete A.expireTime,this.getCDNLiveAddressService(A)):this.getPlayAddressService({...A,type:1})}},{key:"getCDNPlayAddressService",value:function(A){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const g=new FormData,t=new Date,i=`${t.getFullYear()}-${$e(t.getMonth()+1)}-${$e(t.getDate())} 00:00:00`,o=`${t.getFullYear()}-${$e(t.getMonth()+1)}-${$e(t.getDate())} 23:59:59`;return g.append("startTime",i),g.append("endTime",o),g.append("playProtocol",2),g.append("streamName",Oe((function(A,e){var g,t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),i=[];for(e=e||t.length,g=0;g<A;g++)i[g]=t[0|Math.random()*e];return i.join("")}(32)+"_"+(new Date).getTime()).replace(/-/gi,"")+"_"+this.deviceSerial+"_"+this.channelNo+"_"+e.quality)),g.append("supportH265",1),g.append("appName",this.appName),Object.keys(e).forEach((A=>{g.append(A,e[A])})),this.post(A,{body:g}).then((A=>A.json())).then((A=>{var e,g;return 200==+(null===(e=A.meta)||void 0===e?void 0:e.code)?null===(g=A.data)||void 0===g?void 0:g.cdnUrl:""}))}},{key:"getCDNLiveAddressService",value:async function(A){return this.getCDNPlayAddressService(`${je}`,A)}},{key:"getCDNRecordAddressService",value:async function(A){return this.getCDNPlayAddressService(`${Pe}`,{recordStartTime:A.startTime,recordEndTime:A.stopTime,quality:A.quality,type:A.type||1})}},{key:"getStreamInterreputInfo",value:async function(A){const e=new FormData;return e.append("streamId",A),this.post(ze,{body:e,headers:null}).then((A=>A.json()))}}])}();function tg(A){return new Date(ig(A,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/"))}function ig(A){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/";return`${(A=A.replace(/\//gi,"").replace(/-/gi,"").replace(/:/gi,"").replace(/ /gi,"")).substring(0,4)}${e}${A.substring(4,6)}${e}${A.substring(6,8)} ${A.substring(8,10)}:${A.substring(10,12)}:${A.substring(12,14)}`}function og(A){let e=null;if(e="string"==typeof A?document.querySelector("#"+A.replace(/^#/,"")):A,!e)throw new Error("Flv required node can be a string (dom id) or dom (HTMLElement node)");if("CANVAS"===e.nodeName||"VIDEO"===e.nodeName)throw new Error(`Flv container type can not be ${e.nodeName} type`);return e}var Ig={95e3:"服务端内部处理异常",95400:"私有化协议vtm检测私有化协议中码流类型小于0或者设备序列号为空等非法参数场景返回(app不重试取流)",95402:"回放找不到录像文件",95403:"操作码或信令密钥与设备不匹配",95404:"设备不在线\t检查设备网络",95405:"流媒体向设备发送或接受信令超时/cas响应超时",95406:"token失效",95407:"客户端的URL格式错误",95409:"预览开启隐私保护",95411:"token无权限",95412:"session不存在",95413:"token验证失败\t刷新重试",95415:"设备通道错",95416:"设备资源受限\t刷新重试",95417:"设备4G流量耗尽",95451:"设备不支持的码流类型",95452:"设备链接流媒体服务器失败",95454:"流媒体中关于设备取流会话不存在",95455:"设备通道未关联",95456:"设备通道关联设备不在线",95457:"客户端不支持端到端加密",95458:"设备不支持当前并发ECDH密",95459:"VTDU 处理ECDH 加密失败",95460:"手表正在拍照或录像",95461:"手表正在视频聊天",95462:"手表正在识图",95463:"手表正在QQ视频",95464:"手表正在坐姿检测",95465:"手表温度过高",95466:"设备视频通话中,不支持预览",95492:"设备不支持的命令",95500:"服务器处理失败",95503:"vtm返回分配vtdu失败, 请稍后重试",95504:"服务器负载达到上限,请稍后重试",95505:"vtm ecdh解密失败",95506:"vtm 返回IPC不支持取流(需要IPC添加NVR后支持)",95507:"不支持该4G卡套餐在非萤石App取流",95544:"设备返回无视频源",95545:"视频分享时间已经结束",95546:"取流并发路数限制",95547:"开放平台用户并发限制",95556:"ticket校验失败",95557:"回放服务器等待流头超时, 刷新重试,检测设备网络,重启设备",95558:"查找录像开始时间错误",95560:"群组分享取流二次验证失败",95561:"分享群组用户被锁住",95562:"群组分享用户权限变更",95563:"认证服务连接失败",95564:"认证超时",95565:"缓存无效",95566:"不在分享时间内预览",95567:"分享通道被锁定",95568:"未找到认证类型",95569:"认证返回的参数异常",95600:"分享设备不在分享时间内",95601:"群组分享用户没权限",95602:"群组分享权限变更",95530:"机房故障不可用, 刷新重试",95610:"接收流头失败",95620:"心跳超时",95701:"cas信令返回格式错误",95702:"SPGW请求Cas、Status透传超时,刷新重试",95703:"SPGW请求http不通,刷新重试",96001:"客户端参数出错",96002:"等待客户端侧心跳超时(20秒无心跳包)",96099:"客户端默认错误",96101:"不支持的命令",96102:"设备流头发送失败, 刷新重试",96103:"cas/设备返回错误1, 刷新重试",96104:"cas/设备返回错误-1, 刷新重试",96105:"设备返回错误码3, 刷新重试",96106:"设备返回错误码4, 刷新重试",96107:"设备返回错误码5, 刷新重试",96108:"cas信令回应重复, 刷新重试",96109:"视频广场取消分享",96110:"设备信令默认错误\t设备错返回的错误码,不具体\t刷新重试,或者重启设备",96501:"设备数据链路和实际链路不匹配, 刷新重试",96502:"设备数据链路重复建立连接, 刷新重试",96503:"设备数据链路端口不匹配, 刷新重试",96504:"缓存设备数据链路失败, 刷新重试",96505:"设备发送确认头消息重复, 刷新重试",96506:"设备数据先于确定头部到达, 刷新重试",96508:"设备数据头部长度非法, 刷新重试,或者重启设备",96509:"索引找不到设备数据管理块, 刷新重试",96510:"设备数据链路vtdu内存块协议状态不匹配",96511:"设备数据头部没有streamkey错误",96512:"设备数据头部非法",96513:"设备数据长度过小",96514:"设备老协议推流头部没有streamkey错误",96515:"设备老协议推流数据非法",96516:"设备老协议索引找不到内存管理块",96517:"设备老协议推流数据非法",96518:"设备数据包过大, 刷新重试,或者重启设备",96519:"设备推流链路网络不稳定, 设备长时间未推流超时",96520:"设备推流链路网络不稳定, 设备网络异常",90601:"流ID不存在",90602:"流被禁用",90603:"不在可用时间区间",90604:"用户设备关系验证失败",90605:"通道被隐藏",90606:"4G无限流量卡",4050:"服务内部调用向vtdu取流的接口失败",4054:"服务内部生成ticket失败",4056:"vtm服务信息为空",4057:"取流url非法(可能是格式、参数错误)",4058:"取流url过期(不在可用时间)",9048:"并发限制",9049:"带宽限制",9053:"不支持H265",9057:"设备码流加密",9060:"设备取流校验不通过",9061:"auth认证不通过",9062:"auth认证网络有问题",httpFetchStreamError:"取流失败,请检查网络"},Cg={95e3:"Internal server processing error",95400:"Private protocol VTM detection failed: Invalid parameters (stream type < 0 or empty device serial number), (App should not retry streaming)",95402:"Playback failed: Recording file not found",95403:"Operation code/signaling key mismatch with the device",95404:"Device offline, Check device network",95405:"Stream server timeout when sending/receiving device signaling or CAS response timeout, Check device network or restart device",95406:"Token expired, Refresh token or restart device",95407:"Invalid client URL format",95409:"Privacy protection enabled during preview",95411:"Token lacks permissions/user unauthorized",95412:"Session does not exist",95413:"Token verification failed, Refresh token",95415:"Invalid device channel",95416:"Device resource limit reached, Retry later",95417:"Device 4G data quota exhausted",95451:"Unsupported stream type by device",95452:"Device failed to connect to stream server",95454:"Streaming session not found in stream server",95455:"Device channel not associated",95456:"Associated device channel offline",95457:"Client does not support end-to-end encryption",95458:"Device does not support current concurrent ECDH encryption",95459:"VTDU failed to process ECDH encryption",95460:"Watch is capturing photos/video",95461:"Watch is in video chat",95462:"Watch is performing image recognition",95463:"Watch is in QQ video call",95464:"Watch is performing posture detection",95465:"Watch temperature too high",95466:"Device in video call; preview not supported",95492:"Unsupported command by device",95500:"Server processing failure",95503:"VTM failed to allocate VTDU, Retry later (VTDU service issue)",95504:"Server overloaded, Retry later",95505:"VTM ECDH decryption failed",95506:"IPC streaming not supported (requires NVR binding)",95507:"4G plan does not support non-EZVIZ app streaming",95544:"No video source from device",95545:"Video sharing period ended",95546:"Stream concurrency limit reached",95547:"Open platform user concurrency limit exceeded",95556:"Ticket validation failed",95557:"Playback server timeout waiting for stream header, Retry later or check device network.",95558:"Invalid playback start time",95560:"Group sharing stream secondary validation failed",95561:"Group shared user locked",95562:"Group sharing permissions modified",95563:"Authentication service connection failed",95564:"Authentication timeout",95565:"Invalid cache",95566:"Preview outside sharing period",95567:"Shared channel locked",95568:"Authentication type not found",95569:"Invalid authentication parameters",95600:"Shared device not in sharing period",95601:"Group user lacks permissions",95602:"Group sharing permissions modified",95530:"Data center outage, Retry later",95610:"Failed to receive stream header",95620:"Heartbeat timeout",95701:"CAS signaling format error",95702:"SPGW request to CAS/Status timeout, Retry later",95703:"SPGW HTTP request failed, Retry later",96001:"Client parameter error",96002:"Client heartbeat timeout (20s no packet)",96099:"Default client error",96101:"Unsupported command",96102:"Device stream header delivery failed, Retry later",96103:"CAS/device returned error code 1, Retry later",96104:"CAS/device returned error code -1, Retry later",96105:"Device returned error code 3, Retry later",96106:"Device returned error code 4, Retry later",96107:"Device returned error code 5, Retry later",96108:"Duplicate CAS signaling response, Retry later",96109:"Video sharing canceled by platform",96110:"Default device signaling error, Retry or restart device",96501:"Device data path mismatch, Retry later",96502:"Duplicate device data path connection, Retry later",96503:"Device data port mismatch, Retry later",96504:"Failed to cache device data path (insufficient memory), Retry later",96505:"Duplicate device acknowledgment header, Retry later",96506:"Device data arrived before header confirmation, Retry later",96508:"Invalid device data header length, Retry or restart device",96509:"Data management block not found, Retry later",96510:"VTDU protocol state mismatch for device data path",96511:"Missing stream key in device data header",96512:"Invalid device data header",96513:"Device data length too small",96514:"Legacy protocol: Missing stream key in push header",96515:"Invalid legacy protocol push data",96516:"Legacy protocol: Data management block not found",96517:"Invalid legacy protocol push data",96518:"Device data packet too large, Retry or restart device",96519:"Unstable device push stream (timeout due to inactivity)",96520:"Unstable device push stream (network issue)",90601:"Stream ID does not exist",90602:"Stream is disabled",90603:"Not within the available time range",90604:"User-device relationship verification failed",90605:"Channel is hidden",90606:"4G unlimited data plan",4050:"Internal service call to VTDU for stream retrieval failed",4054:"Internal service failed to generate ticket",4056:"VTM service information is empty",4057:"Stream retrieval URL is invalid (possibly due to format or parameter error)",4058:"Stream retrieval URL has expired (not within valid time range)",9048:"Concurrency limit exceeded",9049:"Bandwidth limit exceeded",9053:"H265 encoding not supported",9057:"Device stream is encrypted",9060:"Device stream retrieval validation failed",9061:"Auth authentication failed",9062:"Auth authentication network issue",httpFetchStreamError:"Stream retrieval failed, please check the network"};function Bg(A,e){const g=["h264","h265"];return e||/_(\d+)_(\d+)\.flv\?/.test(A)?BA.addVc(A,g):A}const ng=[.5,1,2,4,8];let Qg=function(g){function o(g){var t,I,C,B,n,Q;e(this,o),i(Q=A(this,o,[{...tA.all([EA,g],{clone:!1}),volumeOptions:{muted:null!==(t=g.muted)&&void 0!==t?t:EA.muted,volume:null!==(I=g.volume)&&void 0!==I?I:EA.volume,...g.volumeOptions||{}},scaleMode:[0,1,2].includes(g.scaleMode)?g.scaleMode:EA.scaleMode,container:og(g.id||g.container),type:"flv"}]),"urlInfo",{}),i(Q,"_record",null),i(Q,"services",null),i(Q,"destoryed",!1),i(Q,"_loadingTimeoutDelayTimer",null),i(Q,"_heartTimeoutDelayTimer",null),i(Q,"_flvRecordFlag",!1),null===(C=Q.i18n)||void 0===C||null===(B=C.appendTranslations)||void 0===B||B.call(C,{zh:Ig,en:Cg}),Q._record=new gA.Record({downloadRecord:Q.options.downloadRecord}),Q._flvParseChunk=new be({onHasAudio:A=>{}}),Me.initMonitor(g.ignoreMonitor||g.disableColect);const r=Object.assign({},{isLive:!0,timeZone:0},EA,g),a=og(g.id||g.container);if(!g.url)throw new Error("Flv url is empty");var E;return Me.url=g.url,Me.report(1,{name:"constructor"}),a.classList.add("ezui-player-container","ezui-flv-container"),delete r.container,r.forceNoOffscreen=!0,ge(r.videoBuffer)&&(r.videoBuffer=1e3*Number(r.videoBuffer)),Q._opt=r,Q.urlInfo=_e(r.url,Q._opt.isEzviz),Q.$container=a,Q._heartTimeoutDelayTimes=0,Q._loadingTimeoutReplayTimes=0,Q.events=new Fe(Q),Q._initPlayer(a,r),Q._videoInfo={},Q._audioInfo={},Q._currentPlayDate=null,Q.definitionList=[],Q.definition={},Q._playbackRate=1,Q.playbackRateList=ng,Q.playbackRecords=[],Q.services=new gg(Q,{baseURL:(null===(n=Q._opt.env)||void 0===n?void 0:n.domain)||VA,accessToken:Q._opt.accessToken,deviceSerial:Q.urlInfo.deviceSerial,channelNo:Q.urlInfo.channelNo}),Q._httpServices(),(E=Q).on(RA.volumechange,((A,e)=>{var g,t;(null===(g=E.player)||void 0===g?void 0:g.volume)!==A&&(E.player.volume=A),(null===(t=E.player)||void 0===t?void 0:t.muted)!==e&&(E.player.muted=e)})),E.on(RA.control.play,(A=>{A?E.play():E.pause()})),E.on(RA.fullscreenChange,(A=>{E.player.emit(RA.fullscreenChange,A)})),E.on(RA.orientationChange,(A=>{E.player.emit(RA.orientationChange,A)})),E.on(RA.videoInfo,(A=>{})),E.on(RA.audioInfo,(A=>{})),E.on(RA.control.recordingChange,(A=>{A?E.startRecord():E.stopRecord()})),function(A){var e,g;null===(e=A.player)||void 0===e||e.on(RA.volumechange,((e,g)=>{A.volume!==e&&(A.volume=e),A.muted!==g&&(A.muted=g)})),null===(g=A.player)||void 0===g||g.on(RA.audioCodecUnsupported,(e=>{A.emit(RA.audioCodecUnsupported,e)}))}(Q),Q.options.useMSE&&(Q._onvisibilitychange=Q._onvisibilitychange.bind(Q),document.addEventListener("visibilitychange",Q._onvisibilitychange)),Q}return C(o,g),t(o,[{key:"_httpServices",value:function(){try{var A,e,g;if(this._opt.isEzviz&&null!==(A=this._opt)&&void 0!==A&&A.accessToken&&this.urlInfo.deviceSerial&&this.urlInfo.channelNo>=0&&this.urlInfo.streamTypeIn)if(this.services=new gg(this,{baseURL:((null===(e=this._opt.env)||void 0===e?void 0:e.domain)||VA).replace(/\/$/,""),accessToken:this._opt.accessToken,deviceSerial:this.urlInfo.deviceSerial,channelNo:this.urlInfo.channelNo,appName:this._opt.appName,v:null===(g=this.urlInfo.query)||void 0===g?void 0:g.v}),this._isEzvizPlayback(this._opt.url)&&!this._opt.isLive){var t,i,o,I;this._playbackRate=+((null===(t=this.urlInfo)||void 0===t||null===(t=t.query)||void 0===t?void 0:t.playbackSpeed)||1),null===(i=this.services)||void 0===i||i.getLocalVideoUnifyQueryService({startTime:tg(null===(o=this.urlInfo)||void 0===o||null===(o=o.query)||void 0===o?void 0:o.begin).getTime(),endTime:tg(null===(I=this.urlInfo)||void 0===I||null===(I=I.query)||void 0===I?void 0:I.end).getTime()});let A=null,e=0;this.on(RA.timeUpdate,(g=>{const t=this.playbackRecords.length;if(t>0){var i,o;const n=tg(this.urlInfo.query.begin).getTime()/1e3;let Q=null===(i=this.playbackRecords[e])||void 0===i?void 0:i.startTime,r=null===(o=this.playbackRecords[e])||void 0===o?void 0:o.endTime;if(n<=this.playbackRecords[0].startTime)e=0;else{if(n>=this.playbackRecords[this.playbackRecords.length-1].endTime)return;for(let A=0;A<t;A++){const g=this.playbackRecords[A];if(n>=g.startTime&&n<=g.endTime){var I;e=A,Q=n,r=null===(I=this.playbackRecords[e])||void 0===I?void 0:I.endTime;break}{const t=this.playbackRecords[A+1];if(n>=g.endTime&&n<=t.startTime){var C,B;e=A+1,Q=null===(C=this.playbackRecords[e])||void 0===C?void 0:C.startTime,r=null===(B=this.playbackRecords[e])||void 0===B?void 0:B.endTime;break}}}}let a=parseInt(Q+g,10);if(0===g)return;this.emit(RA.timeUpdateOSD,{currentTime:g,currentFragmentPlayEnd:Q+g>=r,currentSliceIndex:e,osd:a}),a+3>=this.playbackRecords[t-1].endTime&&(A&&clearTimeout(A),A=setTimeout((()=>{this.emit(RA.end),clearTimeout(A),this.pause()}),3e3)),Q+g>=r&&e<t-1&&e++;const E=new Date(1e3*a);this._currentPlayDate=`${E.getFullYear()}${$e(E.getMonth()+1)}${$e(E.getDate())}${$e(E.getHours())}${$e(E.getMinutes())}${$e(E.getSeconds())}`}}))}else if(!this._isEzvizPlayback(this._opt.url)&&this._opt.isLive){var C,B,n,Q;const A=null!==(C=this.urlInfo)&&void 0!==C&&null!==(C=C.query)&&void 0!==C&&C.expire?parseInt((1e3*this.urlInfo.query.expire-(new Date).getTime())/1e3):void 0;Promise.all([null===(B=this.services)||void 0===B?void 0:B.getVideoQualityService(),null===(n=this.services)||void 0===n?void 0:n.getLiveAddressService({quality:"1"==(null===(Q=this.urlInfo)||void 0===Q?void 0:Q.streamTypeIn)?2:1,expireTime:A})]).then((A=>{let e=[this.urlInfo.url,A[1]].sort(((A,e)=>{const g=A=>{const e=A.match(/_(\d+)\.flv/);return e?parseInt(e[1],10):0};return g(A)-g(e)}));const g=A[0].map(((A,g)=>({...A,url:1===A.streamTypeIn?e[0]:e[1]})));this.definitionList=g,this.emit(RA.getDefinitionListResult,g),this.emit(RA.definitionListChange,g)}))}}catch(A){var r,a;null===(r=this.player)||void 0===r||null===(r=r.debug)||void 0===r||null===(a=r.error)||void 0===a||a.call(r,A)}}},{key:"setDefinitionList",value:function(A){this.player&&(this.definitionList=A,this.emit(RA.definitionListChange,A))}},{key:"switchDefinition",value:function(A){if(this.player){if(A.videoLevel>=0&&[1,2].includes(A.streamTypeIn)){const i=this.definitionList.find((e=>e.videoLevel===A.videoLevel));if(i){if(this.emit(RA.definitionChange,i),this.definition=i,i.url){var e;if("compatible"!==i.type)null===(e=this.services)||void 0===e||e.setVideoLevelService(i.videoLevel);return this.playing?this.pause().then((()=>{this.play({url:i.url})})):this.play({url:i.url}),Promise.resolve(0)}var g;return null===(g=this.player.debug)||void 0===g||g.warn("play url is not found"),Promise.resolve(1)}var t;return null===(t=this.player.debug)||void 0===t||t.warn("definition is not found"),Promise.resolve(1)}var i;return null===(i=this.player.debug)||void 0===i||i.warn(`not support ${null==A?void 0:A.videoLevel}`),Promise.resolve(1)}}},{key:"setPlaybackRateList",value:function(A){this.player&&(this.playbackRateList=A,this.emit(RA.playbackRateListChange,A))}},{key:"playbackRate",get:function(){return this._playbackRate},set:function(A){this.switchPlaybackRate(A)}},{key:"switchPlaybackRate",value:function(A){var e,g,t;return this.player&&this._isEzvizPlayback(this._opt.url)?(A=+A,null!==(e=this.playbackRateList)&&void 0!==e&&e.includes(A)?this._getNewRecordPlayUrl({playbackRate:A}).then((e=>e?(this._playbackRate=A,this.emit(RA.playbackRateChange,A),this.playing?this.pause().then((A=>{this.play({url:e})})):this.play({url:e}),0):1)):(null===(g=this.player)||void 0===g||null===(g=g.debug)||void 0===g||g.warn(`not support ${A}`),Promise.resolve(1))):(null===(t=this.player)||void 0===t||null===(t=t.debug)||void 0===t||t.warn(`not support ${A}`),Promise.resolve(1))}},{key:"_getNewRecordPlayUrl",value:function(){let A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.player&&this._isEzvizPlayback(this._opt.url)){var e,g,t,i;const o=tg(this._currentPlayDate||(null===(e=this.urlInfo)||void 0===e||null===(e=e.query)||void 0===e?void 0:e.begin)),I=tg(null===(g=this.urlInfo)||void 0===g||null===(g=g.query)||void 0===g?void 0:g.end);return null===(t=this.services)||void 0===t?void 0:t.getRecordAddressService({expireTime:parseInt((new Date(1e3*(null===(i=this.urlInfo.query)||void 0===i?void 0:i.expire)).getTime()-(new Date).getTime())/1e3,10),startTime:`${o.getFullYear()}-${$e(o.getMonth()+1)}-${$e(o.getDate())} ${$e(o.getHours())}:${$e(o.getMinutes())}:${$e(o.getSeconds())}`,stopTime:`${I.getFullYear()}-${$e(I.getMonth()+1)}-${$e(I.getDate())} ${$e(I.getHours())}:${$e(I.getMinutes())}:${$e(I.getSeconds())}`,playbackSpeed:A.playbackRate||this.playbackRate,quality:this.urlInfo.streamTypeIn})}return Promise.resolve("")}},{key:"_isEzvizPlayback",value:function(A){return this._opt.isEzviz&&/rec=(local|cloud)/.test(this._opt.url)}},{key:"startRecord",value:function(A,e){var g;const t=this._HKHead;var i;return A=A||`${Date.now()}`,this._record&&t.length&&(null===(g=this._flvParseChunk.firstHeadTagChunk)||void 0===g?void 0:g.length)>0?null===(i=this._record)||void 0===i?void 0:i.startRecord(t,A,((A,g)=>{var t;null===(t=this.emit)||void 0===t||t.call(this,"recordResult",A,g),"function"==typeof e&&e(A,g)})).then((()=>{var A;null===(A=this.emit)||void 0===A||A.call(this,$.Theme.EVENTS.recordingChange,!0),this._record.inputData(this._flvParseChunk.firstHeadTagChunk),this._record.inputData(this._flvParseChunk.lastTagChunk),this._flvRecordFlag=!0})).catch((()=>{var A;null===(A=this.emit)||void 0===A||A.call(this,$.Theme.EVENTS.recordingChange,!1)})):Promise.resolve("")}},{key:"stopRecord",value:function(){var A;return this._flvRecordFlag=!1,this._record?(null===(A=this.emit)||void 0===A||A.call(this,$.Theme.EVENTS.recordingChange,!1),this._record.stopRecord()):Promise.resolve("")}},{key:"destroy",value:function(){this.destoryed=!0,this.events&&(this.events.destroy(),this.events=null),Q(o,"destroy",this)([]),this._record&&(this._flvRecordFlag&&this.stopRecord(),this._record.destroy(),this._record=null),this.player&&(this.player.destroy(),this.player=null),this.$container&&(this.$container.classList.remove("ezui-flv-container"),this.$container.classList.remove("ezui-player-container"),this.$container=null),this.definitionList=[],this.definition={},this._videoInfo={},this._audioInfo={},this._currentPlayDate=null,this.urlInfo={},this._playbackRate=1,this.playbackRateList=[],this.playbackRecords=[],this.$container=null,this._opt={},this._loadingTimeoutReplayTimes=0,this.removeAllListeners(),document.removeEventListener("visibilitychange",this._onvisibilitychange),Me.report(50,{name:"destroy"})}},{key:"_handlevideoInfo",value:function(A){this._videoInfo=A||{}}},{key:"_handleAudioInfo",value:function(A){this._audioInfo=A||{}}},{key:"_initPlayer",value:function(A,e){var g,t,i,I,C,B;e.url&&(e.url=Bg(e.url,this._opt.isEzviz)),this.player=new Ke(this.contentControl.$video,Object.assign({},e,{orientation:this.orientationAngle})),null===(g=this.player.debug)||void 0===g||g.log("Flv","version",o.version),null===(t=this.player.debug)||void 0===t||t.log("Flv","_initPlayer",JSON.stringify(e)),this._bindEvents(),e.autoPlay&&this.play(),this._handlevideoInfo=this._handlevideoInfo.bind(this),this._handleAudioInfo=this._handleAudioInfo.bind(this),null===(i=this.player)||void 0===i||i.off(RA.videoInfo,this._handlevideoInfo),null===(I=this.player)||void 0===I||I.on(RA.videoInfo,this._handlevideoInfo),null===(C=this.player)||void 0===C||C.off(RA.audioInfo,this._handleAudioInfo),null===(B=this.player)||void 0===B||B.on(RA.audioInfo,this._handleAudioInfo)}},{key:"_resetPlayer",value:function(){let A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.player.destroy(),this.player=null,this._opt=Object.assign(this._opt,A),this._initPlayer(this.$container,this._opt)}},{key:"_bindEvents",value:function(){Object.keys(vA).forEach((A=>{[RA.volumechange,RA.play].includes(A)||this.player.on(vA[A],(e=>{this.emit(A,e)}))})),this.player.on(vA.flvStream,(A=>{this._flvParseChunk&&A&&(this._flvRecordFlag&&this._record.inputData(A),this._flvParseChunk.inputData(A))}))}},{key:"setDebug",value:function(A){this.player.updateOption({debug:A}),Me.report(50,{name:"setDebug"})}},{key:"setLogger",value:function(){let A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.player.updateOption({loggerOptions:{...this.player._opt.loggerOptions||{},...A}})}},{key:"closeSound",value:function(){this.muted=!0,Me.report(50,{name:"closeSound"})}},{key:"openSound",value:function(){this.muted=!1,this.setVolume(.8),Me.report(50,{name:"openSound"})}},{key:"setVolume",value:function(A){this.volume=A}},{key:"getVolume",value:function(){return Me.report(50,{name:"getVolume"}),this.volume}},{key:"audioResume",value:function(){var A,e;null===(A=this.player)||void 0===A||null===(A=A.audio)||void 0===A||null===(e=A.audioEnabled)||void 0===e||e.call(A,!0),Me.report(50,{name:"audioResume"})}},{key:"pause",value:function(){return Me.report(50,{name:"pause"}),this._delayTimeoutTimer&&(clearTimeout(this._delayTimeoutTimer),this._delayTimeoutTimer=null),this._heartTimeoutDelayTimer&&(clearTimeout(this._heartTimeoutDelayTimer),this._heartTimeoutDelayTimer=null),this._loadingTimeoutDelayTimer&&(clearTimeout(this._loadingTimeoutDelayTimer),this._loadingTimeoutDelayTimer=null),this.playing=!1,this._playerPuase()}},{key:"_playerPuase",value:function(){var A,e;return this._flvRecordFlag&&this.stopRecord(),null===(A=this.player)||void 0===A||null===(e=A.pause)||void 0===e?void 0:e.call(A)}},{key:"clearView",value:function(){this.player.video.clearView(),Me.report(50,{name:"clearView"})}},{key:"play",value:async function(){let A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this._loadingTimeoutReplayTimes=0,this.__play(A)}},{key:"__play",value:async function(){let A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.loading=!0,A.url&&(Me.url=A.url),"string"==typeof A&&(A={url:A}),this._currentPlayDate&&!A.url&&this._isEzvizPlayback())try{A.url=await this.services.getRecordAddressService({expireTime:86400,quality:this.urlInfo.streamTypeIn,startTime:ig(this._currentPlayDate,"-"),stopTime:ig(this.urlInfo.query.end,"-"),playbackSpeed:this.playbackRate}),this._currentPlayDate=null}catch(A){}const e=Bg(A.url||this._opt.url,this._opt.isEzviz);return this.urlInfo=_e(e,this._opt.isEzviz),this._playbackRate=this.urlInfo.query.playbackSpeed||1,this._opt=Object.assign({},this._opt,A||{},{url:e}),this._opt.urlQuery=Ue(A.url),Me.report(50,{name:"play"}),this.playing=!0,await new Promise(((A,e)=>{var g;if(!this._opt.url)return this.emit(RA.error,UA.playError),void e("play url is empty");null!==(g=this.player)&&void 0!==g&&g.playing?(this.clearView(),this.player.play({...this._opt,muted:this.muted,volume:this.volume}).then((()=>{var e,g,t;this.loading=!1,null===(e=this.posterControl)||void 0===e||e.hide(),null!==(g=this.controls)&&void 0!==g&&g.recordControl&&null!==(t=this.controls)&&void 0!==t&&null!==(t=t.recordControl)&&void 0!==t&&t.disabled&&(this.controls.recordControl.disabled=!1),A()})).catch((A=>{this.player.debug.warn("Flv","pause -> play and play error",A),this._playerPuase().then((()=>{e(A)}))}))):this._play({...this._opt,muted:this.muted,volume:this.volume}).then((()=>{var e,g,t;this.loading=!1,null===(e=this.posterControl)||void 0===e||e.hide(),null!==(g=this.controls)&&void 0!==g&&g.recordControl&&null!==(t=this.controls)&&void 0!==t&&null!==(t=t.recordControl)&&void 0!==t&&t.disabled&&(this.controls.recordControl.disabled=!1),A()})).catch((A=>{this.player.debug.warn("Flv","this._play error",A),e(A)}))}))}},{key:"_play",value:function(){let A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new Promise(((e,g)=>{const t=0===A.url.indexOf("http"),i=t?QA:nA,o=t||-1!==A.url.indexOf(".flv")||this._opt.isFlv?rA:aA;this.player.updateOption({protocol:i,demuxType:o}),this.player.once(UA.webglAlignmentError,(()=>{this.player.off(UA.webglAlignmentError),this.pause().then((()=>{this.player.debug.log("Flv","webglAlignmentError"),this._resetPlayer({openWebglAlignment:!0}),this.play(A).then((()=>{this.player.debug.log("Flv","webglAlignmentError and play success")})).catch((()=>{this.player.debug.log("Flv","webglAlignmentError and play error")}))}))})),this.player.once(UA.mediaSourceH265NotSupport,(()=>{this.player.off(UA.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.player.once(UA.mediaSourceFull,(()=>{this.pause().then((()=>{this.player.debug.log("Flv","media source full"),this._resetPlayer(),this.play(A).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(UA.mediaSourceAppendBufferError,(()=>{this.pause().then((()=>{this.player.debug.log("Flv","media source append buffer error"),this._resetPlayer(),this.play(A).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(UA.mediaSourceBufferListLarge,(()=>{this.pause().then((()=>{this.player.debug.log("Flv","media source buffer list large"),this._resetPlayer(),this.play(A).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(UA.mediaSourceAppendBufferEndTimeout,(()=>{this.pause().then((()=>{this.player.debug.log("Flv","media source append buffer end timeout"),this._resetPlayer(),this.play(A).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(UA.mseSourceBufferError,(()=>{this.pause().then((()=>{this.player.debug.log("Flv","mseSourceBufferError close success")}))})),this.player.once(UA.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(A).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(UA.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(A).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.off(RA.delayTimeout,this._onDelayTimeout),this._onDelayTimeout=this._onDelayTimeout.bind(this),this.player.once(RA.delayTimeout,this._onDelayTimeout),this.player.off(RA.heartTimeout,this._onHeartTimeout),this._onHeartTimeout=this._onHeartTimeout.bind(this),this.player.once(RA.heartTimeout,this._onHeartTimeout),this.player.off(RA.loadingTimeout,this._onLoadingTimeout),this._onLoadingTimeout=this._onLoadingTimeout.bind(this),this.player.once(RA.loadingTimeout,this._onLoadingTimeout),this.player.off(RA.streamSuccess,this._onStreamSuccess),this._onStreamSuccess=this._onStreamSuccess.bind(this),this.player.once(RA.streamSuccess,this._onStreamSuccess),this.player.off(RA.streamError,this._onStreamError),this._onStreamError=this._onStreamError.bind(this),this.player.once(RA.streamError,this._onStreamError),this.hasLoaded()?this.player.play(A).then((()=>{var A,g;null!==(A=this.player)&&void 0!==A&&null!==(A=A.video)&&void 0!==A&&A.$videoElement&&(null===(g=this.urlInfo.query)||void 0===g?void 0:g.playbackSpeed)>=1&&(this.player.video.$videoElement.playbackRate=this.urlInfo.query.playbackSpeed),e()})).catch((A=>{if(this.player){this.player.debug.warn("Flv","hasLoaded and play error",A),null==A||A.name;try{this._playerPuase().then((()=>{g(A)}))}catch(A){}}})):this.player.once(RA.decoderWorkerInit,(()=>{this.player.play(A).then((()=>{var A,g;null!==(A=this.player)&&void 0!==A&&null!==(A=A.video)&&void 0!==A&&A.$videoElement&&(null===(g=this.urlInfo.query)||void 0===g?void 0:g.playbackSpeed)>=1&&(this.player.video.$videoElement.playbackRate=this.urlInfo.query.playbackSpeed),e()})).catch((A=>{if(this.player){this.player.debug.warn("Flv","decoderWorkerInit and play error",A);try{this._playerPuase().then((()=>{g(A)}))}catch(A){}}}))}))}))}},{key:"_onDelayTimeout",value:function(A){this._delayTimeoutTimer=setTimeout((()=>{this._delayTimeoutTimer&&(clearTimeout(this._delayTimeoutTimer),this._delayTimeoutTimer=null),this._loadingTimeoutReplayTimes<+this._opt.loadingTimeoutReplayTimes||-1==+this._opt.loadingTimeoutReplayTimes?(this._loadingTimeoutReplayTimes+=1,this.player.debug.warn("Flv",`delay timeout replay time is ${this._loadingTimeoutReplayTimes}`),this.player.off(RA.delayTimeout,this._onDelayTimeout),this.emit(RA.loadingRetryTimes,this._loadingTimeoutReplayTimes),this.__play(this._opt).then((()=>{this._loadingTimeoutReplayTimes=0}))):this._getDeviceStreamErrorInfo()}),1e3*(this._opt.loadingTimeoutDelay||3))}},{key:"_onHeartTimeout",value:function(){this._heartTimeoutDelayTimes<+this.player._opt.heartTimeoutReplayTimes||-1==+this.player._opt.heartTimeoutReplayTimes?(this._heartTimeoutDelayTimes+=1,this.player.debug.warn("Flv",`heart timeout replay time is ${this._heartTimeoutDelayTimes}`),this.player.off(RA.heartTimeout,this._onLoadingTimeout),this.emit(RA.heartRetryTimes,this._heartTimeoutDelayTimes),this.__play(this._opt).then((()=>{this._heartTimeoutDelayTimes=0}))):this._getDeviceStreamErrorInfo()}},{key:"_onLoadingTimeout",value:function(){this._loadingTimeoutDelayTimer=setTimeout((()=>{this._loadingTimeoutDelayTimer&&(clearTimeout(this._loadingTimeoutDelayTimer),this._loadingTimeoutDelayTimer=null),this._loadingTimeoutReplayTimes<+this._opt.loadingTimeoutReplayTimes||-1==+this._opt.loadingTimeoutReplayTimes?(this._loadingTimeoutReplayTimes+=1,this.player.debug.warn("Flv",`loading timeout replay time is ${this._loadingTimeoutReplayTimes}`),this.player.off(RA.delayTimeout,this._onLoadingTimeout),this.emit(RA.loadingRetryTimes,this._loadingTimeoutReplayTimes),this.__play(this._opt).then((()=>{this._loadingTimeoutReplayTimes=0}))):this._getDeviceStreamErrorInfo()}),1e3*(this._opt.loadingTimeoutDelay||3))}},{key:"_getDeviceStreamErrorInfo",value:function(){var A,e,g,t,i;this.destoryed||(this.services&&null!==(A=this.urlInfo)&&void 0!==A&&null!==(A=A.query)&&void 0!==A&&A.sid?this.services.getStreamInterreputInfo(null===(e=this.urlInfo)||void 0===e||null===(e=e.query)||void 0===e?void 0:e.sid).then((A=>{if(!this.destoryed)if(this.playing=!1,200===A.meta.code){var e,g;let t=this.i18n.t(null===(e=A.data)||void 0===e?void 0:e.intrCode);/^\[missing /.test(t)?null!==(g=A.data)&&void 0!==g&&g.intrCode?this.emit(RA.message,this.i18n.t("httpFetchStreamError")+` [${A.data.intrCode}]`,"fetchError"):this.emit(RA.message,this.i18n.t("httpFetchStreamError"),"fetchError"):this.emit(RA.message,t+` [${A.data.intrCode}]`,"fetchError")}else this.emit(RA.message,this.i18n.t("httpFetchStreamError"),"fetchError")})).catch((()=>{var A,e,g;this.playing=!1,null===(A=this.emit)||void 0===A||A.call(this,RA.message,null===(e=this.i18n)||void 0===e||null===(g=e.t)||void 0===g?void 0:g.call(e,"httpFetchStreamError"),"fetchError")})):(this.playing=!1,null===(g=this.emit)||void 0===g||g.call(this,RA.message,null===(t=this.i18n)||void 0===t||null===(i=t.t)||void 0===i?void 0:i.call(t,"httpFetchStreamError"),"fetchError")))}},{key:"_onStreamSuccess",value:function(){this.emit(RA.streamSuccess)}},{key:"_onStreamError",value:function(){this.emit(RA.streamError)}},{key:"setBufferTime",value:function(A){var e,g;A=Number(A),this.player.updateOption({videoBuffer:1e3*A}),null===(e=this.player)||void 0===e||null===(e=e.decoderWorker)||void 0===e||null===(g=e.updateWorkConfig)||void 0===g||g.call(e,{key:"videoBuffer",value:1e3*A})}},{key:"hasLoaded",value:function(){return this.player.loaded}},{key:"setKeepScreenOn",value:function(){this.player.updateOption({keepScreenOn:!0}),Me.report(50,{name:"setKeepScreenOn"})}},{key:"videoInfo",get:function(){return this._videoInfo}},{key:"currentTime",get:function(){return this.player.video?this.player.video.currentTime:0}},{key:"screenshot",value:function(A){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"png",g=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.92,t=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"download";if(this.player.video)return g=+g,this.player.video.screenshot(A,e,g,t)}},{key:"getState",value:function(){return{playing:!!this.player&&this.player.playing,muted:!(!this.player||!this.muted),fullscreen:this.currentFullscreen,loaded:!!this.player&&this.player.loaded,volume:this.player?parseFloat(this.player.volume).toFixed(2):0,isDebug:!!this.player&&this.player.isDebug}}},{key:"getOptions",value:function(){return this.player?this.player._opt:{}}},{key:"getVersion",value:function(){return Me.report(50,{name:"getVersion"}),"2.1.2-beta.1"}},{key:"_onvisibilitychange",value:function(){!document.hidden&&this.playing&&this.muted&&this.options.isLive&&this.options.mutedShowAutoReload&&!this._flvRecordFlag&&this.pause().finally((()=>{var A;null===(A=this.play)||void 0===A||A.call(this).catch((A=>{}))}))}},{key:"_HKHead",get:function(){return this._videoInfo.encType?gA.Record.getHKHead("flv","h264","aac","16000"):[]}}],[{key:"_setOptions",value:function(A){const e=og((A=Object.assign({},{isLive:!0,timeZone:0},EA,A)).id||A.container);return A.container=e,A}},{key:"supportType",value:function(A){if("flv"===A.type)return!0;if(A.url){let e=A.url;e.startsWith("http://")||e.startsWith("https://")||(e=/^\/\//.test(e)?"http:"+e:location.origin+location.pathname+e);try{return/\.flv$/i.test(new URL(e).pathname)}catch(A){}}return!1}}])}($.Theme);return i(Qg,"ERROR",UA),i(Qg,"EVENTS",RA),i(Qg,"QUALITY_ENUM",Ag),i(Qg,"TIMEOUT",{delayTimeout:RA.delayTimeout}),i(Qg,"version","2.1.2-beta.1"),Qg}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ezuikit-flv",
3
- "version": "2.1.1-beta.1",
3
+ "version": "2.1.2-beta.1",
4
4
  "main": "./index.js",
5
5
  "types": "./types",
6
6
  "author": "Ezviz-OpenBiz",