(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d2089e0"],{a60e:function(e,t,i){(function(r,n){var a,s,o=i("c973").default,l=i("448a").default,c=i("3c96").default,u=i("7ec2").default,d=i("ded3b").default,h=i("643a").default,f=i("a128").default,p=i("8962").default,g=i("36c6").default,m=i("ed6d").default,A=i("2d0d").default,y=i("7037").default,v=(i("da60").default,i("970b").default),b=i("5bc3").default;i("14d9"),i("fb6a"),i("d3b7"),i("159b"),i("b64b"),i("99af"),i("6c57"),i("81b2"),i("0eb6"),i("b7ef"),i("8bd4"),i("ac1f"),i("5319"),i("ace4"),i("5cc6"),i("907a"),i("9a8c"),i("a975"),i("735e"),i("c1ac"),i("d139"),i("3a7b"),i("986a"),i("1d02"),i("d5d6"),i("82f8"),i("e91f"),i("60bd"),i("5f96"),i("3280"),i("3fcc"),i("ca91"),i("25a1"),i("cd26"),i("3c5d"),i("2954"),i("649e"),i("219c"),i("170b"),i("b39a"),i("72f7"),i("ec97"),i("00b4"),i("466d"),i("a9e3"),i("25f0"),i("b680"),i("498a"),i("3ca3"),i("ddb0"),i("2b3d"),i("9861"),i("38cf"),i("e9c4"),i("d81d"),i("cfc3"),i("4057"),i("84c3"),i("b0c0"),i("d9e2"),i("4de4"),i("cb29"),i("4a9b"),i("c19f"),i("a15b"),i("c7cd"),i("5377"),i("c740"),i("fd87"),i("8b09"),i("fb2c"),i("143c"),i("a4d3"),i("e01a"),i("4ec9"),i("a874"),i("4d63"),i("c607"),i("2c3e"),i("aff5"),i("13d5"),i("7db0"),i("a630"),i("1f68"),i("e439"),i("dbb4"),i("131a"),i("3c65"),i("d28b"),i("4e82"),i("9129"),i("caad"),i("2532"),i("841c"),i("a434"),i("f8c9"),i("4ae1"),i("3410"),i("1276"),i("f00c"),i("944a"),i("0c47"),i("23dc"),i("20bf"),function(r){a=r,s="function"===typeof a?a.call(t,i,t,e):a,void 0===s||(e.exports=s)}((function(){"use strict";var e=function(){function e(){v(this,e)}return b(e,[{key:"on",value:function(e,t,i){var r=this.e||(this.e={});return(r[e]||(r[e]=[])).push({fn:t,ctx:i}),this}},{key:"once",value:function(e,t,i){var r=this;function n(){r.off(e,n);for(var a=arguments.length,s=new Array(a),o=0;o>4==10&&0===e[1]}function He(){}function We(e){for(var t=null,i=["webgl","experimental-webgl","moz-webgl","webkit-3d"],r=0;!t&&r>4==1&&0===e[1]}function Ot(e){return!0===e||"true"===e}function Ft(e){return!0!==e&&"true"!==e}var jt=function(){function e(t){v(this,e),this.destroys=[],this.proxy=this.proxy.bind(this),this.master=t}return b(e,[{key:"proxy",value:function(e,t,i){var r=this,n=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]),n=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,n),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:n,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,n,a){var s=2*e/n-1;r=2*(a-t-r)/a-1,e=2*(e+i)/n-1,i=2*(a-t)/a-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,n){var a=this.gl;this._clear(),a.activeTexture(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,this._ytexture),a.texImage2D(a.TEXTURE_2D,0,a.LUMINANCE,e,t,0,a.LUMINANCE,a.UNSIGNED_BYTE,i),a.activeTexture(a.TEXTURE1),a.bindTexture(a.TEXTURE_2D,this._utexture),a.texImage2D(a.TEXTURE_2D,0,a.LUMINANCE,e/2,t/2,0,a.LUMINANCE,a.UNSIGNED_BYTE,r),a.activeTexture(a.TEXTURE2),a.bindTexture(a.TEXTURE_2D,this._vtexture),a.texImage2D(a.TEXTURE_2D,0,a.LUMINANCE,e/2,t/2,0,a.LUMINANCE,a.UNSIGNED_BYTE,n),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),n=i.slice(e*t,e*t*5/4),a=(i=i.slice(e*t*5/4,e*t*3/2),this.gl);this._clear(),a.activeTexture(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,this._ytexture),a.texImage2D(a.TEXTURE_2D,0,a.LUMINANCE,e,t,0,a.LUMINANCE,a.UNSIGNED_BYTE,r),a.activeTexture(a.TEXTURE1),a.bindTexture(a.TEXTURE_2D,this._utexture),a.texImage2D(a.TEXTURE_2D,0,a.LUMINANCE,e/2,t/2,0,a.LUMINANCE,a.UNSIGNED_BYTE,n),a.activeTexture(a.TEXTURE2),a.bindTexture(a.TEXTURE_2D,this._vtexture),a.texImage2D(a.TEXTURE_2D,0,a.LUMINANCE,e/2,t/2,0,a.LUMINANCE,a.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,n){var a=this.gl;a.activeTexture(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,this._rgbatexture),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,n),this._buffers.positions=this._calRect(i,r,n.width,n.height,e,t),this._drawScene(e,t,!1)}}]),e}(),Wt=function(){function e(t){var i=this;v(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 b(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})),n=(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(n,0,t),{positionBuffer:i,texpositionBuffer:r,indexBuffer:n}}},{key:"_initPipeline",value:function(){var e=this;return new Promise((function(t,i){var r=e.gpu.device,n=e.gpu.format;n={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:n}]},depthStencil:{depthWriteEnabled:!0,depthCompare:"less",format:"depth24plus"}};r.createRenderPipelineAsync(n).then((function(e){t(e)})).catch((function(e){i(e)}))}))}},{key:"_initMatrixGroupInfo",value:function(){var e,t,i,r,n,a,s,o,l,c,u,d=this.gpu.device,h=this.pipeline,f=Nt(),p=(e=(t=g=1)/((p=-1)-g),y=1/((i=-1)-t),o=1/((s=.1)-(a=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]=(a+s)*o,l[15]=1,Nt()),g=(Gt(p),Nt()),m=(e=g,t=zt(0,0,0),i=zt(0,0,-1),y=zt(0,1,0),a=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(a-c)<1e-6&&Math.abs(s-u)<1e-6&&Math.abs(t-i)<1e-6?Gt(e):(c=a-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,n=c*y-u*A,(m=Math.hypot(l,r,n))?(l*=m=1/m,r*=m,n*=m):n=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]=n,e[10]=i,e[11]=0,e[12]=-(A*a+y*s+o*t),e[13]=-(l*a+r*s+n*t),e[14]=-(c*a+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,n=i.createTexture({size:[e,t],format:"r8unorm",usage:window.GPUTextureUsage.TEXTURE_BINDING|window.GPUTextureUsage.COPY_DST|window.GPUTextureUsage.RENDER_ATTACHMENT}),a=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:n.createView()},{binding:2,resource:a.createView()},{binding:3,resource:e.createView()}]});return{yTexture:n,uTexture:a,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,n,a;this.hasInited&&(r=i.slice(0,e*t),n=i.slice(e*t,e*t*5/4),i=i.slice(e*t*5/4,e*t*3/2),a=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)),a.queue.writeTexture({texture:this.textureGroupInfo.yTexture},r,{bytesPerRow:e,rowsPerImage:t},[e,t]),a.queue.writeTexture({texture:this.textureGroupInfo.uTexture},n,{bytesPerRow:e/2,rowsPerImage:t/2},[e/2,t/2]),a.queue.writeTexture({texture:this.textureGroupInfo.vTexture},i,{bytesPerRow:e/2,rowsPerImage:t/2},[e/2,t/2]),this._drawScene())}},{key:"clear",value:function(){}}]),e}(),Vt=function(e){m(i,e);var t=A(i);function i(){var e;return v(this,i),e=t.call(this),e.videoInfo={width:null,height:null,encType:null},e.init=!1,e}return b(i,[{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){ft(e.encTypeCode)&&(this.videoInfo.encType=J[e.encTypeCode]),ft(e.encType)&&(this.videoInfo.encType=e.encType),ft(e.width)&&(this.videoInfo.width=e.width),ft(e.height)&&(this.videoInfo.height=e.height),ft(this.videoInfo.encType)&&ft(this.videoInfo.height)&&ft(this.videoInfo.width)&&!this.init&&(this.player.emit(z.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}}]),i}(e),Kt="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 qt(e,t,i){var r=new XMLHttpRequest;r.open("GET",e),r.responseType="blob",r.onload=function(){Xt(r.response,t,i)},r.onerror=function(){console.error("could not download file")},r.send()}function Qt(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch(e){}return 200<=t.status&&t.status<=299}function Yt(t){try{t.dispatchEvent(new MouseEvent("click"))}catch(e){var i=document.createEvent("MouseEvents");i.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),t.dispatchEvent(i)}}var Jt=Kt.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),Xt="object"!=("undefined"===typeof window?"undefined":y(window))||window!==Kt?function(){}:"download"in HTMLAnchorElement.prototype&&!Jt?function(e,t,i){var r=Kt.URL||Kt.webkitURL,n=document.createElementNS("http://www.w3.org/1999/xhtml","a");t=t||e.name||"download",n.download=t,n.rel="noopener","string"==typeof e?(n.href=e,n.origin!==location.origin?Qt(n.href)?qt(e,t,i):Yt(n,n.target="_blank"):Yt(n)):(n.href=r.createObjectURL(e),setTimeout((function(){r.revokeObjectURL(n.href)}),4e4),setTimeout((function(){Yt(n)}),0))}:"msSaveOrOpenBlob"in navigator?function(e,t,i){var r;t=t||e.name||"download","string"==typeof e?Qt(e)?qt(e,t,i):((r=document.createElement("a")).href=e,r.target="_blank",setTimeout((function(){Yt(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 qt(e,t,i);t="application/octet-stream"===e.type,i=/constructor/i.test(Kt.HTMLElement)||Kt.safari;var n,a,s,o=/CriOS\/[\d]+/.test(navigator.userAgent);(o||t&&i||Jt)&&"undefined"!=typeof FileReader?((n=new FileReader).onloadend=function(){var e=n.result;e=o?e:e.replace(/^data:[^;]*;/,"data:attachment/file;");r?r.location.href=e:location=e,r=null},n.readAsDataURL(e)):(a=Kt.URL||Kt.webkitURL,s=a.createObjectURL(e),r?r.location=s:location.href=s,r=null,setTimeout((function(){a.revokeObjectURL(s)}),4e4))},$t=function(){function e(t,i){v(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 b(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,n=t.lineWidth,a=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,n),s.uniform3f(l.uniformLocations.linecolor,a[0],a[1],a[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,n=t.height,a=t.lineWidth,s=t.lineColor,o=t.canvasWidth,l=t.canvasHeight,c=(c=e/o,n=(l-i-n)/l,e=(e+r)/o,r=(l-i)/l,(i=new Ut(4))[0]=c,i[1]=n,i[2]=e,i[3]=r,i);s=zt(1,0,0);this._drawScene({canvasWidth:o,canvasHeight:l,rect:c,lineWidth:a,lineColor:s})}}]),e}(),Zt=function(e){m(i,e);var t=A(i);function i(e){var r;v(this,i),r=t.call(this),r.player=e;var n=document.createElement("canvas");return n.style.position="absolute",n.style.top=0,n.style.left=0,r.$videoElement=n,e.$container.appendChild(r.$videoElement),r.context2D=null,r.contextGl=null,r.webglRender=null,r.webglRectRender=null,r.webGPURender=null,r.isWebglContextLost=!1,r.bitmaprenderer=null,r.renderType=null,r.controlHeight=0,r.proxyDestroyList=[],r.tempCanvasContentList=[],r._initCanvasRender(),r}return b(i,[{key:"destroy",value:function(){p(g(i.prototype),"destroy",this).call(this),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,n=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*a;r[n+2*s]=(1-this.slopeCount)*t[o]+this.slopeCount*t[o+2],r[n+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}}]),i}(li);function ui(){}var di=function(e){m(i,e);var t=A(i);function i(e,r){var n;v(this,i);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,n,a=0;for(this.preCalculateCorrelationReferenceStereo(),t=Number.MIN_VALUE,e=0,r=0,n=0;a<4;a+=1){for(var s=0;hi[a][s]&&!((n=r+hi[a][s])>=this.seekLength);)(i=this.calculateCrossCorrelationStereo(2*n,this.refMidBuffer))>t&&(t=i,e=n),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)}}}]),i}(li);function pi(e,t){return 1e-10<(tthis.defaultPlaybackRate}},{key:"initProcessScriptNode",value:function(){var e=this;this.engineType=Le;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=xe;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(a,i):e(i)}n.autoWriteToDisk&&u((function(e){var t={};t[n.type+"Blob"]=e,x.Store(t)}))}else"function"==typeof e.call?e.call(a,""):e("")}e=e||function(){},f?"paused"===a.state?(a.resumeRecording(),setTimeout((function(){o(e)}),1)):("recording"===a.state||n.disableLogs||console.warn('Recording state should be: "recording", however current state is: ',a.state),n.disableLogs||console.log("Stopped recording "+n.type+" stream."),"gif"!==n.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)):(n.disableLogs||console.warn("Blob encoder did not finish its job yet."),setTimeout((function(){u(e,t)}),1e3))}function d(e){e=e||0,"paused"!==a.state?"stopped"!==a.state&&(e>=a.recordingDuration?o(a.onRecordingStopped):(e+=1e3,setTimeout((function(){d(e)}),1e3))):setTimeout((function(){d(e)}),1e3)}function h(e){a&&(a.state=e,"function"==typeof a.onStateChanged.call?a.onStateChanged.call(a,e):a.onStateChanged(e))}var f,p='It seems that recorder is destroyed or "startRecording" is not invoked for '+n.type+" recorder.";function g(){!0!==n.disableLogs&&console.warn(p)}var y={startRecording:function(t){return n.disableLogs||console.log("RecordRTC version: ",a.version),(n=t?new i(e,t):n).disableLogs||console.log("started recording "+n.type+" stream."),f?(f.clearRecordedData(),f.record(),h("recording"),a.recordingDuration&&d()):s((function(){a.recordingDuration&&d()})),a},stopRecording:o,pauseRecording:function(){f?"recording"===a.state?(h("paused"),f.pause(),n.disableLogs||console.log("Paused recording.")):n.disableLogs||console.warn("Unable to pause the recording. Recording state: ",a.state):g()},resumeRecording:function(){f?"paused"===a.state?(h("recording"),f.resume(),n.disableLogs||console.log("Resumed recording.")):n.disableLogs||console.warn("Unable to resume the recording. Recording state: ",a.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 a.recordingDuration=e,a.onRecordingStopped=t||function(){},{onRecordingStopped:function(e){a.onRecordingStopped=e}}},clearRecordedData:function(){f?(f.clearRecordedData(),n.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(n.type,e):g()},setAdvertisementArray:function(e){n.advertisement=[];for(var t=e.length,i=0;i>=8;return new Uint8Array(t.reverse())}(e[n].id)),r.push(t(o)),r.push(a)}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)};n[1].data.push(c),s+=l}return i(n)}(e.map((function(e){var t=function(e){for(var t=e.RIFF[0].WEBP[0],i=t.indexOf("*"),r=0,n=[];r<4;r++)n[r]=t.charCodeAt(i+3+r);return{width:16383&(n[1]<<8|n[0]),height:16383&(n[3]<<8|n[2]),data:t,riff:e}}(r(atob(e.image.slice(23))));return t.duration=e.duration,t}))),postMessage(e)}t.Whammy=R;var x={init:function(){var e,t,i,r=this;function n(e){e.createObjectStore(r.dataStoreName)}function a(){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(){n(e),a()}:a()},i.onupgradeneeded=function(e){n(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,n=e instanceof CanvasRenderingContext2D||e instanceof HTMLCanvasElement,a=(this.record=function(){"undefined"!=typeof GIFEncoder&&u?(n||(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(a)return setTimeout((function(){e(i)}),100);f=o(e),i-d<90||(!n&&r.paused&&r.play(),n||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(){a=!0},this.resume=function(){a=!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=(n&&(e instanceof CanvasRenderingContext2D?s=(c=e).canvas:e instanceof HTMLCanvasElement&&(c=e.getContext("2d"),s=e)),!0);n||((r=document.createElement("video")).muted=!0,r.autoplay=!0,r.playsInline=!0,u=!1,r.onloadedmetadata=function(){u=!0},w(e,r),r.play());var d,h,f=null,p=this}function B(e,t){t=t||"multi-streams-mixer";var i=[],r=!1,n=document.createElement("canvas"),a=n.getContext("2d"),s=(n.style.opacity=0,n.style.position="absolute",n.style.zIndex=-1,n.style.top="-1000em",n.style.left="-1000em",n.className=t,(document.body||document.documentElement).appendChild(n),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,a;r||(e=i.length,t=!1,a=[],i.forEach((function(e){e.stream||(e.stream={}),e.stream.fullcanvas?t=e:a.push(e)})),t?(n.width=t.stream.width,n.height=t.stream.height):a.length?(n.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)}}]),e}(),Li=function(){function e(){v(this,e)}return b(e,null,[{key:"_ebsp2rbsp",value:function(e){for(var t=e,i=t.byteLength,r=new Uint8Array(i),n=0,a=0;a=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(w,0),k.set(t.sps,4),t.sps=k}if(t.pps){var E=t.pps.byteLength,T=new Uint8Array([E>>>24&255,E>>>16&255,E>>>8&255,255&E]),S=new Uint8Array(E+4);S.set(T,0),S.set(t.pps,4),t.pps=S}return t}function Bi(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 Pi(e){return 31&e[0]}function Mi(e){return e===te}function Oi(e){return 7!==e&&8!==e&&!Mi(e)}var Fi=function(e){for(var t=e,i=t.byteLength,r=new Uint8Array(i),n=0,a=0;a>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],n=e.slice(23),a=0;a>1}var Ni=function(e){m(i,e);var t=A(i);function i(e){var r;return v(this,i),r=t.call(this),r.player=e,r.fileName="",r._isRecording=!1,r._recordingTimestamp=0,r.recordingInterval=null,r.sps=null,r.pps=null,r.vps=null,r.codecId=null,r.mdatBytesLength=0,r.metaInfo={codecWidth:0,codecHeight:0,presentWidth:0,presentHeight:0,refSampleDuration:0,timescale:1e3,avcc:null,videoType:""},r}return b(i,[{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=Ii(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)),n=e[t+=i];if(33!=(63&n))return console.warn("parseHEVCDecoderVPSAndSPSAndPPS and sps tag is "+n),{};t+=2;n=e[1+ ++t]|e[t]<<8;var a=e.slice(t+=2,t+n),s=e[t+=n];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([n>>>24&255,n>>>16&255,n>>>8&255,255&n]);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]);n=new Uint8Array(4+n),n.set(t,0),n.set(a,4),t=new Uint8Array(4+s),t.set(o,0),t.set(e,4),a=new Uint8Array(4+i);return a.set(l,0),a.set(r,4),{sps:n,pps:t,vps:a}}(r);var n=ji(e);i=Object.assign(i,n)}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)}}]),i}(e),Gi=function(e){m(i,e);var t=A(i);function i(e){var r;return v(this,i),r=t.call(this,e),r.totalByteLength=0,r._startRecordingTimestamp=null,e.debug.log("RecorderRTC","init"),r}return b(i,[{key:"_reset",value:function(){p(g(i.prototype),"_reset",this).call(this),this.totalByteLength=0,this._startRecordingTimestamp=null,this.recorder&&(this.recorder.destroy(),this.recorder=null)}},{key:"destroy",value:function(){p(g(i.prototype),"destroy",this).call(this),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,n=new FileReader;return new Promise((function(a,s){n.onload=function(e){i.decode(this.result).forEach((function(e){t.read(e)})),t.stop();var n=r.makeMetadataSeekable(t.metadatas,t.duration,t.cues),s=this.result.slice(t.metadataSize);n=new Blob([n,s],{type:"video/webm"});a(n)},n.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()===R?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 n=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,n=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,n>>>8&255,255&n,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,n=0;n>>24&255,r>>>16&255,r>>>8&255,255&r,255,255,255,255,0,1,0,0,a>>>24&255,a>>>16&255,a>>>8&255,255&a,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}],n=[i[0].duration],a=i.length,s=0;s>>24&255,i>>>16&255,i>>>8&255,255&i]),n=r.byteLength,a=new Uint8Array(n+8*i);a.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]),n),n+=8;return e.box(e.types.stts,a)}},{key:"stss",value:function(t){for(var i=[],r=t.length,n=0;n>>24&255,a>>>16&255,a>>>8&255,255&a]),o=s.byteLength,l=new Uint8Array(o+4*a);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]),n=r.byteLength,a=new Uint8Array(n+12*i);a.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]),n),n+=12}return e.box(e.types.stsc,a)}},{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]),n=r.byteLength,a=new Uint8Array(n+4*i);a.set(r,0);for(var s=0;s>>24&255,o>>>16&255,o>>>8&255,255&o]),n),n+=4}return e.box(e.types.stsz,a)}},{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,n=(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,n.byteLength+16+16+8+16+8+8);return e.box(e.types.traf,r,i,t,n)}},{key:"sdtp",value:function(t){for(var i=t.samples||[],r=i.length,n=new Uint8Array(4+r),a=0;a>>24&255,n>>>16&255,n>>>8&255,255&n,(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,a)}},{key:"mdat",value:function(t){return e.box(e.types.mdat,t)}}]),e}();zi.init();var Hi=function(e){m(i,e);var t=A(i);function i(e){var r;return v(this,i),r=t.call(this,e),r.tagName="recorderMP4",r.totalDuration=0,r.totalByteLength=0,r.bufferList=[],r.cacheTrack={},r.sequenceNumber=0,e.debug.log(r.tagName,"init"),r}return b(i,[{key:"destroy",value:function(){p(g(i.prototype),"destroy",this).call(this),this._reset(),this.player.debug.log(this.tagName,"destroy")}},{key:"_reset",value:function(){p(g(i.prototype),"_reset",this).call(this),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(z.recording,!0),e.log(this.tagName,"start recording"),this.player.emit(z.recordStart),this.startRecordingInterval()}},{key:"startRecordingInterval",value:function(){var e=this;this.stopRecordingInterval(),this.recordingInterval=window.setInterval((function(){e.player.emit(z.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 n=new Uint8Array(r.byteLength+i.byteLength);n.set(r,0),n.set(i,r.byteLength),t.data=n}else if(this.isH265){var a=new Uint8Array(this.sps.byteLength+this.pps.byteLength+this.vps.byteLength);a.set(this.vps,0),a.set(this.sps,this.vps.byteLength),a.set(this.pps,this.vps.byteLength+this.sps.byteLength),n=new Uint8Array(a.byteLength+i.byteLength),n.set(a,0),n.set(i,a.byteLength),t.data=n}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 k}},{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===s?this.player._opt.useWCS||this.player._opt.useMSE?this._decodeAudioNoDelay(e,t):this._decodeAudio(e,t):this.player._opt.playType===w&&(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 n=this.player,a={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(a," 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===s&&(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(z.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}}]),e}();$i.U32=Qi,$i.U16=Yi,$i.U8=Ji;var Zi,er="application/json, text/javascript",tr="text/html",ir=/^(?:text|application)\/xml/i,rr=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,nr=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,ar=/^\s*$/,sr={},or={},lr="",cr={type:"GET",beforeSend:ur,success:ur,error:ur,complete:ur,context:null,xhr:function(){return new window.XMLHttpRequest},accepts:{json:er,xml:"application/xml, text/xml",html:tr,text:"text/plain","*":"*/".concat("*")},crossDomain:!1,timeout:0,username:null,password:null,processData:!0,promise:ur,contentType:"application/x-www-form-urlencoded; charset=UTF-8"};function ur(){}function dr(e,t){"object"==y(e)&&(t=e,e=void 0);var i,r=yr({},t=t||{});for(i in cr)void 0===r[i]&&(r[i]=cr[i]);try{var n={},a=new Promise((function(e,t){n.resolve=e,n.reject=t}));a.resolve=n.resolve,a.reject=n.reject,r.promise=a}catch(e){r.promise={resolve:ur,reject:ur}}a=nr.exec(window.location.href.toLowerCase())||[];var s,o,l,c,u,d=(r.url=((e||r.url||window.location.href)+"").replace(/#.*$/,"").replace(/^\/\//,a[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)||(a=(r.jsonp||"callback")+"=?",r.url=mr(r.url,a)),l=(s=r).jsonpCallback||"jsonp"+wr(),c=window.document.createElement("script"),u={abort:function(){l in window&&(window[l]=ur)}},a=window.document.getElementsByTagName("head")[0]||window.document.documentElement,c.onerror=function(e){e=e,window.clearTimeout(o),u.abort(),pr(e.type,u,e.type,s),f()},window[l]=function(e){window.clearTimeout(o),hr(e,u,s),f()},Ar(s),c.src=s.url.replace(/=\?/,"="+l),c.src=mr(c.src,"_="+(new Date).getTime()),c.async=!0,s.scriptCharset&&(c.charset=s.scriptCharset),a.insertBefore(c,a.firstChild),0>4]+Cr[15&r])}return t.join("")}}),Lr={16:10,24:12,32:14},xr=[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],Ir=[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],Br=[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],Pr=[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],Mr=[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],Or=[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],Fr=[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],jr=[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],Ur=[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],Nr=[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],Gr=[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],zr=[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],Hr=[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],Wr=[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],Vr=[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 Kr(e){for(var t=[],i=0;i>2][t%4]=a[t],this._Kd[e-i][t%4]=a[t];for(var s,o=0,l=n;l>16&255]<<24^Ir[s>>8&255]<<16^Ir[255&s]<<8^Ir[s>>24&255]^xr[o]<<24,o+=1,8!=n)for(t=1;t>8&255]<<8^Ir[s>>16&255]<<16^Ir[s>>24&255]<<24,t=n/2+1;t>2][u=l%4]=a[t],this._Kd[e-c][u]=a[t++],l++}for(var c=1;c>24&255]^Hr[s>>16&255]^Wr[s>>8&255]^Vr[255&s]},qr.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=Kr(e),n=0;n<4;n++)r[n]^=this._Ke[0][n];for(var a=1;a>24&255]^Mr[r[(n+1)%4]>>16&255]^Or[r[(n+2)%4]>>8&255]^Fr[255&r[(n+3)%4]]^this._Ke[a][n];r=i.slice()}var s,o=Sr(16);for(n=0;n<4;n++)s=this._Ke[t][n],o[4*n]=255&(Ir[r[n]>>24&255]^s>>24),o[4*n+1]=255&(Ir[r[(n+1)%4]>>16&255]^s>>16),o[4*n+2]=255&(Ir[r[(n+2)%4]>>8&255]^s>>8),o[4*n+3]=255&(Ir[255&r[(n+3)%4]]^s);return o},qr.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=Kr(e),n=0;n<4;n++)r[n]^=this._Kd[0][n];for(var a=1;a>24&255]^Ur[r[(n+3)%4]>>16&255]^Nr[r[(n+2)%4]>>8&255]^Gr[255&r[(n+1)%4]]^this._Kd[a][n];r=i.slice()}var s,o=Sr(16);for(n=0;n<4;n++)s=this._Kd[t][n],o[4*n]=255&(Br[r[n]>>24&255]^s>>24),o[4*n+1]=255&(Br[r[(n+3)%4]>>16&255]^s>>16),o[4*n+2]=255&(Br[r[(n+2)%4]>>8&255]^s>>8),o[4*n+3]=255&(Br[255&r[(n+1)%4]]^s);return o},Qr.prototype.encrypt=function(e){if((e=Tr(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=Sr(e.length),i=Sr(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)},$r.prototype.setBytes=function(e){if(16!=(e=Tr(e,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=e},$r.prototype.increment=function(){for(var e=15;0<=e;e--){if(255!==this._counter[e]){this._counter[e]++;break}this._counter[e]=0}},Zr.prototype.decrypt=Zr.prototype.encrypt=function(e){for(var t=Tr(e,!0),i=0;i>4&15,h=1==d,1!=d&&2!=d&&n.debug.warn("FlvDemux","frameType is ".concat(d," is not keyFrame or interFrame")),h&&this.calcIframeIntervalTimestamp(l),0n)break;var s=e[a+4];if(1==(s&=31)||5==s){var o=e.slice(a+4+2,a+4+r),l=new en.ModeOfOperation.ctr(t,new en.Counter(i));s=l.decrypt(o),l=null,e.set(s,a+4+2)}a=a+4+r}return e}(c,n._opt.cryptoKey,n._opt.cryptoIV):n.debug.error("FlvDemux","cryptoKey.length is ".concat(n._opt.cryptoKey&&n._opt.cryptoKey.byteLength," or cryptoIV.length is ").concat(n._opt.cryptoIV&&n._opt.cryptoIV.byteLength," null"))),this._doDecode(p,2,l,h,f))),e.abrupt("break",26);case 25:n.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}}]),i}(Ki),rn=function(e){m(i,e);var t=A(i);function i(e){var r;return v(this,i),r=t.call(this,e),e.debug.log("M7sDemux","init"),r}return b(i,[{key:"destroy",value:function(){p(g(i.prototype),"destroy",this).call(this),this.player.debug.log("M7sDemux","destroy")}},{key:"dispatch",value:function(e){var t=this.player,i=new DataView(e),r=i.getUint8(0),n=i.getUint32(1,!1);switch(r){case 1:if(t._opt.hasAudio){var a=new Uint8Array(e,5);t.updateStats({abps:a.byteLength}),0>4==1,l=n;this.player._opt.useMSE&&ft(this.player.mseDecoder.firstRenderTime)&&(l=n-this.player.mseDecoder.firstRenderTime),t.updateStats({vbps:s.byteLength,dts:l}),0>1)&&33!=i&&34!=i?t:$}(i)),this.streamVideoType===X){var r=this.handleAddNaluStartCode(i),n=this.extractNALu(r);if(0===n.length)this.player.debug.warn(this.name,"handleVideoNalu","naluList.length === 0");else{var a=[];if(n.forEach((function(e){var i=Pi(e);8===i||7===i?t.handleVideoH264Nalu(e):Oi(i)&&a.push(e)})),1===a.length)this.handleVideoH264Nalu(a[0]);else{var s=function(e){if(0===e.length)return!1;for(var t=Pi(e[0]),i=1;i>6,n=(60&i[2])>>2,a=(1&i[2])<<2|(192&i[3])>>6,s=new Uint8Array([175,0,r<<3|(14&n)>>1,(1&n)<<7|a<<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=Z.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=Z.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,n=Pi(e);switch(n){case 7:this.sps=e;break;case 8:this.pps=e}if(this.isSendSeqHeader)if(Oi(n)){this.player._times.demuxStart||(this.player._times.demuxStart=Ke());var a=5===n,s=this.getNaluDts(),o=(t=e,(i=[])[0]=a?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}),a&&this.calcIframeIntervalTimestamp(s),this._doDecode(o,2,s,a,0)}else this.player.debug.warn(this.name,"handleVideoH264Nalu is avc seq head nalType is "+n);else if(this.sps&&this.pps){this.isSendSeqHeader=!0;var l=function(e){var t=e,i=t.sps,r=t.pps,n=8+i.byteLength+1+2+r.byteLength,a=!1,s=(e=Li.parseSPS$2(i),66!==i[3]&&77!==i[3]&&88!==i[3]&&(a=!0,n+=4),new Uint8Array(n)),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,a&&(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=Ke());var r=this.getNaluDts(),n=(e=e.reduce((function(e,t){e=Bi(e),t=Bi(t);var i=new Uint8Array(e.byteLength+t.byteLength);return i.set(e,0),i.set(t,e.byteLength),i})),(a=[])[0]=t?23:39,a[1]=1,a[2]=0,a[3]=0,a[4]=0,(s=new Uint8Array(a.length+e.byteLength)).set(a,0),s.set(e,a.length),s);this.player.updateStats({vbps:n.byteLength,dts:r}),t&&this.calcIframeIntervalTimestamp(r),this._doDecode(n,2,r,t,0)}else this.player.debug.warn(this.name,"handleVideoH264NaluList isSendSeqHeader is false");var a,s}},{key:"handleVideoH265Nalu",value:function(e){var t,i,r=Ui(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=Ke());var n=16<=r&&r<=21,a=this.getNaluDts(),s=(r=e,(t=[])[0]=n?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:a}),n&&this.calcIframeIntervalTimestamp(a),this._doDecode(s,2,a,n,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,n={configurationVersion:1},a=function(e){return e=Fi(e),e=new Di(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=Fi(e),i=new Di(t);i.readByte(),i.readByte();i.readBits(4);for(var r=i.readBits(3),n=(e=(i.readBool(),i.readBits(2)),i.readBool()),a=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&n.min_spatial_segmentation_idc,s[15]=252|3&n.parallelismType,s[16]=252|3&n.chroma_format_idc,s[17]=248|7&n.bit_depth_luma_minus8,s[18]=248|7&n.bit_depth_chroma_minus8,s[19]=0,s[20]=0,s[21]=(3&n.constant_frame_rate)<<6|(7&n.num_temporal_layers)<<3|(n.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(a=new Uint8Array(o.length+s.byteLength)).set(o,0),a.set(s,o.length),a}({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}}]),i}(Ki),sn=function(){function e(t){return v(this,e),new(e.getLoaderFactory(t._opt.demuxType))(t)}return b(e,null,[{key:"getLoaderFactory",value:function(e){return"m7s"===e?rn:e===T?tn:e===S?nn:e===_?an:void 0}}]),e}(),on=function(e){m(i,e);var t=A(i);function i(e){var r;return v(this,i),r=t.call(this),r.player=e,r.hasInit=!1,r.isDecodeFirstIIframe=!1,r.isInitInfo=!1,r.prevTimestamp=null,r.decodeDiffTimestamp=null,r.prevDts=null,r.decoder=null,r.isWidthOrHeightChanged=!1,r.initDecoder(),e.debug.log("Webcodecs","init"),r}return b(i,[{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=Ke(),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 n=15&e[0],a={};7==n?a=Ii(e.slice(5)):12==n&&(a=ji(e));var s=this.player.video.videoInfo;s&&s.width&&s.height&&a&&a.codecWidth&&a.codecHeight&&(a.codecWidth!==s.width||a.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(a.codecWidth,", new height is ").concat(a.codecHeight,", and emit change event")),this.isWidthOrHeightChanged=!0,this.player.emit(z.error,V.wcsWidthOrHeightChange),this.player.emit(V.wcsWidthOrHeightChange))}if(this.isWidthOrHeightChanged)this.player.debug.warn("Webcodecs","decodeVideo: video width or height is changed, and return");else if(Mt(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(ln[t]?''.concat(ln[t],""):"","\n"),e}),{});function un(e,t){var i=!1;return e.forEach((function(e){i||e.startTimestamp<=t&&e.endTimestamp>t&&(i=!0)})),i}function dn(e,t,i){var r=0\n ').concat(l.title,"\n \n ")),n[h]);f&&(i+='\n
').concat(f.title,"
\n ")),h+=1}t&&a.$playbackTimeListOne.insertAdjacentHTML("beforeend",t),i&&a.$playbackTimeListSecond.insertAdjacentHTML("beforeend",i),(d+=1)').concat(e,"\n ")})),y&&(t.$qualityMenuList.insertAdjacentHTML("beforeend",y),Object.defineProperty(t,"$qualityMenuItems",{value:e.$container.querySelectorAll(".jessibuca-quality-menu-item")}),setTimeout((function(){var t=A[0];e.streamQuality=t}),0)),e.streamQuality&&m(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")})),v(e.scaleType)}if(e.isPlayback()&&e._opt.playbackConfig.showRateBtn&&0').concat(e.label,"\n ")})),T&&(t.$speedMenuList.insertAdjacentHTML("beforeend",T),Object.defineProperty(t,"$speedMenuItems",{value:e.$container.querySelectorAll(".jessibuca-speed-menu-item")}));var S=e.playback?e.playback.playbackRate:1;E(S)}e.on(z.stats,(function(){var i,r,n,a,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(C[l],'\n
\n
\n 解码模式 ').concat(o,'\n
\n
\n 渲染组件 ').concat(a,"\n
\n ").concat(a===R?'\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(Z[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(n.playTimestamp,'\n
\n
\n 开始请求地址(ms) ').concat(n.streamTimestamp,'\n
\n
\n 请求响应(ms) ').concat(n.streamResponseTimestamp,'\n
\n
\n 解封装(ms) ').concat(n.demuxTimestamp,'\n
\n
\n 解码(ms) ').concat(n.decodeTimestamp,'\n
\n
\n 页面开始渲染(ms) ').concat(n.videoTimestamp,'\n
\n
\n 初始化到页面渲染(ms) ').concat(n.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(At(y.pTs),'\n
\n
\n '),t.$performancePanel.insertAdjacentHTML("beforeend",g)):(t.$performancePanel.innerHTML="",Qe(t.$performancePanel,"display","none"))})),e.on(z.togglePerformancePanel,(function(e){Qe(t.$performance,"display",e?"none":"flex"),Qe(t.$performanceActive,"display",e?"flex":"none")})),e.on(z.faceDetectActive,(function(e){Qe(t.$faceDetect,"display",e?"none":"flex"),Qe(t.$faceDetectActive,"display",e?"flex":"none")}))};function pn(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 gn(e,t){t instanceof Element?e.appendChild(t):e.insertAdjacentHTML("beforeend",String(t)),e.lastElementChild||e.lastChild}function mn(e,t,i){e.style[t]=i}function An(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(cn.narrow,'
\n
').concat(cn.expand,"
\n
\n \n "),n.$container.insertAdjacentHTML("beforeend","\n ".concat(s.background?'
'):"",'\n
\n \n
\n ').concat(s.loadingIcon?'\n
\n '.concat(cn.loading,"\n ").concat(s.loadingText?'
'.concat(s.loadingText,"
"):"","\n
\n "):"","\n ").concat(s.hasControl&&o.play?'
':"","\n ").concat(s.hasControl&&o.ptz?'\n
\n
\n
\n
\n
\n
\n '.concat(s.ptzMoreArrow?'\n
\n
\n
\n
\n ':"",'\n
\n ').concat(s.ptzZoomShow?'\n
\n
\n ':"","\n\n ").concat(s.ptzApertureShow?'\n
\n
\n ':"","\n ").concat(s.ptzFocusShow?'\n
\n
\n ':"","\n
\n "):"","\n ").concat(s.hasVideo?'\n
\n
'.concat(cn.narrow,'
\n
电子放大
\n
').concat(cn.expand,'
\n
').concat(cn.zoomStop,'
\n
\n
\n
\n
00:00:00
\n
').concat(cn.recordStop,"
\n
\n "):"","\n\n ").concat(s.hasControl?'\n
\n
\n
\n '.concat(s.showBandwidth?'
':"",'\n
').concat(s.controlHtml,"
\n
\n ").concat(s.playType===w&&s.playbackConfig.showControl?l:"",'\n\n
\n ').concat(s.playType===w&&s.playbackConfig.showRateBtn?'\n
\n
\n
\n
\n
\n
\n ':"","\n ").concat(o.close?'
'.concat(cn.close,"
"):"","\n ").concat(o.performance?'
'.concat(cn.performance,'
').concat(cn.performanceActive,"
"):"","\n ").concat(o.aiFace?'
'.concat(cn.face,'
').concat(cn.faceActive,"
"):"","\n ").concat(o.quality?'\n
\n
\n
\n
\n
\n
\n ':"","\n ").concat(o.scale?'\n
\n
\n
\n
\n
\n
\n ':"","\n ").concat(o.audio?'\n
\n
\n '.concat(cn.audio,"\n ").concat(cn.mute,'\n
\n
\n
\n
\n
\n
\n
\n
\n '):"","\n ").concat(o.play?'
'.concat(cn.play,'
').concat(cn.pause,"
"):"","\n ").concat(o.screenshot?'
'.concat(cn.screenshot,"
"):"","\n ").concat(o.record?'
'.concat(cn.record,'
').concat(cn.recordStop,"
"):"","\n ").concat(o.ptz?'
'.concat(cn.ptz,'
').concat(cn.ptzActive,"
"):"","\n ").concat(o.zoom?'
'.concat(cn.zoom,'
').concat(cn.zoomStop,"
"):"","\n ").concat(o.fullscreen?'
'.concat(cn.fullscreen,'
').concat(cn.fullscreenExit,"
"):"","\n
\n
\n
\n "):"",'\n
\n
\n ')),Object.defineProperty(a,"$poster",{value:n.$container.querySelector(".jessibuca-poster")}),Object.defineProperty(a,"$loadingBg",{value:n.$container.querySelector(".jessibuca-loading-bg")}),Object.defineProperty(a,"$loadingBgImage",{value:n.$container.querySelector(".jessibuca-loading-bg-image")}),Object.defineProperty(a,"$loading",{value:n.$container.querySelector(".jessibuca-loading")}),Object.defineProperty(a,"$play",{value:n.$container.querySelector(".jessibuca-play")}),Object.defineProperty(a,"$playBig",{value:n.$container.querySelector(".jessibuca-play-big")}),Object.defineProperty(a,"$recording",{value:n.$container.querySelector(".jessibuca-recording")}),Object.defineProperty(a,"$recordingTime",{value:n.$container.querySelector(".jessibuca-recording-time")}),Object.defineProperty(a,"$recordingStop",{value:n.$container.querySelector(".jessibuca-recording-stop")}),Object.defineProperty(a,"$pause",{value:n.$container.querySelector(".jessibuca-pause")}),Object.defineProperty(a,"$controls",{value:n.$container.querySelector(".jessibuca-controls")}),Object.defineProperty(a,"$controlsInner",{value:n.$container.querySelector(".jessibuca-controls-bottom")}),Object.defineProperty(a,"$controlsLeft",{value:n.$container.querySelector(".jessibuca-controls-left")}),Object.defineProperty(a,"$controlsRight",{value:n.$container.querySelector(".jessibuca-controls-right")}),Object.defineProperty(a,"$volume",{value:n.$container.querySelector(".jessibuca-volume")}),Object.defineProperty(a,"$volumePanelWrap",{value:n.$container.querySelector(".jessibuca-volume-panel-wrap")}),Object.defineProperty(a,"$volumePanelText",{value:n.$container.querySelector(".jessibuca-volume-panel-text")}),Object.defineProperty(a,"$volumePanel",{value:n.$container.querySelector(".jessibuca-volume-panel")}),Object.defineProperty(a,"$volumeHandle",{value:n.$container.querySelector(".jessibuca-volume-panel-handle")}),Object.defineProperty(a,"$volumeOn",{value:n.$container.querySelector(".jessibuca-icon-audio")}),Object.defineProperty(a,"$volumeOff",{value:n.$container.querySelector(".jessibuca-icon-mute")}),Object.defineProperty(a,"$fullscreen",{value:n.$container.querySelector(".jessibuca-fullscreen")}),Object.defineProperty(a,"$fullscreenExit",{value:n.$container.querySelector(".jessibuca-fullscreen-exit")}),Object.defineProperty(a,"$record",{value:n.$container.querySelector(".jessibuca-record")}),Object.defineProperty(a,"$recordStop",{value:n.$container.querySelector(".jessibuca-record-stop")}),Object.defineProperty(a,"$screenshot",{value:n.$container.querySelector(".jessibuca-screenshot")}),Object.defineProperty(a,"$speed",{value:n.$container.querySelector(".jessibuca-speed")}),Object.defineProperty(a,"$controlHtml",{value:n.$container.querySelector(".jessibuca-controls-item-html")}),Object.defineProperty(a,"$playbackTime",{value:n.$container.querySelector(".jessibuca-controls-playback-time")}),Object.defineProperty(a,"$playbackTimeInner",{value:n.$container.querySelector(".jessibuca-controls-playback-time-inner")}),Object.defineProperty(a,"$playbackTimeScroll",{value:n.$container.querySelector(".jessibuca-controls-playback-time-scroll")}),Object.defineProperty(a,"$playbackTimeList",{value:n.$container.querySelector(".jessibuca-controls-playback-time-list")}),Object.defineProperty(a,"$playbackTimeListOne",{value:n.$container.querySelector(".jessibuca-playback-time-one-wrap")}),Object.defineProperty(a,"$playbackTimeListSecond",{value:n.$container.querySelector(".jessibuca-playback-time-second-wrap")}),Object.defineProperty(a,"$playbackCurrentTime",{value:n.$container.querySelector(".jessibuca-controls-playback-current-time")}),Object.defineProperty(a,"$playbackCurrentTimeText",{value:n.$container.querySelector(".jessibuca-controls-playback-current-time-text")}),Object.defineProperty(a,"$controlsPlaybackBtns",{value:n.$container.querySelector(".jessibuca-controls-playback-btns")}),Object.defineProperty(a,"$playbackNarrow",{value:n.$container.querySelector(".jessibuca-playback-narrow")}),Object.defineProperty(a,"$playbackExpand",{value:n.$container.querySelector(".jessibuca-playback-expand")}),Object.defineProperty(a,"$ptz",{value:n.$container.querySelector(".jessibuca-ptz")}),Object.defineProperty(a,"$ptzActive",{value:n.$container.querySelector(".jessibuca-ptz-active")}),Object.defineProperty(a,"$ptzControl",{value:n.$container.querySelector(".jessibuca-ptz-controls")}),Object.defineProperty(a,"$ptzBgActive",{value:n.$container.querySelector(".jessibuca-ptz-bg-active")}),Object.defineProperty(a,"$ptzControlCircular",{value:n.$container.querySelector(".jessibuca-ptz-control")}),Object.defineProperty(a,"$ptzArrows",{value:n.$container.querySelectorAll(".jessibuca-ptz-arrow")}),Object.defineProperty(a,"$ptzExpand",{value:n.$container.querySelector(".jessibuca-ptz-expand")}),Object.defineProperty(a,"$ptzNarrow",{value:n.$container.querySelector(".jessibuca-ptz-narrow")}),Object.defineProperty(a,"$ptzApertureFar",{value:n.$container.querySelector(".jessibuca-ptz-aperture-far")}),Object.defineProperty(a,"$ptzApertureNear",{value:n.$container.querySelector(".jessibuca-ptz-aperture-near")}),Object.defineProperty(a,"$ptzFocusFar",{value:n.$container.querySelector(".jessibuca-ptz-focus-far")}),Object.defineProperty(a,"$ptzFocusNear",{value:n.$container.querySelector(".jessibuca-ptz-focus-near")}),Object.defineProperty(a,"$qualityText",{value:n.$container.querySelector(".jessibuca-quality-icon-text")}),Object.defineProperty(a,"$qualityMenu",{value:n.$container.querySelector(".jessibuca-quality-menu")}),Object.defineProperty(a,"$qualityMenuList",{value:n.$container.querySelector(".jessibuca-quality-menu-list")}),Object.defineProperty(a,"$scaleText",{value:n.$container.querySelector(".jessibuca-scale-icon-text")}),Object.defineProperty(a,"$scaleMenu",{value:n.$container.querySelector(".jessibuca-scale-menu")}),Object.defineProperty(a,"$scaleMenuList",{value:n.$container.querySelector(".jessibuca-scale-menu-list")}),Object.defineProperty(a,"$zoom",{value:n.$container.querySelector(".jessibuca-zoom")}),Object.defineProperty(a,"$zoomStop",{value:n.$container.querySelector(".jessibuca-zoom-stop")}),Object.defineProperty(a,"$zoomNarrow",{value:n.$container.querySelector(".jessibuca-zoom-narrow")}),Object.defineProperty(a,"$zoomExpand",{value:n.$container.querySelector(".jessibuca-zoom-expand")}),Object.defineProperty(a,"$zoomStop2",{value:n.$container.querySelector(".jessibuca-zoom-stop2")}),Object.defineProperty(a,"$close",{value:n.$container.querySelector(".jessibuca-close")}),Object.defineProperty(a,"$zoomControls",{value:n.$container.querySelector(".jessibuca-zoom-controls")}),Object.defineProperty(a,"$performancePanel",{value:n.$container.querySelector(".jessibuca-performance-panel")}),Object.defineProperty(a,"$performance",{value:n.$container.querySelector(".jessibuca-performance")}),Object.defineProperty(a,"$performanceActive",{value:n.$container.querySelector(".jessibuca-performance-active")}),Object.defineProperty(a,"$faceDetect",{value:n.$container.querySelector(".jessibuca-face")}),Object.defineProperty(a,"$faceDetectActive",{value:n.$container.querySelector(".jessibuca-face-active")}),Object.defineProperty(a,"$contextmenus",{value:n.$container.querySelector(".jessibuca-contextmenus")}),Object.defineProperty(a,"$speedText",{value:n.$container.querySelector(".jessibuca-speed-icon-text")}),Object.defineProperty(a,"$speedMenu",{value:n.$container.querySelector(".jessibuca-speed-menu")}),Object.defineProperty(a,"$speedMenuList",{value:n.$container.querySelector(".jessibuca-speed-menu-list")}),0n){var a=(t-i*n)/2;e.$container.style.padding="0 ".concat(a,"px")}else{var s=(i-t/n)/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===w?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 n="contain",a=(i.isResize||(n="fill"),i.isFullResize&&(n="none"),"");"none"===i.mirrorRotate&&r&&(a+=" rotate("+r+"deg)"),"level"===i.mirrorRotate?a+=" rotateY(180deg)":"vertical"===i.mirrorRotate&&(a+=" rotateX(180deg)"),this.$loadingBgImage.style.transform=a,this.$loadingBgImage.style.objectFit=n,mn(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(n.children)[t.index],l=(o?o.insertAdjacentHTML("beforebegin",s):gn(n,s),t.icon?n.querySelector(".jessibuca-icon-extend-"+r):null),c=t.icon?n.querySelector(".jessibuca-control-extend-"+r):null,u=t.activeIcon?n.querySelector(".jessibuca-icon-extend-".concat(r,"-active")):null,d=t.activeIcon?n.querySelector(".jessibuca-control-extend-".concat(r,"-active")):null,h=this.player["events"].proxy;t.icon&&(mn(l,"background","url(".concat(t.icon,") no-repeat center")),mn(l,"background-size","100% 100%"),mn(c,"display","none"),t.iconHover)&&(h(l,"mouseover",(function(){mn(l,"background","url(".concat(t.iconHover,") no-repeat center")),mn(l,"background-size","100% 100%")})),h(l,"mouseout",(function(){mn(l,"background","url(".concat(t.icon,") no-repeat center")),mn(l,"background-size","100% 100%")}))),t.activeIcon&&(mn(u,"background","url(".concat(t.activeIcon,") no-repeat center")),mn(u,"background-size","100% 100%"),mn(d,"display","none"),t.activeIconHover)&&(h(u,"mouseover",(function(){mn(u,"background","url(".concat(t.activeIconHover,") no-repeat center")),mn(u,"background-size","100% 100%")})),h(u,"mouseout",(function(){mn(u,"background","url(".concat(t.activeIcon,") no-repeat center")),mn(u,"background-size","100% 100%")}))),t.click&&l&&h(l,"click",(function(i){i.preventDefault(),a&&(mn(c,"display","none"),mn(d,"display","flex")),t.click.call(e.player,e,i)})),t.activeClick&&u&&h(u,"click",(function(i){i.preventDefault(),mn(c,"display","flex"),mn(d,"display","none"),t.activeClick.call(e.player,e,i)})),this.extendBtnList.push({name:r,$iconWrap:c,$activeIconWrap:d})}}}]),e}();pn(".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 bn=function(){function e(){v(this,e)}return b(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),n=r.length,a=0;a>>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,n=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,n>>>8&255,255&n,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,n=(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,n.byteLength+16+16+8+16+8+8);return e.box(e.types.traf,r,i,t,n)}},{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),n=(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),a=t.flags;t=t.cts;return r.set([i>>>24&255,i>>>16&255,i>>>8&255,255&i,n>>>24&255,n>>>16&255,n>>>8&255,255&n,a.isLeading<<2|a.dependsOn,a.isDependedOn<<6|a.hasRedundancy<<4|a.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)}}]),e}();bn.init();var wn=function(t){m(r,t);var i=A(r);function r(e){var t;v(this,r),t=i.call(this),t.player=e,t.isAvc=!0,t.mediaSource=new window.MediaSource,t.sourceBuffer=null,t.hasInit=!1,t.isInitInfo=!1,t.cacheTrack={},t.timeInit=!1,t.sequenceNumber=0,t.dropping=!1,t.firstRenderTime=null,t.$videoElement=null,t.mediaSourceAppendBufferFull=!1,t.mediaSourceAppendBufferError=!1,t.isDecodeFirstIIframe=!1,t.prevTimestamp=null,t.decodeDiffTimestamp=null,t.prevDts=null,t.prevPayloadBufferSize=0,t.isWidthOrHeightChanged=!1,t.prevTs=null,t.mediaSourceObjectURL=window.URL.createObjectURL(t.mediaSource),t.eventListenList=[],e._opt.mseUseCanvasRender?(t.$videoElement=document.createElement("video"),t.$videoElement.src=t.mediaSourceObjectURL,t.initVideoEvents()):(t.player.video.$videoElement.src=t.mediaSourceObjectURL,t.$videoElement=t.player.video.$videoElement);var n=e["events"].proxy,a=n(t.mediaSource,"sourceopen",(function(){t.player&&t.player.emit(z.mseSourceOpen)})),s=n(t.mediaSource,"sourceclose",(function(){t.player&&t.player.emit(z.mseSourceClose)})),o=n(t.mediaSource,"sourceended",(function(){t.player&&t.player.emit(z.mseSourceended)}));if(t.eventListenList.push(a,s,o),t.player.isPlayer){var l=n(t.$videoElement,ke,(function(i){if(t._handleUpdatePlaybackRate(),e._opt.mseUseCanvasRender)if(t.player.checkIsInRender())t.player.handleRender();else{var r=parseInt(i.timeStamp,10);t.player.debug.warn("MediaSource","mseUseCanvasRender is true and $videoElement ts is ".concat(r,", but not in render"))}else t.player.handleRender()})),c=n(t.$videoElement,Ee,(function(){e.debug.log("MediaSource","video playback Rate change",t.$videoElement&&t.$videoElement.playbackRate)}));t.eventListenList.push(l,c)}return e.debug.log("MediaSource","init"),t}return b(r,[{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,be,(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(V.mediaSourceUseCanvasRenderPlayFailed),e.player.emit(z.error,V.mediaSourceUseCanvasRenderPlayFailed)}))})),r=t(this.$videoElement,we,(function(){e.player.debug.log("MediaSource","video waiting")}));t=t(this.$videoElement,ke,(function(t){t=parseInt(t.timeStamp,10),e.player.emit(z.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 n=this.player;if(n)if(this.hasInit)if(!this.isDecodeFirstIIframe&&i&&(this.isDecodeFirstIIframe=!0),this.isDecodeFirstIIframe){if(i&&0===e[1]){var a=15&e[0],s={};7==a?s=Ii(e.slice(5)):12==a&&(s=ji(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(z.error,V.mseWidthOrHeightChange),this.player.emit(V.mseWidthOrHeightChange))}if(this.isWidthOrHeightChanged)this.player.debug.warn("MediaSource","decodeVideo: video width or height is changed, and return");else if(Mt(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(V.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(V.mediaSourceTsIsMaxDiff)}this._decodeVideo(e,l,i,r,t),this.prevDts=l,this.prevPayloadBufferSize=e.byteLength,this.prevTs=t,this.player.getRenderType()===D&&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];n.video.updateVideoInfo({encTypeCode:c}),12!=c||function(){var e=!1;return!(!("MediaSource"in window)||!window.MediaSource.isTypeSupported(le))||e}()?(n._times.decodeStart||(n._times.decodeStart=Ke()),this.hasInit=this._decodeConfigurationRecord(e,t,i,c)):this.emit(V.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?(a.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(bn.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===k&&this.player.recorder.handleAddFmp4Track(this.cacheTrack),h=bn.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),a.emit(z.timeUpdate,n),a.updateStats({fps:!0,ts:n,mseTs:t,buf:a.demux&&a.demux.delay||0}),a._times.videoStart||(a._times.videoStart=Ke(),a.handlePlayToRenderTimes())):(a.debug.log("MediaSource","timeInit set false , cacheTrack = {} now dts is ".concat(t,", and ts is ").concat(n," 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||(a.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)))))},w.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)},w.onMediaDetaching=function(){this.videoBuffer=null,b.prototype.onMediaDetaching.call(this)},w.onAudioTracksUpdated=function(e,t){t=t.audioTracks,this.resetTransmuxer(),this.levels=t.map((function(e){return new l.Level(e)}))},w.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=n.State.IDLE):this.state=n.State.STOPPED,this.tick()},w.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},w.onLevelLoaded=function(e,t){this.mainDetails=t.details},w.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 a=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;a=!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,a),this.state!==n.State.WAITING_TRACK||this.waitForCdnTuneIn(r)||(this.state=n.State.IDLE),this.tick()}else this.warn("Audio tracks were reset while loading level "+t)},w._handleFragmentLoadProgress=function(e){var t,i,r,a,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?(a=o?o.index:-1,a=new f.ChunkMetadata(s.level,s.sn,s.stats.chunkCount,e.byteLength,a,-1!==a),p.push(e,r,l,"",s,o,t.totalduration,!1,a,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=n.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")},w._handleFragmentLoadComplete=function(e){this.waitingData?this.waitingData.complete=!0:b.prototype._handleFragmentLoadComplete.call(this,e)},w.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},w.onBufferCreated=function(e,t){var i=t.tracks.audio;i&&(this.mediaBuffer=i.buffer),t.tracks.video&&(this.videoBuffer=t.tracks.video.buffer)},w.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(a.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId})),this.fragBufferedComplete(i,t)))},w.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!==n.State.ERROR&&this.state!==n.State.STOPPED&&(this.state=t.fatal?n.State.ERROR:n.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!==n.State.PARSING&&this.state!==n.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,n=void 0===(n=l.groupId)?"":n,a=l.name,s=l.type,o=l.url,this.trackId=e,this.trackName=a,this.selectDefaultTrack=!1,this.hls.trigger(r.Events.AUDIO_TRACK_SWITCHING,{id:i,groupId:n,name:a,type:s,url:o}),l.details&&!l.details.live||(e=this.switchParams(l.url,null==t?void 0:t.details),this.loadPlaylist(e)))},a.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:n.ErrorTypes.MEDIA_ERROR,details:n.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},a.findTrackId=function(e){for(var t=this.tracksInGroup,i=0;it.partTarget&&(s+=1),Object(r.isFiniteNumber)(o))return new n.HlsUrlParameters(o,Object(r.isFiniteNumber)(s)?s:void 0,n.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,n=t.details,s=t.stats,o=s.loading.end?Math.max(0,self.performance.now()-s.loading.end):0;if(n.advancedDateTime=Date.now()-o,n.live||null!=i&&i.live){if(n.reloaded(i),i&&this.log("live playlist "+e+" "+(n.advanced?"REFRESHED "+n.lastPartSn+"-"+n.lastPartIndex:"MISSED")),i&&0i.tuneInGoal?(this.warn("CDN Tune-in goal increased from: "+i.tuneInGoal+" to: "+h+" with playlist age: "+n.age),h=0):(o+=f=Math.floor(h/n.targetduration),void 0!==c&&(c+=Math.round(h%n.targetduration/n.partTarget)),this.log("CDN Tune-in age: "+n.ageHeader+"s last advanced "+d.toFixed(2)+"s goal: "+h+" skip sn "+f+" to part "+c)),n.tuneInGoal=h),l=this.getDeliveryDirectives(n,t.deliveryDirectives,o,c),u||!p)return void this.loadPlaylist(l)}else l=this.getDeliveryDirectives(n,t.deliveryDirectives,o,c);i=Object(a.computeReloadInterval)(n,s),void 0!==o&&n.canBlockReload&&(i-=n.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 a=Object(n.getSkipValue)(e,i);return null!=t&&t.skip&&e.deltaUpdateFailed&&(i=t.msn,r=t.part,a=n.HlsSkip.No),new n.HlsUrlParameters(i,r,a)},t.retryLoadingOrFail=function(e){var t,i=this,r=this.hls.config,n=this.retryCount=t.endSN)||e.nextStart)&&(null!=(e=t.partList)&&e.length?(t=e[e.length-1],a.BufferHelper.isBuffered(this.media,t.start+t.duration/2)):(e=r.getState(i))===n.FragmentState.PARTIAL||e===n.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===w.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,n=this.mediaBuffer,s=this.state,o=i?i.currentTime:0;n=a.BufferHelper.bufferInfo(n||i,o,e.maxBufferHole);this.log("media seeking to "+(Object(r.isFiniteNumber)(o)?o.toFixed(3):o)+", state: "+s),s===w.ENDED?this.resetLoadingState():t&&!n.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,n=this.getLoadPosition();if(!Object(r.isFiniteNumber)(n))return null;var s=a.BufferHelper.bufferInfo(e,n,i.maxBufferHole);return 0===s.len&&void 0!==s.nextStart&&(t=this.fragmentTracker.getBufferedFrag(n,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 n,a=this.config,s=i[0].start;if(t.live){var o=a.initialLiveManifestSize;if(re.start&&e.loaded},t.getInitialLiveFragment=function(e,t){var i,r=this.fragPrevious,n=null;return r?(e.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+r.programDateTime),n=Object(h.findFragmentByPDT)(t,r.endProgramDateTime,this.config.maxFragLookUpTolerance)),n||((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: "+(n=i).sn),n)||(n=Object(h.findFragWithCC)(t,r.cc))&&this.log("Live playlist, switching playlist, load frag with same CC: "+n.sn)):null!==(i=this.hls.liveSyncPosition)&&(n=this.getFragmentAtPosition(i,this.bitrateTest?e.fragmentEnd:e.edge,e)),n},t.getFragmentAtPosition=function(e,t,i){var r,a=this.config,s=this.fragPrevious,o=i.fragments,l=i.endSN,c=i.fragmentHint,u=a.maxFragLookUpTolerance;a=!!(a.lowLatencyMode&&i.partList&&c);if(a&&c&&!this.bitrateTest&&(o=o.concat(c),l=c.sn),r=e=n-a.maxFragLookUpTolerance&&i<=r,null!==t)&&s.duration>t&&(i"+e.startSN+" prev-sn: "+(l?l.sn:"na")+" fragments: "+o),a):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,n=this.startPosition;-1!==(n=n"+e))}}]),E);function E(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=w.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"),n=i("./src/events.ts"),a=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&&(a.logger.error("[buffer-controller]: Failed "+r.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),t.fatal=!0)),r.trigger(n.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(n.Events.BUFFER_FLUSHED,{type:e})},onError:function(t){a.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&&a.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(n.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 n=i.sourceBuffer[r];return t.type&&t.type!==r||n&&!n.ended&&(n.ended=!0,a.logger.log("[buffer-controller]: "+r+" sourceBuffer now EOS")),e&&!(n&&!n.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,a,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),a=Math.floor(c/t)*t-i,e.forEach((function(e){var t=u[e];t&&0<(t=o.BufferHelper.getBuffered(t)).length&&a>t.start(0)&&(s.trigger(n.Events.BACK_BUFFER_REACHED,{bufferEnd:a}),l.live&&s.trigger(n.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:a}),s.trigger(n.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:a,type:e}))}))))},i.updateMediaElementDuration=function(){var e,t,i,n,s,o;this.details&&this.media&&this.mediaSource&&"open"===this.mediaSource.readyState&&(e=this.details,t=this.hls,s=this.media,i=this.mediaSource,n=e.fragments[0].start+e.totalduration,s=s.duration,o=Object(r.isFiniteNumber)(i.duration)?i.duration:0,e.live&&t.config.liveDurationInfinity?(a.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,n=e.length-1,a=0;a=t||s.height>=i)&&(!(r=e[a+1])||s.width!==r.width||s.height!==r.height)){n=a;break}}return n},i=[{key:"contentScaleFactor",get:function(){var e=1;try{e=self.devicePixelRatio}catch(e){}return e}}],n((a=s).prototype,[{key:"mediaWidth",get:function(){return this.getDimensions().width*s.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*s.contentScaleFactor}}]),n(a,i);var a=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=a},"./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"),n=i("./src/types/cmcd.ts"),a=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=a.bitrate)}return 0o.config.fpsDroppedMonitoringThreshold*s&&(l=o.currentLevel,n.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=a},"./src/controller/fragment-finders.ts":function(e,t,i){i.r(t),i.d(t,"findFragmentByPDT",(function(){return a})),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"),n=i("./src/utils/binary-search.ts");function a(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 n=0;ne&&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 n.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,n=i("./src/events.ts"),a=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(n.Events.BUFFER_APPENDED,this.onBufferAppended,this),e.on(n.Events.FRAG_BUFFERED,this.onFragBuffered,this),e.on(n.Events.FRAG_LOADED,this.onFragLoaded,this)},i._unregisterListeners=function(){var e=this.hls;e.off(n.Events.BUFFER_APPENDED,this.onBufferAppended,this),e.off(n.Events.FRAG_BUFFERED,this.onFragBuffered,this),e.off(n.Events.FRAG_LOADED,this.onFragLoaded,this)},i.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},i.getAppendedFrag=function(e,t){if(t===a.PlaylistLevelType.MAIN){var i=this.activeFragment,r=this.activeParts;if(!i)return null;if(r)for(var n=r.length;n--;){var s=r[n],o=s?s.end:i.appendedPTS;if(s.start<=e&&void 0!==o&&e<=o)return 9e&&r.removeFragment(n)}))},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"),n=i("./src/errors.ts"),a=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,n=this.stalled,a=i.currentTime,c=i.seeking,u=this.seeking&&!c,d=!this.seeking&&c;if(this.seeking=c,a===e){if((d||u)&&(this.stalled=null),!i.paused&&!i.ended&&0!==i.playbackRate&&r.BufferHelper.getBuffered(i).length&&(e=r.BufferHelper.bufferInfo(i,a,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(a.Events.ERROR,{type:n.ErrorTypes.MEDIA_ERROR,details:n.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 a.ErrorDetails.LEVEL_LOAD_ERROR:case a.ErrorDetails.LEVEL_LOAD_TIMEOUT:i&&(i.deliveryDirectives&&(o=!1),r=i.level),s=!0;break;case a.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 n=e.details,a=this._levels[t];if(a.loadError++,i){if(!this.retryLoadingOrFail(e))return void(this.currentLevelIndex=-1);e.levelRetry=!0}r&&(1<(i=a.url.length)&&a.loadError=t.length){var i=e<0;if(this.hls.trigger(n.Events.ERROR,{type:a.ErrorTypes.OTHER_ERROR,details:a.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(n.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 a})),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"),n=i("./src/utils/logger.ts");function a(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,n=t.startPTS;Object(r.isFiniteNumber)(n)?(i=0,(n=t.sn>e.sn?(i=n-e.start,e):(i=e.start-n,t)).duration!==i&&(n.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,a,s,o){a-i<=0&&(n.logger.warn("Fragment should have a positive duration",t),a=i+t.duration,o=s+t.duration);var c=i,u=a,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(a,h),a=Math.max(a,h),o=Math.max(o,t.endDTS)),t.duration=a-i,i-t.start);t.appendedPTS=a,t.start=t.startPTS=i,t.maxStartPTS=c,t.startDTS=s,t.endPTS=a,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,a)?(e={},this.altAudio&&(e.type="video"),this.hls.trigger(s.Events.BUFFER_EOS,e),this.state=n.State.ENDED):(o=i.end,t=this.getNextFragment(o,a),this.couldBacktrack&&!this.fragPrevious&&t&&"initSegment"!==t.sn&&1<(e=t.sn-a.startSN)&&(t=a.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,a)),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,a,o):this.loadKey(t,a)))))},i.loadFragment=function(e,t,i){var r=this.fragmentTracker.getState(e);if(this.fragCurrent=e,r===l.FragmentState.BACKTRACKED){var n=this.fragmentTracker.getBacktrackData(e);if(n)return this._handleFragmentLoadProgress(n),void this._handleFragmentLoadComplete(n);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==(n=this.media)?void 0:n.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&&a<=r[s].end){n=r[s];break}t=i.start+i.duration,n?n.end=t:r.push(n={start:a,end:t}),this.fragmentTracker.fragBuffered(i)}}},i.onBufferFlushing=function(e,t){var i,r,n,a=t.startOffset,s=t.endOffset;0===a&&s!==Number.POSITIVE_INFINITY&&(i=this.currentTrackId,(r=this.levels).length)&&r[i]&&r[i].details&&((n=s-r[i].details.targetduration)<=0||(t.endOffsetSubtitles=Math.max(0,n),this.tracksBuffered.forEach((function(e){for(var t=0;t=n.length||t!==r)&&l){if(this.mediaBuffer=this.mediaBufferTimeRanges,i.live||null!=(n=l.details)&&n.live){if(r=this.mainDetails,i.deltaUpdateFailed||!r)return;n=r.fragments[0],l.details?0===this.alignPlaylists(i,l.details)&&n&&Object(o.addSliding)(i,n.start):i.hasProgramDateTime&&r.hasProgramDateTime?Object(s.alignMediaPlaylistByPDT)(i,r):n&&Object(o.addSliding)(i,n.start)}l.details=i,this.levelLastLoaded=t,this.tick(),!i.live||this.fragCurrent||!this.media||this.state!==c.State.IDLE||Object(a.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,n=(e=e.payload,i.decryptdata),a=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,n=i.groupId,a=i.name,s=i.type,o=i.url,this.hls.trigger(r.Events.SUBTITLE_TRACK_SWITCH,{id:l,groupId:void 0===n?"":n,name:a,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},a.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,n[h]=v<<16|v>>>16,a[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(a.Events.ERROR,{type:n.ErrorTypes.MEDIA_ERROR,details:n.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,n,a){e.samplerate||(t=s(t,i,n,a))&&(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,n){var a=l(e,t);e=c(e,t);if(0<(e-=a))return{headerLength:a,frameLength:e,stamp:i+r*n}}function A(e,t,i,r,n){var a,s,o;r=m(t,i,r,n,g(e.samplerate));if(r)return n=r.frameLength,s=r.headerLength,r=r.stamp,n=s+n,(o=Math.max(0,i+n-t.length))?(a=new Uint8Array(n-s)).set(t.subarray(i+s,t.length),0):a=t.subarray(i+s,i+n),t={unit:a,pts:r},o||e.samples.push(t),{sample:t,length:n,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"),n=i("./src/demux/id3.ts"),a=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=n.getID3Data(e,0),d=u?u.length:0,h=this._audioTrack,f=this._id3Track,p=u?n.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(a);break;case 12:case 13:s=e[u++],c+=String.fromCharCode((31&a)<<6|63&s);break;case 14:s=e[u++],o=e[u++],c+=String.fromCharCode((15&a)<<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"),n=i("./src/demux/id3.ts"),a=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=(n.getID3Data(e,0)||[]).length,i=e.length;tt.length)){var a=c(t,i);if(a&&i+a.frameLength<=t.length)return r+=n*(9e4*a.samplesPerFrame/a.sampleRate),n={unit:t.subarray(i,i+a.frameLength),pts:r,dts:r},e.config=[],e.channelCount=a.channelCount,e.samplerate=a.sampleRate,e.samples.push(n),{sample:n,length:a.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*n[14*(3==h?3-f:3==f?3:4)+p-1],g=a[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,n=32;n=e.length)return void r();for(var n=e[t].units;!(i>=n.length);i++){var a=n[i];if(!(a.data.length<=48||1!==a.type&&5!==a.type)){var s=this.decrypter.isSync();if(this.decryptAvcSample(e,t,i,r,a,s),!s)return}}}},t.default=a},"./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"),n=i("./src/events.ts"),a=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,n,o,l,c,u,d){var h=this,f=(u.transmuxing.start=self.performance.now(),this.transmuxer),p=this.worker,g=(o||n).start,m=n.decryptdata,A=this.frag,y=!(A&&n.cc===A.cc),v=!(A&&u.level===A.level),b=A?u.sn-A.sn:-1,w=this.part?u.part-this.part.index:1,k=!v&&(1==b||0==b&&1==w),E=self.performance.now();(v||b||0===n.stats.parsing.start)&&(n.stats.parsing.start=E),!o||!w&&k||(o.stats.parsing.start=E),E=!(A&&(null==(b=n.initSegment)?void 0:b.url)===(null==(w=A.initSegment)?void 0:w.url)),b=new a.TransmuxState(y,k,c,v,g,E);k&&!y&&!E||(s.logger.log("[transmuxer-interface, "+n.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: "+E),A=new a.TransmuxConfig(i,r,t,l,d),this.configureTransmuxer(A)),this.frag=n,this.part=o,p?p.postMessage({cmd:"demux",data:e,decryptdata:m,chunkMeta:u,state:b},e instanceof ArrayBuffer?[e]:[]):f&&(w=f.push(e,m,u,b),Object(a.isPromise)(w)?w.then((function(e){h.handleTransmuxComplete(e)})):this.handleTransmuxComplete(w))},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(a.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(n.Events.FRAG_DECRYPTED,d),this.observer.on(n.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(n.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 a.default(this.observer,u,i,p,t),this.worker=null}}else this.transmuxer=new a.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"),n=i("./src/events.ts"),a=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(n.Events.FRAG_DECRYPTED,t),i.on(n.Events.ERROR,t),e.addEventListener("message",(function(n){var s=n.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(a.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,n;((i=t.remuxResult).audio||i.video||i.text||i.id3||i.initSegment)&&(i=[],r=(n=t.remuxResult).audio,n=n.video,r&&c(i,r),n&&c(i,n),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 w})),i.d(t,"TransmuxState",(function(){return k}));var r,n=i("./src/events.ts"),a=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,n){var a=this,s=i.transmuxing,o=(e=(s.executeStart=r(),new Uint8Array(e)),this.cache),l=this.config,c=this.currentTransmuxState,u=this.transmuxConfig;n&&(this.currentTransmuxState=n),d=null,t=d=0>4){if((L=C+5+e[C+4])===C+188)continue}else L=C+4;switch(D){case h:R&&(p&&(n=g(p))&&this.parseAVCPES(n,!1),p={data:[],size:0}),p&&(p.data.push(e.subarray(L,C+188)),p.size+=C+188-L);break;case m:R&&(y&&(n=g(y))&&(s.isAAC?this.parseAACPES(n):this.parseMPEGPES(n)),y={data:[],size:0}),y&&(y.data.push(e.subarray(L,C+188)),y.size+=C+188-L);break;case A:R&&(v&&(n=g(v))&&this.parseID3PES(n),v={data:[],size:0}),v&&(v.data.push(e.subarray(L,C+188)),v.size+=C+188-L);break;case 0:R&&(L+=e[L]+1),k=this._pmtId=(31&(x=e)[(S=L)+10])<<8|x[S+11];break;case k:R&&(L+=e[L]+1);var x=function(e,t,i,r){var n={audio:-1,avc:-1,id3:-1,isAAC:!0},a=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 n.default(this)),m=new a.default(this),A=new s.default(this),y=this.levelController=new l.default(this),b=new c.FragmentTracker(this),w=this.streamController=new u.default(this,b);r.setStreamController(w),d.setStreamController(w),y=[y,w],this.networkControllers=y,w=[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,w),this.emeController=this.createController(t.emeController,null,w),this.cmcdController=this.createController(t.cmcdController,null,w),this.latencyController=this.createController(o.default,null,w),this.coreComponents=w}y.defaultConfig=void 0},"./src/is-supported.ts":function(e,t,i){i.r(t),i.d(t,"isSupported",(function(){return a})),i.d(t,"changeTypeSupported",(function(){return s}));var r=i("./src/utils/mediasource-helper.ts");function n(){return self.SourceBuffer||self.WebKitSourceBuffer}function a(){var e,t=Object(r.getMediaSource)();return!!t&&(e=n(),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=n();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"),n=i("./src/errors.ts");function a(e){var t="function"==typeof Map?new Map:void 0;return(a=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:n.ErrorTypes.NETWORK_ERROR,details:n.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:e,networkDetails:null},"Fragment does not have a "+(r?"part list":"url")));this.abort();var a=this.config,s=a.fLoader,o=a.loader;return new Promise((function(r,l){i.loader&&i.loader.destroy();var u=i.loader=e.loader=new(s||o)(a),d=h(e),f={timeout:a.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:a.fragLoadingMaxRetryTimeout,highWaterMark:c};e.stats=u.stats,u.load(d,f,{onSuccess:function(t,n,a,s){i.resetLoader(e,u),r({frag:e,part:null,payload:t.data,networkDetails:s})},onError:function(t,r,a){i.resetLoader(e,u),l(new p({type:n.ErrorTypes.NETWORK_ERROR,details:n.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:t,networkDetails:a}))},onAbort:function(t,r,a){i.resetLoader(e,u),l(new p({type:n.ErrorTypes.NETWORK_ERROR,details:n.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:e,networkDetails:a}))},onTimeout:function(t,r,a){i.resetLoader(e,u),l(new p({type:n.ErrorTypes.NETWORK_ERROR,details:n.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,networkDetails:a}))},onProgress:function(i,r,n,a){t&&t({frag:e,part:null,payload:n,networkDetails:a})}})}))},t.loadPart=function(e,t,i){var r=this,a=(this.abort(),this.config),s=a.fLoader,o=a.loader;return new Promise((function(l,u){r.loader&&r.loader.destroy();var d=r.loader=e.loader=new(s||o)(a),f=h(e,t),g={timeout:a.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:a.fragLoadingMaxRetryTimeout,highWaterMark:c};t.stats=d.stats,d.load(f,g,{onSuccess:function(n,a,s,o){r.resetLoader(e,d),r.updateStatsFromPart(e,t),n={frag:e,part:t,payload:n.data,networkDetails:o},i(n),l(n)},onError:function(i,a,s){r.resetLoader(e,d),u(new p({type:n.ErrorTypes.NETWORK_ERROR,details:n.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:i,networkDetails:s}))},onAbort:function(i,a,s){e.stats.aborted=t.stats.aborted,r.resetLoader(e,d),u(new p({type:n.ErrorTypes.NETWORK_ERROR,details:n.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,networkDetails:s}))},onTimeout:function(i,a,s){r.resetLoader(e,d),u(new p({type:n.ErrorTypes.NETWORK_ERROR,details:n.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,networkDetails:s}))}})}))},t.updateStatsFromPart=function(e,t){var i=e.stats,r=t.stats,n=r.total;i.loaded+=r.loaded,n?(n=((e=Math.round(e.duration/t.duration))-(t=Math.min(Math.round(i.loaded/n),e)))*Math.round(i.loaded/t),i.total=i.loaded+n):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=a(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,n,a){void 0===a&&(a=!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,n)):s[e]={startPTS:t,endPTS:i,startDTS:r,endDTS:n,partial:a}},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(n.isFiniteNumber)(this.programDateTime)?(e=Object(n.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,n){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,n),n&&(i.fragOffset=n.fragOffset+n.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"),n=i("./src/errors.ts"),a=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,n,s=t.type,o=this.loaders[s];t.decryptdata?(i=t.decryptdata.uri)!==this.decrypturl||null===this.decryptkey?(n=this.hls.config,o&&(a.logger.warn("abort previous key loader for type:"+s),o.abort()),i?(o=n.loader,s=t.loader=this.loaders[s]=new o(n),this.decrypturl=i,this.decryptkey=null,o={url:i,frag:t,responseType:"arraybuffer"},i={timeout:n.fragLoadingTimeOut,maxRetry:0,retryDelay:n.fragLoadingRetryDelay,maxRetryDelay:n.fragLoadingMaxRetryTimeout,highWaterMark:0},n={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)},s.load(o,i,n)):a.logger.warn("key uri is falsy")):this.decryptkey&&(t.decryptdata.key=this.decryptkey,this.hls.trigger(r.Events.KEY_LOADED,{frag:t})):a.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})):a.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:n.ErrorTypes.NETWORK_ERROR,details:n.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:n.ErrorTypes.NETWORK_ERROR,details:n.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 a}));var r=i("./src/polyfills/number.ts");function n(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),a=0,t=8;a>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]))},n.mdia=function(e){return n.box(n.types.mdia,n.mdhd(e.timescale,e.duration),n.hdlr(e.type),n.minf(e))},n.mfhd=function(e){return n.box(n.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e]))},n.minf=function(e){return"audio"===e.type?n.box(n.types.minf,n.box(n.types.smhd,n.SMHD),n.DINF,n.stbl(e)):n.box(n.types.minf,n.box(n.types.vmhd,n.VMHD),n.DINF,n.stbl(e))},n.moof=function(e,t,i){return n.box(n.types.moof,n.mfhd(e),n.traf(i,t))},n.moov=function(e){for(var t=e.length,i=[];t--;)i[t]=n.trak(e[t]);return n.box.apply(null,[n.types.moov,n.mvhd(e[0].timescale,e[0].duration)].concat(i).concat(n.mvex(e)))},n.mvex=function(e){for(var t=e.length,i=[];t--;)i[t]=n.trex(e[t]);return n.box.apply(null,[n.types.mvex].concat(i))},n.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 n.box(n.types.mvhd,e)},n.sdtp=function(e){for(var t,i=e.samples||[],r=new Uint8Array(4+i.length),a=0;a>>8&255),r.push(255&i),r=r.concat(Array.prototype.slice.call(t));for(s=0;s>>8&255),a.push(255&i),a=a.concat(Array.prototype.slice.call(t));var o=n.box(n.types.avcC,new Uint8Array([1,r[3],r[4],r[5],255,224|e.sps.length].concat(r).concat([e.pps.length]).concat(a))),l=e.width,c=e.height,u=e.pixelRatio[0],d=e.pixelRatio[1];return n.box(n.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,n.box(n.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),n.box(n.types.pasp,new Uint8Array([u>>24,u>>16&255,u>>8&255,255&u,d>>24,d>>16&255,d>>8&255,255&d])))},n.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]))},n.mp4a=function(e){var t=e.samplerate;return n.box(n.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]),n.box(n.types.esds,n.esds(e)))},n.mp3=function(e){var t=e.samplerate;return n.box(n.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]))},n.stsd=function(e){return"audio"===e.type?e.isAAC||"mp3"!==e.codec?n.box(n.types.stsd,n.STSD,n.mp4a(e)):n.box(n.types.stsd,n.STSD,n.mp3(e)):n.box(n.types.stsd,n.STSD,n.avc1(e))},n.tkhd=function(e){var t=e.id,i=e.duration*e.timescale,a=e.width,s=(e=e.height,Math.floor(i/(1+r)));i=Math.floor(i%(1+r));return n.box(n.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,a>>8&255,255&a,0,0,e>>8&255,255&e,0,0]))},n.traf=function(e,t){var i=n.sdtp(e),a=e.id,s=Math.floor(t/(1+r));t=Math.floor(t%(1+r));return n.box(n.types.traf,n.box(n.types.tfhd,new Uint8Array([0,0,0,0,a>>24,a>>16&255,a>>8&255,255&a])),n.box(n.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])),n.trun(e,i.length+16+20+8+16+8+8),i)},n.trak=function(e){return e.duration=e.duration||4294967295,n.box(n.types.trak,n.tkhd(e),n.mdia(e))},n.trex=function(e){return e=e.id,n.box(n.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]))},n.trun=function(e,t){var i,r,a,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,a>>>24&255,a>>>16&255,a>>>8&255,255&a,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 n.box(n.types.trun,u)},n.initSegment=function(e){n.types||n.init();e=n.moov(e);var t=new Uint8Array(n.FTYP.byteLength+e.byteLength);return t.set(n.FTYP),t.set(e,n.FTYP.byteLength),t},i=n;function n(){}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"),n=i("./src/remux/aac-helper.ts"),a=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;tC.pts&&(T=Math.max(Math.min(T,C.pts-C.dts),-18e3)),C.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(n.lastIndex=0;null!==(t=n.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,n=0,a=e.length-1;n<=a;){var s=t(r=e[i=(n+a)/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),n=[],a=0;aa&&(r[s-1].end=e[n].end):r.push(e[n])}else r=e;for(var o,l=0,c=t,u=t,d=0;d=e&&s.logger.log(this.time+" ["+e+"] "+t)},C),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(a.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(a.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 ("+n([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=n},"./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"),n=i("./src/loader/load-stats.ts"),a=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&&n(t,i,s.flush(),e)):n(t,i,o,e),a())})).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"),n=i("./src/utils/vttparser.ts"),a=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{a.log()}catch(e){a=n}}else a=n}var o=n},"./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 n})),(i=r=r||{}).WIDEVINE="com.widevine.alpha",i.PLAYREADY="com.microsoft.playready";var r,n="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"),n=i("./src/loader/fragment.ts"),a=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,n=[];if(t.length)for(var a=("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/a,start:s,end:s+p-1}}),s+=p,n=h+=4}return{earliestPresentationTime:0,timescale:a,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=n;function n(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 n})),i.d(t,"addCueToTrack",(function(){return a})),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 n(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 a(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 n=new self.TextTrackCue(t.startTime,t.endTime,t.text);n.id=t.id,e.addCue(n)}"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,n=i;r<=n;){var a=Math.floor((n+r)/2);if(te[a].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 n.VTTParser,y=(e=Object(a.utf8ArrayToStr)(new Uint8Array(e)).trim().replace(l,"\n").split("\n"),[]),v=Object(s.toMpegTsClockFromTimescale)(t,i),b="00:00.000",w=0,k=0,E=!0,T=!1;A.oncue=function(e){var t=u[h],i=u.ccOffset,r=(w-v)/9e4;null!=t&&t.new&&(void 0!==k?i=u.ccOffset=t.start:function(e,t){var i,r=e[h],n=e[r.prevCC];if(!n||!n.new&&r.new)return e.ccOffset=e.presentationOffset=r.start,r.new=!1;for(;null!=(i=n)&&i.new;)e.ccOffset+=r.start-n.start,r.new=!1,n=e[(r=n).prevCC];e.presentationOffset=t}(u,r)),r&&(i=r-u.presentationOffset),T&&(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 "+a.url),this.callbacks.onError({code:t,text:s.statusText},a,s)):(r.logger.warn(t+" while loading "+a.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&&a.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 n in t)e.d(r,n,function(e){return t[e]}.bind(null,n));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 n;return(i[r]||(n=i[r]={i:r,l:!1,exports:{}},t[r].call(n.exports,n,n.exports,e),n.l=!0,n)).exports}var t,i}())})))&&Dr.__esModule&&Object.prototype.hasOwnProperty.call(Dr,"default")?Dr.default:Dr,Sn=function(e){m(i,e);var t=A(i);function i(e){var r;return v(this,i),r=t.call(this),(r.player=e)._opt,r.canVideoPlay=!1,r.$videoElement=null,r.canvasRenderInterval=null,r.bandwidthEstimateInterval=null,r.fpsInterval=null,r.hlsFps=0,r.hlsPrevFrams=0,r.isInitInfo=!1,r.eventsDestroy=[],Tn.isSupported()?(r.$videoElement=r.player.video.$videoElement,r.hls=new Tn({}),r._initHls(),r._bindEvents()):function(){var e=document.createElement("video"),t=e.canPlayType("application/vnd.apple.mpegurl");return e=null,t}()?(r.$videoElement=r.player.video.$videoElement,r.canVideoPlay=!0):r.player.debug.error("HlsDecoder","init hls error ,not support "),r.player.debug.log("HlsDecoder","init"),r}return b(i,[{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(z.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,it()&&(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,ke,(function(i){e.hls&&(i=parseInt(i.timeStamp,10),t.handleRender(),t.updateStats({ts:i,dts:i}),t.emit(z.videoTimeUpdate,i))}));this.eventsDestroy.push(r),this._startBandwidthEstimateInterval(),this._startFpsInterval(),this.hls.on(Tn.Events.ERROR,(function(t,i){if(i.fatal)switch(i.type){case Tn.ErrorTypes.NETWORK_ERROR:e.player.debug.error("HlsDecoder","fatal network error encountered, try to recover"),e.hls.startLoad();break;case Tn.ErrorTypes.MEDIA_ERROR:e.player.debug.error("HlsDecoder","fatal media error encountered, try to recover"),e.hls.recoverMediaError()}})),this.hls.on(Tn.Events.MEDIA_ATTACHING,(function(){})),this.hls.on(Tn.Events.MEDIA_ATTACHED,(function(){})),this.hls.on(Tn.Events.MEDIA_DETACHING,(function(){})),this.hls.on(Tn.Events.MEDIA_DETACHED,(function(){})),this.hls.on(Tn.Events.BUFFER_RESET,(function(){})),this.hls.on(Tn.Events.BUFFER_CODECS,(function(){})),this.hls.on(Tn.Events.BUFFER_CREATED,(function(){})),this.hls.on(Tn.Events.BUFFER_APPENDING,(function(t,i){e.player.debug.log("HlsDecoder","BUFFER_APPENDING",i)})),this.hls.on(Tn.Events.BUFFER_APPENDED,(function(){})),this.hls.on(Tn.Events.BUFFER_EOS,(function(){})),this.hls.on(Tn.Events.BUFFER_FLUSHING,(function(){})),this.hls.on(Tn.Events.BUFFER_FLUSHED,(function(){})),this.hls.on(Tn.Events.MANIFEST_LOADING,(function(){e.player.debug.log("HlsDecoder","MANIFEST_LOADING 开始加载playlist m3u8资源")})),this.hls.on(Tn.Events.MANIFEST_LOADED,(function(t,i){e.player.debug.log("HlsDecoder","MANIFEST_LOADED playlist m3u8文件加载完成",i)})),this.hls.on(Tn.Events.MANIFEST_PARSED,(function(){e.player.debug.log("HlsDecoder","MANIFEST_PARSED playlist m3u8解析完成"),t._times.demuxStart||(t._times.demuxStart=Ke())})),this.hls.on(Tn.Events.LEVEL_LOADING,(function(){})),this.hls.on(Tn.Events.LEVEL_LOADED,(function(e,t){})),this.hls.on(Tn.Events.FRAG_LOADING,(function(){})),this.hls.on(Tn.Events.FRAG_LOADED,(function(e,i){t._times.decodeStart||(t._times.decodeStart=Ke())})),this.hls.on(Tn.Events.BUFFER_APPENDING,(function(){t._times.videoStart||(t._times.videoStart=Ke(),t.handlePlayToRenderTimes())})),this.hls.on(Tn.Events.FRAG_DECRYPTED,(function(){})),this.hls.on(Tn.Events.KEY_LOADING,(function(){})),this.hls.on(Tn.Events.KEY_LOADING,(function(){})),this.hls.on(Tn.Events.FPS_DROP,(function(e){})),this.hls.on(Tn.Events.FPS_DROP_LEVEL_CAPPING,(function(e){})),this.hls.on(Tn.Events.FRAG_PARSING_INIT_SEGMENT,(function(t,i){e.player.debug.log("HlsDecoder","FRAG_PARSING_INIT_SEGMENT",i);var r,n=!!(i&&i.tracks&&i.tracks.audio),a=!!(i&&i.tracks&&i.tracks.video);if(n&&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})}a&&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,be,(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,we,(function(){e.player.debug.log("HlsDecoder","video waiting")})),n=t(this.$videoElement,ke,(function(t){t=parseInt(t.timeStamp,10),e.player.handleRender(),e.player.updateStats({ts:t}),e.player.emit(z.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,Ee,(function(){e.player.debug.log("HlsDecoder","video playback Rate change",e.$videoElement&&e.$videoElement.playbackRate)}));this.eventsDestroy.push(i,r,n,t)}},{key:"loadSource",value:function(e){var t=this;return new Promise((function(i,r){t.canVideoPlay?(t.initVideoPlay(e),i()):t.hls.on(Tn.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),n=i-r;t=Math.max(5,3+t),t=(t\n ').concat(a.content,"\n \n "),(r=Array.from(this.$contextmenus.children)[a.index])?r.insertAdjacentHTML("beforebegin",i):gn(this.$contextmenus,i),r=this.$contextmenus.querySelector(".jessibuca-contextmenu-"+t),a.click&&s(r,"click",(function(e){e.preventDefault(),a.click.call(n.player,n,e),n.hide()})),this.menuList.push({uuid:t,$menuItem:r}))}}]),i}(e),In=function(e){m(r,e);var t=A(r);function r(e,i){var n;v(this,r),n=t.call(this),n.$container=e;e=Pt();var a,s=(n._opt=Object.assign({},e,i),n.debug=new je(c(n)),n._opt.forceNoOffscreen=!0,Ze()&&(n._opt.controlAutoHide=!1),n._opt.forceNoOffscreen||("undefined"==typeof OffscreenCanvas?(n._opt.forceNoOffscreen=!0,n._opt.useOffscreen=!1):n._opt.useOffscreen=!0),(n._opt.isHls||n._opt.isWebrtc)&&(n._opt.useWCS=!1,n._opt.useMSE=!1,n._opt.isNakedFlow=!1),n._opt.isNakedFlow,n._opt.isHls||n._opt.isWebrtc||(n._opt.useWCS&&(n._opt.useWCS="VideoEncoder"in window,n._opt.useWCS||n.debug.warn("Player","useWCS is true, but not support so set useWCS false"),n._opt.useWCS)&&(n._opt.useOffscreen?n._opt.wcsUseVideoRender=!1:n._opt.wcsUseVideoRender&&(n._opt.wcsUseVideoRender=ct()&&ut(),n._opt.wcsUseVideoRender||n.debug.warn("Player","wcsUseVideoRender is true, but not support so set wcsUseVideoRender false"))),n._opt.useMSE&&(n._opt.useMSE=function(){var e=!1;return!(!("MediaSource"in window)||!window.MediaSource.isTypeSupported(oe))||e}(),n._opt.useMSE||n.debug.warn("Player","useMSE is true, but not support so set useMSE false"))),n._opt.useMSE?(n._opt.useWCS&&n.debug.warn("Player","useMSE is true and useWCS is true then useWCS set true->false"),n._opt.forceNoOffscreen||n.debug.warn("Player","useMSE is true and forceNoOffscreen is false then forceNoOffscreen set false->true"),n._opt.useWCS=!1,n._opt.forceNoOffscreen=!0):n._opt.useWCS,!n._opt.useSIMD&&-1===n._opt.decoder.indexOf("-simd")||(n._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])),n._opt.useSIMD)||n.debug.warn("Player","useSIMD is true, but not support so set useSIMD false"),n._opt.useSIMD?-1===n._opt.decoder.indexOf("-simd")&&(n._opt.decoder=n._opt.decoder.replace("decoder-pro","decoder-pro-simd")):-1!==n._opt.decoder.indexOf("-simd")&&(n._opt.decoder=n._opt.decoder.replace("decoder-pro-simd","decoder-pro")),Ft(n._opt.hasAudio)&&(n._opt.operateBtns.audio=!1),Ft(n._opt.hasVideo)&&(n._opt.operateBtns.fullscreen=!1,n._opt.operateBtns.screenshot=!1,n._opt.operateBtns.record=!1,n._opt.operateBtns.ptz=!1,n._opt.operateBtns.quality=!1,n._opt.operateBtns.zoom=!1),n._opt.qualityConfig&&0===n._opt.qualityConfig.length&&n._opt.operateBtns.quality&&(n._opt.operateBtns.quality=!1,n.debug.warn("Player","_opt.qualityConfig is empty, so set operateBtns.quality false")),Ot(n._opt.useWebGPU)&&(n._opt.useWebGPU=function(){var e=!1;return"gpu"in navigator||e}(),Ft(n._opt.useWebGPU))&&n.debug.warn("Player","useWebGPU is true, but not support so set useWebGPU false"),n._opt.hasControl=n._hasControl(),n._loading=!1,n._playing=!1,n._playbackPause=!1,n._hasLoaded=!1,n._zooming=!1,n._destroyed=!1,n._checkHeartTimeout=null,n._checkLoadingTimeout=null,n._checkStatsInterval=null,n._checkVisibleHiddenTimeout=null,n._startBpsTime=null,n._isPlayingBeforePageHidden=!1,n._stats={buf:0,netBuf:0,fps:0,maxFps:0,dfps:0,abps:0,vbps:0,ts:0,mseTs:0,pTs:0,dts:0},n._allStatsData={},n._faceDetectActive=!1,n._objectDetectActive=!1,n._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},n._videoTimestamp=0,n._audioTimestamp=0,n._videoIframeIntervalTs=0,n._streamQuality=n._opt.defaultStreamQuality||"",n._visibility=!0,n._lastestVisibilityChangeTimestamp=null,n._tempWorkerStats=null,n._isPlayback()&&(n._opt.useMSE=!1,n._opt.useWCS=!1),Ft(n._opt.useMSE)&&Ft(n._opt.useWCS)&&Ft(n._opt.isWebrtc)&&Ft(n._opt.isHls)&&(n._opt.useWasm=!0),(n._opt.isHls||n._opt.isWebrtc)&&(n._opt.hasVideo=!0,n._opt.hasAudio=!0),n._opt.hasVideo||(n._opt.useMSE=!1,n._opt.useWCS=!1),n._opt.useWasm&&(n._opt.useOffscreen?n._opt.wasmUseVideoRender=!1:n._opt.wasmUseVideoRender&&(n._opt.wasmUseVideoRender=nt()&&ct()&&ut(),n._opt.wasmUseVideoRender||n.debug.warn("Player","use wasm video render, but not support so set wasmUseVideoRender false")),n._opt.useSIMD?n.debug.log("Player","use simd wasm"):n.debug.log("Player","use wasm")),n._opt.useWasm&&(n._opt.useFaceDetector&&window.JessibucaProFaceDetector||n._opt.useObjectDetector&&window.JessibucaProObjectDetector)?(n.ai=new Ln(c(n)),n._opt.useFaceDetector&&window.JessibucaProFaceDetector||(n._opt.operateBtns.aiFace=!1),n._opt.useObjectDetector&&window.JessibucaProObjectDetector||(n._opt.operateBtns.aiObject=!1)):(n._opt.operateBtns.aiObject=!1,n._opt.operateBtns.aiFace=!1),!n._opt.useFaceDetector||n._opt.useWasm&&window.JessibucaProFaceDetector||n.debug.warn("Player","use face detector, useWasm is ".concat(n._opt.useWasm," and window.JessibucaProFaceDetector is ")+!!window.JessibucaProFaceDetector),!n._opt.useObjectDetector||n._opt.useWasm&&window.JessibucaProObjectDetector||n.debug.warn("Player","use object detector, useWasm is ".concat(n._opt.useWasm," and window.JessibucaProObjectDetector is ")+!!window.JessibucaProObjectDetector),n._opt.useVideoRender&&(n._opt.useWasm&&!n._opt.useOffscreen?(n._opt.wasmUseVideoRender=nt()&&ct()&&ut(),n._opt.wasmUseVideoRender||n.debug.warn("Player","use wasm video render, but not support so set wasmUseVideoRender false")):n._opt.useWCS&&!n._opt.useOffscreen&&(n._opt.wcsUseVideoRender=ct()&&ut(),n._opt.wcsUseVideoRender||n.debug.warn("Player","use wcs video render, but not support so set wcsUseVideoRender false"))),n._opt.useCanvasRender&&(n._opt.useMSE&&(n._opt.mseUseCanvasRender=!0),n._opt.useWasm&&(n._opt.wasmUseVideoRender=!1),n._opt.useWCS&&(n._opt.wcsUseVideoRender=!1),n._opt.isHls)&&!it()&&(n._opt.hlsUseCanvasRender=!0),n._opt.useVideoRender=!1,n._opt.useCanvasRender=!1,n._opt.useWasm?n._opt.wasmUseVideoRender?n._opt.useVideoRender=!0:n._opt.useCanvasRender=!0:n._opt.useWCS?n._opt.wcsUseVideoRender?n._opt.useVideoRender=!0:n._opt.useCanvasRender=!0:n._opt.useMSE?n._opt.mseUseCanvasRender?n._opt.useCanvasRender=!0:n._opt.useVideoRender=!0:n._opt.isHls?n._opt.hlsUseCanvasRender?n._opt.useCanvasRender=!0:n._opt.useVideoRender=!0:n._opt.isWebrtc&&(n._opt.useVideoRender=!0),a=c(n),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]}})})),n.events=new jt(c(n)),n._opt.hasVideo&&(n.video=new ni(c(n)),n.recorder=new Wi(c(n))),n._opt.isHls?(n.hlsDecoder=new Sn(c(n)),n.loaded=!0):n._opt.isWebrtc?(n._opt.isWebrtcForZLM?n.webrtc=new Cn(c(n)):n.webrtc=new _n(c(n)),n.loaded=!0):Ct(n._opt)?n.loaded=!0:n.decoderWorker=new Vi(c(n)),n._opt.hasAudio&&(n.audio=new bi(c(n))),n.stream=null,n.demux=null,n._lastVolume=null,n._isInZoom=!1,n._playingStartTimestamp=null,n._opt.useWCS&&(n.webcodecsDecoder=new on(c(n)),n._opt.hasAudio||(n.loaded=!0)),n._opt.useMSE&&(n.mseDecoder=new wn(c(n)),n._opt.hasAudio||(n.loaded=!0)),n.control=new vn(c(n)),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:a,mseDelay:i,mseDecodeDiffTimes:r,mseDecodePlaybackRate:n,wcsDecodeDiffTimes:r,hlsDelay:i,hlsDecodePlaybackRate:n,delayTs:e,totalDelayTs:g,isDropping:l,isStreamTsMoreThanLocal:c}),this.emit(z.stats,this._allStatsData),1048576=l)){for(s=0;s do talk"),e.emit(z.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(z.talkStreamClose),i(t)})),r(e.socket,"error",(function(t){e.socketStatus="error",e.error(e.tag,"websocket error",t),e.emit(z.talkStreamError,t),i(t)}))}))}},{key:"_sendClose",value:function(){}},{key:"_initTalk",value:function(){this._initMethods(),this._opt.engine===Ce?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 Bn({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(Rt((function(){var e=function(e){m(i,e);var t=A(i);function i(e){var r;return v(this,i),r=t.call(this),r._cursor=0,r._bufferSize=e.processorOptions.bufferSize,r._buffer=new Float32Array(r._bufferSize),r}return b(i,[{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===ye&&(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=Mn(e,Pn,8);return 8<=i?127^t:(i<<4|e>>i+3&15)^t}(e)})),t}(i));for(var n=Uint8Array.from(r),a=0;a>8,r[1]=255&s>>0,r[2]=128,r[3]=128+n,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]=a/65536/256,r[11]=a/65536%256,r[12]=a%65536/256,r[13]=a%65536%256,r.concat(l(e))),c=new Uint8Array(o.length),u=0;u=n.heartTimeout)throw new Error("Jessibuca-pro videoBuffer ".concat(n.videoBuffer,"s must be less than heartTimeout ").concat(n.heartTimeout,"s"));if(a.classList.add("jessibuca-container"),Ft(n.isLive)){var s=document.createElement("video");s.muted=!0,s.setAttribute("controlsList","nodownload"),s.disablePictureInPicture="disablePictureInPicture",s.style.position="absolute",s.style.top=0,s.style.left=0,s.style.height="100%",s.style.width="100%",a.appendChild(s),e.$videoElement=s,e.$container=a,e._opt=n}else delete n.container,ft(n.videoBuffer)&&(n.videoBuffer=1e3*Number(n.videoBuffer)),ft(n.videoBufferDelay)&&(n.videoBufferDelay=1e3*Number(n.videoBufferDelay)),ft(n.networkDelay)&&(n.networkDelay=1e3*Number(n.networkDelay)),ft(n.timeout)&&(dt(n.loadingTimeout)&&(n.loadingTimeout=n.timeout),dt(n.heartTimeout))&&(n.heartTimeout=n.timeout),n.isMulti&&(n.debugUuid="xxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}))),e._opt=n,e._destroyed=!1,e.$container=a,e._loadingTimeoutReplayTimes=0,e._heartTimeoutReplayTimes=0,e.events=new jt(c(e)),e.debug=new je(c(e)),e.watermark=new Fn(c(e)),e._initPlayer(a,n),e._initWatermark();return e}return b(i,[{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=Bt()}},{key:"_initPlayer",value:function(e,t){this.player=new In(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(z.crashLog,i.getCrashLog("this.player.play 1",e)),i.player.pause().then((function(){n(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(z.crashLog,i.getCrashLog("this.player.play 2",e)),n(e)}))})).catch((function(e){i.debug.error("Jessibuca","this.player.pause error",e),n(e)})):i._play(e,t).then((function(){r()})).catch((function(e){i.debug.error("Jessibuca","_play error",e),i.emit(z.crashLog,i.getCrashLog("this.player.play 3",e)),n(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(z.crashLog,i.getCrashLog("this.player.play 4",e)),i.player.pause().then((function(){n(e)}))})):e?i._play(e,t).then((function(){r()})).catch((function(e){i.debug.error("Jessibuca","_play error",e),i.emit(z.crashLog,i.getCrashLog("this.player.play 5",e)),n(e)})):i._play(i._opt.url,i._opt.playOptions).then((function(){r()})).catch((function(e){i.debug.error("Jessibuca","_play error",e),i.emit(z.crashLog,i.getCrashLog("this.player.play 6",e)),n(e)}))}))}},{key:"_cryptoPlay",value:function(e){var t=this;return new Promise((function(i,r){var n,a=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="+a}n=o,new Promise((function(e,t){dr.get(n).then((function(t){e(t)})).catch((function(e){t(e)}))})).then((function(e){if(e){var t=e.split("."),n=xt(t[0]),a=xt(t[1]);a&&n?i({cryptoIV:a,cryptoKey:n}):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(z.playFailedAndPaused,V.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(V.mediaSourceFull,(function(t){e.emit(z.crashLog,e.getCrashLog(V.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(z.playFailedAndPaused,V.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(V.mediaSourceAppendBufferError,(function(t){e.emit(z.crashLog,e.getCrashLog(V.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(z.playFailedAndPaused,V.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(V.mediaSourceBufferListLarge,(function(t){e.emit(z.crashLog,e.getCrashLog(V.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(z.playFailedAndPaused,V.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(V.mediaSourceAppendBufferEndTimeout,(function(t){e.emit(z.crashLog,e.getCrashLog(V.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(z.playFailedAndPaused,V.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(V.mseSourceBufferError,(function(t){e.emit(z.crashLog,e.getCrashLog(V.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(z.playFailedAndPaused,V.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(V.mseAddSourceBufferError,(function(t){e.emit(z.crashLog,e.getCrashLog(V.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(z.playFailedAndPaused,V.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(V.mediaSourceDecoderConfigurationError,(function(t){e.emit(z.crashLog,e.getCrashLog(V.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(V.mediaSourceTsIsMaxDiff,(function(t){e.emit(z.crashLog,e.getCrashLog(V.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(z.playFailedAndPaused,V.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(V.mseWidthOrHeightChange,(function(t){e.emit(z.crashLog,e.getCrashLog(V.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(V.mediaSourceUseCanvasRenderPlayFailed,(function(t){e.emit(z.crashLog,e.getCrashLog(V.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(V.webcodecsH265NotSupport,(function(t){e.emit(z.crashLog,e.getCrashLog(V.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(z.playFailedAndPaused,V.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(V.webcodecsDecodeError,(function(t){e.emit(z.crashLog,e.getCrashLog(V.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(z.playFailedAndPaused,V.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(V.wcsWidthOrHeightChange,(function(t){e.emit(z.crashLog,e.getCrashLog(V.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(V.wasmDecodeError,(function(t){e.emit(z.crashLog,e.getCrashLog(V.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(z.playFailedAndPaused,V.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(V.wasmDecodeVideoNoResponseError,(function(t){e.emit(z.crashLog,e.getCrashLog(V.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(V.wasmWidthOrHeightChange,(function(t){e.emit(z.crashLog,e.getCrashLog(V.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(V.simdH264DecodeVideoWidthIsTooLarge,(function(t){e.emit(z.crashLog,e.getCrashLog(V.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(z.networkDelayTimeout,(function(t){if(e.player._opt.networkDelayTimeoutReplay){e.emit(z.crashLog,e.getCrashLog(z.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 n=e.screenshot("","png",.92,"base64");r.loadingBackground=n}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(V.fetchError,(function(t){e.emit(z.crashLog,e.getCrashLog(V.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(z.delayTimeout,(function(t){e.emit(z.crashLog,e.getCrashLog(z.delayTimeout,t)),e.pause().then((function(){if(e.player&&e.player._opt.heartTimeoutReplay&&(e._heartTimeoutReplayTimes=Math.pow(l,2)?u:0),i=f+(g%l==l-1?c:0),r=p+(g+l>=Math.pow(l,2)?u:0),o+='\n
\n
\n
\n
\n ");for(var m='
'.concat(o,"
"),A=(this.$container.innerHTML=m,this.$container.querySelectorAll(".jessibuca-multi-player")),y=0;y=Math.pow(r,2)?a:0),y=l+(d%r==r-1?n:0),v=c+(d+r>=Math.pow(r,2)?a:0);f.style.width=y+"px",f.style.height=v+"px",f.style.display="block",g.style.width=m+"px",g.style.height=A+"px",g.style.display="block",p.style.width=m+"px",p.style.height=A+"px",p.style.display="block",h.player&&h.player.resize()}if(this.specialLayoutType){var b,w,k,E,T=this.windowList[0],S=T.$playerContainer,_=T.$player,C=T.$playerBorder,R=S.style.width.replace("px",""),D=S.style.height.replace("px",""),L=_.style.width.replace("px",""),x=_.style.height.replace("px","");this.specialLayoutType===Oe?(b=2*R,w=2*D,k=2*L+2,E=2*x+2):this.specialLayoutType===Fe&&(b=3*R,w=3*D,k=3*L+4,E=3*x+4),S.style.width=b+"px",S.style.height=w+"px",_.style.width=k+"px",_.style.height=E+"px",C.style.width=k+"px",C.style.height=E+"px",T.player&&T.player.resize(),u=this._getSpecialMaxSplit()}for(var I=u;Ithis._opt.maxSplit&&(e=this._opt.maxSplit),this._opt.split=e,this.currentWindowIndex=0,this._updateWindows(),this._handleWindowSelect(this.currentWindowIndex))}},{key:"_arrangeSpecialWindow",value:function(e){this._opt.maxSplit<=3&&e===Fe||this._opt.maxSplit<=2&&e===Oe?this.debug.warn(this.LOG_TAG,"_arrangeSpecialWindow() type ".concat(e," is not valid because maxSplit is ")+this._opt.maxSplit):this.specialLayoutType&&this.specialLayoutType===e?this.debug.warn(this.LOG_TAG,"_arrangeSpecialWindow() type ".concat(e," is not changed")):(this.specialLayoutType=e)===Oe?this._arrangeWindow(3):e===Fe?this._arrangeWindow(4):this.debug.warn(this.LOG_TAG,"_arrangeSpecialWindow() type ".concat(e," is not valid"))}},{key:"getCurrentSplit",value:function(){return this.specialLayoutType||this._opt.split}},{key:"_getCurrentMaxSplit",value:function(){if(this.specialLayoutType){var e=0;return this.specialLayoutType===Oe?e=9:this.specialLayoutType===Fe&&(e=16),e}return this._opt.split*this._opt.split}},{key:"_getSpecialMaxSplit",value:function(){var e=0;return this.specialLayoutType===Oe?e=6:this.specialLayoutType===Fe&&(e=8),e}},{key:"getSelectedWindowIndex",value:function(){return this.currentWindowIndex}},{key:"_findWindowItemIndex",value:function(e){return this.windowList.findIndex((function(t){return t.uuid===e.uuid}))}}]),r}(e);Un.MULTI_EVENTS=Me,Un.EVENTS=z,Un.ERROR=V,window.JessibucaProMulti=Un}))}).call(this,i("c8ba"),i("4362"))}}]);