(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2ccd7611"],{"643a":function(e,t,i){function r(e){if(null==e)throw new TypeError("Cannot destructure "+e)}i("d9e2"),e.exports=r,e.exports.__esModule=!0,e.exports["default"]=e.exports},"946b5":function(e,t,i){(function(r,a){var n,s,o=i("c973").default,l=i("448a").default,c=i("7ec2").default,u=i("ded3b").default,d=i("643a").default,h=i("a128").default,f=i("3740").default,p=i("61e5").default,g=i("ed6d").default,m=i("5bc3").default,A=i("970b").default,y=i("7037").default;i("a4d3"),i("e01a"),i("d28b"),i("944a"),i("d9e2"),i("99af"),i("a874"),i("cb29"),i("4de4"),i("7db0"),i("c740"),i("a630"),i("caad"),i("a15b"),i("d81d"),i("14d9"),i("13d5"),i("fb6a"),i("4e82"),i("a434"),i("c19f"),i("ace4"),i("b0c0"),i("6c57"),i("e9c4"),i("0c47"),i("4ec9"),i("4057"),i("23dc"),i("a9e3"),i("f00c"),i("9129"),i("aff5"),i("b680"),i("e439"),i("dbb4"),i("3410"),i("b64b"),i("1f68"),i("131a"),i("d3b7"),i("4ae1"),i("f8c9"),i("4d63"),i("c607"),i("ac1f"),i("5377"),i("2c3e"),i("00b4"),i("25f0"),i("2532"),i("3ca3"),i("466d"),i("38cf"),i("5319"),i("841c"),i("1276"),i("498a"),i("c7cd"),i("cfc3"),i("4a9b"),i("fd87"),i("8b09"),i("143c"),i("5cc6"),i("84c3"),i("fb2c"),i("907a"),i("9a8c"),i("a975"),i("735e"),i("c1ac"),i("d139"),i("3a7b"),i("986a"),i("1d02"),i("d5d6"),i("20bf"),i("82f8"),i("e91f"),i("60bd"),i("5f96"),i("3280"),i("3fcc"),i("ec97"),i("ca91"),i("25a1"),i("cd26"),i("3c5d"),i("2954"),i("649e"),i("219c"),i("170b"),i("b39a"),i("72f7"),i("1b3b"),i("3d71"),i("c6e3"),i("81b2"),i("159b"),i("ddb0"),i("0eb6"),i("b7ef"),i("8bd4"),i("2b3d"),i("bf19"),i("9861"),function(r,a){"object"==y(t)&&"undefined"!=typeof e?e.exports=a():(n=a,s="function"===typeof n?n.call(t,i,t,e):n,void 0===s||(e.exports=s))}(0,(function(){"use strict";var e="fetch",t="websocket",i="worker",n="player",s="playbackTF",v="mp4",b="webm",E="flv",k="webTransport",T="nakedFlow",w={flv:"FLV",m7s:"m7s",hls:"HLS",webrtc:"Webrtc",webTransport:"WebTransport",nakedFlow:"裸流"},S="canvas",_="video",R="debug",C="warn",D="click",L={url:"",playbackConfig:{},fullscreenWatermarkConfig:{},playType:n,playbackForwardMaxRateDecodeIFrame:4,playOptions:{},isLive:!0,isMulti:!1,isCrypto:!1},x={playType:n,container:"",videoBuffer:1e3,videoBufferDelay:1e3,networkDelay:1e4,isResize:!0,isFullResize:!1,isFlv:!1,isHls:!1,isWebrtc:!1,isWebrtcForZLM:!1,isNakedFlow:!1,debug:!1,debugLevel:C,debugUuid:"",isMulti:!1,hotKey:!1,loadingTimeout:10,heartTimeout:10,timeout:10,pageVisibilityHiddenTimeout:300,loadingTimeoutReplay:!0,heartTimeoutReplay:!0,loadingTimeoutReplayTimes:3,heartTimeoutReplayTimes:3,heartTimeoutReplayUseLastFrameShow:!1,replayUseLastFrameShow:!1,supportDblclickFullscreen:!1,showBandwidth:!1,showPerformance:!1,mseCorrectTimeDuration:20,keepScreenOn:!0,isNotMute:!1,hasAudio:!0,hasVideo:!0,operateBtns:{fullscreen:!1,screenshot:!1,play:!1,audio:!1,record:!1,ptz:!1,quality:!1,zoom:!1,close:!1,scale:!1,performance:!1,aiFace:!1,aiObject:!1,fullscreenFn:null,fullscreenExitFn:null,screenshotFn:null,playFn:null,pauseFn:null,recordFn:null,recordStopFn:null},extendOperateBtns:[],contextmenuBtns:[],watermarkConfig:{},controlAutoHide:!1,hasControl:!1,loadingIcon:!0,loadingText:"",background:"",backgroundLoadingShow:!1,loadingBackground:"",decoder:"decoder-pro.js",decoderWASM:"",url:"",rotate:0,mirrorRotate:"none",playbackConfig:{playList:[],fps:"",showControl:!0,showRateBtn:!1,rateConfig:[],isCacheBeforeDecodeForFpsRender:!1,uiUsePlaybackPause:!1,isPlaybackPauseClearCache:!0,isUseFpsRender:!1,isUseLocalCalculateTime:!1,localOneFrameTimestamp:40,supportWheel:!1},qualityConfig:[],defaultStreamQuality:"",scaleConfig:["拉伸","缩放","正常"],forceNoOffscreen:!0,hiddenAutoPause:!1,protocol:2,demuxType:E,useWasm:!1,useWCS:!1,useSIMD:!0,wcsUseVideoRender:!0,wasmUseVideoRender:!0,mseUseCanvasRender:!1,hlsUseCanvasRender:!1,useMSE:!1,useOffscreen:!1,useWebGPU:!1,mseDecodeErrorReplay:!0,wcsDecodeErrorReplay:!0,wasmDecodeErrorReplay:!0,autoWasm:!0,webglAlignmentErrorReplay:!0,webglContextLostErrorReplay:!0,openWebglAlignment:!1,syncAudioAndVideo:!1,playbackDelayTime:1e3,playbackFps:25,playbackForwardMaxRateDecodeIFrame:4,playbackCurrentTimeMove:!0,useVideoRender:!0,useCanvasRender:!1,networkDelayTimeoutReplay:!1,recordType:v,checkFirstIFrame:!0,nakedFlowFps:25,audioEngine:null,isShowRecordingUI:!0,isShowZoomingUI:!0,useFaceDetector:!1,useObjectDetector:!1,ptzClickType:D,ptzStopEmitDelay:.3,ptzZoomShow:!1,ptzApertureShow:!1,ptzFocusShow:!1,ptzMoreArrow:!1,weiXinInAndroidAudioBufferSize:4800,isCrypto:!1,cryptoKey:"",cryptoIV:"",cryptoKeyUrl:"",autoResize:!1,useWebFullScreen:!1,ptsMaxDiff:3600,aiFaceDetectWidth:192,aiObjectDetectWidth:192,videoRenderSupportScale:!0,mediaSourceTsIsMaxDiffReplay:!0,controlHtml:""},I="init",B="initVideo",P="initAudio",M="audioCode",O="videoCode",F="videoCodec",j="closeEnd",U={fullscreen:"fullscreen$2",webFullscreen:"webFullscreen",decoderWorkerInit:"decoderWorkerInit",play:"play",playing:"playing",pause:"pause",mute:"mute",load:"load",loading:"loading",zooming:"zooming",videoInfo:"videoInfo",timeUpdate:"timeUpdate",audioInfo:"audioInfo",log:"log",error:"error",kBps:"kBps",timeout:"timeout",delayTimeout:"delayTimeout",delayTimeoutRetryEnd:"delayTimeoutRetryEnd",loadingTimeout:"loadingTimeout",loadingTimeoutRetryEnd:"loadingTimeoutRetryEnd",stats:"stats",performance:"performance",faceDetectActive:"faceDetectActive",objectDetectActive:"objectDetectActive",record:"record",recording:"recording",recordingTimestamp:"recordingTimestamp",recordStart:"recordStart",recordEnd:"recordEnd",recordCreateError:"recordCreateError",recordBlob:"recordBlob",buffer:"buffer",videoFrame:"videoFrame",start:"start",metadata:"metadata",resize:"resize",volumechange:"volumechange",destroy:"destroy",beforeDestroy:"beforeDestroy",streamEnd:"streamEnd",streamRate:"streamRate",streamAbps:"streamAbps",streamVbps:"streamVbps",streamDts:"streamDts",streamSuccess:"streamSuccess",streamMessage:"streamMessage",streamError:"streamError",streamStats:"streamStats",mseSourceOpen:"mseSourceOpen",mseSourceClose:"mseSourceClose",mseSourceended:"mseSourceended",mseSourceBufferError:"mseSourceBufferError",mseAddSourceBufferError:"mseAddSourceBufferError",mseSourceBufferBusy:"mseSourceBufferBusy",mseSourceBufferFull:"mseSourceBufferFull",videoWaiting:"videoWaiting",videoTimeUpdate:"videoTimeUpdate",videoSyncAudio:"videoSyncAudio",playToRenderTimes:"playToRenderTimes",playbackTime:"playbackTime",playbackTimestamp:"playbackTimestamp",playbackPrecision:"playbackPrecision",playbackJustTime:"playbackJustTime",playbackStats:"playbackStats",playbackSeek:"playbackSeek",playbackPause:"playbackPause",playbackPauseOrResume:"playbackPauseOrResume",playbackRateChange:"playbackRateChange",playbackPreRateChange:"playbackPreRateChange",ptz:"ptz",streamQualityChange:"streamQualityChange",visibilityChange:"visibilityChange",netBuf:"netBuf",close:"close",networkDelayTimeout:"networkDelayTimeout",togglePerformancePanel:"togglePerformancePanel",viewResizeChange:"viewResizeChange",flvDemuxBufferSizeTooLarge:"flvDemuxBufferSizeTooLarge",talkGetUserMediaSuccess:"talkGetUserMediaSuccess",talkGetUserMediaFail:"talkGetUserMediaFail",talkGetUserMediaTimeout:"talkGetUserMediaTimeout",talkStreamStart:"talkStreamStart",talkStreamOpen:"talkStreamOpen",talkStreamClose:"talkStreamClose",talkStreamError:"talkStreamError",talkStreamInactive:"talkStreamInactive",webrtcDisconnect:"webrtcDisconnect",webrtcFailed:"webrtcFailed",webrtcClosed:"webrtcClosed",crashLog:"crashLog",focus:"focus",blur:"blur",visibilityHiddenTimeout:"visibilityHiddenTimeout",websocketOpen:"websocketOpen",websocketClose:"websocketClose",websocketError:"websocketError",websocketMessage:"websocketMessage",aiObjectDetectorInfo:"aiObjectDetectorInfo",aiFaceDetector:"aiFaceDetector",playFailedAndPaused:"playFailedAndPaused",audioResumeState:"audioResumeState"},N={load:U.load,timeUpdate:U.timeUpdate,videoInfo:U.videoInfo,audioInfo:U.audioInfo,error:U.error,kBps:U.kBps,start:U.start,timeout:U.timeout,loadingTimeout:U.loadingTimeout,loadingTimeoutRetryEnd:U.loadingTimeoutRetryEnd,delayTimeout:U.delayTimeout,delayTimeoutRetryEnd:U.delayTimeoutRetryEnd,fullscreen:"fullscreen",webFullscreen:U.webFullscreen,play:U.play,pause:U.pause,mute:U.mute,stats:U.stats,performance:U.performance,recordingTimestamp:U.recordingTimestamp,recordStart:U.recordStart,recordEnd:U.recordEnd,recordBlob:U.recordBlob,playToRenderTimes:U.playToRenderTimes,playbackSeek:U.playbackSeek,playbackStats:U.playbackStats,playbackTimestamp:U.playbackTimestamp,playbackPauseOrResume:U.playbackPauseOrResume,playbackPreRateChange:U.playbackPreRateChange,playbackRateChange:U.playbackRateChange,ptz:U.ptz,streamQualityChange:U.streamQualityChange,zooming:U.zooming,crashLog:U.crashLog,focus:U.focus,blur:U.blur,visibilityHiddenTimeout:U.visibilityHiddenTimeout,visibilityChange:U.visibilityChange,websocketOpen:U.websocketOpen,websocketClose:U.websocketClose,networkDelayTimeout:U.networkDelayTimeout,aiObjectDetectorInfo:U.aiObjectDetectorInfo,playFailedAndPaused:U.playFailedAndPaused,audioResumeState:U.audioResumeState},z={talkStreamClose:U.talkStreamClose,talkStreamError:U.talkStreamError,talkStreamInactive:U.talkStreamInactive,talkGetUserMediaTimeout:U.talkGetUserMediaTimeout},G={playError:"playIsNotPauseOrUrlIsNull",fetchError:"fetchError",websocketError:"websocketError",webcodecsH265NotSupport:"webcodecsH265NotSupport",webcodecsDecodeError:"webcodecsDecodeError",mediaSourceH265NotSupport:"mediaSourceH265NotSupport",mediaSourceDecoderConfigurationError:"mediaSourceDecoderConfigurationError",mediaSourceFull:U.mseSourceBufferFull,mseSourceBufferError:U.mseSourceBufferError,mseAddSourceBufferError:U.mseAddSourceBufferError,mediaSourceAppendBufferError:"mediaSourceAppendBufferError",mediaSourceBufferListLarge:"mediaSourceBufferListLarge",mediaSourceAppendBufferEndTimeout:"mediaSourceAppendBufferEndTimeout",mediaSourceTsIsMaxDiff:"mediaSourceTsIsMaxDiff",mediaSourceUseCanvasRenderPlayFailed:"mediaSourceUseCanvasRenderPlayFailed",wasmDecodeError:"wasmDecodeError",hlsError:"hlsError",webrtcError:"webrtcError",webglAlignmentError:"webglAlignmentError",wasmWidthOrHeightChange:"wasmWidthOrHeightChange",mseWidthOrHeightChange:"mseWidthOrHeightChange",wcsWidthOrHeightChange:"wcsWidthOrHeightChange",tallWebsocketClosedByError:"tallWebsocketClosedByError",flvDemuxBufferSizeTooLarge:U.flvDemuxBufferSizeTooLarge,wasmDecodeVideoNoResponseError:"wasmDecodeVideoNoResponseError",audioChannelError:"audioChannelError",simdH264DecodeVideoWidthIsTooLarge:"simdH264DecodeVideoWidthIsTooLarge",webglContextLostError:"webglContextLostError"},H="notConnect",V="open",W={download:"download",base64:"base64",blob:"blob"},K="download",q={7:"H264(AVC)",12:"H265(HEVC)"},Q="H264(AVC)",Y="H265(HEVC)",J={AAC:"AAC",ALAW:"ALAW(g711a)",MULAW:"MULAW(g711u)"},X={10:"AAC",7:"ALAW",8:"MULAW"},$=6,Z="webcodecs",ee="webgl",te="webgpu",ie="offscreen",re="mse",ae='video/mp4; codecs="avc1.64002A"',ne='video/mp4; codecs="hev1.1.6.L123.b0"',se="oneHour",oe="halfHour",le="fiveMin",ce={oneHour:"one-hour",halfHour:"half-hour",tenMin:"ten-min",fiveMin:"five-min"},ue=["oneHour","halfHour","tenMin","fiveMin"],de=["up","right","down","left","left-up","right-up","left-down","right-down"],he="stop",fe="fiStop",pe="g711a",ge="g711u",me={png:"image/png",jpeg:"image/jpeg",webp:"image/webp"},Ae="canplay",ye="waiting",ve="timeupdate",be="ratechange",Ee="The user aborted a request",ke="AbortError",Te="AbortError",we="worklet",Se={encType:pe,packetType:"rtp",rtpSsrc:"0000000000",numberChannels:1,sampleRate:8e3,sampleBitsWidth:16,debug:!1,debugLevel:C,testMicrophone:!1,audioBufferLength:160,engine:we,checkGetUserMediaTimeout:!1,getUserMediaTimeout:1e4},_e="worklet",Re="script",Ce="active",De={name:"",index:0,icon:"",iconHover:"",iconTitle:"",activeIcon:"",activeIconHover:"",activeIconTitle:"",click:null,activeClick:null},Le={content:"",click:null,index:0},xe=m((function e(t){A(this,e),this.log=function(e){if(t._opt.debug&&t._opt.debugLevel==R){for(var i,r=t._opt.debugUuid?"[".concat(t._opt.debugUuid,"]"):"",a=arguments.length,n=new Array(1>4==10&&0===e[1]}function Oe(){}function Fe(e){for(var t=null,i=["webgl","experimental-webgl","moz-webgl","webkit-3d"],r=0;!t&&r>4==1&&0===e[1]}function Dt(e){return!0===e||"true"===e}function Lt(e){return!0!==e&&"true"!==e}var xt=function(){function e(t){A(this,e),this.destroys=[],this.proxy=this.proxy.bind(this),this.master=t}return m(e,[{key:"proxy",value:function(e,t,i){var r=this,a=30) {\n\n highp float y = texture2D(yTexture, vTexturePosition).r;\n highp float u = texture2D(uTexture, vTexturePosition).r;\n highp float v = texture2D(vTexture, vTexturePosition).r;\n gl_FragColor = vec4(y, u, v, 1) * YUV2RGB;\n\n } else {\n gl_FragColor = texture2D(rgbaTexture, vTexturePosition);\n }\n }\n "),i=this.gl.createProgram();return this.gl.attachShader(i,e),this.gl.attachShader(i,t),this.gl.linkProgram(i),this.gl.getProgramParameter(i,this.gl.LINK_STATUS)?i:(console.log("Unable to initialize the shader program: "+this.gl.getProgramInfoLog(i)),null)}},{key:"_loadShader",value:function(e,t){var i=this.gl;e=i.createShader(e);return i.shaderSource(e,t),i.compileShader(e),i.getShaderParameter(e,i.COMPILE_STATUS)?e:(console.log("An error occurred compiling the shaders: "+i.getShaderInfoLog(e)),i.deleteShader(e),null)}},{key:"_initBuffers",value:function(){var e=this.gl,t=e.createBuffer(),i=(e.bindBuffer(e.ARRAY_BUFFER,t),[-1,-1,1,-1,1,1,-1,1]);e.bufferData(e.ARRAY_BUFFER,new Float32Array(i),e.STATIC_DRAW);var r=(r=[]).concat([0,1],[1,1],[1,0],[0,0]),a=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,a),e.bufferData(e.ARRAY_BUFFER,new Float32Array(r),e.STATIC_DRAW),r=e.createBuffer();return e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,r),e.bufferData(e.ELEMENT_ARRAY_BUFFER,new Uint16Array([0,1,2,0,2,3]),e.STATIC_DRAW),{positions:i,position:t,texPosition:a,indices:r}}},{key:"_createTexture",value:function(){var e=this.gl.createTexture();return this.gl.bindTexture(this.gl.TEXTURE_2D,e),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),e}},{key:"_drawScene",value:function(e,t,i){this.gl.viewport(0,0,e,t),this.gl.enable(this.gl.BLEND),this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this._buffers.position),this.gl.bufferData(this.gl.ARRAY_BUFFER,new Float32Array(this._buffers.positions),this.gl.STATIC_DRAW),this.gl.vertexAttribPointer(this._programInfo.attribLocations.vertexPosition,2,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this._programInfo.attribLocations.vertexPosition),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this._buffers.texPosition),this.gl.vertexAttribPointer(this._programInfo.attribLocations.texturePosition,2,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this._programInfo.attribLocations.texturePosition),this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,this._buffers.indices),i?(this.gl.activeTexture(this.gl.TEXTURE0+3),this.gl.bindTexture(this.gl.TEXTURE_2D,this._ytexture),this.gl.activeTexture(this.gl.TEXTURE0+4),this.gl.bindTexture(this.gl.TEXTURE_2D,this._utexture),this.gl.activeTexture(this.gl.TEXTURE0+5),this.gl.bindTexture(this.gl.TEXTURE_2D,this._vtexture)):(this.gl.activeTexture(this.gl.TEXTURE0+2),this.gl.bindTexture(this.gl.TEXTURE_2D,this._rgbatexture)),this.gl.useProgram(this._programInfo.program),this.gl.uniform1i(this._programInfo.uniformLocations.rgbatexture,2),this.gl.uniform1i(this._programInfo.uniformLocations.ytexture,3),this.gl.uniform1i(this._programInfo.uniformLocations.utexture,4),this.gl.uniform1i(this._programInfo.uniformLocations.vtexture,5),this.gl.uniform1i(this._programInfo.uniformLocations.isyuv,i?1:0),this.gl.drawElements(this.gl.TRIANGLES,6,this.gl.UNSIGNED_SHORT,0)}},{key:"_calRect",value:function(e,t,i,r,a,n){var s=2*e/a-1;r=2*(n-t-r)/n-1,e=2*(e+i)/a-1,i=2*(n-t)/n-1;return[s,r,e,r,e,i,s,i]}},{key:"_clear",value:function(){this.gl.clearColor(0,0,0,1),this.gl.clearDepth(1),this.gl.clear(this.gl.COLOR_BUFFER_BIT|this.gl.DEPTH_BUFFER_BIT)}},{key:"render",value:function(e,t,i,r,a){var n=this.gl;this._clear(),n.activeTexture(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,this._ytexture),n.texImage2D(n.TEXTURE_2D,0,n.LUMINANCE,e,t,0,n.LUMINANCE,n.UNSIGNED_BYTE,i),n.activeTexture(n.TEXTURE1),n.bindTexture(n.TEXTURE_2D,this._utexture),n.texImage2D(n.TEXTURE_2D,0,n.LUMINANCE,e/2,t/2,0,n.LUMINANCE,n.UNSIGNED_BYTE,r),n.activeTexture(n.TEXTURE2),n.bindTexture(n.TEXTURE_2D,this._vtexture),n.texImage2D(n.TEXTURE_2D,0,n.LUMINANCE,e/2,t/2,0,n.LUMINANCE,n.UNSIGNED_BYTE,a),this._buffers.positions=[-1,-1,1,-1,1,1,-1,1],this._drawScene(e,t,!0)}},{key:"renderYUV",value:function(e,t,i){var r=i.slice(0,e*t),a=i.slice(e*t,e*t*5/4),n=(i=i.slice(e*t*5/4,e*t*3/2),this.gl);this._clear(),n.activeTexture(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,this._ytexture),n.texImage2D(n.TEXTURE_2D,0,n.LUMINANCE,e,t,0,n.LUMINANCE,n.UNSIGNED_BYTE,r),n.activeTexture(n.TEXTURE1),n.bindTexture(n.TEXTURE_2D,this._utexture),n.texImage2D(n.TEXTURE_2D,0,n.LUMINANCE,e/2,t/2,0,n.LUMINANCE,n.UNSIGNED_BYTE,a),n.activeTexture(n.TEXTURE2),n.bindTexture(n.TEXTURE_2D,this._vtexture),n.texImage2D(n.TEXTURE_2D,0,n.LUMINANCE,e/2,t/2,0,n.LUMINANCE,n.UNSIGNED_BYTE,i),this._buffers.positions=[-1,-1,1,-1,1,1,-1,1],this._drawScene(e,t,!0)}},{key:"drawDom",value:function(e,t,i,r,a){var n=this.gl;n.activeTexture(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,this._rgbatexture),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,a),this._buffers.positions=this._calRect(i,r,a.width,a.height,e,t),this._drawScene(e,t,!1)}}])}(),jt=function(){function e(t){var i=this;A(this,e),this.gpu=t,this.pipeline=null,this.matrixGroupInfo=null,this.depthTexture=null,this.textureGroupInfo=null,this.hasInited=!1,this.buffers=this._initBuffer(),this._initPipeline().then((function(e){i.pipeline=e,i.matrixGroupInfo=i._initMatrixGroupInfo(),i.hasInited=!0}))}return m(e,[{key:"destroy",value:function(){this.gpu&&(this.gpu.device.destroy(),this.gpu=null),this.hasInited=!1,this.pipeline=null,this.matrixGroupInfo=null,this.depthTexture=null,this.textureGroupInfo=null}},{key:"_initBuffer",value:function(){var e=this.gpu.device,t=new Float32Array([-1,-1,-1,1,-1,-1,1,1,-1,-1,1,-1]),i=e.createBuffer({size:t.byteLength,usage:window.GPUBufferUsage.VERTEX|window.GPUBufferUsage.COPY_DST}),r=(t=(e.queue.writeBuffer(i,0,t),new Float32Array([0,1,1,1,1,0,0,0])),e.createBuffer({size:t.byteLength,usage:window.GPUBufferUsage.VERTEX|window.GPUBufferUsage.COPY_DST})),a=(t=(e.queue.writeBuffer(r,0,t),new Uint16Array([0,1,2,0,2,3])),e.createBuffer({size:t.byteLength,usage:window.GPUBufferUsage.INDEX|window.GPUBufferUsage.COPY_DST}));return e.queue.writeBuffer(a,0,t),{positionBuffer:i,texpositionBuffer:r,indexBuffer:a}}},{key:"_initPipeline",value:function(){var e=this;return new Promise((function(t,i){var r=e.gpu.device,a=e.gpu.format;a={layout:"auto",vertex:{module:r.createShaderModule({code:"\n\n @binding(0) @group(0) var uModelMatrix : mat4x4;\n @binding(1) @group(0) var uViewMatrix : mat4x4;\n @binding(2) @group(0) var uProjectionMatrix : mat4x4;\n\n struct VertexOutput {\n @builtin(position) Position : vec4,\n @location(0) vTexturePosition : vec2,\n }\n\n @vertex\n fn main(\n @location(0) aVertexPosition : vec4,\n @location(1) aTexturePosition : vec2\n ) -> VertexOutput {\n var output : VertexOutput;\n var tmppos : vec4 = uProjectionMatrix * uViewMatrix * uModelMatrix * aVertexPosition;\n output.Position = vec4(tmppos.x, tmppos.y, (tmppos.z+1.)/2., tmppos.w); // webgl z [-1, 1], webgpu z [0, 1], 这里z做下调整 z-webgpu = (z-webgl+1)/2\n output.vTexturePosition = aTexturePosition;\n return output;\n }\n\n "}),entryPoint:"main",buffers:[{arrayStride:12,attributes:[{shaderLocation:0,offset:0,format:"float32x3"}]},{arrayStride:8,attributes:[{shaderLocation:1,offset:0,format:"float32x2"}]}]},primitive:{topology:"triangle-list"},fragment:{module:r.createShaderModule({code:"\n @group(1) @binding(0) var mySampler: sampler;\n @group(1) @binding(1) var yTexture: texture_2d;\n @group(1) @binding(2) var uTexture: texture_2d;\n @group(1) @binding(3) var vTexture: texture_2d;\n\n const YUV2RGB : mat4x4 = mat4x4( 1.1643828125, 0, 1.59602734375, -.87078515625,\n 1.1643828125, -.39176171875, -.81296875, .52959375,\n 1.1643828125, 2.017234375, 0, -1.081390625,\n 0, 0, 0, 1);\n\n @fragment\n fn main(\n @location(0) vTexturePosition: vec2\n ) -> @location(0) vec4 {\n\n var y : f32= textureSample(yTexture, mySampler, vTexturePosition).r;\n var u : f32 = textureSample(uTexture, mySampler, vTexturePosition).r;\n var v : f32 = textureSample(vTexture, mySampler, vTexturePosition).r;\n\n return vec4(y, u, v, 1.0)*YUV2RGB;\n }\n\n "}),entryPoint:"main",targets:[{format:a}]},depthStencil:{depthWriteEnabled:!0,depthCompare:"less",format:"depth24plus"}};r.createRenderPipelineAsync(a).then((function(e){t(e)})).catch((function(e){i(e)}))}))}},{key:"_initMatrixGroupInfo",value:function(){var e,t,i,r,a,n,s,o,l,c,u,d=this.gpu.device,h=this.pipeline,f=Pt(),p=(e=(t=g=1)/((p=-1)-g),y=1/((i=-1)-t),o=1/((s=.1)-(n=100)),(l=f)[0]=-2*e,l[1]=0,l[2]=0,l[3]=0,l[4]=0,l[5]=-2*y,l[6]=0,l[7]=0,l[8]=0,l[9]=0,l[10]=2*o,l[11]=0,l[12]=(p+g)*e,l[13]=(t+i)*y,l[14]=(n+s)*o,l[15]=1,Pt()),g=(Mt(p),Pt()),m=(e=g,t=Ot(0,0,0),i=Ot(0,0,-1),y=Ot(0,1,0),n=t[0],s=t[1],t=t[2],o=y[0],l=y[1],y=y[2],c=i[0],u=i[1],i=i[2],Math.abs(n-c)<1e-6&&Math.abs(s-u)<1e-6&&Math.abs(t-i)<1e-6?Mt(e):(c=n-c,u=s-u,i=t-i,A=l*(i*=m=1/Math.hypot(c,u,i))-y*(u*=m),y=y*(c*=m)-o*i,o=o*u-l*c,(m=Math.hypot(A,y,o))?(A*=m=1/m,y*=m,o*=m):o=y=A=0,l=u*o-i*y,r=i*A-c*o,a=c*y-u*A,(m=Math.hypot(l,r,a))?(l*=m=1/m,r*=m,a*=m):a=r=l=0,e[0]=A,e[1]=l,e[2]=c,e[3]=0,e[4]=y,e[5]=r,e[6]=u,e[7]=0,e[8]=o,e[9]=a,e[10]=i,e[11]=0,e[12]=-(A*n+y*s+o*t),e[13]=-(l*n+r*s+a*t),e[14]=-(c*n+u*s+i*t),e[15]=1),d.createBuffer({size:64,usage:window.GPUBufferUsage.UNIFORM|window.GPUBufferUsage.COPY_DST})),A=(d.queue.writeBuffer(m,0,p),d.createBuffer({size:64,usage:window.GPUBufferUsage.UNIFORM|window.GPUBufferUsage.COPY_DST})),y=(d.queue.writeBuffer(A,0,g),d.createBuffer({size:64,usage:window.GPUBufferUsage.UNIFORM|window.GPUBufferUsage.COPY_DST}));return d.queue.writeBuffer(y,0,f),{modelMatrixBuffer:m,viewMatrixBuffer:A,projectMatrixBuffer:y,group:d.createBindGroup({label:"group0",layout:h.getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:m}},{binding:1,resource:{buffer:A}},{binding:2,resource:{buffer:y}}]})}}},{key:"_initTextureGroupInfo",value:function(e,t){var i=this.gpu.device,r=this.pipeline,a=i.createTexture({size:[e,t],format:"r8unorm",usage:window.GPUTextureUsage.TEXTURE_BINDING|window.GPUTextureUsage.COPY_DST|window.GPUTextureUsage.RENDER_ATTACHMENT}),n=i.createTexture({size:[e/2,t/2],format:"r8unorm",usage:window.GPUTextureUsage.TEXTURE_BINDING|window.GPUTextureUsage.COPY_DST|window.GPUTextureUsage.RENDER_ATTACHMENT});e=i.createTexture({size:[e/2,t/2],format:"r8unorm",usage:window.GPUTextureUsage.TEXTURE_BINDING|window.GPUTextureUsage.COPY_DST|window.GPUTextureUsage.RENDER_ATTACHMENT}),t=i.createSampler({magFilter:"linear",minFilter:"linear"}),i=i.createBindGroup({label:"group1",layout:r.getBindGroupLayout(1),entries:[{binding:0,resource:t},{binding:1,resource:a.createView()},{binding:2,resource:n.createView()},{binding:3,resource:e.createView()}]});return{yTexture:a,uTexture:n,vTexture:e,group:i}}},{key:"_drawScene",value:function(){var e=this.gpu.device,t=this.gpu.context,i=e.createCommandEncoder();t={colorAttachments:[{view:t.getCurrentTexture().createView(),clearValue:{r:0,g:0,b:0,a:0},loadOp:"clear",storeOp:"store"}],depthStencilAttachment:{view:this.depthTexture.createView(),depthClearValue:1,depthLoadOp:"clear",depthStoreOp:"store"}},t=i.beginRenderPass(t);t.setPipeline(this.pipeline),t.setBindGroup(0,this.matrixGroupInfo.group),t.setBindGroup(1,this.textureGroupInfo.group),t.setVertexBuffer(0,this.buffers.positionBuffer),t.setVertexBuffer(1,this.buffers.texpositionBuffer),t.setIndexBuffer(this.buffers.indexBuffer,"uint16"),t.drawIndexed(6),t.end(),e.queue.submit([i.finish()])}},{key:"renderYUV",value:function(e,t,i){var r,a,n;this.hasInited&&(r=i.slice(0,e*t),a=i.slice(e*t,e*t*5/4),i=i.slice(e*t*5/4,e*t*3/2),n=this.gpu.device,this.depthTexture||(this.depthTexture=this.gpu.device.createTexture({size:[e,t],format:"depth24plus",usage:window.GPUTextureUsage.RENDER_ATTACHMENT})),this.textureGroupInfo||(this.textureGroupInfo=this._initTextureGroupInfo(e,t)),n.queue.writeTexture({texture:this.textureGroupInfo.yTexture},r,{bytesPerRow:e,rowsPerImage:t},[e,t]),n.queue.writeTexture({texture:this.textureGroupInfo.uTexture},a,{bytesPerRow:e/2,rowsPerImage:t/2},[e/2,t/2]),n.queue.writeTexture({texture:this.textureGroupInfo.vTexture},i,{bytesPerRow:e/2,rowsPerImage:t/2},[e/2,t/2]),this._drawScene())}},{key:"clear",value:function(){}}])}(),Ut=function(e){function t(){var e;return A(this,t),e=p(this,t),e.videoInfo={width:null,height:null,encType:null},e.init=!1,e}return g(t,e),m(t,[{key:"destroy",value:function(){this.resetInit(),this.off()}},{key:"resetInit",value:function(){this.videoInfo={width:null,height:null,encType:null},this.init=!1}},{key:"getHasInit",value:function(){return this.init}},{key:"updateVideoInfo",value:function(e){st(e.encTypeCode)&&(this.videoInfo.encType=q[e.encTypeCode]),st(e.encType)&&(this.videoInfo.encType=e.encType),st(e.width)&&(this.videoInfo.width=e.width),st(e.height)&&(this.videoInfo.height=e.height),st(this.videoInfo.encType)&&st(this.videoInfo.height)&&st(this.videoInfo.width)&&!this.init&&(this.player.emit(U.videoInfo,this.videoInfo),this.init=!0)}},{key:"getVideoInfo",value:function(){return this.videoInfo}},{key:"clearView",value:function(){}},{key:"play",value:function(){}},{key:"pause",value:function(){}},{key:"getType",value:function(){return""}},{key:"getCanvasType",value:function(){return""}},{key:"isPlaying",value:function(){return!0}},{key:"addContentToCanvas",value:function(){}},{key:"getPlaybackQuality",value:function(){return null}}])}(It),Nt="object"==("undefined"===typeof window?"undefined":y(window))&&window.window===window?window:"object"==("undefined"===typeof self?"undefined":y(self))&&self.self===self?self:"object"==("undefined"===typeof r?"undefined":y(r))&&r.global===r?r:void 0;function zt(e,t,i){var r=new XMLHttpRequest;r.open("GET",e),r.responseType="blob",r.onload=function(){Wt(r.response,t,i)},r.onerror=function(){console.error("could not download file")},r.send()}function Gt(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch(e){}return 200<=t.status&&t.status<=299}function Ht(e){try{e.dispatchEvent(new MouseEvent("click"))}catch(It){var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var Vt=Nt.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),Wt="object"!=("undefined"===typeof window?"undefined":y(window))||window!==Nt?function(){}:"download"in HTMLAnchorElement.prototype&&!Vt?function(e,t,i){var r=Nt.URL||Nt.webkitURL,a=document.createElementNS("http://www.w3.org/1999/xhtml","a");t=t||e.name||"download",a.download=t,a.rel="noopener","string"==typeof e?(a.href=e,a.origin!==location.origin?Gt(a.href)?zt(e,t,i):Ht(a,a.target="_blank"):Ht(a)):(a.href=r.createObjectURL(e),setTimeout((function(){r.revokeObjectURL(a.href)}),4e4),setTimeout((function(){Ht(a)}),0))}:"msSaveOrOpenBlob"in navigator?function(e,t,i){var r;t=t||e.name||"download","string"==typeof e?Gt(e)?zt(e,t,i):((r=document.createElement("a")).href=e,r.target="_blank",setTimeout((function(){Ht(r)}))):navigator.msSaveOrOpenBlob((e=e,void 0===(i=i)?i={autoBom:!1}:"object"!=y(i)&&(console.warn("Deprecated: Expected third argument to be a object"),i={autoBom:!i}),i.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob([String.fromCharCode(65279),e],{type:e.type}):e),t)}:function(e,t,i,r){if((r=r||open("","_blank"))&&(r.document.title=r.document.body.innerText="downloading..."),"string"==typeof e)return zt(e,t,i);t="application/octet-stream"===e.type,i=/constructor/i.test(Nt.HTMLElement)||Nt.safari;var a,n,s,o=/CriOS\/[\d]+/.test(navigator.userAgent);(o||t&&i||Vt)&&"undefined"!=typeof FileReader?((a=new FileReader).onloadend=function(){var e=a.result;e=o?e:e.replace(/^data:[^;]*;/,"data:attachment/file;");r?r.location.href=e:location=e,r=null},a.readAsDataURL(e)):(n=Nt.URL||Nt.webkitURL,s=n.createObjectURL(e),r?r.location=s:location.href=s,r=null,setTimeout((function(){n.revokeObjectURL(s)}),4e4))},Kt=function(){function e(t,i){A(this,e),this.gl=t,i&&this.gl.pixelStorei(this.gl.UNPACK_ALIGNMENT,1),t=this._initShaderProgram(),this.shaderProgram=t,this.programInfo={program:t,attribLocations:{vertexPosition:this.gl.getAttribLocation(t,"aVertexPosition")},uniformLocations:{linewidth:this.gl.getUniformLocation(t,"uLineWidth"),rect:this.gl.getUniformLocation(t,"uRect"),linecolor:this.gl.getUniformLocation(t,"uLineColor"),resolution:this.gl.getUniformLocation(t,"uResolution")}},this.buffers=this._initBuffers()}return m(e,[{key:"destroy",value:function(){this.gl.deleteProgram(this.shaderProgram),this.gl.deleteBuffer(this.buffers.position),this.gl.deleteBuffer(this.buffers.indices),this.shaderProgram=null,this.buffers=null}},{key:"_initShaderProgram",value:function(){var e=this.gl,t=this._loadShader(e.VERTEX_SHADER,"\n attribute vec4 aVertexPosition;\n void main(void) {\n gl_Position = aVertexPosition;\n }\n "),i=this._loadShader(e.FRAGMENT_SHADER,"\n precision highp float;\n uniform float uLineWidth;\n uniform vec4 uRect;\n uniform vec3 uLineColor;\n uniform vec2 uResolution;\n\n\n float inBox(vec2 st, vec4 rect){\n\n vec2 bl = step(rect.xy,st);\n float pct = bl.x * bl.y;\n\n vec2 tr = step(st, rect.zw);\n pct *= tr.x * tr.y;\n\n return pct;\n }\n\n void main(void) {\n\n vec2 cur = gl_FragCoord.xy/uResolution;\n\n float xlinewidth = uLineWidth/uResolution.x;\n float ylinewidth = uLineWidth/uResolution.y;\n\n // vec4 outRect = uRect + vec4(-1.*xlinewidth/2., -1.*ylinewidth/2., xlinewidth/2., ylinewidth/2.);\n // vec4 inRect = uRect + vec4(xlinewidth/2., ylinewidth/2., -1.*xlinewidth/2., -1.*ylinewidth/2.);\n\n vec4 outRect = uRect + vec4(-1.*xlinewidth/2., -1.*ylinewidth/2., xlinewidth/2., ylinewidth/2.);\n vec4 inRect = uRect;\n\n float a = inBox(cur, outRect);\n float b = inBox(cur, inRect);\n\n gl_FragColor = mix(vec4(0., 0., 0., 0.), vec4(uLineColor.rgb, 1.0), a-b);\n\n }\n "),r=e.createProgram();return e.attachShader(r,t),e.attachShader(r,i),e.linkProgram(r),e.getProgramParameter(r,e.LINK_STATUS)?r:(console.log("Unable to initialize the shader program: "+e.getProgramInfoLog(r)),null)}},{key:"_loadShader",value:function(e,t){var i=this.gl;e=i.createShader(e);return i.shaderSource(e,t),i.compileShader(e),i.getShaderParameter(e,i.COMPILE_STATUS)?e:(console.log("An error occurred compiling the shaders: "+i.getShaderInfoLog(e)),i.deleteShader(e),null)}},{key:"_createTexture",value:function(){var e=this.gl,t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),t}},{key:"_initBuffers",value:function(){var e=this.gl,t=e.createBuffer(),i=(e.bindBuffer(e.ARRAY_BUFFER,t),e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,1,1,-1,1]),e.STATIC_DRAW),e.createBuffer());return e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,i),e.bufferData(e.ELEMENT_ARRAY_BUFFER,new Uint16Array([0,1,2,0,2,3]),e.STATIC_DRAW),{position:t,indices:i}}},{key:"_drawScene",value:function(e){var t=e,i=(e=t.canvasWidth,t.canvasHeight),r=t.rect,a=t.lineWidth,n=t.lineColor,s=this.gl,o=this.buffers,l=this.programInfo;s.viewport(0,0,e,i),s.enable(s.BLEND),s.blendFunc(s.SRC_ALPHA,s.ONE_MINUS_SRC_ALPHA),s.bindBuffer(s.ARRAY_BUFFER,o.position),s.vertexAttribPointer(l.attribLocations.vertexPosition,2,s.FLOAT,!1,0,0),s.enableVertexAttribArray(l.attribLocations.vertexPosition),s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,o.indices),s.useProgram(l.program),s.uniform2f(l.uniformLocations.resolution,e,i),s.uniform4f(l.uniformLocations.rect,r[0],r[1],r[2],r[3]),s.uniform1f(l.uniformLocations.linewidth,a),s.uniform3f(l.uniformLocations.linecolor,n[0],n[1],n[2]),s.drawElements(s.TRIANGLES,6,s.UNSIGNED_SHORT,0)}},{key:"drawBox",value:function(e){var t=e,i=(e=t.x,t.y),r=t.width,a=t.height,n=t.lineWidth,s=t.lineColor,o=t.canvasWidth,l=t.canvasHeight,c=(c=e/o,a=(l-i-a)/l,e=(e+r)/o,r=(l-i)/l,(i=new Bt(4))[0]=c,i[1]=a,i[2]=e,i[3]=r,i);s=Ot(1,0,0);this._drawScene({canvasWidth:o,canvasHeight:l,rect:c,lineWidth:n,lineColor:s})}}])}(),qt=function(e){function t(e){var i;A(this,t),i=p(this,t),i.player=e;var r=document.createElement("canvas");return r.style.position="absolute",r.style.top=0,r.style.left=0,i.$videoElement=r,e.$container.appendChild(i.$videoElement),i.context2D=null,i.contextGl=null,i.webglRender=null,i.webglRectRender=null,i.webGPURender=null,i.isWebglContextLost=!1,i.bitmaprenderer=null,i.renderType=null,i.controlHeight=0,i.proxyDestroyList=[],i.tempCanvasContentList=[],i._initCanvasRender(),i}return g(t,e),m(t,[{key:"destroy",value:function(){f(t,"destroy",this,3)([]),0 ")+this.fps),this.player.playback.isUseFpsRender&&this._sync()):this.player.debug.log("CanvasPlaybackLoader","setFps, same fps "+e)}},{key:"setStreamFps",value:function(e){this.player.debug.log("CanvasPlaybackLoader","setStreamFps",e),this._hasCalcFps=!0,this.streamFps=e,this.preFps=e,this.setFps(e)}},{key:"setRate",value:function(e){e!==this.playbackRate&&(this.playbackRate=e,this.player.playback.isUseFpsRender)&&this._sync()}},{key:"render$2",value:function(e){null===this._firstTimestamp&&(this._firstTimestamp=e.ts);var t={tfTs:e.ts-this._firstTimestamp,ts:e.ts,buffer:e.output};this.bufferList.push(t),this.startRender(),this.player.handleRender(),this.player.playback.updateStats({ts:e.ts,tfTs:t.tfTs})}},{key:"startRender",value:function(){for(;!(this.bufferList.length<=0);){var e=this.bufferList.shift();this._doRender(e.buffer)}}},{key:"pushData",value:function(e){null===this._firstTimestamp&&(this._firstTimestamp=e.ts);var t={tfTs:e.ts-this._firstTimestamp,ts:e.ts,buffer:e.output},i=this.player._opt.playbackConfig.isCacheBeforeDecodeForFpsRender;if(i||this.bufferSize>this.fps*this.playbackRate*2&&(this.player.debug.warn("CanvasPlaybackLoader","buffer size is "+this.bufferSize),this._doPlay()),this.bufferList.push(t),!this._hasCalcFps){var r=function(e){var t,i=e[0],r=null,a=1;if(0s){for(var l=0;lthis._frameCount)||(e=this.frameCount),this._frameCount-=e,this._position+=e}},{key:"receiveSamples",value:function(e){var t=1=e-1)break e;var o=i+2*n;r[a+2*s]=(1-this.slopeCount)*t[o]+this.slopeCount*t[o+2],r[a+2*s+1]=(1-this.slopeCount)*t[o+1]+this.slopeCount*t[o+3],s+=1,this.slopeCount+=this._rate}return this.prevSampleL=t[i+2*e-2],this.prevSampleR=t[i+2*e-1],s}}])}(ii);function ai(){}var ni=function(e){function t(e,i){var r;A(this,t);var a=2this._position)throw new RangeError("New position may not be greater than current position");var t=this.outputBufferPosition-(this._position-e);if(t<0)throw new RangeError("New position falls outside of history buffer");this.outputBufferPosition=t,this._position=e}},{key:"sourcePosition",get:function(){return this._sourcePosition},set:function(e){this.clear(),this._sourcePosition=e}},{key:"onEnd",value:function(){this.callback()}},{key:"fillInputBuffer",value:function(){var e=0t&&(t=i,e=r);return e}},{key:"seekBestOverlapPositionStereoQuick",value:function(){var e,t,i,r,a,n=0;for(this.preCalculateCorrelationReferenceStereo(),t=Number.MIN_VALUE,e=0,r=0,a=0;n<4;n+=1){for(var s=0;si[n][s]&&!((a=r+si[n][s])>=this.seekLength);)(i=this.calculateCrossCorrelationStereo(2*a,this.refMidBuffer))>t&&(t=i,e=a),s+=1;r=e}return e}},{key:"preCalculateCorrelationReferenceStereo",value:function(){for(var e,t,i=0;i=this.sampleReq;){e=this.seekBestOverlapPosition(),this._outputBuffer.ensureAdditionalCapacity(this.overlapLength),this.overlap(Math.floor(e)),this._outputBuffer.put(this.overlapLength),0<(t=this.seekWindowLength-2*this.overlapLength)&&this._outputBuffer.putBuffer(this._inputBuffer,e+this.overlapLength,t);var t=this._inputBuffer.startIndex+2*(e+this.seekWindowLength-this.overlapLength);this.midBuffer.set(this._inputBuffer.vector.subarray(t,t+2*this.overlapLength)),this.skipFract+=this.nominalSkip,e=Math.floor(this.skipFract),this.skipFract-=e,this._inputBuffer.receive(e)}}}])}(ii);function li(e,t){return 1e-10<(tthis.defaultPlaybackRate}},{key:"initProcessScriptNode",value:function(){var e=this;this.engineType=Re;var t=this.audioContext.createScriptProcessor(this.audioBufferSize,0,this.audioInfo.channels);t.onaudioprocess=function(t){t=t.outputBuffer,e.handleScriptNodeCallback(t)},t.connect(this.gainNode),this.scriptNode=t,this.gainNode.connect(this.audioContext.destination),this.gainNode.connect(this.mediaStreamAudioDestinationNode),this.hasInitScriptNode=!0}},{key:"initIntervalScriptNode",value:function(){var e=this;this.scriptStartTime=0,this.engineType=Ce;var t=1e3*this.audioBufferSize/this.audioContext.sampleRate;this.scriptNodeInterval=setInterval((function(){var t=e.audioContext.createBufferSource(),i=e.audioContext.createBuffer(e.audioInfo.channels,e.audioBufferSize,e.audioContext.sampleRate);e.handleScriptNodeCallback(i,(function(){e.scriptStartTimet?(this.player.debug.warn("AudioContext","bufferList length ".concat(this.bufferList.length," more than ").concat(t,", speed up")),e=this.defaultPlaybackRate+.1):this.bufferList.length",m(r.size)),e){try{i=c.createObjectURL(r)}catch(t){}"function"==typeof e.call?e.call(n,i):e(i)}a.autoWriteToDisk&&u((function(e){var t={};t[a.type+"Blob"]=e,x.Store(t)}))}else"function"==typeof e.call?e.call(n,""):e("")}e=e||function(){},f?"paused"===n.state?(n.resumeRecording(),setTimeout((function(){o(e)}),1)):("recording"===n.state||a.disableLogs||console.warn('Recording state should be: "recording", however current state is: ',n.state),a.disableLogs||console.log("Stopped recording "+a.type+" stream."),"gif"!==a.type?f.stop(t):(f.stop(),t()),h("stopped")):g()}function l(e){postMessage((new FileReaderSync).readAsDataURL(e))}function u(e,t){if(!e)throw"Pass a callback function over getDataURL.";var i,r=(t||f||{}).blob;r?"undefined"==typeof Worker||navigator.mozGetUserMedia?((i=new FileReader).readAsDataURL(r),i.onload=function(t){e(t.target.result)}):((i=function(e){try{var t=c.createObjectURL(new Blob([e.toString(),"this.onmessage = function (eee) {"+e.name+"(eee.data);}"],{type:"application/javascript"})),i=new Worker(t);return c.revokeObjectURL(t),i}catch(e){}}(l)).onmessage=function(t){e(t.data)},i.postMessage(r)):(a.disableLogs||console.warn("Blob encoder did not finish its job yet."),setTimeout((function(){u(e,t)}),1e3))}function d(e){e=e||0,"paused"!==n.state?"stopped"!==n.state&&(e>=n.recordingDuration?o(n.onRecordingStopped):(e+=1e3,setTimeout((function(){d(e)}),1e3))):setTimeout((function(){d(e)}),1e3)}function h(e){n&&(n.state=e,"function"==typeof n.onStateChanged.call?n.onStateChanged.call(n,e):n.onStateChanged(e))}var f,p='It seems that recorder is destroyed or "startRecording" is not invoked for '+a.type+" recorder.";function g(){!0!==a.disableLogs&&console.warn(p)}var y={startRecording:function(t){return a.disableLogs||console.log("RecordRTC version: ",n.version),(a=t?new i(e,t):a).disableLogs||console.log("started recording "+a.type+" stream."),f?(f.clearRecordedData(),f.record(),h("recording"),n.recordingDuration&&d()):s((function(){n.recordingDuration&&d()})),n},stopRecording:o,pauseRecording:function(){f?"recording"===n.state?(h("paused"),f.pause(),a.disableLogs||console.log("Paused recording.")):a.disableLogs||console.warn("Unable to pause the recording. Recording state: ",n.state):g()},resumeRecording:function(){f?"paused"===n.state?(h("recording"),f.resume(),a.disableLogs||console.log("Resumed recording.")):a.disableLogs||console.warn("Unable to resume the recording. Recording state: ",n.state):g()},initRecorder:s,setRecordingDuration:function(e,t){if(void 0===e)throw"recordingDuration is required.";if("number"!=typeof e)throw"recordingDuration must be a number.";return n.recordingDuration=e,n.onRecordingStopped=t||function(){},{onRecordingStopped:function(e){n.onRecordingStopped=e}}},clearRecordedData:function(){f?(f.clearRecordedData(),a.disableLogs||console.log("Cleared old recorded data.")):g()},getBlob:function(){if(f)return f.blob;g()},getDataURL:u,toURL:function(){if(f)return c.createObjectURL(f.blob);g()},getInternalRecorder:function(){return f},save:function(e){f?A(f.blob,e):g()},getFromDisk:function(e){f?t.getFromDisk(a.type,e):g()},setAdvertisementArray:function(e){a.advertisement=[];for(var t=e.length,i=0;i>=8;return new Uint8Array(t.reverse())}(e[a].id)),r.push(t(o)),r.push(n)}return new Blob(r,{type:"video/webm"})}function r(e){for(var t=0,i={};t 127 not supported";return[128|e.trackNum,e.timecode>>8,255&e.timecode,t].map((function(e){return String.fromCharCode(e)})).join("")+e.frame}({discardable:0,frame:e.data.slice(4),invisible:0,keyframe:1,lacing:0,trackNum:1,timecode:Math.round(t)});return t+=e.duration,{data:i,id:163}})))}(s,0,o)};a[1].data.push(c),s+=l}return i(a)}(e.map((function(e){var t=function(e){for(var t=e.RIFF[0].WEBP[0],i=t.indexOf("*"),r=0,a=[];r<4;r++)a[r]=t.charCodeAt(i+3+r);return{width:16383&(a[1]<<8|a[0]),height:16383&(a[3]<<8|a[2]),data:t,riff:e}}(r(atob(e.image.slice(23))));return t.duration=e.duration,t}))),postMessage(e)}t.Whammy=C;var x={init:function(){var e,t,i,r=this;function a(e){e.createObjectStore(r.dataStoreName)}function n(){var t=e.transaction([r.dataStoreName],"readwrite");function i(e){t.objectStore(r.dataStoreName).get(e).onsuccess=function(t){r.callback&&r.callback(t.target.result,e)}}r.videoBlob&&t.objectStore(r.dataStoreName).put(r.videoBlob,"videoBlob"),r.gifBlob&&t.objectStore(r.dataStoreName).put(r.gifBlob,"gifBlob"),r.audioBlob&&t.objectStore(r.dataStoreName).put(r.audioBlob,"audioBlob"),i("audioBlob"),i("videoBlob"),i("gifBlob")}"undefined"!=typeof indexedDB&&void 0!==indexedDB.open?(t=this.dbName||location.href.replace(/\/|:|#|%|\.|\[|\]/g,""),(i=indexedDB.open(t,1)).onerror=r.onError,i.onsuccess=function(){(e=i.result).onerror=r.onError,e.setVersion&&1!==e.version?e.setVersion(1).onsuccess=function(){a(e),n()}:n()},i.onupgradeneeded=function(e){a(e.target.result)}):console.error("IndexedDB API are not available in this browser.")},Fetch:function(e){return this.callback=e,this.init(),this},Store:function(e){return this.audioBlob=e.audioBlob,this.videoBlob=e.videoBlob,this.gifBlob=e.gifBlob,this.init(),this},onError:function(e){console.error(JSON.stringify(e,null,"\t"))},dataStoreName:"recordRTC",dbName:null};function I(e,t){"undefined"==typeof GIFEncoder&&((i=document.createElement("script")).src="https://www.webrtc-experiment.com/gif-recorder.js",(document.body||document.documentElement).appendChild(i)),t=t||{};var i,r,a=e instanceof CanvasRenderingContext2D||e instanceof HTMLCanvasElement,n=(this.record=function(){"undefined"!=typeof GIFEncoder&&u?(a||(t.width||(t.width=r.offsetWidth||320),t.height||(t.height=r.offsetHeight||240),t.video||(t.video={width:t.width,height:t.height}),t.canvas||(t.canvas={width:t.width,height:t.height}),s.width=t.canvas.width||320,s.height=t.canvas.height||240,r.width=t.video.width||320,r.height=t.video.height||240),(h=new GIFEncoder).setRepeat(0),h.setDelay(t.frameRate||200),h.setQuality(t.quality||10),h.start(),"function"==typeof t.onGifRecordingStarted&&t.onGifRecordingStarted(),f=o((function e(i){if(!0!==p.clearedRecordedData){if(n)return setTimeout((function(){e(i)}),100);f=o(e),i-d<90||(!a&&r.paused&&r.play(),a||c.drawImage(r,0,0,s.width,s.height),t.onGifPreview&&t.onGifPreview(s.toDataURL("image/png")),h.addFrame(c),d=i)}})),t.initCallback&&t.initCallback()):setTimeout(p.record,1e3)},!(this.stop=function(e){e=e||function(){},f&&l(f),this.blob=new Blob([new Uint8Array(h.stream().bin)],{type:"image/gif"}),e(this.blob),h.stream().bin=[]})),s=(this.pause=function(){n=!0},this.resume=function(){n=!1},this.clearRecordedData=function(){p.clearedRecordedData=!0,h&&(h.stream().bin=[])},this.name="GifRecorder",this.toString=function(){return this.name},document.createElement("canvas")),c=s.getContext("2d"),u=(a&&(e instanceof CanvasRenderingContext2D?s=(c=e).canvas:e instanceof HTMLCanvasElement&&(c=e.getContext("2d"),s=e)),!0);a||((r=document.createElement("video")).muted=!0,r.autoplay=!0,r.playsInline=!0,u=!1,r.onloadedmetadata=function(){u=!0},E(e,r),r.play());var d,h,f=null,p=this}function B(e,t){t=t||"multi-streams-mixer";var i=[],r=!1,a=document.createElement("canvas"),n=a.getContext("2d"),s=(a.style.opacity=0,a.style.position="absolute",a.style.zIndex=-1,a.style.top="-1000em",a.style.left="-1000em",a.className=t,(document.body||document.documentElement).appendChild(a),this.disableLogs=!1,this.frameInterval=10,this.width=360,this.height=240,this.useGainNode=!0,this),o=window.AudioContext;void 0===o&&("undefined"!=typeof webkitAudioContext&&(o=webkitAudioContext),"undefined"!=typeof mozAudioContext)&&(o=mozAudioContext),window.URL,"undefined"!=typeof navigator&&void 0===navigator.getUserMedia&&(void 0!==navigator.webkitGetUserMedia&&(navigator.getUserMedia=navigator.webkitGetUserMedia),void 0!==navigator.mozGetUserMedia)&&(navigator.getUserMedia=navigator.mozGetUserMedia);var l=window.MediaStream,c=(void 0!==(l=void 0===l&&"undefined"!=typeof webkitMediaStream?webkitMediaStream:l)&&void 0===l.prototype.stop&&(l.prototype.stop=function(){this.getTracks().forEach((function(e){e.stop()}))}),{});function u(){var e,t,n;r||(e=i.length,t=!1,n=[],i.forEach((function(e){e.stream||(e.stream={}),e.stream.fullcanvas?t=e:n.push(e)})),t?(a.width=t.stream.width,a.height=t.stream.height):n.length?(a.width=1>>32-e,this._current_word<<=e,this._current_word_bits_left-=e,t):(t=this._current_word_bits_left?this._current_word:0,t>>>=32-this._current_word_bits_left,e-=this._current_word_bits_left,this._fillCurrentWord(),e=Math.min(e,this._current_word_bits_left),i=this._current_word>>>32-e,this._current_word<<=e,this._current_word_bits_left-=e,t<>>e))return this._current_word<<=e,this._current_word_bits_left-=e,e;return this._fillCurrentWord(),e+this._skipLeadingZero()}},{key:"readUEG",value:function(){var e=this._skipLeadingZero();return this.readBits(e+1)-1}},{key:"readSEG",value:function(){var e=this.readUEG();return 1&e?e+1>>>1:-1*(e>>>1)}}])}(),wi=function(){function e(){A(this,e)}return m(e,null,[{key:"_ebsp2rbsp",value:function(e){for(var t=e,i=t.byteLength,r=new Uint8Array(i),a=0,n=0;n=this.buflen)return this.iserro=!0,0;this.iserro=!1,t=8>8-this.bufoff-t&255>>8-t),this.bufoff+=t,e-=t,8==this.bufoff&&(this.bufpos++,this.bufoff=0)}return i}},{key:"look",value:function(e){var t=this.bufpos,i=this.bufoff;e=this.read(e);return this.bufpos=t,this.bufoff=i,e}},{key:"read_golomb",value:function(){var e;for(e=0;0===this.read(1)&&!this.iserro;e++);return(1<>>24&255,b>>>16&255,b>>>8&255,255&b]),k=new Uint8Array(b+4);k.set(E,0),k.set(t.sps,4),t.sps=k}if(t.pps){var T=t.pps.byteLength,w=new Uint8Array([T>>>24&255,T>>>16&255,T>>>8&255,255&T]),S=new Uint8Array(T+4);S.set(w,0),S.set(t.pps,4),t.pps=S}return t}function Ri(e){var t=e.byteLength,i=new Uint8Array(4);i[0]=t>>>24&255,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t,t=new Uint8Array(t+4);return t.set(i,0),t.set(e,4),t}function Ci(e){return 31&e[0]}function Di(e){return e===$}function Li(e){return 7!==e&&8!==e&&!Di(e)}var xi=function(e){for(var t=e,i=t.byteLength,r=new Uint8Array(i),a=0,n=0;n>6&3,i.general_tier_flag=e[1]>>5&1,i.general_profile_idc=31&e[1],i.general_profile_compatibility_flags=e[2]<<24|e[3]<<16|e[4]<<8|e[5],i.general_constraint_indicator_flags=e[6]<<24|e[7]<<16|e[8]<<8|e[9],i.general_constraint_indicator_flags=i.general_constraint_indicator_flags<<16|e[10]<<8|e[11],i.general_level_idc=e[12],i.min_spatial_segmentation_idc=(15&e[13])<<8|e[14],i.parallelismType=3&e[15],i.chromaFormat=3&e[16],i.bitDepthLumaMinus8=7&e[17],i.bitDepthChromaMinus8=7&e[18],i.avgFrameRate=e[19]<<8|e[20],i.constantFrameRate=e[21]>>6&3,i.numTemporalLayers=e[21]>>3&7,i.temporalIdNested=e[21]>>2&1,i.lengthSizeMinusOne=3&e[21];for(var r=e[22],a=e.slice(23),n=0;n>1}var Pi=function(e){function t(e){var i;return A(this,t),i=p(this,t),i.player=e,i.fileName="",i._isRecording=!1,i._recordingTimestamp=0,i.recordingInterval=null,i.sps=null,i.pps=null,i.vps=null,i.codecId=null,i.mdatBytesLength=0,i.metaInfo={codecWidth:0,codecHeight:0,presentWidth:0,presentHeight:0,refSampleDuration:0,timescale:1e3,avcc:null,videoType:""},i}return g(t,e),m(t,[{key:"destroy",value:function(){this._reset()}},{key:"isH264",get:function(){return 7===this.codecId}},{key:"isH265",get:function(){return 12===this.codecId}},{key:"setFileName",value:function(e){this.fileName=e}},{key:"isRecording",get:function(){return this._isRecording}},{key:"recording",get:function(){return this._isRecording}},{key:"recordTime",get:function(){return this._recordingTimestamp}},{key:"startRecord",value:function(){}},{key:"handleAddNaluTrack",value:function(e,t,i,r){}},{key:"handleAddTrack",value:function(e){}},{key:"stopRecordAndSave",value:function(){}},{key:"startRecordingInterval",value:function(){}},{key:"stopRecordingInterval",value:function(){this.recordingInterval&&clearInterval(this.recordingInterval),this.recordingInterval=null}},{key:"getToTalByteLength",value:function(){}},{key:"_reset",value:function(){this.fileName="",this._isRecording=!1,this._recordingTimestamp=0,this.stopRecordingInterval(),this.sps=null,this.pps=null,this.vps=null,this.codecId=null,this.mdatBytesLength=0}},{key:"initMetaData",value:function(e,t){var i,r=e.slice(5);if(this.codecId=t,this.metaInfo.avcc=r,7===t)i=_i(r);else if(12===t){i=function(e){var t=23,i=e[23];if(32!=(63&i))return console.warn("parseHEVCDecoderVPSAndSPSAndPPS and vpsTag is "+i),{};t+=2,++t;i=e[27]|e[26]<<8;var r=(t+=2,e.slice(28,28+i)),a=e[t+=i];if(33!=(63&a))return console.warn("parseHEVCDecoderVPSAndSPSAndPPS and sps tag is "+a),{};t+=2;a=e[1+ ++t]|e[t]<<8;var n=e.slice(t+=2,t+a),s=e[t+=a];if(34!=(63&s))return console.warn("parseHEVCDecoderVPSAndSPSAndPPS and pps tag is "+s),{};t+=2;s=e[1+ ++t]|e[t]<<8,e=e.slice(t+=2,t+s),t=new Uint8Array([a>>>24&255,a>>>16&255,a>>>8&255,255&a]);var o=new Uint8Array([s>>>24&255,s>>>16&255,s>>>8&255,255&s]),l=new Uint8Array([i>>>24&255,i>>>16&255,i>>>8&255,255&i]);a=new Uint8Array(4+a),a.set(t,0),a.set(n,4),t=new Uint8Array(4+s),t.set(o,0),t.set(e,4),n=new Uint8Array(4+i);return n.set(l,0),n.set(r,4),{sps:a,pps:t,vps:n}}(r);var a=Ii(e);i=Object.assign(i,a)}i&&(i.vps&&(this.vps=i.vps),i.pps&&(this.pps=i.pps),i.sps&&(this.sps=i.sps),i.presentWidth&&(this.metaInfo.presentWidth=i.presentWidth),i.presentHeight&&(this.metaInfo.presentHeight=i.presentHeight),i.codecWidth&&(this.metaInfo.codecWidth=i.codecWidth),i.codecHeight&&(this.metaInfo.codecHeight=i.codecHeight),i.timescale&&(this.metaInfo.timescale=i.timescale),i.refSampleDuration&&(this.metaInfo.refSampleDuration=i.refSampleDuration),i.videoType)&&(this.metaInfo.videoType=i.videoType)}}])}(It),Mi=function(e){function t(e){var i;return A(this,t),i=p(this,t,[e]),i.totalByteLength=0,i._startRecordingTimestamp=null,e.debug.log("RecorderRTC","init"),i}return g(t,e),m(t,[{key:"_reset",value:function(){f(t,"_reset",this,3)([]),this.totalByteLength=0,this._startRecordingTimestamp=null,this.recorder&&(this.recorder.destroy(),this.recorder=null)}},{key:"destroy",value:function(){f(t,"destroy",this,3)([]),this._reset(),this.player.debug.log("RecorderRTC","destroy")}},{key:"getSeekableBlob",value:function(e){var t=new EBML.Reader,i=new EBML.Decoder,r=EBML.tools,a=new FileReader;return new Promise((function(n,s){a.onload=function(e){i.decode(this.result).forEach((function(e){t.read(e)})),t.stop();var a=r.makeMetadataSeekable(t.metadatas,t.duration,t.cues),s=this.result.slice(t.metadataSize);a=new Blob([a,s],{type:"video/webm"});n(a)},a.readAsArrayBuffer(e)}))}},{key:"startRecord",value:function(){var e=this,t=this.player.debug,i={type:"video",mimeType:"video/webm;codecs=h264",timeSlice:1e3,onTimeStamp:function(i){t.log("RecorderRTC","record timestamp :"+i),null===e._startRecordingTimestamp&&(e._startRecordingTimestamp=i),e._recordingTimestamp=(i-e._startRecordingTimestamp)/1e3},ondataavailable:function(i){e.totalByteLength+=i.size,t.log("RecorderRTC","ondataavailable",i.size)},disableLogs:!this.player._opt.debug};try{var r=null;if(this.player.getRenderType()===S?r=this.player.video.$videoElement.captureStream(25):this.player.video.mediaStream?r=this.player.video.mediaStream:this.player._opt.isHls||this.player._opt.useMSE||this.player._opt.useWCS?r=this.player.video.$videoElement.captureStream(25):this.player._opt.isWebrtc&&(r=this.player.webrtc.videoStream),r){if(this.player.audio&&this.player.audio.mediaStreamAudioDestinationNode&&this.player.audio.mediaStreamAudioDestinationNode.stream&&!this.player.audio.isStateSuspended()&&this.player.audio.hasAudio&&this.player._opt.hasAudio){var a=this.player.audio.mediaStreamAudioDestinationNode.stream;if(0>>24&255,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t,i.set(e,4);for(var s=8,o=0;o=Math.pow(2,32)-1?(s=16,(o=new Uint8Array(r+s)).set(new Uint8Array([0,0,0,1]),0),o.set(e.types.mdat,4),o.set(new Uint8Array([r+8>>>56&255,r+8>>>48&255,r+8>>>40&255,r+8>>>32&255,r+8>>>24&255,r+8>>>16&255,r+8>>>8&255,r+8&255]),8)):((o=new Uint8Array(r+s))[0]=r+8>>>24&255,o[1]=r+8>>>16&255,o[2]=r+8>>>8&255,o[3]=r+8&255,o.set(e.types.mdat,4));for(var l=0;l>>24&255,t>>>16&255,t>>>8&255,255&t,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3]))}},{key:"trak",value:function(t){return e.box(e.types.trak,e.tkhd(t),e.mdia(t))}},{key:"tkhd",value:function(t){var i=t.id,r=t.duration,a=t.presentWidth;t=t.presentHeight;return e.box(e.types.tkhd,new Uint8Array([0,0,0,15,206,186,253,168,206,186,253,168,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,a>>>8&255,255&a,0,0,t>>>8&255,255&t,0,0]))}},{key:"edts",value:function(t,i){return e.box(e.types.edts,e.elst(t,i))}},{key:"elst",value:function(t,i){for(var r=0,a=0;a>>24&255,r>>>16&255,r>>>8&255,255&r,255,255,255,255,0,1,0,0,n>>>24&255,n>>>16&255,n>>>8&255,255&n,0,0,0,0,0,1,0,0]))}},{key:"mdia",value:function(t){return e.box(e.types.mdia,e.mdhd(t),e.hdlr(t),e.minf(t))}},{key:"mdhd",value:function(t){var i=t.timescale/t.refSampleDuration;t=i*t.duration/t.timescale;return e.box(e.types.mdhd,new Uint8Array([0,0,0,0,206,186,253,168,206,186,253,168,i>>>24&255,i>>>16&255,i>>>8&255,255&i,t>>>24&255,t>>>16&255,t>>>8&255,255&t,85,196,0,0]))}},{key:"hdlr",value:function(t){var i=e.constants.HDLR_VIDEO;return e.box(e.types.hdlr,i)}},{key:"minf",value:function(t){var i=e.box(e.types.vmhd,e.constants.VMHD);return e.box(e.types.minf,i,e.dinf(),e.stbl(t))}},{key:"dinf",value:function(){return e.box(e.types.dinf,e.box(e.types.dref,e.constants.DREF))}},{key:"stbl",value:function(t){for(var i=t.samples,r=[{No:1,num:0,sampleDelte:1,chunkNo:1,duration:i[0].duration}],a=[i[0].duration],n=i.length,s=0;s>>24&255,i>>>16&255,i>>>8&255,255&i]),a=r.byteLength,n=new Uint8Array(a+8*i);n.set(r,0);for(var s=0;s>>24&255,t[s].num>>>16&255,t[s].num>>>8&255,255&t[s].num,t[s].sampleDelte>>>24&255,t[s].sampleDelte>>>16&255,t[s].sampleDelte>>>8&255,255&t[s].sampleDelte]),a),a+=8;return e.box(e.types.stts,n)}},{key:"stss",value:function(t){for(var i=[],r=t.length,a=0;a>>24&255,n>>>16&255,n>>>8&255,255&n]),o=s.byteLength,l=new Uint8Array(o+4*n);l.set(s,0);for(var c=0;c>>24&255,i[c]>>>16&255,i[c]>>>8&255,255&i[c]]),o),o+=4;return e.box(e.types.stss,l)}},{key:"stsc",value:function(t){var i=t.length,r=new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i]),a=r.byteLength,n=new Uint8Array(a+12*i);n.set(r,0);for(var s=0;s>>24&255,o>>>16&255,o>>>8&255,255&o,l>>>24&255,l>>>16&255,l>>>8&255,255&l,c>>>24&255,c>>>16&255,c>>>8&255,255&c]),a),a+=12}return e.box(e.types.stsc,n)}},{key:"stsz",value:function(t){var i=t.length,r=new Uint8Array([0,0,0,0,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i]),a=r.byteLength,n=new Uint8Array(a+4*i);n.set(r,0);for(var s=0;s>>24&255,o>>>16&255,o>>>8&255,255&o]),a),a+=4}return e.box(e.types.stsz,n)}},{key:"stco",value:function(t,i){return i=i[0].chunkOffset,e.box(e.types.stco,new Uint8Array([0,0,0,0,0,0,0,1,i>>>24&255,i>>>16&255,i>>>8&255,255&i]))}},{key:"stsd",value:function(t){return"audio"===t.type?"mp3"===t.codec?e.box(e.types.stsd,e.constants.STSD_PREFIX,e.mp3(t)):e.box(e.types.stsd,e.constants.STSD_PREFIX,e.mp4a(t)):"avc"===t.videoType?e.box(e.types.stsd,e.constants.STSD_PREFIX,e.avc1(t)):e.box(e.types.stsd,e.constants.STSD_PREFIX,e.hvc1(t))}},{key:"mp3",value:function(t){var i=t.channelCount;t=t.audioSampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,i,0,16,0,0,0,0,t>>>8&255,255&t,0,0]);return e.box(e.types[".mp3"],i)}},{key:"mp4a",value:function(t){var i=t.channelCount,r=t.audioSampleRate;i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,i,0,16,0,0,0,0,r>>>8&255,255&r,0,0]);return e.box(e.types.mp4a,i,e.esds(t))}},{key:"esds",value:function(t){t=t.config||[];var i=t.length;i=new Uint8Array([0,0,0,0,3,23+i,0,1,0,4,15+i,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([i]).concat(t).concat([6,1,2]));return e.box(e.types.esds,i)}},{key:"avc1",value:function(t){var i=t.avcc,r=t.codecWidth;t=t.codecHeight,r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,r>>>8&255,255&r,t>>>8&255,255&t,0,72,0,0,0,72,0,0,0,0,0,0,0,1,13,106,101,115,115,105,98,117,99,97,45,112,114,111,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return e.box(e.types.avc1,r,e.box(e.types.avcC,i))}},{key:"hvc1",value:function(t){var i=t.avcc,r=t.codecWidth;t=t.codecHeight,r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,r>>>8&255,255&r,t>>>8&255,255&t,0,72,0,0,0,72,0,0,0,0,0,0,0,1,13,106,101,115,115,105,98,117,99,97,45,112,114,111,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return e.box(e.types.hvc1,r,e.box(e.types.hvcC,i))}},{key:"mvex",value:function(t){return e.box(e.types.mvex,e.trex(t))}},{key:"trex",value:function(t){return t=t.id,t=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]),e.box(e.types.trex,t)}},{key:"moof",value:function(t,i){return e.box(e.types.moof,e.mfhd(t.sequenceNumber),e.traf(t,i))}},{key:"mfhd",value:function(t){return t=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t]),e.box(e.types.mfhd,t)}},{key:"traf",value:function(t,i){var r=t.id,a=(r=e.box(e.types.tfhd,new Uint8Array([0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r])),i=e.box(e.types.tfdt,new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i])),e.sdtp(t));t=e.trun(t,a.byteLength+16+16+8+16+8+8);return e.box(e.types.traf,r,i,t,a)}},{key:"sdtp",value:function(t){for(var i=t.samples||[],r=i.length,a=new Uint8Array(4+r),n=0;n>>24&255,a>>>16&255,a>>>8&255,255&a,(i+=8+t)>>>24&255,i>>>16&255,i>>>8&255,255&i],0);for(var s=0;s>>24&255,o>>>16&255,o>>>8&255,255&o,l>>>24&255,l>>>16&255,l>>>8&255,255&l,c.isLeading<<2|c.dependsOn,c.isDependedOn<<6|c.hasRedundancy<<4|c.isNonSync,0,0,u>>>24&255,u>>>16&255,u>>>8&255,255&u],12+16*s)}return e.box(e.types.trun,n)}},{key:"mdat",value:function(t){return e.box(e.types.mdat,t)}}])}();Oi.init();var Fi=function(e){function t(e){var i;return A(this,t),i=p(this,t,[e]),i.tagName="recorderMP4",i.totalDuration=0,i.totalByteLength=0,i.bufferList=[],i.cacheTrack={},i.sequenceNumber=0,e.debug.log(i.tagName,"init"),i}return g(t,e),m(t,[{key:"destroy",value:function(){f(t,"destroy",this,3)([]),this._reset(),this.player.debug.log(this.tagName,"destroy")}},{key:"_reset",value:function(){f(t,"_reset",this,3)([]),this.totalDuration=0,this.totalByteLength=0,this.sequenceNumber=0,this.cacheTrack={},this.bufferList=[]}},{key:"startRecord",value:function(){var e=this.player.debug;this._isRecording=!0,this.player.emit(U.recording,!0),e.log(this.tagName,"start recording"),this.player.emit(U.recordStart),this.startRecordingInterval()}},{key:"startRecordingInterval",value:function(){var e=this;this.stopRecordingInterval(),this.recordingInterval=window.setInterval((function(){e.player.emit(U.recordingTimestamp,e.getTotalDuration())}),1e3)}},{key:"formatFmp4Track",value:function(e,t,i,r){return{id:1,sequenceNumber:++this.sequenceNumber,size:e.byteLength,dts:i,cts:r,isKeyframe:t,data:e,duration:0,flags:{isLeading:0,dependsOn:t?2:1,isDependedOn:t?1:0,hasRedundancy:0,isNonSync:t?0:1}}}},{key:"handleAddNaluTrack",value:function(e,t,i,r){this.cacheTrack.id&&i>=this.cacheTrack.dts?(this.cacheTrack.duration=i-this.cacheTrack.dts,this.handleAddFmp4Track(this.cacheTrack)):this.cacheTrack={},this.cacheTrack=this.formatFmp4Track(e,t,i,r)}},{key:"handleAddFmp4Track",value:function(e){if(this.isRecording)if(null!==this.sps&&null!==this.pps||!this.isH264)if(null!==this.sps&&null!==this.pps&&null!==this.vps||!this.isH265){var t=Object.assign({},e),i=(t.pts=t.dts+t.cts,t.data);if(t.isKeyframe)if(this.isH264){var r=new Uint8Array(this.sps.byteLength+this.pps.byteLength);r.set(this.sps,0),r.set(this.pps,this.sps.byteLength);var a=new Uint8Array(r.byteLength+i.byteLength);a.set(r,0),a.set(i,r.byteLength),t.data=a}else if(this.isH265){var n=new Uint8Array(this.sps.byteLength+this.pps.byteLength+this.vps.byteLength);n.set(this.vps,0),n.set(this.sps,this.vps.byteLength),n.set(this.pps,this.vps.byteLength+this.sps.byteLength),a=new Uint8Array(n.byteLength+i.byteLength),a.set(n,0),a.set(i,n.byteLength),t.data=a}t.size=t.data.byteLength,this.totalDuration+=t.duration,this.totalByteLength+=t.data.byteLength,t.duration=0,t.originalDts=t.dts,delete t.id,delete t.sequenceNumber,this.bufferList.push(t)}else this.player.debug.error(this.tagName,"handleAddFmp4Track, is h265 and this.sps or this.pps or this.vps is null ");else this.player.debug.error(this.tagName,"handleAddFmp4Track, is h264 and this.sps or this.pps is null ");else this.player.debug.error(this.tagName,"handleAddFmp4Track, isRecording is false ")}},{key:"getTotalDuration",value:function(){return this.totalDuration/1e3}},{key:"getType",value:function(){return v}},{key:"getToTalByteLength",value:function(){return this.totalByteLength}},{key:"stopRecordAndSave",value:function(){var e=this,t=0=this.player._opt.playbackForwardMaxRateDecodeIFrame?i&&(this.player.debug.log("decoderWorker","current rate is ".concat(this.player.video.rate,",only decode i frame")),this._decodeVideoNoDelay(e,t,i)):1===this.player.video.rate?this._decodeVideo(e,t,i):this._decodeVideoNoDelay(e,t,i))}},{key:"_decodeVideo",value:function(e,t,i){t={type:2,ts:Math.max(t,0),isIFrame:i},this.decoderWorker.postMessage({cmd:"decode",buffer:e,options:t},[e.buffer])}},{key:"_decodeVideoNoDelay",value:function(e,t,i){this.decoderWorker.postMessage({cmd:"videoDecode",buffer:e,ts:Math.max(t,0),isIFrame:i},[e.buffer])}},{key:"decodeAudio",value:function(e,t){this.player._opt.playType===n?this.player._opt.useWCS||this.player._opt.useMSE?this._decodeAudioNoDelay(e,t):this._decodeAudio(e,t):this.player._opt.playType===s&&(1===this.player.video.rate?this._decodeAudio(e,t):this._decodeAudioNoDelay(e,t))}},{key:"_decodeAudio",value:function(e,t){t={type:1,ts:Math.max(t,0)},this.decoderWorker.postMessage({cmd:"decode",buffer:e,options:t},[e.buffer])}},{key:"_decodeAudioNoDelay",value:function(e,t){this.decoderWorker.postMessage({cmd:"audioDecode",buffer:e,ts:Math.max(t,0)},[e.buffer])}},{key:"updateWorkConfig",value:function(e){this.decoderWorker&&this.decoderWorker.postMessage({cmd:"updateConfig",key:e.key,value:e.value})}},{key:"workerFetchStream",value:function(e){var t=this.player["_opt"];t={protocol:t.protocol,isFlv:t.isFlv};this.decoderWorker.postMessage({cmd:"fetchStream",url:e,opt:JSON.stringify(t)})}},{key:"clearWorkBuffer",value:function(){this.decoderWorker.postMessage({cmd:"clearBuffer",needClear:0e?1e3 timestamp is ").concat(e," more than ").concat(this.preDelayTimestamp-e,"ms")):this.firstTimestamp?e&&(t=Date.now()-this.startTimestamp,(i=e-this.firstTimestamp)<=t?(this.isStreamTsMoreThanLocal=!1,this.delay=t-i):(this.isStreamTsMoreThanLocal=!0,this.delay=i-t)):(this.firstTimestamp=e,this.startTimestamp=Date.now(),this.delay=-1),this.preDelayTimestamp=e,this.delay):-1}},{key:"getDelayNotUpdateDelay",value:function(e){if(e&&this.player.isDemuxDecodeFirstIIframeInit())if(this.preDelayTimestamp&&1e3 timestamp is ").concat(e," more than ").concat(this.preDelayTimestamp-e,"ms"));else if(this.firstTimestamp){var t,i=-1;return e&&(t=Date.now()-this.startTimestamp,e-=this.firstTimestamp,i=e<=t?t-e:e-t),i}return-1}},{key:"resetDelay",value:function(){this.firstTimestamp=null,this.startTimestamp=null,this.delay=-1,this.dropping=!1}},{key:"resetAllDelay",value:function(){this.resetDelay(),this.preDelayTimestamp=null}},{key:"initInterval",value:function(){var e=this;this.player.debug.log("CommonDemux","init Interval"),this._loop(),this.stopId=setInterval((function(){var t=(new Date).getTime();e.preLoopTimestamp||(e.preLoopTimestamp=t),t-=e.preLoopTimestamp;100i+t&&r?this.hasIframeInBufferList()?(this.player.debug.warn("CommonDemux","_loop delay is ".concat(this.delay,", set dropping is true")),this.resetAllDelay(),this.dropping=!0):(this.bufferList.shift(),this._doDecoderDecode(e)):this.delay>t?(this.bufferList.shift(),this._doDecoderDecode(e)):this.delay<0&&this.player.debug.error("CommonDemux","_loop delay is ".concat(this.delay," bufferList is ")+this.bufferList);else-1!==this.delay&&this.player.debug.log("CommonDemux","loop() bufferList is empty and reset delay"),this.resetAllDelay()}},{key:"_doDecode",value:function(e,t,i,r){var a=this.player,s={ts:i,cts:4=2*this.preTimestampDuration-5&&this.player.debug.error("CommonDemux","pushBuffer video\n ts is ".concat(t.ts,", preTimestamp is ").concat(this.preTimestamp,",\n diff is ").concat(s," and preTimestampDuration is ").concat(this.preTimestampDuration,"\n maybe trigger black screen or flower screen"))}if(0l&&this.delay ").concat(r+i,", bufferList is ").concat(this.bufferList.length,", delay is ").concat(this.delay," and dropBuffer$2()")),this.dropBuffer$2()):o>l&&this.delay ").concat(r+i,",bufferList is ").concat(this.bufferList.length,", delay is ").concat(this.delay," and dropBuffer$2()")),this.dropBuffer$2())}2===t.type&&(0this.player._opt.networkDelay&&this.player._opt.playType===n&&(this.player.debug.warn("CommonDemux","delay is more than networkDelay and now dts:".concat(e,",start dts is ").concat(this.bufferStartDts,", vs start is ").concat(t,",local diff is ").concat(i," ,delay is ").concat(r,", _opt.networkDelay is ")+this.player._opt.networkDelay),this.player.emit(U.networkDelayTimeout,r)),this.player.updateStats({netBuf:r}))}},{key:"calcIframeIntervalTimestamp",value:function(e){var t;null===this.preIframeTs?this.preIframeTs=e:this.preIframeTs>24&255,e>>16&255,e>>8&255,255&e]),this.flush()}},{key:"writeU16",value:function(e){this.malloc(2).set([e>>8&255,255&e]),this.flush()}},{key:"writeU8",value:function(e){this.malloc(1)[0]=e,this.flush()}},{key:"malloc",value:function(e){if(this.buffer){var t=this.buffer.length,i=t+e;if(i<=this.buffer.buffer.byteLength-this.buffer.byteOffset)this.buffer=new Uint8Array(this.buffer.buffer,this.buffer.byteOffset,i);else{var r=new Uint8Array(i);r.set(this.buffer),this.buffer=r}return this.buffer.subarray(t,i)}return this.buffer=new Uint8Array(e),this.buffer}}])}();Ki.U32=Gi,Ki.U16=Hi,Ki.U8=Vi;var qi,Qi="application/json, text/javascript",Yi="text/html",Ji=/^(?:text|application)\/xml/i,Xi=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,$i=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,Zi=/^\s*$/,er={},tr={},ir="",rr={type:"GET",beforeSend:ar,success:ar,error:ar,complete:ar,context:null,xhr:function(){return new window.XMLHttpRequest},accepts:{json:Qi,xml:"application/xml, text/xml",html:Yi,text:"text/plain","*":"*/".concat("*")},crossDomain:!1,timeout:0,username:null,password:null,processData:!0,promise:ar,contentType:"application/x-www-form-urlencoded; charset=UTF-8"};function ar(){}function nr(e,t){"object"==y(e)&&(t=e,e=void 0);var i,r=hr({},t=t||{});for(i in rr)void 0===r[i]&&(r[i]=rr[i]);try{var a={},n=new Promise((function(e,t){a.resolve=e,a.reject=t}));n.resolve=a.resolve,n.reject=a.reject,r.promise=n}catch(e){r.promise={resolve:ar,reject:ar}}n=$i.exec(window.location.href.toLowerCase())||[];var s,o,l,c,u,d=(r.url=((e||r.url||window.location.href)+"").replace(/#.*$/,"").replace(/^\/\//,n[1]+"//"),r.url),h=(r.crossDomain||(r.crossDomain=/^([\w-]+:)?\/\/([^\/]+)/.test(r.url)&&RegExp.$2!==window.location.href),r.dataType);if("jsonp"===h)return/=\?/.test(r.url)||(n=(r.jsonp||"callback")+"=?",r.url=ur(r.url,n)),l=(s=r).jsonpCallback||"jsonp"+gr(),c=window.document.createElement("script"),u={abort:function(){l in window&&(window[l]=ar)}},n=window.document.getElementsByTagName("head")[0]||window.document.documentElement,c.onerror=function(e){e=e,window.clearTimeout(o),u.abort(),lr(e.type,u,e.type,s),f()},window[l]=function(e){window.clearTimeout(o),sr(e,u,s),f()},dr(s),c.src=s.url.replace(/=\?/,"="+l),c.src=ur(c.src,"_="+(new Date).getTime()),c.async=!0,s.scriptCharset&&(c.charset=s.scriptCharset),n.insertBefore(c,n.firstChild),0>4]+Er[15&r])}return t.join("")}}),wr={16:10,24:12,32:14},Sr=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],_r=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],Rr=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],Cr=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],Dr=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],Lr=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],xr=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],Ir=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],Br=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],Pr=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],Mr=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],Or=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],Fr=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],jr=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],Ur=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function Nr(e){for(var t=[],i=0;i>2][t%4]=n[t],this._Kd[e-i][t%4]=n[t];for(var s,o=0,l=a;l>16&255]<<24^_r[s>>8&255]<<16^_r[255&s]<<8^_r[s>>24&255]^Sr[o]<<24,o+=1,8!=a)for(t=1;t>8&255]<<8^_r[s>>16&255]<<16^_r[s>>24&255]<<24,t=a/2+1;t>2][u=l%4]=n[t],this._Kd[e-c][u]=n[t++],l++}for(var c=1;c>24&255]^Fr[s>>16&255]^jr[s>>8&255]^Ur[255&s]},zr.prototype.encrypt=function(e){if(16!=e.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var t=this._Ke.length-1,i=[0,0,0,0],r=Nr(e),a=0;a<4;a++)r[a]^=this._Ke[0][a];for(var n=1;n>24&255]^Dr[r[(a+1)%4]>>16&255]^Lr[r[(a+2)%4]>>8&255]^xr[255&r[(a+3)%4]]^this._Ke[n][a];r=i.slice()}var s,o=vr(16);for(a=0;a<4;a++)s=this._Ke[t][a],o[4*a]=255&(_r[r[a]>>24&255]^s>>24),o[4*a+1]=255&(_r[r[(a+1)%4]>>16&255]^s>>16),o[4*a+2]=255&(_r[r[(a+2)%4]>>8&255]^s>>8),o[4*a+3]=255&(_r[255&r[(a+3)%4]]^s);return o},zr.prototype.decrypt=function(e){if(16!=e.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var t=this._Kd.length-1,i=[0,0,0,0],r=Nr(e),a=0;a<4;a++)r[a]^=this._Kd[0][a];for(var n=1;n>24&255]^Br[r[(a+3)%4]>>16&255]^Pr[r[(a+2)%4]>>8&255]^Mr[255&r[(a+1)%4]]^this._Kd[n][a];r=i.slice()}var s,o=vr(16);for(a=0;a<4;a++)s=this._Kd[t][a],o[4*a]=255&(Rr[r[a]>>24&255]^s>>24),o[4*a+1]=255&(Rr[r[(a+3)%4]>>16&255]^s>>16),o[4*a+2]=255&(Rr[r[(a+2)%4]>>8&255]^s>>8),o[4*a+3]=255&(Rr[255&r[(a+1)%4]]^s);return o},Gr.prototype.encrypt=function(e){if((e=yr(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=vr(e.length),i=vr(16),r=0;rNumber.MAX_SAFE_INTEGER)throw new Error("integer value out of safe range");for(var t=15;0<=t;--t)this._counter[t]=e%256,e=parseInt(e/256)},Kr.prototype.setBytes=function(e){if(16!=(e=yr(e,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=e},Kr.prototype.increment=function(){for(var e=15;0<=e;e--){if(255!==this._counter[e]){this._counter[e]++;break}this._counter[e]=0}},qr.prototype.decrypt=qr.prototype.encrypt=function(e){for(var t=yr(e,!0),i=0;i>4&15,h=1==d,1!=d&&2!=d&&a.debug.warn("FlvDemux","frameType is ".concat(d," is not keyFrame or interFrame")),h&&this.calcIframeIntervalTimestamp(l),0a)break;var s=e[n+4];if(1==(s&=31)||5==s){var o=e.slice(n+4+2,n+4+r),l=new Qr.ModeOfOperation.ctr(t,new Qr.Counter(i));s=l.decrypt(o),l=null,e.set(s,n+4+2)}n=n+4+r}return e}(u,a._opt.cryptoKey,a._opt.cryptoIV):a.debug.error("FlvDemux","cryptoKey.length is ".concat(a._opt.cryptoKey&&a._opt.cryptoKey.byteLength," or cryptoIV.length is ").concat(a._opt.cryptoIV&&a._opt.cryptoIV.byteLength," null"))),this._doDecode(p,2,l,h,f))),e.abrupt("break",26);case 25:a.debug.log("FlvDemux","demux() type is "+s);case 26:e.next=3;break;case 28:case"end":return e.stop()}}),e,this)}))},{key:"close",value:function(){this.input=null}},{key:"getInputByteLength",value:function(){var e=0;return this.input&&this.input.buffer?this.input.buffer.byteLength:e}}])}(Ni),Jr=function(e){function t(e){var i;return A(this,t),i=p(this,t,[e]),e.debug.log("M7sDemux","init"),i}return g(t,e),m(t,[{key:"destroy",value:function(){f(t,"destroy",this,3)([]),this.player.debug.log("M7sDemux","destroy")}},{key:"dispatch",value:function(e){var t=this.player,i=new DataView(e),r=i.getUint8(0),a=i.getUint32(1,!1);switch(r){case 1:if(t._opt.hasAudio){var n=new Uint8Array(e,5);t.updateStats({abps:n.byteLength}),0>4==1,l=a;this.player._opt.useMSE&&st(this.player.mseDecoder.firstRenderTime)&&(l=a-this.player.mseDecoder.firstRenderTime),t.updateStats({vbps:s.byteLength,dts:l}),0>1)&&33!=i&&34!=i?t:Y}(i)),this.streamVideoType===Q){var r=this.handleAddNaluStartCode(i),a=this.extractNALu(r);if(0===a.length)this.player.debug.warn(this.name,"handleVideoNalu","naluList.length === 0");else{var n=[];if(a.forEach((function(e){var i=Ci(e);8===i||7===i?t.handleVideoH264Nalu(e):Li(i)&&n.push(e)})),1===n.length)this.handleVideoH264Nalu(n[0]);else{var s=function(e){if(0===e.length)return!1;for(var t=Ci(e[0]),i=1;i>6,a=(60&i[2])>>2,n=(1&i[2])<<2|(192&i[3])>>6,s=new Uint8Array([175,0,r<<3|(14&a)>>1,(1&a)<<7|n<<3]);this.isSendAACSeqHeader=!0,this._doDecode(s,1,0,!1,0)}var o=this.getNaluAudioDts(),l=new Uint8Array(t.length+2);l.set([175,1],0),l.set(t,2),this._doDecode(l,1,o,!1,0)}}},{key:"handleAudioG711ANalu",value:function(e){var t,i;!e||e.byteLength<1||(this.streamAudioType||(this.streamAudioType=J.ALAW),e=new Uint8Array(e),t=this.getNaluAudioDts(),(i=new Uint8Array(e.length+1)).set([114],0),i.set(e,1),this._doDecode(i,1,t,!1,0))}},{key:"handleAudioG711UNalu",value:function(e){var t,i;!e||e.byteLength<1||(this.streamAudioType||(this.streamAudioType=J.MULAW),e=new Uint8Array(e),t=this.getNaluAudioDts(),(i=new Uint8Array(e.length+1)).set([130],0),i.set(e,1),this._doDecode(i,1,t,!1,0))}},{key:"handleVideoH264Nalu",value:function(e){var t,i,r,a=Ci(e);switch(a){case 7:this.sps=e;break;case 8:this.pps=e}if(this.isSendSeqHeader)if(Li(a)){this.player._times.demuxStart||(this.player._times.demuxStart=Ue());var n=5===a,s=this.getNaluDts(),o=(t=e,(i=[])[0]=n?23:39,i[1]=1,i[2]=0,i[3]=0,i[4]=0,i[5]=t.byteLength>>24&255,i[6]=t.byteLength>>16&255,i[7]=t.byteLength>>8&255,i[8]=255&t.byteLength,(r=new Uint8Array(i.length+t.byteLength)).set(i,0),r.set(t,i.length),r);this.player.updateStats({vbps:o.byteLength,dts:s}),n&&this.calcIframeIntervalTimestamp(s),this._doDecode(o,2,s,n,0)}else this.player.debug.warn(this.name,"handleVideoH264Nalu is avc seq head nalType is "+a);else if(this.sps&&this.pps){this.isSendSeqHeader=!0;var l=function(e){var t=e,i=t.sps,r=t.pps,a=8+i.byteLength+1+2+r.byteLength,n=!1,s=(e=wi.parseSPS$2(i),66!==i[3]&&77!==i[3]&&88!==i[3]&&(n=!0,a+=4),new Uint8Array(a)),o=(s[0]=1,s[1]=i[1],s[2]=i[2],s[3]=i[3],s[4]=255,s[5]=225,i.byteLength),l=(s[6]=o>>>8,s[7]=255&o,8);s.set(i,8),s[l+=o]=1,o=r.byteLength,s[l+1]=o>>>8,s[l+2]=255&o,s.set(r,l+3),l+=3+o,n&&(s[l]=252|e.chroma_format_idc,s[l+1]=248|e.bit_depth_luma-8,s[l+2]=248|e.bit_depth_chroma-8,s[l+3]=0,l+=4),o=[23,0,0,0,0],e=new Uint8Array(o.length+s.byteLength);return e.set(o,0),e.set(s,o.length),e}({sps:this.sps,pps:this.pps});this._doDecode(l,2,0,!0,0)}}},{key:"handleVideoH264NaluList",value:function(e,t,i){if(this.isSendSeqHeader){this.player._times.demuxStart||(this.player._times.demuxStart=Ue());var r=this.getNaluDts(),a=(e=e.reduce((function(e,t){e=Ri(e),t=Ri(t);var i=new Uint8Array(e.byteLength+t.byteLength);return i.set(e,0),i.set(t,e.byteLength),i})),(n=[])[0]=t?23:39,n[1]=1,n[2]=0,n[3]=0,n[4]=0,(s=new Uint8Array(n.length+e.byteLength)).set(n,0),s.set(e,n.length),s);this.player.updateStats({vbps:a.byteLength,dts:r}),t&&this.calcIframeIntervalTimestamp(r),this._doDecode(a,2,r,t,0)}else this.player.debug.warn(this.name,"handleVideoH264NaluList isSendSeqHeader is false");var n,s}},{key:"handleVideoH265Nalu",value:function(e){var t,i,r=Bi(e);switch(r){case 32:this.vps=e;break;case 33:this.sps=e;break;case 34:this.pps=e}if(this.isSendSeqHeader){if(!(32<=r&&r<=40)){this.player._times.demuxStart||(this.player._times.demuxStart=Ue());var a=16<=r&&r<=21,n=this.getNaluDts(),s=(r=e,(t=[])[0]=a?28:44,t[1]=1,t[2]=0,t[3]=0,t[4]=0,t[5]=r.byteLength>>24&255,t[6]=r.byteLength>>16&255,t[7]=r.byteLength>>8&255,t[8]=255&r.byteLength,(i=new Uint8Array(t.length+r.byteLength)).set(t,0),i.set(r,t.length),i);this.player.updateStats({vbps:s.byteLength,dts:n}),a&&this.calcIframeIntervalTimestamp(n),this._doDecode(s,2,n,a,0)}}else if(this.vps&&this.sps&&this.pps){this.isSendSeqHeader=!0;var o=function(e){var t=e,i=(e=t.vps,t.pps),r=t.sps,a={configurationVersion:1},n=function(e){return e=xi(e),e=new Ti(e),e.readByte(),e.readByte(),e.readBits(4),e.readBits(2),e.readBits(6),{num_temporal_layers:e.readBits(3)+1,temporal_id_nested:e.readBool()}}(e),s=function(e){var t=xi(e),i=new Ti(t);i.readByte(),i.readByte();i.readBits(4);for(var r=i.readBits(3),a=(e=(i.readBool(),i.readBits(2)),i.readBool()),n=i.readBits(5),s=i.readByte(),o=i.readByte(),l=i.readByte(),c=i.readByte(),u=i.readByte(),d=i.readByte(),h=i.readByte(),f=i.readByte(),p=i.readByte(),g=i.readByte(),m=i.readByte(),A=[],y=[],v=0;v>8,s[14]=255&a.min_spatial_segmentation_idc,s[15]=252|3&a.parallelismType,s[16]=252|3&a.chroma_format_idc,s[17]=248|7&a.bit_depth_luma_minus8,s[18]=248|7&a.bit_depth_chroma_minus8,s[19]=0,s[20]=0,s[21]=(3&a.constant_frame_rate)<<6|(7&a.num_temporal_layers)<<3|(a.temporal_id_nested?1:0)<<2|3,s[22]=3,s[23]=160,s[24]=0,s[25]=1,s[26]=(65280&e.byteLength)>>8,s[27]=(255&e.byteLength)>>0,s.set(e,28),s[23+(5+e.byteLength)+0]=161,s[23+(5+e.byteLength)+1]=0,s[23+(5+e.byteLength)+2]=1,s[23+(5+e.byteLength)+3]=(65280&r.byteLength)>>8,s[23+(5+e.byteLength)+4]=(255&r.byteLength)>>0,s.set(r,23+(5+e.byteLength)+5),s[23+(5+e.byteLength+5+r.byteLength)+0]=162,s[23+(5+e.byteLength+5+r.byteLength)+1]=0,s[23+(5+e.byteLength+5+r.byteLength)+2]=1,s[23+(5+e.byteLength+5+r.byteLength)+3]=(65280&i.byteLength)>>8,s[23+(5+e.byteLength+5+r.byteLength)+4]=(255&i.byteLength)>>0,s.set(i,23+(5+e.byteLength+5+r.byteLength)+5),o=[28,0,0,0,0];return(n=new Uint8Array(o.length+s.byteLength)).set(o,0),n.set(s,o.length),n}({vps:this.vps,sps:this.sps,pps:this.pps});this._doDecode(o,2,0,!0,0)}}},{key:"getInputByteLength",value:function(){var e=0;return this.lastBuf?this.lastBuf.byteLength:e}}])}(Ni),Zr=function(){function e(t){return A(this,e),new(e.getLoaderFactory(t._opt.demuxType))(t)}return m(e,null,[{key:"getLoaderFactory",value:function(e){return"m7s"===e?Jr:e===E?Yr:e===k?Xr:e===T?$r:void 0}}])}(),ea=function(e){function t(e){var i;return A(this,t),i=p(this,t),i.player=e,i.hasInit=!1,i.isDecodeFirstIIframe=!1,i.isInitInfo=!1,i.prevTimestamp=null,i.decodeDiffTimestamp=null,i.prevDts=null,i.decoder=null,i.isWidthOrHeightChanged=!1,i.initDecoder(),e.debug.log("Webcodecs","init"),i}return g(t,e),m(t,[{key:"destroy",value:function(){this.decoder&&("closed"!==this.decoder.state&&this.decoder.close(),this.decoder=null),this.prevTimestamp=null,this.decodeDiffTimestamp=null,this.prevDts=null,this.hasInit=!1,this.isInitInfo=!1,this.isDecodeFirstIIframe=!1,this.isWidthOrHeightChanged=!1,this.off(),this.player.debug.log("Webcodecs","destroy")}},{key:"initDecoder",value:function(){var e=this;this.decoder=new VideoDecoder({output:function(t){e.handleDecode(t)},error:function(t){e.handleError(t)}})}},{key:"handleDecode",value:function(e){this.isInitInfo||(this.player.video.updateVideoInfo({width:e.codedWidth,height:e.codedHeight}),this.player.video.initCanvasViewSize(),this.isInitInfo=!0),this.player._times.videoStart||(this.player._times.videoStart=Ue(),this.player.handlePlayToRenderTimes()),this.player.video.render({videoFrame:e,ts:e.timestamp}),this.player.handleRender(),this.player.updateStats({dfps:!0,buf:this.player.demux&&this.player.demux.delay||0})}},{key:"handleError",value:function(e){this.player.debug.error("Webcodecs","VideoDecoder handleError",e)}},{key:"decodeVideo",value:function(e,t,i,r){if(this.hasInit)if(this.isDecodeFirstIIframe||i||this.player.debug.warn("Webcodecs","VideoDecoder isDecodeFirstIIframe false and isIframe is false"),!this.isDecodeFirstIIframe&&i&&(this.isDecodeFirstIIframe=!0),this.isDecodeFirstIIframe){if(i&&0===e[1]){var a=15&e[0],n={};7==a?n=_i(e.slice(5)):12==a&&(n=Ii(e));var s=this.player.video.videoInfo;s&&s.width&&s.height&&n&&n.codecWidth&&n.codecHeight&&(n.codecWidth!==s.width||n.codecHeight!==s.height)&&(this.player.debug.warn("Webcodecs","decodeVideo: video width or height is changed, old width is ".concat(videoWidth,", old height is ").concat(videoHeight,", new width is ").concat(n.codecWidth,", new height is ").concat(n.codecHeight,", and emit change event")),this.isWidthOrHeightChanged=!0,this.player.emit(U.error,G.wcsWidthOrHeightChange),this.player.emit(G.wcsWidthOrHeightChange))}if(this.isWidthOrHeightChanged)this.player.debug.warn("Webcodecs","decodeVideo: video width or height is changed, and return");else if(Ct(e))this.player.debug.warn("Webcodecs","decodeVideo and payload is video sequence header so drop this frame");else if(e.byteLength<12)this.player.debug.warn("Webcodecs","decodeVideo and payload is too small , payload length is "+e.byteLength);else{var o=!1,l=(new Date).getTime();this.prevTimestamp||(this.prevTimestamp=l,o=!0);var c=l-this.prevTimestamp,u=(c=(((this.decodeDiffTimestamp=c)<5||500\n ').concat(ta[t]?''.concat(ta[t],""):"","\n"),e}),{});function ra(e,t){var i=!1;return e.forEach((function(e){i||e.startTimestamp<=t&&e.endTimestamp>t&&(i=!0)})),i}function aa(e,t,i){var r=0\n ').concat(l.title,"\n \n ")),a[h]);f&&(i+='\n
').concat(f.title,"
\n ")),h+=1}t&&n.$playbackTimeListOne.insertAdjacentHTML("beforeend",t),i&&n.$playbackTimeListSecond.insertAdjacentHTML("beforeend",i),(d+=1)').concat(e,"\n ")})),v&&(t.$qualityMenuList.insertAdjacentHTML("beforeend",v),Object.defineProperty(t,"$qualityMenuItems",{value:e.$container.querySelectorAll(".jessibuca-quality-menu-item")}),setTimeout((function(){var t=y[0];e.streamQuality=t}),0)),e.streamQuality&&A(e.streamQuality)}if(e._opt.operateBtns.scale&&0').concat(e,"\n ")})),k&&(t.$scaleMenuList.insertAdjacentHTML("beforeend",k),Object.defineProperty(t,"$scaleMenuItems",{value:e.$container.querySelectorAll(".jessibuca-scale-menu-item")})),b(e.scaleType)}if(e.isPlayback()&&e._opt.playbackConfig.showRateBtn&&0').concat(e.label,"\n ")})),_&&(t.$speedMenuList.insertAdjacentHTML("beforeend",_),Object.defineProperty(t,"$speedMenuItems",{value:e.$container.querySelectorAll(".jessibuca-speed-menu-item")}));var R=e.playback?e.playback.playbackRate:1;T(R)}e.on(U.stats,(function(){var i,r,a,n,s,o,l,c,u,d,h,f,p,g,m,A,y=0\n \n ").concat(e.isPlayback()?'\n
\n 播放倍率 '.concat(e.playback.rate,'倍\n
\n
\n 播放模式 ').concat(e.playback.isUseFpsRender?"固定FPS":"动态FPS","\n
\n ").concat(e.playback.isUseFpsRender?'\n
\n 固定FPS '.concat(e.video.getStreamFps(),"\n
\n "):"","\n "):"",'\n
\n 解封装模式 ').concat(w[l],'\n
\n
\n 解码模式 ').concat(o,'\n
\n
\n 渲染组件 ').concat(n,"\n
\n ").concat(n===S?'\n
\n 渲染引擎 '.concat(s,"\n
\n "):"",'\n
\n 网络请求组件 ').concat(c,'\n
\n
\n 视频格式 ').concat(i.encType||"-",'\n
\n
\n 视频(宽x高) ').concat(i.width||"-","x").concat(i.height||"-","\n
\n ").concat(e.isPlayer()?'\n
\n 视频GOP(ms) '.concat(h||"-","\n
\n "):"",'\n
\n 音频格式 ').concat(J[r.encType]||"-",'\n
\n
\n 音频引擎 ').concat(u||"-",'\n
\n
\n 音频通道 ').concat(r.channels||"-",'\n
\n
\n 音频采样率 ').concat(r.sampleRate||"-","\n
\n ").concat(e.isPlayer()?'\n
\n 播放器初始化(ms) '.concat(a.playTimestamp,'\n
\n
\n 开始请求地址(ms) ').concat(a.streamTimestamp,'\n
\n
\n 请求响应(ms) ').concat(a.streamResponseTimestamp,'\n
\n
\n 解封装(ms) ').concat(a.demuxTimestamp,'\n
\n
\n 解码(ms) ').concat(a.decodeTimestamp,'\n
\n
\n 页面开始渲染(ms) ').concat(a.videoTimestamp,'\n
\n
\n 初始化到页面渲染(ms) ').concat(a.allTimestamp,"\n
\n ").concat(e.recording?'\n
\n 视频录制时间 '.concat(f,'\n
\n
\n 视频录制大小 ').concat(p,"\n
\n "):"","\n "):"",'\n
\n 音频码率(bit) ').concat(y.abps,'\n
\n
\n 视频码率(bit) ').concat(y.vbps,'\n
\n
\n 视频帧率(fps) ').concat(y.fps,'\n
\n
\n 视频峰值帧率(fps) ').concat(y.maxFps,'\n
\n
\n 解码帧率(fps) ').concat(y.dfps,'\n
\n
\n 音频缓冲帧 ').concat(y.audioBuffer,"\n
\n ").concat(e.isPlayer()?'\n
\n 视频待解码帧 '.concat(y.demuxBuffer,"\n
\n "):'\n
\n 缓存时长(ms) '.concat(y.playbackCacheDataDuration,'\n
\n
\n 视频待渲染帧 ').concat(y.playbackVideoBuffer,'\n
\n
\n 视频待解码帧 ').concat(y.demuxBuffer,'\n
\n
\n 音频待解码帧 ').concat(y.audioDemuxBuffer,"\n
\n "),'\n
\n 待解封装数据(byte) ').concat(y.flvBuffer,"\n
\n ").concat(e._opt.useMSE?'\n
\n MSE缓冲时长(ms) '.concat(y.mseDelay,'\n
\n
\n MSE解码间隔(ms) ').concat(y.mseDecodeDiffTimes,'\n
\n
\n MSE解码时间(ms) ').concat(y.mseTs,'\n
\n
\n MSE播放模式 ').concat(1\n
\n "):"","\n ").concat(e._opt.useWCS?'\n
\n WCS解码间隔(ms) '.concat(y.wcsDecodeDiffTimes,"\n
\n "):"","\n ").concat(e._opt.isHls?'
\n HLS缓冲时长(ms) '.concat(y.hlsDelay,'\n
\n
\n HLS播放模式 ').concat(1\n
\n "):"","\n ").concat(e.isPlayer()?'\n
\n 网络延迟(ms) '.concat(y.netBuf,'\n
\n
\n 缓冲时长(ms) ').concat(y.buf,'\n
\n
\n 最新缓冲时长(ms) ').concat(y.pushLatestDelay,"\n
\n "):"",'\n
\n 视频显示时间(ms) ').concat(y.ts,"\n
\n ").concat(e._opt.hasAudio&&e.isAudioNotMute()?'\n
\n 音频显示时间(ms) '.concat(y.audioTs,"\n
\n ").concat(e._opt.hasVideo?'\n
\n 音视频同步时间戳(ms) '.concat(y.ts-y.audioTs,"\n
\n "):"",'\n
\n 音频播放模式 ').concat(d?"加速":"正常","\n
\n "):"",'\n
\n 视频解码时间(ms) ').concat(y.dts,"\n
\n ").concat(e.isPlayer()?'\n
\n 解码前-解码后延迟(ms) '.concat(y.delayTs,'\n
\n
\n 总延迟(网络+解码)(ms) ').concat(y.totalDelayTs,"\n
\n "):"","\n ").concat(e.isPlayer()&&y.isStreamTsMoreThanLocal?'
\n 是否超过一倍率推流 是\n
\n ':"","\n ").concat(e.isPlayer()?'\n
\n 是否在丢帧 '.concat(m,"\n
\n "):"",'\n
\n 网速 ').concat(A,'\n
\n
\n 播放时长(s) ').concat(ut(y.pTs),'\n
\n
\n '),t.$performancePanel.insertAdjacentHTML("beforeend",g)):(t.$performancePanel.innerHTML="",ze(t.$performancePanel,"display","none"))})),e.on(U.togglePerformancePanel,(function(e){ze(t.$performance,"display",e?"none":"flex"),ze(t.$performanceActive,"display",e?"flex":"none")})),e.on(U.faceDetectActive,(function(e){ze(t.$faceDetect,"display",e?"none":"flex"),ze(t.$faceDetectActive,"display",e?"flex":"none")}))};function oa(e,t){var i,r;t=(t=void 0===t?{}:t).insertAt;e&&"undefined"!=typeof document&&(i=document.head||document.getElementsByTagName("head")[0],(r=document.createElement("style")).type="text/css","top"===t&&i.firstChild?i.insertBefore(r,i.firstChild):i.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e)))}function la(e,t){t instanceof Element?e.appendChild(t):e.insertAdjacentHTML("beforeend",String(t)),e.lastElementChild||e.lastChild}function ca(e,t,i){e.style[t]=i}function ua(e,t){return e.composedPath&&-1\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
00:00:00
\n
\n
\n
\n
\n
\n
'.concat(ia.narrow,'
\n
').concat(ia.expand,"
\n
\n \n "),a.$container.insertAdjacentHTML("beforeend","\n ".concat(o.background?'
'):"",'\n
\n \n
\n ').concat(o.loadingIcon?'\n
\n '.concat(ia.loading,"\n ").concat(o.loadingText?'
'.concat(o.loadingText,"
"):"","\n
\n "):"","\n ").concat(o.hasControl&&l.play?'
':"","\n ").concat(o.hasControl&&l.ptz?'\n
\n
\n
\n
\n
\n
\n '.concat(o.ptzMoreArrow?'\n
\n
\n
\n
\n ':"",'\n
\n ').concat(o.ptzZoomShow?'\n
\n
\n ':"","\n\n ").concat(o.ptzApertureShow?'\n
\n
\n ':"","\n ").concat(o.ptzFocusShow?'\n
\n
\n ':"","\n
\n "):"","\n ").concat(o.hasVideo?'\n
\n
'.concat(ia.narrow,'
\n
电子放大
\n
').concat(ia.expand,'
\n
').concat(ia.zoomStop,'
\n
\n
\n
\n
00:00:00
\n
').concat(ia.recordStop,"
\n
\n "):"","\n\n ").concat(o.hasControl?'\n
\n
\n
\n '.concat(o.showBandwidth?'
':"",'\n
').concat(o.controlHtml,"
\n
\n ").concat(o.playType===s&&o.playbackConfig.showControl?c:"",'\n\n
\n ').concat(o.playType===s&&o.playbackConfig.showRateBtn?'\n
\n
\n
\n
\n
\n
\n ':"","\n ").concat(l.close?'
'.concat(ia.close,"
"):"","\n ").concat(l.performance?'
'.concat(ia.performance,'
').concat(ia.performanceActive,"
"):"","\n ").concat(l.aiFace?'
'.concat(ia.face,'
').concat(ia.faceActive,"
"):"","\n ").concat(l.quality?'\n
\n
\n
\n
\n
\n
\n ':"","\n ").concat(l.scale?'\n
\n
\n
\n
\n
\n
\n ':"","\n ").concat(l.audio?'\n
\n
\n '.concat(ia.audio,"\n ").concat(ia.mute,'\n
\n
\n
\n
\n
\n
\n
\n
\n '):"","\n ").concat(l.play?'
'.concat(ia.play,'
').concat(ia.pause,"
"):"","\n ").concat(l.screenshot?'
'.concat(ia.screenshot,"
"):"","\n ").concat(l.record?'
'.concat(ia.record,'
').concat(ia.recordStop,"
"):"","\n ").concat(l.ptz?'
'.concat(ia.ptz,'
').concat(ia.ptzActive,"
"):"","\n ").concat(l.zoom?'
'.concat(ia.zoom,'
').concat(ia.zoomStop,"
"):"","\n ").concat(l.fullscreen?'
'.concat(ia.fullscreen,'
').concat(ia.fullscreenExit,"
"):"","\n
\n
\n
\n "):"",'\n
\n
\n ')),Object.defineProperty(n,"$poster",{value:a.$container.querySelector(".jessibuca-poster")}),Object.defineProperty(n,"$loadingBg",{value:a.$container.querySelector(".jessibuca-loading-bg")}),Object.defineProperty(n,"$loadingBgImage",{value:a.$container.querySelector(".jessibuca-loading-bg-image")}),Object.defineProperty(n,"$loading",{value:a.$container.querySelector(".jessibuca-loading")}),Object.defineProperty(n,"$play",{value:a.$container.querySelector(".jessibuca-play")}),Object.defineProperty(n,"$playBig",{value:a.$container.querySelector(".jessibuca-play-big")}),Object.defineProperty(n,"$recording",{value:a.$container.querySelector(".jessibuca-recording")}),Object.defineProperty(n,"$recordingTime",{value:a.$container.querySelector(".jessibuca-recording-time")}),Object.defineProperty(n,"$recordingStop",{value:a.$container.querySelector(".jessibuca-recording-stop")}),Object.defineProperty(n,"$pause",{value:a.$container.querySelector(".jessibuca-pause")}),Object.defineProperty(n,"$controls",{value:a.$container.querySelector(".jessibuca-controls")}),Object.defineProperty(n,"$controlsInner",{value:a.$container.querySelector(".jessibuca-controls-bottom")}),Object.defineProperty(n,"$controlsLeft",{value:a.$container.querySelector(".jessibuca-controls-left")}),Object.defineProperty(n,"$controlsRight",{value:a.$container.querySelector(".jessibuca-controls-right")}),Object.defineProperty(n,"$volume",{value:a.$container.querySelector(".jessibuca-volume")}),Object.defineProperty(n,"$volumePanelWrap",{value:a.$container.querySelector(".jessibuca-volume-panel-wrap")}),Object.defineProperty(n,"$volumePanelText",{value:a.$container.querySelector(".jessibuca-volume-panel-text")}),Object.defineProperty(n,"$volumePanel",{value:a.$container.querySelector(".jessibuca-volume-panel")}),Object.defineProperty(n,"$volumeHandle",{value:a.$container.querySelector(".jessibuca-volume-panel-handle")}),Object.defineProperty(n,"$volumeOn",{value:a.$container.querySelector(".jessibuca-icon-audio")}),Object.defineProperty(n,"$volumeOff",{value:a.$container.querySelector(".jessibuca-icon-mute")}),Object.defineProperty(n,"$fullscreen",{value:a.$container.querySelector(".jessibuca-fullscreen")}),Object.defineProperty(n,"$fullscreenExit",{value:a.$container.querySelector(".jessibuca-fullscreen-exit")}),Object.defineProperty(n,"$record",{value:a.$container.querySelector(".jessibuca-record")}),Object.defineProperty(n,"$recordStop",{value:a.$container.querySelector(".jessibuca-record-stop")}),Object.defineProperty(n,"$screenshot",{value:a.$container.querySelector(".jessibuca-screenshot")}),Object.defineProperty(n,"$speed",{value:a.$container.querySelector(".jessibuca-speed")}),Object.defineProperty(n,"$controlHtml",{value:a.$container.querySelector(".jessibuca-controls-item-html")}),Object.defineProperty(n,"$playbackTime",{value:a.$container.querySelector(".jessibuca-controls-playback-time")}),Object.defineProperty(n,"$playbackTimeInner",{value:a.$container.querySelector(".jessibuca-controls-playback-time-inner")}),Object.defineProperty(n,"$playbackTimeScroll",{value:a.$container.querySelector(".jessibuca-controls-playback-time-scroll")}),Object.defineProperty(n,"$playbackTimeList",{value:a.$container.querySelector(".jessibuca-controls-playback-time-list")}),Object.defineProperty(n,"$playbackTimeListOne",{value:a.$container.querySelector(".jessibuca-playback-time-one-wrap")}),Object.defineProperty(n,"$playbackTimeListSecond",{value:a.$container.querySelector(".jessibuca-playback-time-second-wrap")}),Object.defineProperty(n,"$playbackCurrentTime",{value:a.$container.querySelector(".jessibuca-controls-playback-current-time")}),Object.defineProperty(n,"$playbackCurrentTimeText",{value:a.$container.querySelector(".jessibuca-controls-playback-current-time-text")}),Object.defineProperty(n,"$controlsPlaybackBtns",{value:a.$container.querySelector(".jessibuca-controls-playback-btns")}),Object.defineProperty(n,"$playbackNarrow",{value:a.$container.querySelector(".jessibuca-playback-narrow")}),Object.defineProperty(n,"$playbackExpand",{value:a.$container.querySelector(".jessibuca-playback-expand")}),Object.defineProperty(n,"$ptz",{value:a.$container.querySelector(".jessibuca-ptz")}),Object.defineProperty(n,"$ptzActive",{value:a.$container.querySelector(".jessibuca-ptz-active")}),Object.defineProperty(n,"$ptzControl",{value:a.$container.querySelector(".jessibuca-ptz-controls")}),Object.defineProperty(n,"$ptzBgActive",{value:a.$container.querySelector(".jessibuca-ptz-bg-active")}),Object.defineProperty(n,"$ptzControlCircular",{value:a.$container.querySelector(".jessibuca-ptz-control")}),Object.defineProperty(n,"$ptzArrows",{value:a.$container.querySelectorAll(".jessibuca-ptz-arrow")}),Object.defineProperty(n,"$ptzExpand",{value:a.$container.querySelector(".jessibuca-ptz-expand")}),Object.defineProperty(n,"$ptzNarrow",{value:a.$container.querySelector(".jessibuca-ptz-narrow")}),Object.defineProperty(n,"$ptzApertureFar",{value:a.$container.querySelector(".jessibuca-ptz-aperture-far")}),Object.defineProperty(n,"$ptzApertureNear",{value:a.$container.querySelector(".jessibuca-ptz-aperture-near")}),Object.defineProperty(n,"$ptzFocusFar",{value:a.$container.querySelector(".jessibuca-ptz-focus-far")}),Object.defineProperty(n,"$ptzFocusNear",{value:a.$container.querySelector(".jessibuca-ptz-focus-near")}),Object.defineProperty(n,"$qualityText",{value:a.$container.querySelector(".jessibuca-quality-icon-text")}),Object.defineProperty(n,"$qualityMenu",{value:a.$container.querySelector(".jessibuca-quality-menu")}),Object.defineProperty(n,"$qualityMenuList",{value:a.$container.querySelector(".jessibuca-quality-menu-list")}),Object.defineProperty(n,"$scaleText",{value:a.$container.querySelector(".jessibuca-scale-icon-text")}),Object.defineProperty(n,"$scaleMenu",{value:a.$container.querySelector(".jessibuca-scale-menu")}),Object.defineProperty(n,"$scaleMenuList",{value:a.$container.querySelector(".jessibuca-scale-menu-list")}),Object.defineProperty(n,"$zoom",{value:a.$container.querySelector(".jessibuca-zoom")}),Object.defineProperty(n,"$zoomStop",{value:a.$container.querySelector(".jessibuca-zoom-stop")}),Object.defineProperty(n,"$zoomNarrow",{value:a.$container.querySelector(".jessibuca-zoom-narrow")}),Object.defineProperty(n,"$zoomExpand",{value:a.$container.querySelector(".jessibuca-zoom-expand")}),Object.defineProperty(n,"$zoomStop2",{value:a.$container.querySelector(".jessibuca-zoom-stop2")}),Object.defineProperty(n,"$close",{value:a.$container.querySelector(".jessibuca-close")}),Object.defineProperty(n,"$zoomControls",{value:a.$container.querySelector(".jessibuca-zoom-controls")}),Object.defineProperty(n,"$performancePanel",{value:a.$container.querySelector(".jessibuca-performance-panel")}),Object.defineProperty(n,"$performance",{value:a.$container.querySelector(".jessibuca-performance")}),Object.defineProperty(n,"$performanceActive",{value:a.$container.querySelector(".jessibuca-performance-active")}),Object.defineProperty(n,"$faceDetect",{value:a.$container.querySelector(".jessibuca-face")}),Object.defineProperty(n,"$faceDetectActive",{value:a.$container.querySelector(".jessibuca-face-active")}),Object.defineProperty(n,"$contextmenus",{value:a.$container.querySelector(".jessibuca-contextmenus")}),Object.defineProperty(n,"$speedText",{value:a.$container.querySelector(".jessibuca-speed-icon-text")}),Object.defineProperty(n,"$speedMenu",{value:a.$container.querySelector(".jessibuca-speed-menu")}),Object.defineProperty(n,"$speedMenuList",{value:a.$container.querySelector(".jessibuca-speed-menu-list")}),0a){var n=(t-i*a)/2;e.$container.style.padding="0 ".concat(n,"px")}else{var s=(i-t/a)/2;e.$container.style.padding=s+"px 0"}}},{key:"initLoadingBackground",value:function(){var e=this.player;if(e._opt.loadingBackground&&e._opt.heartTimeoutReplayUseLastFrameShow){var t=e.height,i=e._opt,r=(i.hasControl&&!i.controlAutoHide&&(t-=i.playType===s?48:38),this.$loadingBgImage.width=e.width,this.$loadingBgImage.height=t,i.rotate);270!==r&&90!==r||(control.$loadingBgImage.width=t,control.$loadingBgImage.height=e.width),this.$loadingBgImage.src=e._opt.loadingBackground;var a="contain",n=(i.isResize||(a="fill"),i.isFullResize&&(a="none"),"");"none"===i.mirrorRotate&&r&&(n+=" rotate("+r+"deg)"),"level"===i.mirrorRotate?n+=" rotateY(180deg)":"vertical"===i.mirrorRotate&&(n+=" rotateX(180deg)"),this.$loadingBgImage.style.transform=n,this.$loadingBgImage.style.objectFit=a,ca(this.$loadingBg,"display","block")}}},{key:"_validateExtendBtn",value:function(e){var t=!0;return e.name||(this.player.debug.warn("Control","extend button name is required"),t=!1),t&&-1!==this.extendBtnList.findIndex((function(t){return t.name===e.name}))&&(this.player.debug.warn("Control","extend button name: ".concat(e.name," is already exist")),t=!1),t&&!e.icon&&(this.player.debug.warn("Control","extend button icon is required"),t=!1),t}},{key:"addExtendBtn",value:function(){var e=this,t=0\n '.concat(t.icon?'
\n \n ').concat(t.iconTitle?'\n '.concat(t.iconTitle,"\n "):"","\n
"):"","\n ").concat(t.activeIcon?'
\n \n ').concat(t.activeIconTitle?'\n '.concat(t.activeIconTitle,"\n "):"","\n
"):"","\n \n "),o=Array.from(a.children)[t.index],l=(o?o.insertAdjacentHTML("beforebegin",s):la(a,s),t.icon?a.querySelector(".jessibuca-icon-extend-"+r):null),c=t.icon?a.querySelector(".jessibuca-control-extend-"+r):null,u=t.activeIcon?a.querySelector(".jessibuca-icon-extend-".concat(r,"-active")):null,d=t.activeIcon?a.querySelector(".jessibuca-control-extend-".concat(r,"-active")):null,h=this.player["events"].proxy;t.icon&&(ca(l,"background","url(".concat(t.icon,") no-repeat center")),ca(l,"background-size","100% 100%"),ca(c,"display","none"),t.iconHover)&&(h(l,"mouseover",(function(){ca(l,"background","url(".concat(t.iconHover,") no-repeat center")),ca(l,"background-size","100% 100%")})),h(l,"mouseout",(function(){ca(l,"background","url(".concat(t.icon,") no-repeat center")),ca(l,"background-size","100% 100%")}))),t.activeIcon&&(ca(u,"background","url(".concat(t.activeIcon,") no-repeat center")),ca(u,"background-size","100% 100%"),ca(d,"display","none"),t.activeIconHover)&&(h(u,"mouseover",(function(){ca(u,"background","url(".concat(t.activeIconHover,") no-repeat center")),ca(u,"background-size","100% 100%")})),h(u,"mouseout",(function(){ca(u,"background","url(".concat(t.activeIcon,") no-repeat center")),ca(u,"background-size","100% 100%")}))),t.click&&l&&h(l,"click",(function(i){i.preventDefault(),n&&(ca(c,"display","none"),ca(d,"display","flex")),t.click.call(e.player,e,i)})),t.activeClick&&u&&h(u,"click",(function(i){i.preventDefault(),ca(c,"display","flex"),ca(d,"display","none"),t.activeClick.call(e.player,e,i)})),this.extendBtnList.push({name:r,$iconWrap:c,$activeIconWrap:d})}}}])}();oa(".jessibuca-container{position:relative;width:100%;height:100%;overflow:hidden}.jessibuca-container.jessibuca-fullscreen-web{position:fixed;z-index:9999;left:0;top:0;right:0;bottom:0;width:100vw!important;height:100vh!important;background:#000}");var fa=function(){function e(){A(this,e)}return m(e,null,[{key:"init",value:function(){for(var t in e.types={avc1:[],avcC:[],hvc1:[],hvcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]},e.types)e.types.hasOwnProperty(t)&&(e.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);var i=e.constants={};i.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),i.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),i.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),i.STSC=i.STCO=i.STTS,i.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),i.HDLR_VIDEO=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),i.HDLR_AUDIO=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),i.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),i.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),i.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}},{key:"box",value:function(e){for(var t=8,i=null,r=Array.prototype.slice.call(arguments,1),a=r.length,n=0;n>>24&255,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t,i.set(e,4);for(var s=8,o=0;o>>24&255,t>>>16&255,t>>>8&255,255&t,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]))}},{key:"trak",value:function(t){return e.box(e.types.trak,e.tkhd(t),e.mdia(t))}},{key:"tkhd",value:function(t){var i=t.id,r=t.duration,a=t.presentWidth;t=t.presentHeight;return e.box(e.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,a>>>8&255,255&a,0,0,t>>>8&255,255&t,0,0]))}},{key:"mdia",value:function(t){return e.box(e.types.mdia,e.mdhd(t),e.hdlr(t),e.minf(t))}},{key:"mdhd",value:function(t){var i=t.timescale;t=t.duration;return e.box(e.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,t>>>24&255,t>>>16&255,t>>>8&255,255&t,85,196,0,0]))}},{key:"hdlr",value:function(t){return t="audio"===t.type?e.constants.HDLR_AUDIO:e.constants.HDLR_VIDEO,e.box(e.types.hdlr,t)}},{key:"minf",value:function(t){var i="audio"===t.type?e.box(e.types.smhd,e.constants.SMHD):e.box(e.types.vmhd,e.constants.VMHD);return e.box(e.types.minf,i,e.dinf(),e.stbl(t))}},{key:"dinf",value:function(){return e.box(e.types.dinf,e.box(e.types.dref,e.constants.DREF))}},{key:"stbl",value:function(t){return e.box(e.types.stbl,e.stsd(t),e.box(e.types.stts,e.constants.STTS),e.box(e.types.stsc,e.constants.STSC),e.box(e.types.stsz,e.constants.STSZ),e.box(e.types.stco,e.constants.STCO))}},{key:"stsd",value:function(t){return"audio"===t.type?e.box(e.types.stsd,e.constants.STSD_PREFIX,e.mp4a(t)):"avc"===t.videoType?e.box(e.types.stsd,e.constants.STSD_PREFIX,e.avc1(t)):e.box(e.types.stsd,e.constants.STSD_PREFIX,e.hvc1(t))}},{key:"mp4a",value:function(t){var i=t.channelCount,r=t.audioSampleRate;i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,i,0,16,0,0,0,0,r>>>8&255,255&r,0,0]);return e.box(e.types.mp4a,i,e.esds(t))}},{key:"esds",value:function(t){t=t.config||[];var i=t.length;i=new Uint8Array([0,0,0,0,3,23+i,0,1,0,4,15+i,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([i]).concat(t).concat([6,1,2]));return e.box(e.types.esds,i)}},{key:"avc1",value:function(t){var i=t.avcc,r=t.codecWidth;t=t.codecHeight,r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,r>>>8&255,255&r,t>>>8&255,255&t,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return e.box(e.types.avc1,r,e.box(e.types.avcC,i))}},{key:"hvc1",value:function(t){var i=t.avcc,r=t.codecWidth;t=t.codecHeight,r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,r>>>8&255,255&r,t>>>8&255,255&t,0,72,0,0,0,72,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return e.box(e.types.hvc1,r,e.box(e.types.hvcC,i))}},{key:"mvex",value:function(t){return e.box(e.types.mvex,e.trex(t))}},{key:"trex",value:function(t){return t=t.id,t=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]),e.box(e.types.trex,t)}},{key:"moof",value:function(t,i){return e.box(e.types.moof,e.mfhd(t.sequenceNumber),e.traf(t,i))}},{key:"mfhd",value:function(t){return t=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t]),e.box(e.types.mfhd,t)}},{key:"traf",value:function(t,i){var r=t.id,a=(r=e.box(e.types.tfhd,new Uint8Array([0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r])),i=e.box(e.types.tfdt,new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i])),e.sdtp(t));t=e.trun(t,a.byteLength+16+16+8+16+8+8);return e.box(e.types.traf,r,i,t,a)}},{key:"sdtp",value:function(t){var i=new Uint8Array(5);t=t.flags;return i[4]=t.isLeading<<6|t.dependsOn<<4|t.isDependedOn<<2|t.hasRedundancy,e.box(e.types.sdtp,i)}},{key:"trun",value:function(t,i){var r=new Uint8Array(28),a=(i=(r.set([0,0,15,1,0,0,0,1,(i+=36)>>>24&255,i>>>16&255,i>>>8&255,255&i],0),t.duration),t.size),n=t.flags;t=t.cts;return r.set([i>>>24&255,i>>>16&255,i>>>8&255,255&i,a>>>24&255,a>>>16&255,a>>>8&255,255&a,n.isLeading<<2|n.dependsOn,n.isDependedOn<<6|n.hasRedundancy<<4|n.isNonSync,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t],12),e.box(e.types.trun,r)}},{key:"mdat",value:function(t){return e.box(e.types.mdat,t)}}])}();fa.init();var pa=function(e){function t(e){var i;A(this,t),i=p(this,t),i.player=e,i.isAvc=!0,i.mediaSource=new window.MediaSource,i.sourceBuffer=null,i.hasInit=!1,i.isInitInfo=!1,i.cacheTrack={},i.timeInit=!1,i.sequenceNumber=0,i.dropping=!1,i.firstRenderTime=null,i.$videoElement=null,i.mediaSourceAppendBufferFull=!1,i.mediaSourceAppendBufferError=!1,i.isDecodeFirstIIframe=!1,i.prevTimestamp=null,i.decodeDiffTimestamp=null,i.prevDts=null,i.prevPayloadBufferSize=0,i.isWidthOrHeightChanged=!1,i.prevTs=null,i.mediaSourceObjectURL=window.URL.createObjectURL(i.mediaSource),i.eventListenList=[],e._opt.mseUseCanvasRender?(i.$videoElement=document.createElement("video"),i.$videoElement.src=i.mediaSourceObjectURL,i.initVideoEvents()):(i.player.video.$videoElement.src=i.mediaSourceObjectURL,i.$videoElement=i.player.video.$videoElement);var r=e["events"].proxy,a=r(i.mediaSource,"sourceopen",(function(){i.player&&i.player.emit(U.mseSourceOpen)})),n=r(i.mediaSource,"sourceclose",(function(){i.player&&i.player.emit(U.mseSourceClose)})),s=r(i.mediaSource,"sourceended",(function(){i.player&&i.player.emit(U.mseSourceended)}));if(i.eventListenList.push(a,n,s),i.player.isPlayer){var o=r(i.$videoElement,ve,(function(t){if(i._handleUpdatePlaybackRate(),e._opt.mseUseCanvasRender)if(i.player.checkIsInRender())i.player.handleRender();else{var r=parseInt(t.timeStamp,10);i.player.debug.warn("MediaSource","mseUseCanvasRender is true and $videoElement ts is ".concat(r,", but not in render"))}else i.player.handleRender()})),l=r(i.$videoElement,be,(function(){e.debug.log("MediaSource","video playback Rate change",i.$videoElement&&i.$videoElement.playbackRate)}));i.eventListenList.push(o,l)}return e.debug.log("MediaSource","init"),i}return g(t,e),m(t,[{key:"destroy",value:function(){this.stop(),this.eventListenList.length&&(this.eventListenList.forEach((function(e){return e()})),this.eventListenList=[]),this.mediaSource=null,this.sourceBuffer=null,this.hasInit=!1,this.isInitInfo=!1,this.sequenceNumber=0,this.cacheTrack={},this.timeInit=!1,this.mediaSourceAppendBufferFull=!1,this.mediaSourceAppendBufferError=!1,this.isDecodeFirstIIframe=!1,this.prevTimestamp=null,this.prevDts=null,this.prevPayloadBufferSize=0,this.prevTs=null,this.firstRenderTime=null,this.isWidthOrHeightChanged=!1,this.dropping=!1,this.$videoElement&&(this.player._opt.mseUseCanvasRender&&this.$videoElement.src&&(this.$videoElement.src="",this.$videoElement.removeAttribute("src")),this.$videoElement=null),this.mediaSourceObjectURL&&(window.URL.revokeObjectURL(this.mediaSourceObjectURL),this.mediaSourceObjectURL=null),this.off(),this.player.debug.log("MediaSource","destroy")}},{key:"state",get:function(){return this.mediaSource&&this.mediaSource.readyState}},{key:"isStateOpen",get:function(){return"open"===this.state}},{key:"isStateClosed",get:function(){return"closed"===this.state}},{key:"isStateEnded",get:function(){return"ended"===this.state}},{key:"duration",get:function(){return this.mediaSource&&this.mediaSource.duration||-1},set:function(e){this.mediaSource.duration=e}},{key:"initVideoEvents",value:function(){var e=this,t=this.player.events["proxy"],i=t(this.$videoElement,Ae,(function(){e.player.debug.log("MediaSource","video canplay"),e.$videoElement.play().then((function(){e.player.debug.log("MediaSource","video play")})).catch((function(t){e.player.debug.warn("MediaSource","video play error ",t),e.player.emit(G.mediaSourceUseCanvasRenderPlayFailed),e.player.emit(U.error,G.mediaSourceUseCanvasRenderPlayFailed)}))})),r=t(this.$videoElement,ye,(function(){e.player.debug.log("MediaSource","video waiting")}));t=t(this.$videoElement,ve,(function(t){t=parseInt(t.timeStamp,10),e.player.emit(U.videoTimeUpdate,t),e.$videoElement.paused&&(e.player.debug.warn("MediaSource","video is paused and next try to replay"),e.$videoElement.play().then((function(){e.player.debug.log("MediaSource","video is paused and replay success")})).catch((function(t){e.player.debug.warn("MediaSource","video is paused and replay error ",t)})))}));this.eventListenList.push(i,r,t)}},{key:"decodeVideo",value:function(e,t,i,r){var a=this.player;if(a)if(this.hasInit)if(!this.isDecodeFirstIIframe&&i&&(this.isDecodeFirstIIframe=!0),this.isDecodeFirstIIframe){if(i&&0===e[1]){var n=15&e[0],s={};7==n?s=_i(e.slice(5)):12==n&&(s=Ii(e));var o=this.player.video.videoInfo;o&&o.width&&o.height&&s&&s.codecWidth&&s.codecHeight&&(s.codecWidth!==o.width||s.codecHeight!==o.height)&&(this.player.debug.warn("MediaSource","\n decodeVideo: video width or height is changed,\n old width is ".concat(o.width,", old height is ").concat(o.height,",\n new width is ").concat(s.codecWidth,", new height is ").concat(s.codecHeight,",\n and emit change event")),this.isWidthOrHeightChanged=!0,this.player.emit(U.error,G.mseWidthOrHeightChange),this.player.emit(G.mseWidthOrHeightChange))}if(this.isWidthOrHeightChanged)this.player.debug.warn("MediaSource","decodeVideo: video width or height is changed, and return");else if(Ct(e))this.player.debug.warn("MediaSource","decodeVideo and payload is video sequence header so drop this frame");else if(e.byteLength<12)this.player.debug.warn("MediaSource","decodeVideo and payload is too small , payload length is "+e.byteLength);else{null===this.firstRenderTime&&(this.firstRenderTime=t);var l=t-this.firstRenderTime;if(l<0&&(this.player.debug.error("MediaSource","decodeVideo\n local dts is < 0 , ts is ".concat(t," and prevTs is ").concat(this.prevTs,",\n firstRenderTime is ").concat(this.firstRenderTime," and mseCorrectTimeDuration is ")+this.player._opt.mseCorrectTimeDuration),l=null===this.prevDts?0:this.prevDts+this.player._opt.mseCorrectTimeDuration,this._checkTsIsMaxDiff(t)))this.player.debug.error("MediaSource","decodeVideo is max diff , ts is ".concat(t," and prevTs is ").concat(this.prevTs,", diff is ")+(this.prevTs-t)),this.emit(G.mediaSourceTsIsMaxDiff);else{if(null!==this.prevDts&&l<=this.prevDts){if(this.player.debug.error("MediaSource","\n decodeVideo dts is less than(or equal) prev dts ,\n dts is ".concat(l," and prev dts is ").concat(this.prevDts," ,\n and now ts is ").concat(t," and prev ts is ").concat(this.prevTs," ,\n and diff is ").concat(t-this.prevTs," and firstRenderTime is ").concat(this.firstRenderTime,",\n and mseCorrectTimeDuration is ").concat(this.player._opt.mseCorrectTimeDuration,",\n and prevPayloadBufferSize is ").concat(this.prevPayloadBufferSize," and payload size is ")+e.byteLength),l===this.prevDts&&this.prevPayloadBufferSize===e.byteLength)return void this.player.debug.error("MediaSource","decodeVideo dts is equal to prev dts and payload size is equal to prev payload size so drop this frame");if(l=this.prevDts+this.player._opt.mseCorrectTimeDuration,this._checkTsIsMaxDiff(t))return this.player.debug.error("MediaSource","decodeVideo is max diff , ts is ".concat(t," and prevTs is ").concat(this.prevTs,", diff is ").concat(this.prevTs-t," and emit replay")),void this.emit(G.mediaSourceTsIsMaxDiff)}this._decodeVideo(e,l,i,r,t),this.prevDts=l,this.prevPayloadBufferSize=e.byteLength,this.prevTs=t,this.player.getRenderType()===_&&this.player.video&&this.player.video.doAddContentToWatermark()}}}else this.player.debug.warn("MediaSource","decodeVideo isDecodeFirstIIframe false");else if(i&&0===e[1]){var c=15&e[0];a.video.updateVideoInfo({encTypeCode:c}),12!=c||function(){var e=!1;return!(!("MediaSource"in window)||!window.MediaSource.isTypeSupported(ne))||e}()?(a._times.decodeStart||(a._times.decodeStart=Ue()),this.hasInit=this._decodeConfigurationRecord(e,t,i,c)):this.emit(G.mediaSourceH265NotSupport)}else this.player.debug.error("MediaSource","decodeVideo has not init , isIframe is ".concat(i," , payload is ")+e[1])}},{key:"_checkTsIsMaxDiff",value:function(e){return 0h?(n.debug.warn("MediaSource","dropping time is ",t-this.cacheTrack.dts),this.dropping=!1,this.cacheTrack={}):this.cacheTrack.id&&t>=this.cacheTrack.dts?(h=8+this.cacheTrack.size,(u=new Uint8Array(h))[0]=h>>>24&255,u[1]=h>>>16&255,u[2]=h>>>8&255,u[3]=255&h,u.set(fa.types.mdat,4),u.set(this.cacheTrack.data,8),this.cacheTrack.duration=t-this.cacheTrack.dts,this.player.recorder&&this.player.recorder.isRecording&&this.player._opt.recordType===v&&this.player.recorder.handleAddFmp4Track(this.cacheTrack),h=fa.moof(this.cacheTrack,this.cacheTrack.dts),(d=new Uint8Array(h.byteLength+u.byteLength)).set(h,0),d.set(u,h.byteLength),this.appendBuffer(d.buffer),n.emit(U.timeUpdate,a),n.updateStats({fps:!0,ts:a,mseTs:t,buf:n.demux&&n.demux.delay||0}),n._times.videoStart||(n._times.videoStart=Ue(),n.handlePlayToRenderTimes())):(n.debug.log("MediaSource","timeInit set false , cacheTrack = {} now dts is ".concat(t,", and ts is ").concat(a," cacheTrack dts is ")+(this.cacheTrack&&this.cacheTrack.dts)),this.timeInit=!1,this.cacheTrack={}),this.cacheTrack||(this.cacheTrack={}),this.cacheTrack.id=1,this.cacheTrack.sequenceNumber=++this.sequenceNumber,this.cacheTrack.size=o,this.cacheTrack.dts=t,this.cacheTrack.cts=r,this.cacheTrack.isKeyframe=i,this.cacheTrack.data=s,this.cacheTrack.flags={isLeading:0,dependsOn:i?2:1,isDependedOn:i?1:0,hasRedundancy:0,isNonSync:i?0:1},this.timeInit||1!==e.buffered.length||(n.debug.log("MediaSource","timeInit set true"),this.timeInit=!0,e.currentTime=e.buffered.end(0)),!this.isInitInfo&&0e||r.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),s.currentTime=e+.05),(t=this.getNextFragment(o,l))?"identity"!==(null==(i=t.decryptdata)?void 0:i.keyFormat)||null!=(r=t.decryptdata)&&r.key?this.loadFragment(t,l,o):this.loadKey(t,l):this.bufferFlushed=!0)))))},E.getMaxBufferLength=function(){var e=b.prototype.getMaxBufferLength.call(this),t=this.getFwdBufferInfo(this.videoBuffer||this.media,c.PlaylistLevelType.MAIN);return null===t?e:Math.max(e,t.len)},E.onMediaDetaching=function(){this.videoBuffer=null,b.prototype.onMediaDetaching.call(this)},E.onAudioTracksUpdated=function(e,t){t=t.audioTracks,this.resetTransmuxer(),this.levels=t.map((function(e){return new l.Level(e)}))},E.onAudioTrackSwitching=function(e,t){var i=!!t.url;this.trackId=t.id,t=this.fragCurrent;null!=t&&t.loader&&t.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),i?this.setInterval(100):this.resetTransmuxer(),i?(this.audioSwitch=!0,this.state=a.State.IDLE):this.state=a.State.STOPPED,this.tick()},E.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},E.onLevelLoaded=function(e,t){this.mainDetails=t.details},E.onAudioTrackLoaded=function(e,t){var i=this.levels,r=t.details;t=t.id;if(i){this.log("Track "+t+" loaded ["+r.startSN+","+r.endSN+"],duration:"+r.totalduration);i=i[t];var n=0;if(r.live||null!=(s=i.details)&&s.live){var s=this.mainDetails;if(r.fragments[0]||(r.deltaUpdateFailed=!0),r.deltaUpdateFailed||!s)return;n=!i.details&&r.hasProgramDateTime&&s.hasProgramDateTime?(Object(g.alignMediaPlaylistByPDT)(r,s),r.fragments[0].start):this.alignPlaylists(r,i.details)}i.details=r,this.levelLastLoaded=t,this.startFragRequested||!this.mainDetails&&r.live||this.setStartPosition(i.details,n),this.state!==a.State.WAITING_TRACK||this.waitForCdnTuneIn(r)||(this.state=a.State.IDLE),this.tick()}else this.warn("Audio tracks were reset while loading level "+t)},E._handleFragmentLoadProgress=function(e){var t,i,r,n,s=e.frag,o=e.part,l=(e=e.payload,this.config),u=this.trackId,p=this.levels;p?(p=p[u],console.assert(p,"Audio track is defined on fragment load progress"),t=p.details,console.assert(t,"Audio track details are defined on fragment load progress"),l=l.defaultAudioCodec||p.audioCodec||"mp4a.40.2",p=(p=this.transmuxer)||(this.transmuxer=new h.default(this.hls,c.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this))),i=this.initPTS[s.cc],r=null==(r=s.initSegment)?void 0:r.data,void 0!==i?(n=o?o.index:-1,n=new f.ChunkMetadata(s.level,s.sn,s.stats.chunkCount,e.byteLength,n,-1!==n),p.push(e,r,l,"",s,o,t.totalduration,!1,n,i)):(A.logger.log("Unknown video PTS for cc "+s.cc+", waiting for video PTS before demuxing audio frag "+s.sn+" of ["+t.startSN+" ,"+t.endSN+"],track "+u),(this.waitingData=this.waitingData||{frag:s,part:o,cache:new d.default,complete:!1}).cache.push(new Uint8Array(e)),this.waitingVideoCC=this.videoTrackCC,this.state=a.State.WAITING_INIT_PTS)):this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+s.sn+" of level "+s.level+" will not be buffered")},E._handleFragmentLoadComplete=function(e){this.waitingData?this.waitingData.complete=!0:b.prototype._handleFragmentLoadComplete.call(this,e)},E.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},E.onBufferCreated=function(e,t){var i=t.tracks.audio;i&&(this.mediaBuffer=i.buffer),t.tracks.video&&(this.videoBuffer=t.tracks.video.buffer)},E.onFragBuffered=function(e,t){var i=t.frag;t=t.part;i.type===c.PlaylistLevelType.AUDIO&&(this.fragContextChanged(i)?this.warn("Fragment "+i.sn+(t?" p: "+t.index:"")+" of level "+i.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch):("initSegment"!==i.sn&&(this.fragPrevious=i,this.audioSwitch)&&(this.audioSwitch=!1,this.hls.trigger(n.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId})),this.fragBufferedComplete(i,t)))},E.onError=function(e,t){switch(t.details){case m.ErrorDetails.FRAG_LOAD_ERROR:case m.ErrorDetails.FRAG_LOAD_TIMEOUT:case m.ErrorDetails.KEY_LOAD_ERROR:case m.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(c.PlaylistLevelType.AUDIO,t);break;case m.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case m.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==a.State.ERROR&&this.state!==a.State.STOPPED&&(this.state=t.fatal?a.State.ERROR:a.State.IDLE,this.warn(t.details+" while loading frag, switching to "+this.state+" state"));break;case m.ErrorDetails.BUFFER_FULL_ERROR:var i,r;"audio"!==t.parent||this.state!==a.State.PARSING&&this.state!==a.State.PARSED||(i=!0,(i=(r=this.getFwdBufferInfo(this.mediaBuffer,c.PlaylistLevelType.AUDIO))&&.5=l.length?this.warn("Invalid id passed to audio-track controller"):(this.clearTimer(),t=l[this.trackId],this.log("Now switching to audio-track index "+e),i=(l=l[e]).id,a=void 0===(a=l.groupId)?"":a,n=l.name,s=l.type,o=l.url,this.trackId=e,this.trackName=n,this.selectDefaultTrack=!1,this.hls.trigger(r.Events.AUDIO_TRACK_SWITCHING,{id:i,groupId:a,name:n,type:s,url:o}),l.details&&!l.details.live||(e=this.switchParams(l.url,null==t?void 0:t.details),this.loadPlaylist(e)))},n.selectInitialTrack=function(){var e=this.tracksInGroup;console.assert(e.length,"Initial audio track should be selected when tracks are known"),e=this.trackName,e=this.findTrackId(e)||this.findTrackId();-1!==e?this.setAudioTrack(e):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(r.Events.ERROR,{type:a.ErrorTypes.MEDIA_ERROR,details:a.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},n.findTrackId=function(e){for(var t=this.tracksInGroup,i=0;it.partTarget&&(s+=1),Object(r.isFiniteNumber)(o))return new a.HlsUrlParameters(o,Object(r.isFiniteNumber)(s)?s:void 0,a.HlsSkip.No)}}},t.loadPlaylist=function(e){},t.shouldLoadTrack=function(e){return this.canLoad&&e&&!!e.url&&(!e.details||e.details.live)},t.playlistLoaded=function(e,t,i){var r=this,a=t.details,s=t.stats,o=s.loading.end?Math.max(0,self.performance.now()-s.loading.end):0;if(a.advancedDateTime=Date.now()-o,a.live||null!=i&&i.live){if(a.reloaded(i),i&&this.log("live playlist "+e+" "+(a.advanced?"REFRESHED "+a.lastPartSn+"-"+a.lastPartIndex:"MISSED")),i&&0i.tuneInGoal?(this.warn("CDN Tune-in goal increased from: "+i.tuneInGoal+" to: "+h+" with playlist age: "+a.age),h=0):(o+=f=Math.floor(h/a.targetduration),void 0!==c&&(c+=Math.round(h%a.targetduration/a.partTarget)),this.log("CDN Tune-in age: "+a.ageHeader+"s last advanced "+d.toFixed(2)+"s goal: "+h+" skip sn "+f+" to part "+c)),a.tuneInGoal=h),l=this.getDeliveryDirectives(a,t.deliveryDirectives,o,c),u||!p)return void this.loadPlaylist(l)}else l=this.getDeliveryDirectives(a,t.deliveryDirectives,o,c);i=Object(n.computeReloadInterval)(a,s),void 0!==o&&a.canBlockReload&&(i-=a.partTarget||1),this.log("reload live playlist "+e+" in "+Math.round(i)+" ms"),this.timer=self.setTimeout((function(){return r.loadPlaylist(l)}),i)}}else this.clearTimer()},t.getDeliveryDirectives=function(e,t,i,r){var n=Object(a.getSkipValue)(e,i);return null!=t&&t.skip&&e.deltaUpdateFailed&&(i=t.msn,r=t.part,n=a.HlsSkip.No),new a.HlsUrlParameters(i,r,n)},t.retryLoadingOrFail=function(e){var t,i=this,r=this.hls.config,a=this.retryCount=t.endSN)||e.nextStart)&&(null!=(e=t.partList)&&e.length?(t=e[e.length-1],n.BufferHelper.isBuffered(this.media,t.start+t.duration/2)):(e=r.getState(i))===a.FragmentState.PARTIAL||e===a.FragmentState.OK)},t.onMediaAttached=function(e,t){t=this.media=this.mediaBuffer=t.media,this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),t.addEventListener("seeking",this.onvseeking),t.addEventListener("ended",this.onvended),t=this.config,this.levels&&t.autoStartLoad&&this.state===E.STOPPED&&this.startLoad(t.startPosition)},t.onMediaDetaching=function(){var e=this.media;null!=e&&e.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),e&&(e.removeEventListener("seeking",this.onvseeking),e.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},t.onMediaSeeking=function(){var e=this.config,t=this.fragCurrent,i=this.media,a=this.mediaBuffer,s=this.state,o=i?i.currentTime:0;a=n.BufferHelper.bufferInfo(a||i,o,e.maxBufferHole);this.log("media seeking to "+(Object(r.isFiniteNumber)(o)?o.toFixed(3):o)+", state: "+s),s===E.ENDED?this.resetLoadingState():t&&!a.len&&(s=e.maxFragLookUpTolerance,e=t.start-s,s=o>t.start+t.duration+s,oe.end&&t.fragmentHint&&(e=t.fragmentHint);var l,c=this.getNextPart(s,e,i);if(-1i&&this.flushMainBuffer(r,e.start)):this.flushMainBuffer(0,e.start))},t.getFwdBufferInfo=function(e,t){var i=this.config,a=this.getLoadPosition();if(!Object(r.isFiniteNumber)(a))return null;var s=n.BufferHelper.bufferInfo(e,a,i.maxBufferHole);return 0===s.len&&void 0!==s.nextStart&&(t=this.fragmentTracker.getBufferedFrag(a,t),t&&s.nextStart=e&&(t.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+t.maxMaxBufferLength+"s"),!0)},t.getNextFragment=function(e,t){var i=t.fragments,r=i.length;if(!r)return null;var a,n=this.config,s=i[0].start;if(t.live){var o=n.initialLiveManifestSize;if(re.start&&e.loaded},t.getInitialLiveFragment=function(e,t){var i,r=this.fragPrevious,a=null;return r?(e.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+r.programDateTime),a=Object(h.findFragmentByPDT)(t,r.endProgramDateTime,this.config.maxFragLookUpTolerance)),a||((i=r.sn+1)>=e.startSN&&i<=e.endSN&&(i=t[i-e.startSN],r.cc===i.cc)&&this.log("Live playlist, switching playlist, load frag with next SN: "+(a=i).sn),a)||(a=Object(h.findFragWithCC)(t,r.cc))&&this.log("Live playlist, switching playlist, load frag with same CC: "+a.sn)):null!==(i=this.hls.liveSyncPosition)&&(a=this.getFragmentAtPosition(i,this.bitrateTest?e.fragmentEnd:e.edge,e)),a},t.getFragmentAtPosition=function(e,t,i){var r,n=this.config,s=this.fragPrevious,o=i.fragments,l=i.endSN,c=i.fragmentHint,u=n.maxFragLookUpTolerance;n=!!(n.lowLatencyMode&&i.partList&&c);if(n&&c&&!this.bitrateTest&&(o=o.concat(c),l=c.sn),r=e=a-n.maxFragLookUpTolerance&&i<=r,null!==t)&&s.duration>t&&(i"+e.startSN+" prev-sn: "+(l?l.sn:"na")+" fragments: "+o),n):i):(this.warn("No fragments in live playlist"),0)},t.waitForCdnTuneIn=function(e){return e.live&&e.canBlockReload&&e.tuneInGoal>Math.max(e.partHoldBack,3*e.partTarget)},t.setStartPosition=function(e,t){var i,a=this.startPosition;-1!==(a=a"+e))}}]),T);function T(e,t,i){var r;return(r=b.call(this)||this).hls=void 0,r.fragPrevious=null,r.fragCurrent=null,r.fragmentTracker=void 0,r.transmuxer=null,r._state=E.STOPPED,r.media=void 0,r.mediaBuffer=void 0,r.config=void 0,r.bitrateTest=!1,r.lastCurrentTime=0,r.nextLoadPosition=0,r.startPosition=0,r.loadedmetadata=!1,r.fragLoadError=0,r.retryDate=0,r.levels=null,r.fragmentLoader=void 0,r.levelLastLoaded=null,r.startFragRequested=!1,r.decrypter=void 0,r.initPTS=[],r.onvseeking=null,r.onvended=null,r.logPrefix="",r.log=void 0,r.warn=void 0,r.logPrefix=i,r.log=s.logger.log.bind(s.logger,i+":"),r.warn=s.logger.warn.bind(s.logger,i+":"),r.hls=e,r.fragmentLoader=new p.default(e.config),r.fragmentTracker=t,r.config=e.config,r.decrypter=new g.default(e,e.config),e.on(o.Events.KEY_LOADED,r.onKeyLoaded,function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(r)),r}},"./src/controller/buffer-controller.ts":function(e,t,i){i.r(t),i.d(t,"default",(function(){return h}));var r=i("./src/polyfills/number.ts"),a=i("./src/events.ts"),n=i("./src/utils/logger.ts"),s=i("./src/errors.ts"),o=i("./src/utils/buffer-helper.ts"),l=(t=i("./src/utils/mediasource-helper.ts"),i("./src/loader/fragment.ts")),c=i("./src/controller/buffer-operation-queue.ts"),u=Object(t.getMediaSource)(),d=/([ha]vc.)(?:\.[^.,]+)+/,h=((i=f.prototype).hasSourceTypes=function(){return 0r.config.appendErrorMaxRetry&&(n.logger.error("[buffer-controller]: Failed "+r.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),t.fatal=!0)),r.trigger(a.Events.ERROR,t)}},d)},i.onBufferFlushing=function(e,t){function i(e){return{execute:r.removeExecutor.bind(r,e,t.startOffset,t.endOffset),onStart:function(){},onComplete:function(){r.hls.trigger(a.Events.BUFFER_FLUSHED,{type:e})},onError:function(t){n.logger.warn("[buffer-controller]: Failed to remove from "+e+" SourceBuffer",t)}}}var r=this,s=this.operationQueue;t.type?s.append(i(t.type),t.type):this.getSourceBufferTypes().forEach((function(e){s.append(i(e),e)}))},i.onFragParsed=function(e,t){var i=this,r=t.frag,s=t.part,o=(t=[],(s||r).elementaryStreams);o[l.ElementaryStreamTypes.AUDIOVIDEO]?t.push("audiovideo"):(o[l.ElementaryStreamTypes.AUDIO]&&t.push("audio"),o[l.ElementaryStreamTypes.VIDEO]&&t.push("video")),0===t.length&&n.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+r.type+" level: "+r.level+" sn: "+r.sn),this.blockBuffers((function(){var e=self.performance.now();r.stats.buffering.end=e,s&&(s.stats.buffering.end=e),e=(s||r).stats;i.hls.trigger(a.Events.FRAG_BUFFERED,{frag:r,part:s,stats:e,id:r.type})}),t)},i.onFragChanged=function(e,t){this.flushBackBuffer()},i.onBufferEos=function(e,t){var i=this;this.getSourceBufferTypes().reduce((function(e,r){var a=i.sourceBuffer[r];return t.type&&t.type!==r||a&&!a.ended&&(a.ended=!0,n.logger.log("[buffer-controller]: "+r+" sourceBuffer now EOS")),e&&!(a&&!a.ended)}),!0)&&this.blockBuffers((function(){var e=i.mediaSource;e&&"open"===e.readyState&&e.endOfStream()}))},i.onLevelUpdated=function(e,t){t=t.details,t.fragments.length&&(this.details=t,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())},i.flushBackBuffer=function(){var e,t,i,n,s=this.hls,l=this.details,c=this.media,u=this.sourceBuffer;c&&null!==l&&(e=this.getSourceBufferTypes()).length&&(i=l.live&&null!==s.config.liveBackBufferLength?s.config.liveBackBufferLength:s.config.backBufferLength,!Object(r.isFiniteNumber)(i)||i<0||(c=c.currentTime,t=l.levelTargetDuration,i=Math.max(i,t),n=Math.floor(c/t)*t-i,e.forEach((function(e){var t=u[e];t&&0<(t=o.BufferHelper.getBuffered(t)).length&&n>t.start(0)&&(s.trigger(a.Events.BACK_BUFFER_REACHED,{bufferEnd:n}),l.live&&s.trigger(a.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:n}),s.trigger(a.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:n,type:e}))}))))},i.updateMediaElementDuration=function(){var e,t,i,a,s,o;this.details&&this.media&&this.mediaSource&&"open"===this.mediaSource.readyState&&(e=this.details,t=this.hls,s=this.media,i=this.mediaSource,a=e.fragments[0].start+e.totalduration,s=s.duration,o=Object(r.isFiniteNumber)(i.duration)?i.duration:0,e.live&&t.config.liveDurationInfinity?(n.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),i.duration=1/0,this.updateSeekableRange(e)):(othis.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping)},i.getMaxLevel=function(e){var t=this,i=this.hls.levels;return i.length?(i=i.filter((function(i,r){return s.isLevelAllowed(r,t.restrictedLevels)&&r<=e})),this.clientRect=null,s.getMaxLevelByMediaSize(i,this.mediaWidth,this.mediaHeight)):-1},i.startCapping=function(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())},i.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},i.getDimensions=function(){var e,t,i;return this.clientRect||(t={width:0,height:0},(e=this.media)&&(i=e.getBoundingClientRect(),t.width=i.width,t.height=i.height,t.width||t.height||(t.width=i.right-i.left||e.width||0,t.height=i.bottom-i.top||e.height||0)),this.clientRect=t)},s.isLevelAllowed=function(e,t){return-1===(t=void 0===t?[]:t).indexOf(e)},s.getMaxLevelByMediaSize=function(e,t,i){if(!e||!e.length)return-1;for(var r,a=e.length-1,n=0;n=t||s.height>=i)&&(!(r=e[n+1])||s.width!==r.width||s.height!==r.height)){a=n;break}}return a},i=[{key:"contentScaleFactor",get:function(){var e=1;try{e=self.devicePixelRatio}catch(e){}return e}}],a((n=s).prototype,[{key:"mediaWidth",get:function(){return this.getDimensions().width*s.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*s.contentScaleFactor}}]),a(n,i);var n=s;function s(e){this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.hls=void 0,this.streamController=void 0,this.clientRect=void 0,this.hls=e,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}t.default=n},"./src/controller/cmcd-controller.ts":function(e,t,i){i.r(t),i.d(t,"default",(function(){return h}));var r=i("./src/events.ts"),a=i("./src/types/cmcd.ts"),n=i("./src/utils/buffer-helper.ts"),s=i("./src/utils/logger.ts");function o(e,t){for(var i=0;i=e.length?{done:!0}:{done:!1,value:e[i++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,r=new Array(t);it&&(t=n.bitrate)}return 0o.config.fpsDroppedMonitoringThreshold*s&&(l=o.currentLevel,a.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+l),0=l)&&(o.trigger(r.Events.FPS_DROP_LEVEL_CAPPING,{level:--l,droppedLevel:o.currentLevel}),o.autoLevelCapping=l,this.streamController.nextLevelSwitch()),this.lastTime=c,this.lastDroppedFrames=i,this.lastDecodedFrames=t)},i.checkFPSInterval=function(){var e,t=this.media;t&&(this.isVideoPlaybackQualityAvailable?(e=t.getVideoPlaybackQuality(),this.checkFPS(t,e.totalVideoFrames,e.droppedVideoFrames)):this.checkFPS(t,t.webkitDecodedFrameCount,t.webkitDroppedFrameCount))},t.default=n},"./src/controller/fragment-finders.ts":function(e,t,i){i.r(t),i.d(t,"findFragmentByPDT",(function(){return n})),i.d(t,"findFragmentByPTS",(function(){return s})),i.d(t,"fragmentWithinToleranceTest",(function(){return o})),i.d(t,"pdtWithinToleranceTest",(function(){return l})),i.d(t,"findFragWithCC",(function(){return c}));var r=i("./src/polyfills/number.ts"),a=i("./src/utils/binary-search.ts");function n(e,t,i){if(null!==t&&Array.isArray(e)&&e.length&&Object(r.isFiniteNumber)(t)&&!(t<(e[0].programDateTime||0)||t>=(e[e.length-1].endProgramDateTime||0))){i=i||0;for(var a=0;ae&&i.start?-1:0}function l(e,t,i){return t=1e3*Math.min(t,i.duration+(i.deltaPTS||0)),(i.endProgramDateTime||0)-t>e}function c(e,t){return a.default.search(e,(function(e){return e.cct?-1:0}))}},"./src/controller/fragment-tracker.ts":function(e,t,i){i.r(t),i.d(t,"FragmentState",(function(){return r})),i.d(t,"FragmentTracker",(function(){return s}));var r,a=i("./src/events.ts"),n=i("./src/types/loader.ts"),s=((t=r=r||{}).NOT_LOADED="NOT_LOADED",t.BACKTRACKED="BACKTRACKED",t.APPENDING="APPENDING",t.PARTIAL="PARTIAL",t.OK="OK",(i=o.prototype)._registerListeners=function(){var e=this.hls;e.on(a.Events.BUFFER_APPENDED,this.onBufferAppended,this),e.on(a.Events.FRAG_BUFFERED,this.onFragBuffered,this),e.on(a.Events.FRAG_LOADED,this.onFragLoaded,this)},i._unregisterListeners=function(){var e=this.hls;e.off(a.Events.BUFFER_APPENDED,this.onBufferAppended,this),e.off(a.Events.FRAG_BUFFERED,this.onFragBuffered,this),e.off(a.Events.FRAG_LOADED,this.onFragLoaded,this)},i.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},i.getAppendedFrag=function(e,t){if(t===n.PlaylistLevelType.MAIN){var i=this.activeFragment,r=this.activeParts;if(!i)return null;if(r)for(var a=r.length;a--;){var s=r[a],o=s?s.end:i.appendedPTS;if(s.start<=e&&void 0!==o&&e<=o)return 9e&&r.removeFragment(a)}))},i.removeFragment=function(e){var t=c(e);e.stats.loaded=0,e.clearElementaryStreamInfo(),delete this.fragments[t]},i.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},o);function o(e){this.activeFragment=null,this.activeParts=null,this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hls=e,this._registerListeners()}function l(e){var t;return e.buffered&&(null!=(t=e.range.video)&&t.partial||null!=(t=e.range.audio)&&t.partial)}function c(e){return e.type+"_"+e.level+"_"+e.urlId+"_"+e.sn}},"./src/controller/gap-controller.ts":function(e,t,i){i.r(t),i.d(t,"STALL_MINIMUM_DURATION_MS",(function(){return o})),i.d(t,"MAX_START_GAP_JUMP",(function(){return l})),i.d(t,"SKIP_BUFFER_HOLE_STEP_SECONDS",(function(){return c})),i.d(t,"SKIP_BUFFER_RANGE_START",(function(){return u})),i.d(t,"default",(function(){return d}));var r=i("./src/utils/buffer-helper.ts"),a=i("./src/errors.ts"),n=i("./src/events.ts"),s=i("./src/utils/logger.ts"),o=250,l=2,c=.1,u=.05,d=((t=h.prototype).destroy=function(){this.hls=this.fragmentTracker=this.media=null},t.poll=function(e){var t=this.config,i=this.media,a=this.stalled,n=i.currentTime,c=i.seeking,u=this.seeking&&!c,d=!this.seeking&&c;if(this.seeking=c,n===e){if((d||u)&&(this.stalled=null),!i.paused&&!i.ended&&0!==i.playbackRate&&r.BufferHelper.getBuffered(i).length&&(e=r.BufferHelper.bufferInfo(i,n,0),d=0l;var h=!u||li.maxBufferHole&&t>1e3*i.highBufferWatchdogPeriod&&(s.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},t._reportStall=function(e){var t=this.hls,i=this.media;this.stallReported||(this.stallReported=!0,s.logger.warn("Playback stalling at @"+i.currentTime+" due to low buffer (buffer="+e+")"),t.trigger(n.Events.ERROR,{type:a.ErrorTypes.MEDIA_ERROR,details:a.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:e}))},t._trySkipBufferHole=function(e){for(var t=this.config,i=this.hls,o=this.media,l=o.currentTime,d=0,h=r.BufferHelper.getBuffered(o),f=0;f=d&&lthis.hls.config.fragLoadingMaxRetry))&&(r=t.frag.level);break;case n.ErrorDetails.LEVEL_LOAD_ERROR:case n.ErrorDetails.LEVEL_LOAD_TIMEOUT:i&&(i.deliveryDirectives&&(o=!1),r=i.level),s=!0;break;case n.ErrorDetails.REMUX_ALLOC_ERROR:r=t.level,s=!0}void 0!==r&&this.recoverLevel(t,r,s,o)}}},t.recoverLevel=function(e,t,i,r){var a=e.details,n=this._levels[t];if(n.loadError++,i){if(!this.retryLoadingOrFail(e))return void(this.currentLevelIndex=-1);e.levelRetry=!0}r&&(1<(i=n.url.length)&&n.loadError=t.length){var i=e<0;if(this.hls.trigger(a.Events.ERROR,{type:n.ErrorTypes.OTHER_ERROR,details:n.ErrorDetails.LEVEL_SWITCH_ERROR,level:e,fatal:i,reason:"invalid level idx"}),i)return;e=Math.min(e,t.length-1)}this.clearTimer();i=this.currentLevelIndex;var r=t[i];t=t[e],i=(this.log("switching to level "+e+" from "+i),c({},t,{level:this.currentLevelIndex=e,maxBitrate:t.maxBitrate,uri:t.uri,urlId:t.urlId})),e=(delete i._urlId,this.hls.trigger(a.Events.LEVEL_SWITCHING,i),t.details);e&&!e.live||(i=this.switchParams(t.uri,null==r?void 0:r.details),this.loadPlaylist(i))}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(e){this.manualLevelIndex=e,void 0===this._startLevel&&(this._startLevel=e),-1!==e&&(this.level=e)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(e){this._firstLevel=e}},{key:"startLevel",get:function(){var e;return void 0===this._startLevel?void 0!==(e=this.hls.config.startLevel)?e:this._firstLevel:this._startLevel},set:function(e){this._startLevel=e}},{key:"nextLoadLevel",get:function(){return-1!==this.manualLevelIndex?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(e){this.level=e,-1===this.manualLevelIndex&&(this.hls.nextAutoLevel=e)}}]),g);function g(e){return(e=h.call(this,e,"[level-controller]")||this)._levels=[],e._firstLevel=-1,e._startLevel=void 0,e.currentLevelIndex=-1,e.manualLevelIndex=-1,e.onParsedComplete=void 0,e._registerListeners(),e}},"./src/controller/level-helper.ts":function(e,t,i){i.r(t),i.d(t,"addGroupId",(function(){return n})),i.d(t,"assignTrackIdsByGroup",(function(){return s})),i.d(t,"updatePTS",(function(){return o})),i.d(t,"updateFragPTSDTS",(function(){return c})),i.d(t,"mergeDetails",(function(){return u})),i.d(t,"mapPartIntersection",(function(){return d})),i.d(t,"mapFragmentIntersection",(function(){return h})),i.d(t,"adjustSliding",(function(){return f})),i.d(t,"addSliding",(function(){return p})),i.d(t,"computeReloadInterval",(function(){return g})),i.d(t,"getFragmentWithSN",(function(){return m})),i.d(t,"getPartWith",(function(){return A}));var r=i("./src/polyfills/number.ts"),a=i("./src/utils/logger.ts");function n(e,t,i){switch(t){case"audio":e.audioGroupIds||(e.audioGroupIds=[]),e.audioGroupIds.push(i);break;case"text":e.textGroupIds||(e.textGroupIds=[]),e.textGroupIds.push(i)}}function s(e){var t={};e.forEach((function(e){var i=e.groupId||"";e.id=t[i]=t[i]||0,t[i]++}))}function o(e,t,i){l(e[t],e[i])}function l(e,t){var i,a=t.startPTS;Object(r.isFiniteNumber)(a)?(i=0,(a=t.sn>e.sn?(i=a-e.start,e):(i=e.start-a,t)).duration!==i&&(a.duration=i)):t.sn>e.sn?e.cc===t.cc&&e.minEndPTS?t.start=e.start+(e.minEndPTS-e.start):t.start=e.start+e.duration:t.start=Math.max(e.start-t.duration,0)}function c(e,t,i,n,s,o){n-i<=0&&(a.logger.warn("Fragment should have a positive duration",t),n=i+t.duration,o=s+t.duration);var c=i,u=n,d=t.startPTS,h=t.endPTS,f=(Object(r.isFiniteNumber)(d)&&(f=Math.abs(d-i),Object(r.isFiniteNumber)(t.deltaPTS)?t.deltaPTS=Math.max(f,t.deltaPTS):t.deltaPTS=f,c=Math.max(i,d),i=Math.min(i,d),s=Math.min(s,t.startDTS),u=Math.min(n,h),n=Math.max(n,h),o=Math.max(o,t.endDTS)),t.duration=n-i,i-t.start);t.appendedPTS=n,t.start=t.startPTS=i,t.maxStartPTS=c,t.startDTS=s,t.endPTS=n,t.minEndPTS=u,t.endDTS=o;var p;d=t.sn;if(!e||de.endSN)return 0;h=d-e.startSN;var g=e.fragments;for(g[h]=t,p=h;0=e.length||p(t,e[i].start)}function p(e,t){if(t){for(var i=e.fragments,r=e.skippedSegments;r=this.getMaxBufferLength(t.maxBitrate)||(this._streamEnded(i,n)?(e={},this.altAudio&&(e.type="video"),this.hls.trigger(s.Events.BUFFER_EOS,e),this.state=a.State.ENDED):(o=i.end,t=this.getNextFragment(o,n),this.couldBacktrack&&!this.fragPrevious&&t&&"initSegment"!==t.sn&&1<(e=t.sn-n.startSN)&&(t=n.fragments[e-1],this.fragmentTracker.removeFragment(t)),t&&this.fragmentTracker.getState(t)===l.FragmentState.OK&&this.nextLoadPosition>o&&(i=this.audioOnly&&!this.altAudio?u.ElementaryStreamTypes.AUDIO:u.ElementaryStreamTypes.VIDEO,this.afterBufferFlushed(r,i,c.PlaylistLevelType.MAIN),t=this.getNextFragment(this.nextLoadPosition,n)),t&&("identity"!==(null==(e=(t=!t.initSegment||t.initSegment.data||this.bitrateTest?t:t.initSegment).decryptdata)?void 0:e.keyFormat)||null!=(r=t.decryptdata)&&r.key?this.loadFragment(t,n,o):this.loadKey(t,n)))))},i.loadFragment=function(e,t,i){var r=this.fragmentTracker.getState(e);if(this.fragCurrent=e,r===l.FragmentState.BACKTRACKED){var a=this.fragmentTracker.getBacktrackData(e);if(a)return this._handleFragmentLoadProgress(a),void this._handleFragmentLoadComplete(a);r=l.FragmentState.NOT_LOADED}r===l.FragmentState.NOT_LOADED||r===l.FragmentState.PARTIAL?"initSegment"===e.sn?this._loadInitSegment(e):this.bitrateTest?(e.bitrateTest=!0,this.log("Fragment "+e.sn+" of level "+e.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(e)):(this.startFragRequested=!0,y.prototype.loadFragment.call(this,e,t,i)):r===l.FragmentState.APPENDING?this.reduceMaxBufferLength(e.duration)&&this.fragmentTracker.removeFragment(e):0===(null==(a=this.media)?void 0:a.buffered.length)&&this.fragmentTracker.removeAllFragments()},i.getAppendedFrag=function(e){return e=this.fragmentTracker.getAppendedFrag(e,c.PlaylistLevelType.MAIN),e&&"fragment"in e?e.fragment:e},i.getBufferedFrag=function(e){return this.fragmentTracker.getBufferedFrag(e,c.PlaylistLevelType.MAIN)},i.followingBufferedFrag=function(e){return e?this.getBufferedFrag(e.end+.5):null},i.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},i.nextLevelSwitch=function(){var e,t=this.levels,i=this.media;null!=i&&i.readyState&&((e=this.getAppendedFrag(i.currentTime))&&1=r[s].start&&n<=r[s].end){a=r[s];break}t=i.start+i.duration,a?a.end=t:r.push(a={start:n,end:t}),this.fragmentTracker.fragBuffered(i)}}},i.onBufferFlushing=function(e,t){var i,r,a,n=t.startOffset,s=t.endOffset;0===n&&s!==Number.POSITIVE_INFINITY&&(i=this.currentTrackId,(r=this.levels).length)&&r[i]&&r[i].details&&((a=s-r[i].details.targetduration)<=0||(t.endOffsetSubtitles=Math.max(0,a),this.tracksBuffered.forEach((function(e){for(var t=0;t=a.length||t!==r)&&l){if(this.mediaBuffer=this.mediaBufferTimeRanges,i.live||null!=(a=l.details)&&a.live){if(r=this.mainDetails,i.deltaUpdateFailed||!r)return;a=r.fragments[0],l.details?0===this.alignPlaylists(i,l.details)&&a&&Object(o.addSliding)(i,a.start):i.hasProgramDateTime&&r.hasProgramDateTime?Object(s.alignMediaPlaylistByPDT)(i,r):a&&Object(o.addSliding)(i,a.start)}l.details=i,this.levelLastLoaded=t,this.tick(),!i.live||this.fragCurrent||!this.media||this.state!==c.State.IDLE||Object(n.findFragmentByPTS)(null,i.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),l.details=void 0)}}},i._handleFragmentLoadComplete=function(e){var t,i=e.frag,a=(e=e.payload,i.decryptdata),n=this.hls;!this.fragContextChanged(i)&&e&&0this.getMaxBufferLength()+o||(console.assert(e,"Subtitle track details are defined on idle subtitle stream controller tick"),o=(s=e.fragments).length,d=e.edge,u=this.fragPrevious,i=l.length||(this.clearTimer(),i=l[e],this.log("Switching to subtitle track "+e),this.trackId=e,i?(l=i.id,a=i.groupId,n=i.name,s=i.type,o=i.url,this.hls.trigger(r.Events.SUBTITLE_TRACK_SWITCH,{id:l,groupId:void 0===a?"":a,name:n,type:s,url:o}),l=this.switchParams(i.url,null==t?void 0:t.details),this.loadPlaylist(l)):this.hls.trigger(r.Events.SUBTITLE_TRACK_SWITCH,{id:e}))):this.queuedDefaultTrack=e},n.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),this.media&&this.hls.config.renderTextTracksNatively){for(var e=-1,t=d(this.media.textTracks),i=0;i>>8^255&g^99,d[t[g]=h]),A=d[m],y=d[A],v=257*d[g]^16843008*g;r[h]=v<<24|v>>>8,a[h]=v<<16|v>>>16,n[h]=v<<8|v>>>24,s[h]=v,o[g]=(v=16843009*y^65537*A^257*m^16843008*h)<<24|v>>>8,l[g]=v<<16|v>>>16,c[g]=v<<8|v>>>24,u[g]=v,h?(h=m^d[d[d[y^m]]],f^=d[d[f]]):h=f=1}},t.expandKey=function(e){for(var t=this.uint8ArrayToUint32Array_(e),i=!0,r=0;r>>6),f=(60&t[i+2])>>>2;if(!(d.length-1>>6,r.logger.log("manifest codec:"+s+", ADTS type:"+h+", samplingIndex:"+f),t=/firefox/i.test(c)?6<=f?(h=5,l=new Array(4),f-3):(h=2,l=new Array(2),f):-1!==c.indexOf("android")?(h=2,l=new Array(2),f):(h=5,l=new Array(4),s&&(-1!==s.indexOf("mp4a.40.29")||-1!==s.indexOf("mp4a.40.5"))||!s&&6<=f?f-3:((s&&-1!==s.indexOf("mp4a.40.2")&&(6<=f&&1==o||/vivaldi/i.test(c))||!s&&1==o)&&(h=2,l=new Array(2)),f)),l[0]=h<<3,l[0]|=(14&f)>>1,l[1]|=(1&f)<<7,l[1]|=o<<3,5===h&&(l[1]|=(14&t)>>1,l[2]=(1&t)<<7,l[2]|=8,l[3]=0),{config:l,samplerate:d[f],channelCount:o,codec:"mp4a.40."+h,manifestCodec:u};e.trigger(n.Events.ERROR,{type:a.ErrorTypes.MEDIA_ERROR,details:a.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+f})}function o(e,t){return 255===e[t]&&240==(246&e[t+1])}function l(e,t){return 1&e[t+1]?7:9}function c(e,t){return(3&e[t+3])<<11|e[t+4]<<3|(224&e[t+5])>>>5}function u(e,t){return t+5=e.length||(i=c(e,t))<=r)&&((r=t+i)===e.length||d(e,r))}function p(e,t,i,a,n){e.samplerate||(t=s(t,i,a,n))&&(e.config=t.config,e.samplerate=t.samplerate,e.channelCount=t.channelCount,e.codec=t.codec,e.manifestCodec=t.manifestCodec,r.logger.log("parsed codec:"+e.codec+", rate:"+t.samplerate+", channels:"+t.channelCount))}function g(e){return 9216e4/e}function m(e,t,i,r,a){var n=l(e,t);e=c(e,t);if(0<(e-=n))return{headerLength:n,frameLength:e,stamp:i+r*a}}function A(e,t,i,r,a){var n,s,o;r=m(t,i,r,a,g(e.samplerate));if(r)return a=r.frameLength,s=r.headerLength,r=r.stamp,a=s+a,(o=Math.max(0,i+a-t.length))?(n=new Uint8Array(a-s)).set(t.subarray(i+s,t.length),0):n=t.subarray(i+s,i+a),t={unit:n,pts:r},o||e.samples.push(t),{sample:t,length:a,missing:o}}},"./src/demux/base-audio-demuxer.ts":function(e,t,i){i.r(t),i.d(t,"initPTSFn",(function(){return l}));var r=i("./src/polyfills/number.ts"),a=i("./src/demux/id3.ts"),n=i("./src/demux/dummy-demuxed-track.ts"),s=i("./src/utils/mp4-tools.ts"),o=i("./src/utils/typed-array.ts");(i=c.prototype).resetInitSegment=function(e,t,i){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},i.resetTimeStamp=function(){},i.resetContiguity=function(){},i.canParse=function(e,t){return!1},i.appendFrame=function(e,t,i){},i.demux=function(e,t){this.cachedData&&(e=Object(s.appendUint8Array)(this.cachedData,e),this.cachedData=null);var i,r,c,u=a.getID3Data(e,0),d=u?u.length:0,h=this._audioTrack,f=this._id3Track,p=u?a.getTimeStamp(u):void 0,g=e.length;for(0!==this.frameIndex&&null!==this.initPTS||(this.initPTS=l(p,t)),u&&0e||(e=(e-=this.bitsAvailable)-((t=e>>3)>>3),this.bytesAvailable-=t,this.loadWord()),this.word<<=e,this.bitsAvailable-=e},i.readBits=function(e){var t=Math.min(this.bitsAvailable,e),i=this.word>>>32-t;return 32>>e))return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()},i.skipUEG=function(){this.skipBits(1+this.skipLZ())},i.skipEG=function(){this.skipBits(1+this.skipLZ())},i.readUEG=function(){var e=this.skipLZ();return this.readBits(e+1)-1},i.readEG=function(){var e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)},i.readBoolean=function(){return 1===this.readBits(1)},i.readUByte=function(){return this.readBits(8)},i.readUShort=function(){return this.readBits(16)},i.readUInt=function(){return this.readBits(32)},i.skipScalingList=function(e){for(var t=8,i=8,r=0;r>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:c+=String.fromCharCode(n);break;case 12:case 13:s=e[u++],c+=String.fromCharCode((31&n)<<6|63&s);break;case 14:s=e[u++],o=e[u++],c+=String.fromCharCode((15&n)<<12|(63&s)<<6|(63&o)<<0)}}return c},v={decodeTextFrame:g}},"./src/demux/mp3demuxer.ts":function(e,t,i){i.r(t);var r=i("./src/demux/base-audio-demuxer.ts"),a=i("./src/demux/id3.ts"),n=i("./src/utils/logger.ts"),s=i("./src/demux/mpegaudio.ts");function o(e,t){return(o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}l=r.default,i=l,(r=c).prototype=Object.create(i.prototype),o(r.prototype.constructor=r,i),(r=c.prototype).resetInitSegment=function(e,t,i){l.prototype.resetInitSegment.call(this,e,t,i),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:e,duration:i,inputTimeScale:9e4,dropped:0}},c.probe=function(e){if(e)for(var t=(a.getID3Data(e,0)||[]).length,i=e.length;tt.length)){var n=c(t,i);if(n&&i+n.frameLength<=t.length)return r+=a*(9e4*n.samplesPerFrame/n.sampleRate),a={unit:t.subarray(i,i+n.frameLength),pts:r,dts:r},e.config=[],e.channelCount=n.channelCount,e.samplerate=n.sampleRate,e.samples.push(a),{sample:a,length:n.frameLength,missing:0}}}function c(e,t){var i,l,c,u,d,h=e[t+1]>>3&3,f=e[t+1]>>1&3,p=e[t+2]>>4&15,g=e[t+2]>>2&3;if(1!=h&&0!=p&&15!=p&&3!=g)return d=e[t+2]>>1&1,i=e[t+3]>>6,p=1e3*a[14*(3==h?3-f:3==f?3:4)+p-1],g=n[3*(3==h?0:2==h?1:2)+g],l=3==i?1:2,u=8*(h=s[h][f])*(c=o[f]),h=Math.floor(h*p/g+d)*c,null===r&&(d=(navigator.userAgent||"").match(/Chrome\/(\d+)/i),r=d?parseInt(d[1]):0),r&&r<=87&&2==f&&224e3<=p&&0==i&&(e[t+3]=128|e[t+3]),{sampleRate:g,channelCount:l,frameLength:h,samplesPerFrame:u}}function u(e,t){return 255===e[t]&&224==(224&e[t+1])&&0!=(6&e[t+1])}function d(e,t){return t+1=e.length)return void i();if(!(e[t].unit.length<32)){var r=this.decrypter.isSync();if(this.decryptAacSample(e,t,i,r),!r)return}}},i.getAvcEncryptedData=function(e){for(var t=16*Math.floor((e.length-48)/160)+16,i=new Int8Array(t),r=0,a=32;a=e.length)return void r();for(var a=e[t].units;!(i>=a.length);i++){var n=a[i];if(!(n.data.length<=48||1!==n.type&&5!==n.type)){var s=this.decrypter.isSync();if(this.decryptAvcSample(e,t,i,r,n,s),!s)return}}}},t.default=n},"./src/demux/transmuxer-interface.ts":function(e,t,i){i.r(t),i.d(t,"default",(function(){return u}));var r=i("./node_modules/webworkify-webpack/index.js"),a=i("./src/events.ts"),n=i("./src/demux/transmuxer.ts"),s=i("./src/utils/logger.ts"),o=i("./src/errors.ts"),l=(t=i("./src/utils/mediasource-helper.ts"),i("./node_modules/eventemitter3/index.js")),c=Object(t.getMediaSource)()||{isTypeSupported:function(){return!1}},u=((i=d.prototype).destroy=function(){var e=this.worker;e?(e.removeEventListener("message",this.onwmsg),e.terminate(),this.worker=null):(e=this.transmuxer)&&(e.destroy(),this.transmuxer=null),e=this.observer;e&&e.removeAllListeners(),this.observer=null},i.push=function(e,t,i,r,a,o,l,c,u,d){var h=this,f=(u.transmuxing.start=self.performance.now(),this.transmuxer),p=this.worker,g=(o||a).start,m=a.decryptdata,A=this.frag,y=!(A&&a.cc===A.cc),v=!(A&&u.level===A.level),b=A?u.sn-A.sn:-1,E=this.part?u.part-this.part.index:1,k=!v&&(1==b||0==b&&1==E),T=self.performance.now();(v||b||0===a.stats.parsing.start)&&(a.stats.parsing.start=T),!o||!E&&k||(o.stats.parsing.start=T),T=!(A&&(null==(b=a.initSegment)?void 0:b.url)===(null==(E=A.initSegment)?void 0:E.url)),b=new n.TransmuxState(y,k,c,v,g,T);k&&!y&&!T||(s.logger.log("[transmuxer-interface, "+a.type+"]: Starting new transmux session for sn: "+u.sn+" p: "+u.part+" level: "+u.level+" id: "+u.id+"\n discontinuity: "+y+"\n trackSwitch: "+v+"\n contiguous: "+k+"\n accurateTimeOffset: "+c+"\n timeOffset: "+g+"\n initSegmentChange: "+T),A=new n.TransmuxConfig(i,r,t,l,d),this.configureTransmuxer(A)),this.frag=a,this.part=o,p?p.postMessage({cmd:"demux",data:e,decryptdata:m,chunkMeta:u,state:b},e instanceof ArrayBuffer?[e]:[]):f&&(E=f.push(e,m,u,b),Object(n.isPromise)(E)?E.then((function(e){h.handleTransmuxComplete(e)})):this.handleTransmuxComplete(E))},i.flush=function(e){var t=this,i=(e.transmuxing.start=self.performance.now(),this.transmuxer),r=this.worker;r?r.postMessage({cmd:"flush",chunkMeta:e}):i&&(r=i.flush(e),Object(n.isPromise)(r)?r.then((function(i){t.handleFlushResult(i,e)})):this.handleFlushResult(r,e))},i.handleFlushResult=function(e,t){var i=this;e.forEach((function(e){i.handleTransmuxComplete(e)})),this.onFlush(t)},i.onWorkerMessage=function(e){var t=e.data,i=this.hls;switch(t.event){case"init":self.URL.revokeObjectURL(this.worker.objectURL);break;case"transmuxComplete":this.handleTransmuxComplete(t.data);break;case"flush":this.onFlush(t.data);break;default:t.data=t.data||{},t.data.frag=this.frag,t.data.id=this.id,i.trigger(t.event,t.data)}},i.configureTransmuxer=function(e){var t=this.worker,i=this.transmuxer;t?t.postMessage({cmd:"configure",config:e}):i&&i.configure(e)},i.handleTransmuxComplete=function(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)},d);function d(e,t,i,u){function d(t,i){(i=i||{}).frag=f.frag,i.id=f.id,e.trigger(t,i)}var h,f=this,p=(i=(this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=e,this.id=t,this.onTransmuxComplete=i,this.onFlush=u,e.config),u=(this.observer=new l.EventEmitter,this.observer.on(a.Events.FRAG_DECRYPTED,d),this.observer.on(a.Events.ERROR,d),{mp4:c.isTypeSupported("video/mp4"),mpeg:c.isTypeSupported("audio/mpeg"),mp3:c.isTypeSupported('audio/mp4; codecs="mp3"')}),navigator.vendor);if(i.enableWorker&&"undefined"!=typeof Worker){s.logger.log("demuxing in webworker");try{h=this.worker=r("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),h.addEventListener("message",this.onwmsg),h.onerror=function(t){e.trigger(a.Events.ERROR,{type:o.ErrorTypes.OTHER_ERROR,details:o.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(t.message+" ("+t.filename+":"+t.lineno+")")})},h.postMessage({cmd:"init",typeSupported:u,vendor:p,id:t,config:JSON.stringify(i)})}catch(e){s.logger.warn("Error in worker:",e),s.logger.error("Error while initializing DemuxerWorker, fallback to inline"),h&&self.URL.revokeObjectURL(h.objectURL),this.transmuxer=new n.default(this.observer,u,i,p,t),this.worker=null}}else this.transmuxer=new n.default(this.observer,u,i,p,t)}},"./src/demux/transmuxer-worker.ts":function(e,t,i){i.r(t),i.d(t,"default",(function(){return o}));var r=i("./src/demux/transmuxer.ts"),a=i("./src/events.ts"),n=i("./src/utils/logger.ts"),s=i("./node_modules/eventemitter3/index.js");function o(e){function t(t,i){e.postMessage({event:t,data:i})}var i=new s.EventEmitter;i.on(a.Events.FRAG_DECRYPTED,t),i.on(a.Events.ERROR,t),e.addEventListener("message",(function(a){var s=a.data;switch(s.cmd){case"init":var o=JSON.parse(s.config);e.transmuxer=new r.default(i,s.typeSupported,o,s.vendor,s.id),Object(n.enableLogs)(o.debug),t("init",null);break;case"configure":e.transmuxer.configure(s.config);break;case"demux":o=e.transmuxer.push(s.data,s.decryptdata,s.chunkMeta,s.state),Object(r.isPromise)(o)?o.then((function(t){l(e,t)})):l(e,o);break;case"flush":var c=s.chunkMeta;o=e.transmuxer.flush(c);Object(r.isPromise)(o)?o.then((function(t){u(e,t,c)})):u(e,o,c)}}))}function l(e,t){var i,r,a;((i=t.remuxResult).audio||i.video||i.text||i.id3||i.initSegment)&&(i=[],r=(a=t.remuxResult).audio,a=a.video,r&&c(i,r),a&&c(i,a),e.postMessage({event:"transmuxComplete",data:t},i))}function c(e,t){t.data1&&e.push(t.data1.buffer),t.data2&&e.push(t.data2.buffer)}function u(e,t,i){t.forEach((function(t){l(e,t)})),e.postMessage({event:"flush",data:i})}},"./src/demux/transmuxer.ts":function(e,t,i){i.r(t),i.d(t,"default",(function(){return A})),i.d(t,"isPromise",(function(){return b})),i.d(t,"TransmuxConfig",(function(){return E})),i.d(t,"TransmuxState",(function(){return k}));var r,a=i("./src/events.ts"),n=i("./src/errors.ts"),s=i("./src/crypt/decrypter.ts"),o=(t=i("./src/demux/aacdemuxer.ts"),i("./src/demux/mp4demuxer.ts")),l=i("./src/demux/tsdemuxer.ts"),c=i("./src/demux/mp3demuxer.ts"),u=i("./src/remux/mp4-remuxer.ts"),d=i("./src/remux/passthrough-remuxer.ts"),h=i("./src/demux/chunk-cache.ts"),f=i("./src/utils/mp4-tools.ts"),p=i("./src/utils/logger.ts");try{r=self.performance.now.bind(self.performance)}catch(e){p.logger.debug("Unable to use Performance API on this environment"),r=self.Date.now}var g=[{demux:l.default,remux:u.default},{demux:o.default,remux:d.default},{demux:t.default,remux:u.default},{demux:c.default,remux:u.default}],m=1024,A=(g.forEach((function(e){e=e.demux,m=Math.max(m,e.minProbeByteLength)})),(i=v.prototype).configure=function(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()},i.push=function(e,t,i,a){var n=this,s=i.transmuxing,o=(e=(s.executeStart=r(),new Uint8Array(e)),this.cache),l=this.config,c=this.currentTransmuxState,u=this.transmuxConfig;a&&(this.currentTransmuxState=a),d=null,t=d=0>4){if((L=R+5+e[R+4])===R+188)continue}else L=R+4;switch(D){case h:C&&(p&&(a=g(p))&&this.parseAVCPES(a,!1),p={data:[],size:0}),p&&(p.data.push(e.subarray(L,R+188)),p.size+=R+188-L);break;case m:C&&(y&&(a=g(y))&&(s.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),y={data:[],size:0}),y&&(y.data.push(e.subarray(L,R+188)),y.size+=R+188-L);break;case A:C&&(v&&(a=g(v))&&this.parseID3PES(a),v={data:[],size:0}),v&&(v.data.push(e.subarray(L,R+188)),v.size+=R+188-L);break;case 0:C&&(L+=e[L]+1),k=this._pmtId=(31&(x=e)[(S=L)+10])<<8|x[S+11];break;case k:C&&(L+=e[L]+1);var x=function(e,t,i,r){var a={audio:-1,avc:-1,id3:-1,isAAC:!0},n=t+3+((15&e[t+1])<<8|e[t+2])-4;for(t+=12+((15&e[t+10])<<8|e[t+11]);te.size-6)return null;var l=t[7],c=(192&l&&(r=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2,64&l?54e5=e[i-1].pts)e.push(t);else for(var r=i-1;0<=r;r--)if(t.ptst)return r;return 0}},{key:"maxAutoLevel",get:function(){var e=this.levels,t=this.autoLevelCapping;return-1===t&&e&&e.length?e.length-1:t}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(e){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,e)}},{key:"audioTracks",get:function(){var e=this.audioTrackController;return e?e.audioTracks:[]}},{key:"audioTrack",get:function(){var e=this.audioTrackController;return e?e.audioTrack:-1},set:function(e){var t=this.audioTrackController;t&&(t.audioTrack=e)}},{key:"subtitleTracks",get:function(){var e=this.subtitleTrackController;return e?e.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var e=this.subtitleTrackController;return e?e.subtitleTrack:-1},set:function(e){var t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var e=this.subtitleTrackController;return!!e&&e.subtitleDisplay},set:function(e){var t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(e){this.config.lowLatencyMode=e}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}]),A(i,t);var y=v;function v(e){void 0===e&&(e={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new p.EventEmitter,this._autoLevelCapping=void 0,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var t=this.config=Object(f.mergeConfig)(v.DefaultConfig,e),i=(e=(this.userConfig=e,Object(h.enableLogs)(t.debug),this._autoLevelCapping=-1,t.progressive&&Object(f.enableStreamingMode)(t),t.abrController),t.bufferController),r=t.capLevelController,d=t.fpsController,g=(e=this.abrController=new e(this),i=this.bufferController=new i(this),r=this.capLevelController=new r(this),d=new d(this),new a.default(this)),m=new n.default(this),A=new s.default(this),y=this.levelController=new l.default(this),b=new c.FragmentTracker(this),E=this.streamController=new u.default(this,b);r.setStreamController(E),d.setStreamController(E),y=[y,E],this.networkControllers=y,E=[g,m,e,i,r,d,A,b];this.audioTrackController=this.createController(t.audioTrackController,null,y),this.createController(t.audioStreamController,b,y),this.subtitleTrackController=this.createController(t.subtitleTrackController,null,y),this.createController(t.subtitleStreamController,b,y),this.createController(t.timelineController,null,E),this.emeController=this.createController(t.emeController,null,E),this.cmcdController=this.createController(t.cmcdController,null,E),this.latencyController=this.createController(o.default,null,E),this.coreComponents=E}y.defaultConfig=void 0},"./src/is-supported.ts":function(e,t,i){i.r(t),i.d(t,"isSupported",(function(){return n})),i.d(t,"changeTypeSupported",(function(){return s}));var r=i("./src/utils/mediasource-helper.ts");function a(){return self.SourceBuffer||self.WebKitSourceBuffer}function n(){var e,t=Object(r.getMediaSource)();return!!t&&(e=a(),t=t&&"function"==typeof t.isTypeSupported&&t.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),e=!e||e.prototype&&"function"==typeof e.prototype.appendBuffer&&"function"==typeof e.prototype.remove,!!t)&&!!e}function s(){var e=a();return"function"==typeof(null==e||null==(e=e.prototype)?void 0:e.changeType)}},"./src/loader/fragment-loader.ts":function(e,t,i){i.r(t),i.d(t,"default",(function(){return u})),i.d(t,"LoadError",(function(){return p}));var r=i("./src/polyfills/number.ts"),a=i("./src/errors.ts");function n(e){var t="function"==typeof Map?new Map:void 0;return(n=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,i)}function i(){return s(e,arguments,l(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),o(i,e)})(e)}function s(e,t,i){return(s=function(){if("undefined"!=typeof Reflect&&Reflect.construct&&!Reflect.construct.sham){if("function"==typeof Proxy)return 1;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),1}catch(e){}}}()?Reflect.construct:function(e,t,i){var r=[null];r.push.apply(r,t),t=new(Function.bind.apply(e,r));return i&&o(t,i.prototype),t}).apply(null,arguments)}function o(e,t){return(o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var c=Math.pow(2,17),u=((t=d.prototype).destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},t.abort=function(){this.loader&&this.loader.abort()},t.load=function(e,t){var i=this,r=e.url;if(!r)return Promise.reject(new p({type:a.ErrorTypes.NETWORK_ERROR,details:a.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:e,networkDetails:null},"Fragment does not have a "+(r?"part list":"url")));this.abort();var n=this.config,s=n.fLoader,o=n.loader;return new Promise((function(r,l){i.loader&&i.loader.destroy();var u=i.loader=e.loader=new(s||o)(n),d=h(e),f={timeout:n.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:n.fragLoadingMaxRetryTimeout,highWaterMark:c};e.stats=u.stats,u.load(d,f,{onSuccess:function(t,a,n,s){i.resetLoader(e,u),r({frag:e,part:null,payload:t.data,networkDetails:s})},onError:function(t,r,n){i.resetLoader(e,u),l(new p({type:a.ErrorTypes.NETWORK_ERROR,details:a.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:t,networkDetails:n}))},onAbort:function(t,r,n){i.resetLoader(e,u),l(new p({type:a.ErrorTypes.NETWORK_ERROR,details:a.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:e,networkDetails:n}))},onTimeout:function(t,r,n){i.resetLoader(e,u),l(new p({type:a.ErrorTypes.NETWORK_ERROR,details:a.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,networkDetails:n}))},onProgress:function(i,r,a,n){t&&t({frag:e,part:null,payload:a,networkDetails:n})}})}))},t.loadPart=function(e,t,i){var r=this,n=(this.abort(),this.config),s=n.fLoader,o=n.loader;return new Promise((function(l,u){r.loader&&r.loader.destroy();var d=r.loader=e.loader=new(s||o)(n),f=h(e,t),g={timeout:n.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:n.fragLoadingMaxRetryTimeout,highWaterMark:c};t.stats=d.stats,d.load(f,g,{onSuccess:function(a,n,s,o){r.resetLoader(e,d),r.updateStatsFromPart(e,t),a={frag:e,part:t,payload:a.data,networkDetails:o},i(a),l(a)},onError:function(i,n,s){r.resetLoader(e,d),u(new p({type:a.ErrorTypes.NETWORK_ERROR,details:a.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:i,networkDetails:s}))},onAbort:function(i,n,s){e.stats.aborted=t.stats.aborted,r.resetLoader(e,d),u(new p({type:a.ErrorTypes.NETWORK_ERROR,details:a.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,networkDetails:s}))},onTimeout:function(i,n,s){r.resetLoader(e,d),u(new p({type:a.ErrorTypes.NETWORK_ERROR,details:a.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,networkDetails:s}))}})}))},t.updateStatsFromPart=function(e,t){var i=e.stats,r=t.stats,a=r.total;i.loaded+=r.loaded,a?(a=((e=Math.round(e.duration/t.duration))-(t=Math.min(Math.round(i.loaded/a),e)))*Math.round(i.loaded/t),i.total=i.loaded+a):i.total=Math.max(i.loaded,i.total),e=i.loading,t=r.loading;e.start?e.first+=t.first-t.start:(e.start=t.start,e.first=t.first),e.end=t.end},t.resetLoader=function(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()},d);function d(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}function h(e,t){var i=(t=void 0===t?null:t)||e;e={frag:e,part:t,responseType:"arraybuffer",url:i.url,headers:{},rangeStart:0,rangeEnd:0},t=i.byteRangeStartOffset,i=i.byteRangeEndOffset;return Object(r.isFiniteNumber)(t)&&Object(r.isFiniteNumber)(i)&&(e.rangeStart=t,e.rangeEnd=i),e}f=n(Error),i=f,(t=g).prototype=Object.create(i.prototype),o(t.prototype.constructor=t,i);var f,p=g;function g(e){for(var t,i=arguments.length,r=new Array(1>8*(15-i)&255;return t},i.setDecryptDataFromLevelKey=function(e,t){var i=e;return"AES-128"===(null==e?void 0:e.method)&&e.uri&&!e.iv&&((i=o.LevelKey.fromURI(e.uri)).method=e.method,i.iv=this.createInitializationVector(t),i.keyFormat="identity"),i},i.setElementaryStreamInfo=function(e,t,i,r,a,n){void 0===n&&(n=!1);var s=this.elementaryStreams,o=s[e];o?(o.startPTS=Math.min(o.startPTS,t),o.endPTS=Math.max(o.endPTS,i),o.startDTS=Math.min(o.startDTS,r),o.endDTS=Math.max(o.endDTS,a)):s[e]={startPTS:t,endPTS:i,startDTS:r,endDTS:a,partial:n}},i.clearElementaryStreamInfo=function(){var e=this.elementaryStreams;e[r.AUDIO]=null,e[r.VIDEO]=null,e[r.AUDIOVIDEO]=null},h(v,[{key:"decryptdata",get:function(){var e;return this.levelkey||this._decryptdata?(!this._decryptdata&&this.levelkey&&("number"!=typeof(e=this.sn)&&(this.levelkey&&"AES-128"===this.levelkey.method&&!this.levelkey.iv&&s.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),e=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,e)),this._decryptdata):null}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){var e;return null!==this.programDateTime&&Object(a.isFiniteNumber)(this.programDateTime)?(e=Object(a.isFiniteNumber)(this.duration)?this.duration:0,this.programDateTime+1e3*e):null}},{key:"encrypted",get:function(){var e;return!(null==(e=this.decryptdata)||!e.keyFormat||!this.decryptdata.uri)}}]),v),A=(c(y,f=g),h(y,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var e=this.elementaryStreams;return!!(e.audio||e.video||e.audiovideo)}}]),y);function y(e,t,i,r,a){return(i=f.call(this,i)||this).fragOffset=0,i.duration=0,i.gap=!1,i.independent=!1,i.relurl=void 0,i.fragment=void 0,i.index=void 0,i.stats=new l.LoadStats,i.duration=e.decimalFloatingPoint("DURATION"),i.gap=e.bool("GAP"),i.independent=e.bool("INDEPENDENT"),i.relurl=e.enumeratedString("URI"),i.fragment=t,i.index=r,t=e.enumeratedString("BYTERANGE"),t&&i.setByteRange(t,a),a&&(i.fragOffset=a.fragOffset+a.duration),i}function v(e,t){return(t=p.call(this,t)||this)._decryptdata=null,t.rawProgramDateTime=null,t.programDateTime=null,t.tagList=[],t.duration=0,t.sn=0,t.levelkey=void 0,t.type=void 0,t.loader=null,t.level=-1,t.cc=0,t.startPTS=void 0,t.endPTS=void 0,t.appendedPTS=void 0,t.startDTS=void 0,t.endDTS=void 0,t.start=0,t.deltaPTS=void 0,t.maxStartPTS=void 0,t.minEndPTS=void 0,t.stats=new l.LoadStats,t.urlId=0,t.data=void 0,t.bitrateTest=!1,t.title=null,t.initSegment=null,t.type=e,t}function b(e){var t;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=((t={})[r.AUDIO]=null,t[r.VIDEO]=null,t[r.AUDIOVIDEO]=null,t),this.baseurl=e}},"./src/loader/key-loader.ts":function(e,t,i){i.r(t),i.d(t,"default",(function(){return s}));var r=i("./src/events.ts"),a=i("./src/errors.ts"),n=i("./src/utils/logger.ts"),s=((t=o.prototype)._registerListeners=function(){this.hls.on(r.Events.KEY_LOADING,this.onKeyLoading,this)},t._unregisterListeners=function(){this.hls.off(r.Events.KEY_LOADING,this.onKeyLoading)},t.destroy=function(){for(var e in this._unregisterListeners(),this.loaders)e=this.loaders[e],e&&e.destroy();this.loaders={}},t.onKeyLoading=function(e,t){t=t.frag;var i,a,s=t.type,o=this.loaders[s];t.decryptdata?(i=t.decryptdata.uri)!==this.decrypturl||null===this.decryptkey?(a=this.hls.config,o&&(n.logger.warn("abort previous key loader for type:"+s),o.abort()),i?(o=a.loader,s=t.loader=this.loaders[s]=new o(a),this.decrypturl=i,this.decryptkey=null,o={url:i,frag:t,responseType:"arraybuffer"},i={timeout:a.fragLoadingTimeOut,maxRetry:0,retryDelay:a.fragLoadingRetryDelay,maxRetryDelay:a.fragLoadingMaxRetryTimeout,highWaterMark:0},a={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)},s.load(o,i,a)):n.logger.warn("key uri is falsy")):this.decryptkey&&(t.decryptdata.key=this.decryptkey,this.hls.trigger(r.Events.KEY_LOADED,{frag:t})):n.logger.warn("Missing decryption data on fragment in onKeyLoading")},t.loadsuccess=function(e,t,i){i=i.frag,i.decryptdata?(this.decryptkey=i.decryptdata.key=new Uint8Array(e.data),i.loader=null,delete this.loaders[i.type],this.hls.trigger(r.Events.KEY_LOADED,{frag:i})):n.logger.error("after key load, decryptdata unset")},t.loaderror=function(e,t){t=t.frag;var i=t.loader;i&&i.abort(),delete this.loaders[t.type],this.hls.trigger(r.Events.ERROR,{type:a.ErrorTypes.NETWORK_ERROR,details:a.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:t,response:e})},t.loadtimeout=function(e,t){t=t.frag;var i=t.loader;i&&i.abort(),delete this.loaders[t.type],this.hls.trigger(r.Events.ERROR,{type:a.ErrorTypes.NETWORK_ERROR,details:a.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:t})},o);function o(e){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=e,this._registerListeners()}},"./src/loader/level-details.ts":function(e,t,i){i.r(t),i.d(t,"LevelDetails",(function(){return n}));var r=i("./src/polyfills/number.ts");function a(e,t){for(var i=0;ie.endSN||0>24&255,o[1]=t>>16&255,o[2]=t>>8&255,o[3]=255&t,o.set(e,4),n=0,t=8;n>24&255,e>>16&255,e>>8&255,255&e,i>>24,i>>16&255,i>>8&255,255&i,t>>24,t>>16&255,t>>8&255,255&t,85,196,0,0]))},a.mdia=function(e){return a.box(a.types.mdia,a.mdhd(e.timescale,e.duration),a.hdlr(e.type),a.minf(e))},a.mfhd=function(e){return a.box(a.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e]))},a.minf=function(e){return"audio"===e.type?a.box(a.types.minf,a.box(a.types.smhd,a.SMHD),a.DINF,a.stbl(e)):a.box(a.types.minf,a.box(a.types.vmhd,a.VMHD),a.DINF,a.stbl(e))},a.moof=function(e,t,i){return a.box(a.types.moof,a.mfhd(e),a.traf(i,t))},a.moov=function(e){for(var t=e.length,i=[];t--;)i[t]=a.trak(e[t]);return a.box.apply(null,[a.types.moov,a.mvhd(e[0].timescale,e[0].duration)].concat(i).concat(a.mvex(e)))},a.mvex=function(e){for(var t=e.length,i=[];t--;)i[t]=a.trex(e[t]);return a.box.apply(null,[a.types.mvex].concat(i))},a.mvhd=function(e,t){t*=e;var i=Math.floor(t/(1+r));t=Math.floor(t%(1+r)),e=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,i>>24,i>>16&255,i>>8&255,255&i,t>>24,t>>16&255,t>>8&255,255&t,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return a.box(a.types.mvhd,e)},a.sdtp=function(e){for(var t,i=e.samples||[],r=new Uint8Array(4+i.length),n=0;n>>8&255),r.push(255&i),r=r.concat(Array.prototype.slice.call(t));for(s=0;s>>8&255),n.push(255&i),n=n.concat(Array.prototype.slice.call(t));var o=a.box(a.types.avcC,new Uint8Array([1,r[3],r[4],r[5],255,224|e.sps.length].concat(r).concat([e.pps.length]).concat(n))),l=e.width,c=e.height,u=e.pixelRatio[0],d=e.pixelRatio[1];return a.box(a.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,l>>8&255,255&l,c>>8&255,255&c,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),o,a.box(a.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),a.box(a.types.pasp,new Uint8Array([u>>24,u>>16&255,u>>8&255,255&u,d>>24,d>>16&255,d>>8&255,255&d])))},a.esds=function(e){var t=e.config.length;return new Uint8Array([0,0,0,0,3,23+t,0,1,0,4,15+t,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([t]).concat(e.config).concat([6,1,2]))},a.mp4a=function(e){var t=e.samplerate;return a.box(a.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,t>>8&255,255&t,0,0]),a.box(a.types.esds,a.esds(e)))},a.mp3=function(e){var t=e.samplerate;return a.box(a.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,t>>8&255,255&t,0,0]))},a.stsd=function(e){return"audio"===e.type?e.isAAC||"mp3"!==e.codec?a.box(a.types.stsd,a.STSD,a.mp4a(e)):a.box(a.types.stsd,a.STSD,a.mp3(e)):a.box(a.types.stsd,a.STSD,a.avc1(e))},a.tkhd=function(e){var t=e.id,i=e.duration*e.timescale,n=e.width,s=(e=e.height,Math.floor(i/(1+r)));i=Math.floor(i%(1+r));return a.box(a.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,0,0,0,0,s>>24,s>>16&255,s>>8&255,255&s,i>>24,i>>16&255,i>>8&255,255&i,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,n>>8&255,255&n,0,0,e>>8&255,255&e,0,0]))},a.traf=function(e,t){var i=a.sdtp(e),n=e.id,s=Math.floor(t/(1+r));t=Math.floor(t%(1+r));return a.box(a.types.traf,a.box(a.types.tfhd,new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n])),a.box(a.types.tfdt,new Uint8Array([1,0,0,0,s>>24,s>>16&255,s>>8&255,255&s,t>>24,t>>16&255,t>>8&255,255&t])),a.trun(e,i.length+16+20+8+16+8+8),i)},a.trak=function(e){return e.duration=e.duration||4294967295,a.box(a.types.trak,a.tkhd(e),a.mdia(e))},a.trex=function(e){return e=e.id,a.box(a.types.trex,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},a.trun=function(e,t){var i,r,n,s,o,l=e.samples||[],c=l.length,u=(e=12+16*c,new Uint8Array(e));for(u.set([0,0,15,1,c>>>24&255,c>>>16&255,c>>>8&255,255&c,(t+=8+e)>>>24&255,t>>>16&255,t>>>8&255,255&t],0),i=0;i>>24&255,r>>>16&255,r>>>8&255,255&r,n>>>24&255,n>>>16&255,n>>>8&255,255&n,s.isLeading<<2|s.dependsOn,s.isDependedOn<<6|s.hasRedundancy<<4|s.paddingValue<<1|s.isNonSync,61440&s.degradPrio,15&s.degradPrio,o>>>24&255,o>>>16&255,o>>>8&255,255&o],12+16*i);return a.box(a.types.trun,u)},a.initSegment=function(e){a.types||a.init();e=a.moov(e);var t=new Uint8Array(a.FTYP.byteLength+e.byteLength);return t.set(a.FTYP),t.set(e,a.FTYP.byteLength),t},i=a;function a(){}i.types=void 0,i.HDLR_TYPES=void 0,i.STTS=void 0,i.STSC=void 0,i.STCO=void 0,i.STSZ=void 0,i.VMHD=void 0,i.SMHD=void 0,i.STSD=void 0,i.FTYP=void 0,i.DINF=void 0,t.default=i},"./src/remux/mp4-remuxer.ts":function(e,t,i){i.r(t),i.d(t,"default",(function(){return g})),i.d(t,"normalizePts",(function(){return A}));var r=i("./src/polyfills/number.ts"),a=i("./src/remux/aac-helper.ts"),n=i("./src/remux/mp4-generator.ts"),s=i("./src/events.ts"),o=i("./src/errors.ts"),l=i("./src/utils/logger.ts"),c=i("./src/types/loader.ts"),u=i("./src/utils/timescale-conversion.ts");function d(){return(d=Object.assign||function(e){for(var t=1;tR.pts&&(w=Math.max(Math.min(w,R.pts-R.dts),-18e3)),R.dtsNumber.MAX_SAFE_INTEGER?1/0:e},i.hexadecimalInteger=function(e){if(this[e]){for(var t=(1&(t=(this[e]||"0x").slice(2)).length?"0":"")+t,i=new Uint8Array(t.length/2),r=0;rNumber.MAX_SAFE_INTEGER?1/0:e},i.decimalFloatingPoint=function(e){return parseFloat(this[e])},i.optionalFloat=function(e,t){return e=this[e],e?parseFloat(e):t},i.enumeratedString=function(e){return this[e]},i.bool=function(e){return"YES"===this[e]},i.decimalResolution=function(e){if(e=r.exec(this[e]),null!==e)return{width:parseInt(e[1],10),height:parseInt(e[2],10)}},s.parseAttrList=function(e){var t,i={};for(a.lastIndex=0;null!==(t=a.exec(e));){var r=t[2];0===r.indexOf('"')&&r.lastIndexOf('"')===r.length-1&&(r=r.slice(1,-1)),i[t[1]]=r}return i},s);function s(e){for(var t in e="string"==typeof e?s.parseAttrList(e):e)e.hasOwnProperty(t)&&(this[t]=e[t])}},"./src/utils/binary-search.ts":function(e,t,i){i.r(t),t.default={search:function(e,t){for(var i,r,a=0,n=e.length-1;a<=n;){var s=t(r=e[i=(a+n)/2|0]);if(0=i.start(r)&&t<=i.end(r))return!0}catch(e){}return!1},s.bufferInfo=function(e,t,i){try{if(e){for(var r=s.getBuffered(e),a=[],n=0;nn&&(r[s-1].end=e[a].end):r.push(e[a])}else r=e;for(var o,l=0,c=t,u=t,d=0;d=e&&s.logger.log(this.time+" ["+e+"] "+t)},R),m=((i=_.prototype).reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},i.setStyles=function(e){for(var t=["foreground","underline","italics","background","flash"],i=0;ic&&(this.logger.log(n.DEBUG,"Too large cursor position "+this.pos),this.pos=c)},i.moveCursor=function(e){var t=this.pos+e;if(1=c?this.logger.log(n.ERROR,"Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!"):(this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1))},i.clearFromPos=function(e){for(var t=e;t ("+a([l,c])+")"),!(i=(i=(i=(i=this.parseCmd(l,c))||this.parseMidrow(l,c))||this.parsePAC(l,c))||this.parseBackgroundAttributes(l,c))&&(r=this.parseChars(l,c))&&((o=this.currentChannel)&&0i.startCC||e&&e.cc=this.minWeight_},i.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},i.destroy=function(){},t.default=a},"./src/utils/ewma.ts":function(e,t,i){function r(e,t,i){void 0===t&&(t=0),void 0===i&&(i=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=i}i.r(t),(i=r.prototype).sample=function(e,t){var i=Math.pow(this.alpha_,e);this.estimate_=t*(1-i)+i*this.estimate_,this.totalWeight_+=e},i.getTotalWeight=function(){return this.totalWeight_},i.getEstimate=function(){if(this.alpha_){var e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_},t.default=r},"./src/utils/fetch-loader.ts":function(e,t,i){i.r(t),i.d(t,"fetchSupported",(function(){return d}));var r=i("./src/polyfills/number.ts"),a=i("./src/loader/load-stats.ts"),n=i("./src/demux/chunk-cache.ts");function s(e){var t="function"==typeof Map?new Map:void 0;return(s=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,i)}function i(){return o(e,arguments,c(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),l(i,e)})(e)}function o(e,t,i){return(o=function(){if("undefined"!=typeof Reflect&&Reflect.construct&&!Reflect.construct.sham){if("function"==typeof Proxy)return 1;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),1}catch(e){}}}()?Reflect.construct:function(e,t,i){var r=[null];r.push.apply(r,t),t=new(Function.bind.apply(e,r));return i&&l(t,i.prototype),t}).apply(null,arguments)}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function u(){return(u=Object.assign||function(e){for(var t=1;t=r&&a(t,i,s.flush(),e)):a(t,i,o,e),n())})).catch((function(){return Promise.reject()}))}()},i=h,p=s(Error),m=p,(g=y).prototype=Object.create(m.prototype),l(g.prototype.constructor=g,m);var p,g,m,A=y;function y(e,t,i){return(e=p.call(this,e)||this).code=void 0,e.details=void 0,e.code=t,e.details=i,e}t.default=i},"./src/utils/imsc1-ttml-parser.ts":function(e,t,i){i.r(t),i.d(t,"IMSC1_CODEC",(function(){return u})),i.d(t,"parseIMSC1",(function(){return p}));var r=i("./src/utils/mp4-tools.ts"),a=i("./src/utils/vttparser.ts"),n=i("./src/utils/vttcue.ts"),s=i("./src/demux/id3.ts"),o=i("./src/utils/timescale-conversion.ts"),l=i("./src/utils/webvtt-parser.ts");function c(){return(c=Object.assign||function(e){for(var t=1;t"):r)}))}(e,"debug","log","info","warn","error");try{n.log()}catch(e){n=a}}else n=a}var o=a},"./src/utils/mediakeys-helper.ts":function(e,t,i){i.r(t),i.d(t,"KeySystems",(function(){return r})),i.d(t,"requestMediaKeySystemAccess",(function(){return a})),(i=r=r||{}).WIDEVINE="com.widevine.alpha",i.PLAYREADY="com.microsoft.playready";var r,a="undefined"!=typeof self&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null},"./src/utils/mediasource-helper.ts":function(e,t,i){function r(){return self.MediaSource||self.WebKitMediaSource}i.r(t),i.d(t,"getMediaSource",(function(){return r}))},"./src/utils/mp4-tools.ts":function(e,t,i){i.r(t),i.d(t,"bin2str",(function(){return o})),i.d(t,"readUint16",(function(){return l})),i.d(t,"readUint32",(function(){return c})),i.d(t,"writeUint32",(function(){return u})),i.d(t,"findBox",(function(){return d})),i.d(t,"parseSegmentIndex",(function(){return h})),i.d(t,"parseInitSegment",(function(){return f})),i.d(t,"getStartDTS",(function(){return p})),i.d(t,"getDuration",(function(){return g})),i.d(t,"computeRawDurationFromSamples",(function(){return m})),i.d(t,"offsetStartDTS",(function(){return A})),i.d(t,"segmentValidRange",(function(){return y})),i.d(t,"appendUint8Array",(function(){return v}));var r=i("./src/utils/typed-array.ts"),a=i("./src/loader/fragment.ts"),n=Math.pow(2,32)-1,s=[].push;function o(e){return String.fromCharCode.apply(null,e)}function l(e,t){return"data"in e&&(t+=e.start,e=e.data),e=e[t]<<8|e[t+1],e<0?65536+e:e}function c(e,t){return"data"in e&&(t+=e.start,e=e.data),e=e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3],e<0?4294967296+e:e}function u(e,t,i){"data"in e&&(t+=e.start,e=e.data),e[t]=i>>24,e[t+1]=i>>16&255,e[t+2]=i>>8&255,e[t+3]=255&i}function d(e,t){var i,r,a=[];if(t.length)for(var n=("data"in e?(i=e.data,r=e.start,e.end):(r=0,(i=e).byteLength)),l=r;l>>31)return console.warn("SIDX has hierarchical references (not supported)"),null;f=c(r,h),h+=4,i.push({referenceSize:p,subsegmentDuration:f,info:{duration:f/n,start:s,end:s+p-1}}),s+=p,a=h+=4}return{earliestPresentationTime:0,timescale:n,version:e,referencesCount:o,references:i,moovEndOffset:t}}function f(e){for(var t=[],i=d(e,["moov","trak"]),r=0;re)&&(this.startTime=e),this.endTime=t,this.screen=i,this.timelineController.createCaptionsTrack(this.trackName)},i.reset=function(){this.cueRanges=[],this.startTime=null};var r=a;function a(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t}},"./src/utils/texttrack-utils.ts":function(e,t,i){i.r(t),i.d(t,"sendAddTrackEvent",(function(){return a})),i.d(t,"addCueToTrack",(function(){return n})),i.d(t,"clearCurrentCues",(function(){return s})),i.d(t,"removeCuesInRange",(function(){return o})),i.d(t,"getCuesInRange",(function(){return l}));var r=i("./src/utils/logger.ts");function a(e,t){var i;try{i=new Event("addtrack")}catch(e){(i=document.createEvent("Event")).initEvent("addtrack",!1,!1)}i.track=e,t.dispatchEvent(i)}function n(e,t){var i=e.mode;if("disabled"===i&&(e.mode="hidden"),e.cues&&!e.cues.getCueById(t.id))try{if(e.addCue(t),!e.cues.getCueById(t.id))throw new Error("addCue is failed for: "+t)}catch(i){r.logger.debug("[texttrack-utils]: "+i);var a=new self.TextTrackCue(t.startTime,t.endTime,t.text);a.id=t.id,e.addCue(a)}"disabled"===i&&(e.mode=i)}function s(e){var t=e.mode;if("disabled"===t&&(e.mode="hidden"),e.cues)for(var i=e.cues.length;i--;)e.removeCue(e.cues[i]);"disabled"===t&&(e.mode=t)}function o(e,t,i){var r=e.mode;if("disabled"===r&&(e.mode="hidden"),e.cues&&0e[i].endTime)return-1;for(var r=0,a=i;r<=a;){var n=Math.floor((a+r)/2);if(te[n].startTime&&r=t&&o.endTime<=i)r.push(o);else if(o.startTime>i)return r}return r}},"./src/utils/time-ranges.ts":function(e,t,i){i.r(t),t.default={toString:function(e){for(var t="",i=e.length,r=0;r/gi,"\n")}(i=p.prototype).parse=function(e){var t=this;function i(){for(var e=0,i=h(i=t.buffer);e>>0).toString()};function d(e,t,i){return u(e.toString())+u(t.toString())+u(i)}function h(e,t,i,u,h,f,p,g){var m,A=new a.VTTParser,y=(e=Object(n.utf8ArrayToStr)(new Uint8Array(e)).trim().replace(l,"\n").split("\n"),[]),v=Object(s.toMpegTsClockFromTimescale)(t,i),b="00:00.000",E=0,k=0,T=!0,w=!1;A.oncue=function(e){var t=u[h],i=u.ccOffset,r=(E-v)/9e4;null!=t&&t.new&&(void 0!==k?i=u.ccOffset=t.start:function(e,t){var i,r=e[h],a=e[r.prevCC];if(!a||!a.new&&r.new)return e.ccOffset=e.presentationOffset=r.start,r.new=!1;for(;null!=(i=a)&&i.new;)e.ccOffset+=r.start-a.start,r.new=!1,a=e[(r=a).prevCC];e.presentationOffset=t}(u,r)),r&&(i=r-u.presentationOffset),w&&(t=e.endTime-e.startTime,r=Object(o.normalizePts)(9e4*(e.startTime+i-k),9e4*f)/9e4,e.startTime=r,e.endTime=r+t),i=e.text.trim();e.text=decodeURIComponent(encodeURIComponent(i)),e.id||(e.id=d(e.startTime,e.endTime,i)),0=e.maxRetry||400<=t&&t<499?(r.logger.error(t+" while loading "+n.url),this.callbacks.onError({code:t,text:s.statusText},n,s)):(r.logger.warn(t+" while loading "+n.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,e.maxRetryDelay),o.retry++)):(self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),e.timeout)))},i.loadtimeout=function(){r.logger.warn("timeout while loading "+this.context.url);var e=this.callbacks;e&&(this.abortInternal(),e.onTimeout(this.stats,this.context,this.loader))},i.loadprogress=function(e){var t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)},i.getCacheAge=function(){var e,t=null;return this.loader&&n.test(this.loader.getAllResponseHeaders())?(e=this.loader.getResponseHeader("age"))?parseFloat(e):null:t},t.default=s}},i={},e.m=t,e.c=i,e.d=function(t,i,r){e.o(t,i)||Object.defineProperty(t,i,{enumerable:!0,get:r})},e.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},e.t=function(t,i){if(1&i&&(t=e(t)),8&i)return t;if(4&i&&"object"==y(t)&&t&&t.__esModule)return t;var r=Object.create(null);if(e.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&i&&"string"!=typeof t)for(var a in t)e.d(r,a,function(e){return t[e]}.bind(null,a));return r},e.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(i,"a",i),i},e.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},e.p="/dist/",e(e.s="./src/hls.ts").default;function e(r){var a;return(i[r]||(a=i[r]={i:r,l:!1,exports:{}},t[r].call(a.exports,a,a.exports,e),a.l=!0,a)).exports}var t,i}())})))&&Tr.__esModule&&Object.prototype.hasOwnProperty.call(Tr,"default")?Tr.default:Tr,ya=function(e){function t(e){var i;return A(this,t),i=p(this,t),(i.player=e)._opt,i.canVideoPlay=!1,i.$videoElement=null,i.canvasRenderInterval=null,i.bandwidthEstimateInterval=null,i.fpsInterval=null,i.hlsFps=0,i.hlsPrevFrams=0,i.isInitInfo=!1,i.eventsDestroy=[],Aa.isSupported()?(i.$videoElement=i.player.video.$videoElement,i.hls=new Aa({}),i._initHls(),i._bindEvents()):function(){var e=document.createElement("video"),t=e.canPlayType("application/vnd.apple.mpegurl");return e=null,t}()?(i.$videoElement=i.player.video.$videoElement,i.canVideoPlay=!0):i.player.debug.error("HlsDecoder","init hls error ,not support "),i.player.debug.log("HlsDecoder","init"),i}return g(t,e),m(t,[{key:"destroy",value:function(){this.hls&&(this.hls.destroy(),this.hls=null),this.eventsDestroy.length&&(this.eventsDestroy.forEach((function(e){return e()})),this.eventsDestroy=[]),this.isInitInfo=!1,this._stopCanvasRender(),this._stopBandwidthEstimateInterval(),this._stopFpsInterval(),this.$videoElement=null,this.hlsFps=0,this.player.debug.log("HlsDecoder","destroy")}},{key:"checkHlsBufferedDelay",value:function(){var e=this.$videoElement,t=0,i=e.buffered;i=i.length?i.end(i.length-1):0;return(t=i-e.currentTime)<0&&(this.player.debug.warn("HlsDecoder","checkHlsBufferedDelay result < 0",t,i,e.currentTime),t=0),t}},{key:"getFps",value:function(){return this.hlsFps}},{key:"_startCanvasRender",value:function(){var e=this;this._stopCanvasRender(),this.canvasRenderInterval=setInterval((function(){e.player.video.render({$video:e.$videoElement,ts:0})}),40)}},{key:"_stopCanvasRender",value:function(){this.canvasRenderInterval&&(clearInterval(this.canvasRenderInterval),this.canvasRenderInterval=null)}},{key:"_startBandwidthEstimateInterval",value:function(){var e=this;this._stopBandwidthEstimateInterval(),this.bandwidthEstimateInterval=setInterval((function(){var t=0;e.hls.bandwidthEstimate&&(t=e.hls.bandwidthEstimate),e.player.emit(U.kBps,(t/1024/8/10).toFixed(2))}),1e3)}},{key:"_stopBandwidthEstimateInterval",value:function(){this.bandwidthEstimateInterval&&(clearInterval(this.bandwidthEstimateInterval),this.bandwidthEstimateInterval=null)}},{key:"_startFpsInterval",value:function(){var e=this;this._stopCanvasRender(),this.fpsInterval=setInterval((function(){var t=e.$videoElement.getVideoPlaybackQuality();e.hlsFps=t.totalVideoFrames-e.hlsPrevFrams,e.hlsPrevFrams=t.totalVideoFrames}),1e3)}},{key:"_stopFpsInterval",value:function(){this.fpsInterval&&(clearInterval(this.fpsInterval),this.fpsInterval=null)}},{key:"_initHls",value:function(){this.player._opt.useCanvasRender&&(this.$videoElement=document.createElement("video"),this.$videoElement.muted=!0,Ye()&&(this.$videoElement.style.position="absolute"),this.initVideoEvents()),this.hls.attachMedia(this.$videoElement)}},{key:"_bindEvents",value:function(){var e=this,t=this.player,i=this.player.events["proxy"];this.hls;var r=i(this.$videoElement,ve,(function(i){e.hls&&(i=parseInt(i.timeStamp,10),t.handleRender(),t.updateStats({ts:i,dts:i}),t.emit(U.videoTimeUpdate,i))}));this.eventsDestroy.push(r),this._startBandwidthEstimateInterval(),this._startFpsInterval(),this.hls.on(Aa.Events.ERROR,(function(t,i){if(i.fatal)switch(i.type){case Aa.ErrorTypes.NETWORK_ERROR:e.player.debug.error("HlsDecoder","fatal network error encountered, try to recover"),e.hls.startLoad();break;case Aa.ErrorTypes.MEDIA_ERROR:e.player.debug.error("HlsDecoder","fatal media error encountered, try to recover"),e.hls.recoverMediaError()}})),this.hls.on(Aa.Events.MEDIA_ATTACHING,(function(){})),this.hls.on(Aa.Events.MEDIA_ATTACHED,(function(){})),this.hls.on(Aa.Events.MEDIA_DETACHING,(function(){})),this.hls.on(Aa.Events.MEDIA_DETACHED,(function(){})),this.hls.on(Aa.Events.BUFFER_RESET,(function(){})),this.hls.on(Aa.Events.BUFFER_CODECS,(function(){})),this.hls.on(Aa.Events.BUFFER_CREATED,(function(){})),this.hls.on(Aa.Events.BUFFER_APPENDING,(function(t,i){e.player.debug.log("HlsDecoder","BUFFER_APPENDING",i)})),this.hls.on(Aa.Events.BUFFER_APPENDED,(function(){})),this.hls.on(Aa.Events.BUFFER_EOS,(function(){})),this.hls.on(Aa.Events.BUFFER_FLUSHING,(function(){})),this.hls.on(Aa.Events.BUFFER_FLUSHED,(function(){})),this.hls.on(Aa.Events.MANIFEST_LOADING,(function(){e.player.debug.log("HlsDecoder","MANIFEST_LOADING 开始加载playlist m3u8资源")})),this.hls.on(Aa.Events.MANIFEST_LOADED,(function(t,i){e.player.debug.log("HlsDecoder","MANIFEST_LOADED playlist m3u8文件加载完成",i)})),this.hls.on(Aa.Events.MANIFEST_PARSED,(function(){e.player.debug.log("HlsDecoder","MANIFEST_PARSED playlist m3u8解析完成"),t._times.demuxStart||(t._times.demuxStart=Ue())})),this.hls.on(Aa.Events.LEVEL_LOADING,(function(){})),this.hls.on(Aa.Events.LEVEL_LOADED,(function(e,t){})),this.hls.on(Aa.Events.FRAG_LOADING,(function(){})),this.hls.on(Aa.Events.FRAG_LOADED,(function(e,i){t._times.decodeStart||(t._times.decodeStart=Ue())})),this.hls.on(Aa.Events.BUFFER_APPENDING,(function(){t._times.videoStart||(t._times.videoStart=Ue(),t.handlePlayToRenderTimes())})),this.hls.on(Aa.Events.FRAG_DECRYPTED,(function(){})),this.hls.on(Aa.Events.KEY_LOADING,(function(){})),this.hls.on(Aa.Events.KEY_LOADING,(function(){})),this.hls.on(Aa.Events.FPS_DROP,(function(e){})),this.hls.on(Aa.Events.FPS_DROP_LEVEL_CAPPING,(function(e){})),this.hls.on(Aa.Events.FRAG_PARSING_INIT_SEGMENT,(function(t,i){e.player.debug.log("HlsDecoder","FRAG_PARSING_INIT_SEGMENT",i);var r,a=!!(i&&i.tracks&&i.tracks.audio),n=!!(i&&i.tracks&&i.tracks.video);if(a&&i.tracks.audio){var s=i.tracks.audio,o=s.metadata&&s.metadata.channelCount?s.metadata.channelCount:0,l=s.codec;e.player.audio&&e.player.audio.updateAudioInfo({encType:l,channels:o,sampleRate:44100})}n&&i.tracks.video&&(i=(s=i.tracks.video).codec,r=s.metadata&&s.metadata.width?s.metadata.width:0,s=s.metadata&&s.metadata.height?s.metadata.height:0,e.player.video)&&e.player.video.updateVideoInfo({encTypeCode:-1!==i.indexOf("avc")?7:12,width:r,height:s})}))}},{key:"initVideoPlay",value:function(e){this.player._opt.useCanvasRender&&(this.$videoElement=document.createElement("video"),this.initVideoEvents()),this.$videoElement.muted=!0,this.$videoElement.src=e}},{key:"initRenderSize",value:function(){this.isInitInfo||(this.player.video.updateVideoInfo({width:this.$videoElement.videoWidth,height:this.$videoElement.videoHeight}),this.player.video.initCanvasViewSize(),this.isInitInfo=!0)}},{key:"initVideoEvents",value:function(){var e=this,t=this.player.events["proxy"],i=t(this.$videoElement,Ae,(function(){e.player.debug.log("HlsDecoder","video canplay"),e.$videoElement.play().then((function(){e.player.debug.log("HlsDecoder","video play"),e._startCanvasRender(),e.initRenderSize()})).catch((function(t){e.player.debug.warn("HlsDecoder","video play error ",t)}))})),r=t(this.$videoElement,ye,(function(){e.player.debug.log("HlsDecoder","video waiting")})),a=t(this.$videoElement,ve,(function(t){t=parseInt(t.timeStamp,10),e.player.handleRender(),e.player.updateStats({ts:t}),e.player.emit(U.videoTimeUpdate,t),e.$videoElement.paused&&(e.player.debug.warn("HlsDecoder","video is paused and next try to replay"),e.$videoElement.play().then((function(){e.player.debug.log("HlsDecoder","video is paused and replay success")})).catch((function(t){e.player.debug.warn("HlsDecoder","video is paused and replay error ",t)})))}));t=t(this.$videoElement,be,(function(){e.player.debug.log("HlsDecoder","video playback Rate change",e.$videoElement&&e.$videoElement.playbackRate)}));this.eventsDestroy.push(i,r,a,t)}},{key:"loadSource",value:function(e){var t=this;return new Promise((function(i,r){t.canVideoPlay?(t.initVideoPlay(e),i()):t.hls.on(Aa.Events.MEDIA_ATTACHED,(function(){t.hls.loadSource(e),i()}))}))}},{key:"_handleUpdatePlaybackRate",value:function(){if(this.$videoElement){var e=this.$videoElement,t=(this.player._opt.videoBuffer+this.player._opt.videoBufferDelay)/1e3,i=e.buffered,r=(i=(i.length&&i.start(0),i.length?i.end(i.length-1):0),e.currentTime),a=i-r;t=Math.max(5,3+t),t=(t\n ').concat(n.content,"\n \n "),(r=Array.from(this.$contextmenus.children)[n.index])?r.insertAdjacentHTML("beforebegin",i):la(this.$contextmenus,i),r=this.$contextmenus.querySelector(".jessibuca-contextmenu-"+t),n.click&&s(r,"click",(function(e){e.preventDefault(),n.click.call(a.player,a,e),a.hide()})),this.menuList.push({uuid:t,$menuItem:r}))}}])}(It),Sa=function(e){function r(e,t){var i;A(this,r),i=p(this,r),i.$container=e;e=Rt();var a,n=(i._opt=Object.assign({},e,t),i.debug=new xe(i),i._opt.forceNoOffscreen=!0,Ke()&&(i._opt.controlAutoHide=!1),i._opt.forceNoOffscreen||("undefined"==typeof OffscreenCanvas?(i._opt.forceNoOffscreen=!0,i._opt.useOffscreen=!1):i._opt.useOffscreen=!0),(i._opt.isHls||i._opt.isWebrtc)&&(i._opt.useWCS=!1,i._opt.useMSE=!1,i._opt.isNakedFlow=!1),i._opt.isNakedFlow,i._opt.isHls||i._opt.isWebrtc||(i._opt.useWCS&&(i._opt.useWCS="VideoEncoder"in window,i._opt.useWCS||i.debug.warn("Player","useWCS is true, but not support so set useWCS false"),i._opt.useWCS)&&(i._opt.useOffscreen?i._opt.wcsUseVideoRender=!1:i._opt.wcsUseVideoRender&&(i._opt.wcsUseVideoRender=it()&&rt(),i._opt.wcsUseVideoRender||i.debug.warn("Player","wcsUseVideoRender is true, but not support so set wcsUseVideoRender false"))),i._opt.useMSE&&(i._opt.useMSE=function(){var e=!1;return!(!("MediaSource"in window)||!window.MediaSource.isTypeSupported(ae))||e}(),i._opt.useMSE||i.debug.warn("Player","useMSE is true, but not support so set useMSE false"))),i._opt.useMSE?(i._opt.useWCS&&i.debug.warn("Player","useMSE is true and useWCS is true then useWCS set true->false"),i._opt.forceNoOffscreen||i.debug.warn("Player","useMSE is true and forceNoOffscreen is false then forceNoOffscreen set false->true"),i._opt.useWCS=!1,i._opt.forceNoOffscreen=!0):i._opt.useWCS,!i._opt.useSIMD&&-1===i._opt.decoder.indexOf("-simd")||(i._opt.useSIMD=WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11])),i._opt.useSIMD)||i.debug.warn("Player","useSIMD is true, but not support so set useSIMD false"),i._opt.useSIMD?-1===i._opt.decoder.indexOf("-simd")&&(i._opt.decoder=i._opt.decoder.replace("decoder-pro","decoder-pro-simd")):-1!==i._opt.decoder.indexOf("-simd")&&(i._opt.decoder=i._opt.decoder.replace("decoder-pro-simd","decoder-pro")),Lt(i._opt.hasAudio)&&(i._opt.operateBtns.audio=!1),Lt(i._opt.hasVideo)&&(i._opt.operateBtns.fullscreen=!1,i._opt.operateBtns.screenshot=!1,i._opt.operateBtns.record=!1,i._opt.operateBtns.ptz=!1,i._opt.operateBtns.quality=!1,i._opt.operateBtns.zoom=!1),i._opt.qualityConfig&&0===i._opt.qualityConfig.length&&i._opt.operateBtns.quality&&(i._opt.operateBtns.quality=!1,i.debug.warn("Player","_opt.qualityConfig is empty, so set operateBtns.quality false")),Dt(i._opt.useWebGPU)&&(i._opt.useWebGPU=function(){var e=!1;return"gpu"in navigator||e}(),Lt(i._opt.useWebGPU))&&i.debug.warn("Player","useWebGPU is true, but not support so set useWebGPU false"),i._opt.hasControl=i._hasControl(),i._loading=!1,i._playing=!1,i._playbackPause=!1,i._hasLoaded=!1,i._zooming=!1,i._destroyed=!1,i._checkHeartTimeout=null,i._checkLoadingTimeout=null,i._checkStatsInterval=null,i._checkVisibleHiddenTimeout=null,i._startBpsTime=null,i._isPlayingBeforePageHidden=!1,i._stats={buf:0,netBuf:0,fps:0,maxFps:0,dfps:0,abps:0,vbps:0,ts:0,mseTs:0,pTs:0,dts:0},i._allStatsData={},i._faceDetectActive=!1,i._objectDetectActive=!1,i._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},i._videoTimestamp=0,i._audioTimestamp=0,i._videoIframeIntervalTs=0,i._streamQuality=i._opt.defaultStreamQuality||"",i._visibility=!0,i._lastestVisibilityChangeTimestamp=null,i._tempWorkerStats=null,i._isPlayback()&&(i._opt.useMSE=!1,i._opt.useWCS=!1),Lt(i._opt.useMSE)&&Lt(i._opt.useWCS)&&Lt(i._opt.isWebrtc)&&Lt(i._opt.isHls)&&(i._opt.useWasm=!0),(i._opt.isHls||i._opt.isWebrtc)&&(i._opt.hasVideo=!0,i._opt.hasAudio=!0),i._opt.hasVideo||(i._opt.useMSE=!1,i._opt.useWCS=!1),i._opt.useWasm&&(i._opt.useOffscreen?i._opt.wasmUseVideoRender=!1:i._opt.wasmUseVideoRender&&(i._opt.wasmUseVideoRender=Xe()&&it()&&rt(),i._opt.wasmUseVideoRender||i.debug.warn("Player","use wasm video render, but not support so set wasmUseVideoRender false")),i._opt.useSIMD?i.debug.log("Player","use simd wasm"):i.debug.log("Player","use wasm")),i._opt.useWasm&&(i._opt.useFaceDetector&&window.JessibucaProFaceDetector||i._opt.useObjectDetector&&window.JessibucaProObjectDetector)?(i.ai=new Ta(i),i._opt.useFaceDetector&&window.JessibucaProFaceDetector||(i._opt.operateBtns.aiFace=!1),i._opt.useObjectDetector&&window.JessibucaProObjectDetector||(i._opt.operateBtns.aiObject=!1)):(i._opt.operateBtns.aiObject=!1,i._opt.operateBtns.aiFace=!1),!i._opt.useFaceDetector||i._opt.useWasm&&window.JessibucaProFaceDetector||i.debug.warn("Player","use face detector, useWasm is ".concat(i._opt.useWasm," and window.JessibucaProFaceDetector is ")+!!window.JessibucaProFaceDetector),!i._opt.useObjectDetector||i._opt.useWasm&&window.JessibucaProObjectDetector||i.debug.warn("Player","use object detector, useWasm is ".concat(i._opt.useWasm," and window.JessibucaProObjectDetector is ")+!!window.JessibucaProObjectDetector),i._opt.useVideoRender&&(i._opt.useWasm&&!i._opt.useOffscreen?(i._opt.wasmUseVideoRender=Xe()&&it()&&rt(),i._opt.wasmUseVideoRender||i.debug.warn("Player","use wasm video render, but not support so set wasmUseVideoRender false")):i._opt.useWCS&&!i._opt.useOffscreen&&(i._opt.wcsUseVideoRender=it()&&rt(),i._opt.wcsUseVideoRender||i.debug.warn("Player","use wcs video render, but not support so set wcsUseVideoRender false"))),i._opt.useCanvasRender&&(i._opt.useMSE&&(i._opt.mseUseCanvasRender=!0),i._opt.useWasm&&(i._opt.wasmUseVideoRender=!1),i._opt.useWCS&&(i._opt.wcsUseVideoRender=!1),i._opt.isHls)&&!Ye()&&(i._opt.hlsUseCanvasRender=!0),i._opt.useVideoRender=!1,i._opt.useCanvasRender=!1,i._opt.useWasm?i._opt.wasmUseVideoRender?i._opt.useVideoRender=!0:i._opt.useCanvasRender=!0:i._opt.useWCS?i._opt.wcsUseVideoRender?i._opt.useVideoRender=!0:i._opt.useCanvasRender=!0:i._opt.useMSE?i._opt.mseUseCanvasRender?i._opt.useCanvasRender=!0:i._opt.useVideoRender=!0:i._opt.isHls?i._opt.hlsUseCanvasRender?i._opt.useCanvasRender=!0:i._opt.useVideoRender=!0:i._opt.isWebrtc&&(i._opt.useVideoRender=!0),a=i,Object.defineProperty(a,"rect",{get:function(){var e=a.$container.getBoundingClientRect();return e.width=Math.max(e.width,a.$container.clientWidth),e.height=Math.max(e.height,a.$container.clientHeight),e}}),["bottom","height","left","right","top","width"].forEach((function(e){Object.defineProperty(a,e,{get:function(){return a.rect[e]}})})),i.events=new xt(i),i._opt.hasVideo&&(i.video=new $t(i),i.recorder=new ji(i)),i._opt.isHls?(i.hlsDecoder=new ya(i),i.loaded=!0):i._opt.isWebrtc?(i._opt.isWebrtcForZLM?i.webrtc=new ba(i):i.webrtc=new va(i),i.loaded=!0):bt(i._opt)?i.loaded=!0:i.decoderWorker=new Ui(i),i._opt.hasAudio&&(i.audio=new pi(i)),i.stream=null,i.demux=null,i._lastVolume=null,i._isInZoom=!1,i._playingStartTimestamp=null,i._opt.useWCS&&(i.webcodecsDecoder=new ea(i),i._opt.hasAudio||(i.loaded=!0)),i._opt.useMSE&&(i.mseDecoder=new pa(i),i._opt.hasAudio||(i.loaded=!0)),i.control=new ha(i),0this._stats.maxFps&&(this._stats.maxFps=this._stats.fps),this._allStatsData=Object.assign(this._stats,{audioBuffer:d,audioTs:this.audioTimestamp,playbackVideoBuffer:h,playbackVideoWaitingBuffer:0,playbackAudioWaitingBuffer:0,playbackCacheDataDuration:f,demuxBuffer:s,pushLatestDelay:u,audioDemuxBuffer:o,flvBuffer:n,mseDelay:i,mseDecodeDiffTimes:r,mseDecodePlaybackRate:a,wcsDecodeDiffTimes:r,hlsDelay:i,hlsDecodePlaybackRate:a,delayTs:e,totalDelayTs:g,isDropping:l,isStreamTsMoreThanLocal:c}),this.emit(U.stats,this._allStatsData),1048576=l)){for(s=0;s do talk"),e.emit(U.talkStreamOpen),t(),e._doTalk()})),r(e.socket,"message",(function(t){e.log(e.tag,"websocket message",t.data)})),r(e.socket,"close",(function(t){e.socketStatus="close",e.log(e.tag,"websocket close"),e.emit(U.talkStreamClose),i(t)})),r(e.socket,"error",(function(t){e.socketStatus="error",e.error(e.tag,"websocket error",t),e.emit(U.talkStreamError,t),i(t)}))}))}},{key:"_sendClose",value:function(){}},{key:"_initTalk",value:function(){this._initMethods(),this._opt.engine===we?this._initWorklet():"script"===this._opt.engine&&this._initScriptProcessor(),this.log(this.tag,"audioContext samplerate",this.audioContext.sampleRate)}},{key:"_initMethods",value:function(){this.audioContext=new(window.AudioContext||window.webkitAudioContext)({sampleRate:48e3}),this.gainNode=this.audioContext.createGain(),this.gainNode.gain.value=1,this.biquadFilter=this.audioContext.createBiquadFilter(),this.biquadFilter.type="lowpass",this.biquadFilter.frequency.value=3e3,this.resampler=new _a({fromSampleRate:this.audioContext.sampleRate,toSampleRate:this._opt.sampleRate,channels:this._opt.numberChannels,inputBufferSize:this.bufferSize})}},{key:"_initScriptProcessor",value:function(){var e=this,t=this.audioContext.createScriptProcessor||this.audioContext.createJavaScriptNode;this.recorder=t.apply(this.audioContext,[this.bufferSize,this._opt.numberChannels,this._opt.numberChannels]),this.recorder.onaudioprocess=function(t){return e._onaudioprocess(t)}}},{key:"_initWorklet",value:function(){var e=this;this.audioContext.audioWorklet.addModule(Et((function(){var e=function(e){function t(e){var i;return A(this,t),i=p(this,t),i._cursor=0,i._bufferSize=e.processorOptions.bufferSize,i._buffer=new Float32Array(i._bufferSize),i}return g(t,e),m(t,[{key:"process",value:function(e,t,i){if(e.length&&e[0].length)for(var r=0;r>4&15:e>>i+3&15)^t)}(e)})),t}(i):this._opt.encType===ge&&(r=function(e){var t=[];return Array.prototype.slice.call(e).forEach((function(e,i){t[i]=function(e){var t=0;t=e<0?(e=132-e,127):(e+=132,255);var i=Ca(e,Ra,8);return 8<=i?127^t:(i<<4|e>>i+3&15)^t}(e)})),t}(i));for(var a=Uint8Array.from(r),n=0;n>8,r[1]=255&s>>0,r[2]=128,r[3]=128+a,r[4]=t/256,r[5]=t%256,r[6]=i/65536/256,r[7]=i/65536%256,r[8]=i%65536/256,r[9]=i%65536%256,r[10]=n/65536/256,r[11]=n/65536%256,r[12]=n%65536/256,r[13]=n%65536%256,r.concat(l(e))),c=new Uint8Array(o.length),u=0;u=r.heartTimeout)throw new Error("Jessibuca-pro videoBuffer ".concat(r.videoBuffer,"s must be less than heartTimeout ").concat(r.heartTimeout,"s"));if(a.classList.add("jessibuca-container"),Lt(r.isLive)){var n=document.createElement("video");n.muted=!0,n.setAttribute("controlsList","nodownload"),n.disablePictureInPicture="disablePictureInPicture",n.style.position="absolute",n.style.top=0,n.style.left=0,n.style.height="100%",n.style.width="100%",a.appendChild(n),e.$videoElement=n,e.$container=a,e._opt=r}else delete r.container,st(r.videoBuffer)&&(r.videoBuffer=1e3*Number(r.videoBuffer)),st(r.videoBufferDelay)&&(r.videoBufferDelay=1e3*Number(r.videoBufferDelay)),st(r.networkDelay)&&(r.networkDelay=1e3*Number(r.networkDelay)),st(r.timeout)&&(at(r.loadingTimeout)&&(r.loadingTimeout=r.timeout),at(r.heartTimeout))&&(r.heartTimeout=r.timeout),r.isMulti&&(r.debugUuid="xxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}))),e._opt=r,e._destroyed=!1,e.$container=a,e._loadingTimeoutReplayTimes=0,e._heartTimeoutReplayTimes=0,e.events=new xt(e),e.debug=new xe(e),e.watermark=new La(e),e._initPlayer(a,r),e._initWatermark();return e}return g(t,e),m(t,[{key:"destroy",value:function(){var e=this;return new Promise((function(t,i){e._destroyed=!0,e.off(),e.$videoElement&&(e.$videoElement.pause(),e.$videoElement.currentTime=0,e.$videoElement.srcObject&&(e.$videoElement.srcObject=null,e.$videoElement.removeAttribute("srcObject")),e.$videoElement.src&&(e.$videoElement.src="",e.$videoElement.removeAttribute("src")),e.$container.removeChild(e.$videoElement),e.$videoElement=null),e.player?e.player.destroy().then((function(){e.player=null,e._destroy(),t()})).catch((function(){})):(e._destroy(),t())}))}},{key:"_destroy",value:function(){this.events&&(this.events.destroy(),this.events=null),this.talk&&(this.talk.destroy(),this.talk=null),this.watermark&&(this.watermark.destroy(),this.watermark=null),this.$container.classList.remove("jessibuca-container"),this.$container=null,this._resetOpt(),this._loadingTimeoutReplayTimes=0,this._heartTimeoutReplayTimes=0,this.debug&&this.debug.log("jessibuca","destroy")}},{key:"_resetOpt",value:function(){this._opt=_t()}},{key:"_initPlayer",value:function(e,t){this.player=new Sa(e,t),this.debug.log("jessibuca","_initPlayer",this.player.getOption()),this._bindEvents()}},{key:"_initTalk",value:function(){var e=0 play"),i.player.play(i._opt.url,i._opt.playOptions).then((function(){r(),i.player.resumeAudioAfterPause()})).catch((function(e){i.debug.error("Jessibuca","_playBefore this.player.play error",e),i.emit(U.crashLog,i.getCrashLog("this.player.play 1",e)),i.player.pause().then((function(){a(e)}))}))):i.player.pause().then((function(){i._play(e,t).then((function(){r()})).catch((function(e){i.debug.error("Jessibuca","_play error",e),i.emit(U.crashLog,i.getCrashLog("this.player.play 2",e)),a(e)}))})).catch((function(e){i.debug.error("Jessibuca","this.player.pause error",e),a(e)})):i._play(e,t).then((function(){r()})).catch((function(e){i.debug.error("Jessibuca","_play error",e),i.emit(U.crashLog,i.getCrashLog("this.player.play 3",e)),a(e)})):i.player.play(i._opt.url,i._opt.playOptions).then((function(){r(),i.player.resumeAudioAfterPause()})).catch((function(e){i.debug.error("Jessibuca","this.player.play error",e),i.emit(U.crashLog,i.getCrashLog("this.player.play 4",e)),i.player.pause().then((function(){a(e)}))})):e?i._play(e,t).then((function(){r()})).catch((function(e){i.debug.error("Jessibuca","_play error",e),i.emit(U.crashLog,i.getCrashLog("this.player.play 5",e)),a(e)})):i._play(i._opt.url,i._opt.playOptions).then((function(){r()})).catch((function(e){i.debug.error("Jessibuca","_play error",e),i.emit(U.crashLog,i.getCrashLog("this.player.play 6",e)),a(e)}))}))}},{key:"_cryptoPlay",value:function(e){var t=this;return new Promise((function(i,r){var a,n=function(){var t=(e||document.location.toString()).split("//"),i=t[1].indexOf("/"),r=t[1].substring(i);return-1!=r.indexOf("?")?r.split("?")[0]:r}(),s=t._opt.cryptoKeyUrl,o="";if(s)o=s;else{var l=function(e){var t=/(msie|trident)/i.test(navigator.userAgent),i=document.createElement("a"),r=e;return t&&(i.setAttribute("href",r),r=i.href),i.setAttribute("href",r),{origin:i.origin,href:i.href,protocol:i.protocol?i.protocol.replace(/:$/,""):"",host:i.host,search:i.search?i.search.replace(/^\?/,""):"",hash:i.hash?i.hash.replace(/^#/,""):"",hostname:i.hostname,port:i.port,pathname:"/"===i.pathname.charAt(0)?i.pathname:"/"+i.pathname}}(e);s=l.origin+"/crypto/",o=s+"?stream="+n}a=o,new Promise((function(e,t){nr.get(a).then((function(t){e(t)})).catch((function(e){t(e)}))})).then((function(e){if(e){var t=e.split("."),a=wt(t[0]),n=wt(t[1]);n&&a?i({cryptoIV:n,cryptoKey:a}):r("get cryptoIV or cryptoKey error")}else r("cryptoKeyUrl: getM7SCryptoStreamKey ".concat(o," res is null"))})).catch((function(e){r(e)}))}))}},{key:"playback",value:function(e){var t=this,i=1 wasm] reset player and play");var t=e._opt.url;e._resetPlayer({useMSE:!1,useWCS:!1}).then((function(){e.play(t).then((function(){e.debug.log("Jessibuca","mediaSourceH265NotSupport auto wasm [mse-> wasm] reset player and play success")})).catch((function(t){e.debug.error("Jessibuca","mediaSourceH265NotSupport auto wasm [mse-> wasm] reset player and play error",t)}))})).catch((function(t){e.debug.error("Jessibuca","mediaSourceH265NotSupport auto wasm [mse-> wasm] _resetPlayer error",t)}))}else e.emit(U.playFailedAndPaused,G.mediaSourceH265NotSupport),e.debug.log("Jessibuca","mediaSourceH265NotSupport and autoWasm is false")})).catch((function(t){e.debug.error("Jessibuca","mediaSourceH265NotSupport and pause error",t)}))})),e.player.once(G.mediaSourceFull,(function(t){e.emit(U.crashLog,e.getCrashLog(G.mediaSourceFull,t)),e.pause().then((function(){if(e.player._opt.mseDecodeErrorReplay){e.debug.log("Jessibuca","mediaSourceFull and auto wasm [mse-> wasm] reset player and play");var t,i=e._opt.url,r={};e.player._opt.autoWasm&&(r={useMSE:!1,useWCS:!1}),e.player._opt.replayUseLastFrameShow&&(t=e.screenshot("","png",.92,"base64"),r.loadingBackground=t),e._resetPlayer(r).then((function(){e.play(i).then((function(){e.debug.log("Jessibuca","mediaSourceFull and reset player and play success")})).catch((function(t){e.debug.error("Jessibuca","mediaSourceFull and reset player and play error",t)}))})).catch((function(t){e.debug.error("Jessibuca","mediaSourceFull and _resetPlayer error",t)}))}else e.emit(U.playFailedAndPaused,G.mediaSourceFull),e.debug.log("Jessibuca","mediaSourceFull and autoWasm is false")})).catch((function(t){e.debug.error("Jessibuca","mediaSourceFull and pause error",t)}))})),e.player.once(G.mediaSourceAppendBufferError,(function(t){e.emit(U.crashLog,e.getCrashLog(G.mediaSourceAppendBufferError,t)),e.pause().then((function(){if(e.player._opt.mseDecodeErrorReplay){e.debug.log("Jessibuca","mediaSourceAppendBufferError and auto wasm [mse-> wasm] reset player and play");var t,i=e._opt.url,r={};e.player._opt.autoWasm&&(r={useMSE:!1,useWCS:!1}),e.player._opt.replayUseLastFrameShow&&(t=e.screenshot("","png",.92,"base64"),r.loadingBackground=t),e._resetPlayer(r).then((function(){e.play(i).then((function(){e.debug.log("Jessibuca","mediaSourceAppendBufferError and reset player and play success")})).catch((function(t){e.debug.error("Jessibuca","mediaSourceAppendBufferError and reset player and play error",t)}))})).catch((function(t){e.debug.error("Jessibuca","mediaSourceAppendBufferError and _resetPlayer error",t)}))}else e.emit(U.playFailedAndPaused,G.mediaSourceAppendBufferError),e.debug.log("Jessibuca","mediaSourceAppendBufferError and autoWasm is false")})).catch((function(t){e.debug.error("Jessibuca","mediaSourceAppendBufferError and pause error",t)}))})),e.player.once(G.mediaSourceBufferListLarge,(function(t){e.emit(U.crashLog,e.getCrashLog(G.mediaSourceBufferListLarge,t)),e.pause().then((function(){if(e.player._opt.mseDecodeErrorReplay){e.debug.log("Jessibuca","media source buffer list large and auto wasm [mse-> wasm] reset player and play");var t,i=e._opt.url,r={};e.player._opt.autoWasm&&(r={useMSE:!1,useWCS:!1}),e.player._opt.replayUseLastFrameShow&&(t=e.screenshot("","png",.92,"base64"),r.loadingBackground=t),e._resetPlayer(r).then((function(){e.play(i).then((function(){e.debug.log("Jessibuca","media source buffer list large and reset player and play success")})).catch((function(t){e.debug.error("Jessibuca","media source buffer list large and reset player and play error",t)}))})).catch((function(t){e.debug.error("Jessibuca","media source buffer list large and _resetPlayer error",t)}))}else e.emit(U.playFailedAndPaused,G.mediaSourceBufferListLarge),e.debug.log("Jessibuca","media source buffer list large and autoWasm is false")})).catch((function(t){e.debug.error("Jessibuca","media source buffer list large and pause error",t)}))})),e.player.once(G.mediaSourceAppendBufferEndTimeout,(function(t){e.emit(U.crashLog,e.getCrashLog(G.mediaSourceAppendBufferEndTimeout,t)),e.pause().then((function(){if(e.player._opt.mseDecodeErrorReplay){e.debug.log("Jessibuca","media source append buffer end timeout and auto wasm [mse-> wasm] reset player and play");var t,i=e._opt.url,r={};e.player._opt.autoWasm&&(r={useMSE:!1,useWCS:!1}),e.player._opt.replayUseLastFrameShow&&(t=e.screenshot("","png",.92,"base64"),r.loadingBackground=t),e._resetPlayer(r).then((function(){e.play(i).then((function(){e.debug.log("Jessibuca","media source append buffer end timeout and reset player and play success")})).catch((function(t){e.debug.error("Jessibuca","media source append buffer end timeout and reset player and play error",t)}))})).catch((function(t){e.debug.error("Jessibuca","media source append buffer end timeout and _resetPlayer error",t)}))}else e.emit(U.playFailedAndPaused,G.mediaSourceAppendBufferEndTimeout),e.debug.log("Jessibuca","media source append buffer end timeout and autoWasm is false")})).catch((function(t){e.debug.error("Jessibuca","media source append buffer end timeout and pause error",t)}))})),e.player.once(G.mseSourceBufferError,(function(t){e.emit(U.crashLog,e.getCrashLog(G.mseSourceBufferError,t)),e.pause().then((function(){if(e.player._opt.mseDecodeErrorReplay){e.debug.log("Jessibuca","mseSourceBufferError auto wasm [mse-> wasm] reset player and play");var t,i=e._opt.url,r={};e.player._opt.autoWasm&&(r={useMSE:!1,useWCS:!1}),e.player._opt.replayUseLastFrameShow&&(t=e.screenshot("","png",.92,"base64"),r.loadingBackground=t),e._resetPlayer(r).then((function(){e.play(i).then((function(){e.debug.log("Jessibuca","mseSourceBufferError auto wasm [mse-> wasm] reset player and play success")})).catch((function(t){e.debug.error("Jessibuca","mseSourceBufferError auto wasm [mse-> wasm] reset player and play error",t)}))})).catch((function(t){e.debug.error("Jessibuca","mseSourceBufferError auto wasm [mse-> wasm] _resetPlayer and play error",t)}))}else e.emit(U.playFailedAndPaused,G.mseSourceBufferError),e.debug.log("Jessibuca","mseSourceBufferError and autoWasm is false")})).catch((function(t){e.debug.error("Jessibuca","mseSourceBufferError and pause error",t)}))})),e.player.once(G.mseAddSourceBufferError,(function(t){e.emit(U.crashLog,e.getCrashLog(G.mseAddSourceBufferError,t)),e.pause().then((function(){if(e.player._opt.autoWasm){e.debug.log("Jessibuca","mseAddSourceBufferError auto wasm [mse-> wasm] reset player and play");var t=e._opt.url;e._resetPlayer({useMSE:!1,useWCS:!1}).then((function(){e.play(t).then((function(){e.debug.log("Jessibuca","mseAddSourceBufferError auto wasm [mse-> wasm] reset player and play success")})).catch((function(t){e.debug.error("Jessibuca","mseAddSourceBufferError auto wasm [mse-> wasm] reset player and play error",t)}))})).catch((function(t){e.debug.error("Jessibuca","mseAddSourceBufferError auto wasm [mse-> wasm] _resetPlayer and play error",t)}))}else e.emit(U.playFailedAndPaused,G.mseAddSourceBufferError),e.debug.log("Jessibuca","mseAddSourceBufferError and autoWasm is false")})).catch((function(t){e.debug.error("Jessibuca","mseAddSourceBufferError and pause error",t)}))})),e.player.once(G.mediaSourceDecoderConfigurationError,(function(t){e.emit(U.crashLog,e.getCrashLog(G.mediaSourceDecoderConfigurationError,t)),e.pause().then((function(){if(e.player._opt.autoWasm){e.debug.log("Jessibuca","mediaSourceDecoderConfigurationError auto wasm [mse-> wasm] reset player and play");var t=e._opt.url;e._resetPlayer({useMSE:!1,useWCS:!1}).then((function(){e.play(t).then((function(){e.debug.log("Jessibuca","mediaSourceDecoderConfigurationError auto wasm [mse-> wasm] reset player and play success")})).catch((function(t){e.debug.error("Jessibuca","mediaSourceDecoderConfigurationError auto wasm [mse-> wasm] reset player and play error",t)}))})).catch((function(t){e.debug.error("Jessibuca","mediaSourceDecoderConfigurationError auto wasm [mse-> wasm] _resetPlayer and play error",t)}))}else e.debug.log("Jessibuca","mediaSourceDecoderConfigurationError and autoWasm is false")})).catch((function(t){e.debug.error("Jessibuca","mediaSourceDecoderConfigurationError and pause error",t)}))})),e.player.once(G.mediaSourceTsIsMaxDiff,(function(t){e.emit(U.crashLog,e.getCrashLog(G.mediaSourceTsIsMaxDiff,t)),e.pause().then((function(){if(e.player._opt.mediaSourceTsIsMaxDiffReplay){e.debug.log("Jessibuca","mediaSourceTsIsMaxDiff reset player and play");var t=e._opt.url,i={};i.loadingBackground=e.screenshot("","png",.92,"base64"),e._resetPlayer(i).then((function(){e.play(t).then((function(){})).catch((function(t){e.debug.error("Jessibuca","mediaSourceTsIsMaxDiff replay error",t)}))})).catch((function(t){e.debug.error("Jessibuca","mediaSourceTsIsMaxDiff _resetPlayer error",t)}))}else e.emit(U.playFailedAndPaused,G.mediaSourceTsIsMaxDiff),e.debug.log("Jessibuca","mediaSourceTsIsMaxDiff and replay is false")})).catch((function(t){e.debug.error("Jessibuca","mediaSourceTsIsMaxDiff and pause error",t)}))})),e.player.once(G.mseWidthOrHeightChange,(function(t){e.emit(U.crashLog,e.getCrashLog(G.mseWidthOrHeightChange,t)),e.debug.log("Jessibuca","mseWidthOrHeightChange and reset player and play");var i=e._opt.url,r=e.screenshot("","png",.92,"base64");e._resetPlayer({loadingBackground:r}).then((function(){e.play(i).then((function(){e.debug.log("Jessibuca","mseWidthOrHeightChange and reset player and play success")})).catch((function(t){e.debug.error("Jessibuca","mseWidthOrHeightChange and reset player and play error",t)}))})).catch((function(t){e.debug.error("Jessibuca","mseWidthOrHeightChange and _resetPlayer error",t)}))})),e.player.once(G.mediaSourceUseCanvasRenderPlayFailed,(function(t){e.emit(U.crashLog,e.getCrashLog(G.mediaSourceUseCanvasRenderPlayFailed,t)),e.debug.log("Jessibuca","mediaSourceUseCanvasRenderPlayFailed and reset player"),e.pause().then((function(){e._resetPlayer().then((function(){e.debug.log("Jessibuca","mediaSourceUseCanvasRenderPlayFailed and reset player success")})).catch((function(t){e.debug.error("Jessibuca","mediaSourceUseCanvasRenderPlayFailed and reset player error",t)}))})).catch((function(t){e.debug.error("Jessibuca","mediaSourceUseCanvasRenderPlayFailed and pause",t)}))})),e.player.once(G.webcodecsH265NotSupport,(function(t){e.emit(U.crashLog,e.getCrashLog(G.webcodecsH265NotSupport,t)),e.pause().then((function(){if(e.player._opt.autoWasm){e.debug.log("Jessibuca","webcodecsH265NotSupport auto wasm [wcs-> wasm] reset player and play");var t=e._opt.url;e._resetPlayer({useMSE:!1,useWCS:!1}).then((function(){e.play(t).then((function(){e.debug.log("Jessibuca","webcodecsH265NotSupport auto wasm [wcs-> wasm] reset player and play success")})).catch((function(t){e.debug.error("Jessibuca","webcodecsH265NotSupport auto wasm [wcs-> wasm] reset player and play error",t)}))})).catch((function(t){e.debug.error("Jessibuca","webcodecsH265NotSupport auto wasm [wcs-> wasm] _resetPlayer and play error",t)}))}else e.emit(U.playFailedAndPaused,G.webcodecsH265NotSupport),e.debug.log("Jessibuca","webcodecsH265NotSupport and autoWasm is false")})).catch((function(t){e.debug.error("Jessibuca","webcodecsH265NotSupport and pause error",t)}))})),e.player.once(G.webcodecsDecodeError,(function(t){e.emit(U.crashLog,e.getCrashLog(G.webcodecsDecodeError,t)),e.pause().then((function(){if(e.player._opt.wcsDecodeErrorReplay){e.debug.log("Jessibuca","webcodecs decode error reset player and play");var t,i=e._opt.url,r={};e.player._opt.autoWasm&&(r={useMSE:!1,useWCS:!1}),e.player._opt.replayUseLastFrameShow&&(t=e.screenshot("","png",.92,"base64"),r.loadingBackground=t),e._resetPlayer(r).then((function(){e.play(i).then((function(){e.debug.log("Jessibuca","webcodecs decode error reset player and play success")})).catch((function(t){e.debug.error("Jessibuca","webcodecs decode error reset player and play error",t)}))})).catch((function(){e.debug.error("Jessibuca","webcodecs decode error _resetPlayer error")}))}else e.emit(U.playFailedAndPaused,G.webcodecsDecodeError),e.debug.log("Jessibuca","webcodecs decode error and autoWasm is false")})).catch((function(t){e.debug.error("Jessibuca","webcodecs decode error and pause error",t)}))})),e.player.once(G.wcsWidthOrHeightChange,(function(t){e.emit(U.crashLog,e.getCrashLog(G.wcsWidthOrHeightChange,t)),e.debug.log("Jessibuca","wcsWidthOrHeightChange and reset player and play");var i=e._opt.url,r=e.screenshot("","png",.92,"base64");e._resetPlayer({loadingBackground:r}).then((function(){e.play(i).then((function(){e.debug.log("Jessibuca","wcsWidthOrHeightChange and reset player and play success")})).catch((function(t){e.debug.error("Jessibuca","wcsWidthOrHeightChange and reset player and play error",t)}))})).catch((function(t){e.debug.error("Jessibuca","wcsWidthOrHeightChange and _resetPlayer error",t)}))})),e.player.once(G.wasmDecodeError,(function(t){e.emit(U.crashLog,e.getCrashLog(G.wasmDecodeError,t)),e.pause().then((function(){if(e.player._opt.wasmDecodeErrorReplay){e.debug.log("Jessibuca","wasm decode error and reset player and play");var t,i=e._opt.url,r={};e.player._opt.replayUseLastFrameShow&&(t=e.screenshot("","png",.92,"base64"),r.loadingBackground=t),e._resetPlayer(r).then((function(){e.play(i).then((function(){e.debug.log("Jessibuca","wasm decode error and reset player and play success")})).catch((function(t){e.debug.error("Jessibuca","wasm decode error and reset player and play error",t)}))})).catch((function(){e.debug.error("Jessibuca","wasm decode error and _resetPlayer error")}))}else e.emit(U.playFailedAndPaused,G.wasmDecodeError),e.debug.log("Jessibuca","wasm decode error and wasmDecodeErrorReplay is false")})).catch((function(t){e.debug.error("Jessibuca","wasm decode error and pause error",t)}))})),e.player.once(G.wasmDecodeVideoNoResponseError,(function(t){e.emit(U.crashLog,e.getCrashLog(G.wasmDecodeVideoNoResponseError,t)),e.pause().then((function(){e.debug.log("Jessibuca","wasm decode video no response error and reset player and play");var t=e._opt.url,i={};if(e.player._opt.replayUseLastFrameShow){var r=e.screenshot("","png",.92,"base64");i.loadingBackground=r}e._resetPlayer(i).then((function(){e.play(t).then((function(){e.debug.log("Jessibuca","wasm decode video no response error and reset player and play success")})).catch((function(t){e.debug.error("Jessibuca","wasm decode video no response error and reset player and play error",t)}))})).catch((function(t){e.debug.error("Jessibuca","wasm decode video no response error and _resetPlayer error",t)}))})).catch((function(t){e.debug.error("Jessibuca","wasm decode video no response error and pause error",t)}))})),e.player.once(G.wasmWidthOrHeightChange,(function(t){e.emit(U.crashLog,e.getCrashLog(G.wasmWidthOrHeightChange,t)),e.debug.log("Jessibuca","wasmWidthOrHeightChange and reset player and play");var i=e._opt.url,r=e.screenshot("","png",.92,"base64");e._resetPlayer({loadingBackground:r}).then((function(){e.play(i).then((function(){e.debug.log("Jessibuca","wasmWidthOrHeightChange and reset player and play success")})).catch((function(t){e.debug.error("Jessibuca","wasmWidthOrHeightChange and reset player and play error",t)}))})).catch((function(t){e.debug.error("Jessibuca","wasmWidthOrHeightChange and _resetPlayer error",t)}))})),e.player.once(G.simdH264DecodeVideoWidthIsTooLarge,(function(t){e.emit(U.crashLog,e.getCrashLog(G.simdH264DecodeVideoWidthIsTooLarge,t)),e.pause().then((function(){e.debug.log("Jessibuca","simdH264DecodeVideoWidthIsTooLarge and reset player and play");var t=e._opt.url;e._resetPlayer({useSIMD:!1}).then((function(){e.play(t).then((function(){e.debug.log("Jessibuca","simdH264DecodeVideoWidthIsTooLarge and reset player and play success")})).catch((function(t){e.debug.error("Jessibuca","simdH264DecodeVideoWidthIsTooLarge and reset player and play error",t)}))})).catch((function(t){e.debug.error("Jessibuca","simdH264DecodeVideoWidthIsTooLarge and _resetPlayer error",t)}))})).catch((function(t){e.debug.error("Jessibuca","simdH264DecodeVideoWidthIsTooLarge and pause error",t)}))})),e.player.once(U.networkDelayTimeout,(function(t){if(e.player._opt.networkDelayTimeoutReplay){e.emit(U.crashLog,e.getCrashLog(U.networkDelayTimeout,t)),e.debug.log("Jessibuca","network delay time out and reset player and play");var i=e._opt.url,r={};if(e.player._opt.replayUseLastFrameShow){var a=e.screenshot("","png",.92,"base64");r.loadingBackground=a}e._resetPlayer(r).then((function(){e.play(i).then((function(){e.debug.log("Jessibuca","wasm decode error and reset player and play success")})).catch((function(t){e.debug.error("Jessibuca","wasm decode error and reset player and play error",t)}))})).catch((function(){e.debug.error("Jessibuca","wasm decode error and _resetPlayer error")}))}})),e.player.once(G.fetchError,(function(t){e.emit(U.crashLog,e.getCrashLog(G.fetchError,t)),e.debug.log("Jessibuca","fetch error and reset player"),e.pause().then((function(){e._resetPlayer().then((function(){})).catch((function(){}))})).catch((function(t){e.debug.error("Jessibuca","fetch error and pause",t)}))})),e.player.on(U.delayTimeout,(function(t){e.emit(U.crashLog,e.getCrashLog(U.delayTimeout,t)),e.pause().then((function(){if(e.player&&e.player._opt.heartTimeoutReplay&&(e._heartTimeoutReplayTimes