!function(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)r.d(n,a,function(t){return e[t]}.bind(null,a));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=4)}([function(e,t,r){"use strict";var n=r(1);Object.defineProperty(t,"__esModule",{value:!0}),t.BrowserDetect=function(){var e=navigator.userAgent.toLowerCase(),t=navigator.appName,r=null;"Microsoft Internet Explorer"===t||e.indexOf("trident")>-1||e.indexOf("edge/")>-1?(r="ie","Microsoft Internet Explorer"===t?(e=/msie ([0-9]{1,}[\.0-9]{0,})/.exec(e),r+=parseInt(e[1])):e.indexOf("trident")>-1?r+=11:e.indexOf("edge/")>-1&&(r="edge")):e.indexOf("safari")>-1?r=e.indexOf("chrome")>-1?"chrome":"safari":e.indexOf("firefox")>-1&&(r="firefox");return r},t.CommonAudioUtil=function(){var e=[1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384],t=function(e,t,r){var n=0,a=0;for(n=0;n0?r:8191&-r,e,15)-6,o=i+(n>>6&15)-13,u=(0===a?32:i>=0?a>>i:a<<-i)*(n&parseInt("077",8))+48>>4,s=o>=0?u<>-o,(r^n)<0?-s:s};this.g726InitState=function(){var e={},t=0;for(e.pp=new Array(2),e.zp=new Array(6),e.pk=new Array(2),e.dq=new Array(6),e.sr=new Array(2),e.yl=34816,e.yu=544,e.dms=0,e.dml=0,e.ppp=0,t=0;t<2;t++)e.pp[t]=0,e.pk[t]=0,e.sr[t]=32;for(t=0;t<6;t++)e.zp[t]=0,e.dq[t]=32;return e.td=0,e},this.predictorZero=function(e){var t=0,n=0;for(n=r(e.zp[0]>>2,e.dq[0]),t=1;t<6;t++)n+=r(e.zp[t]>>2,e.dq[t]);return n},this.predictorPole=function(e){return r(e.pp[1]>>2,e.sr[1])+r(e.pp[0]>>2,e.sr[0])},this.stepSize=function(e){var t=0,r=0,n=0;return e.ppp>=256?e.yu:(t=e.yl>>6,r=e.yu-t,n=e.ppp>>2,r>0?t+=r*n>>6:r<0&&(t+=r*n+63>>6),t)},this.quantize=function(r,n,a,i){var o=0,u=0,s=0;return o=Math.abs(r),u=t(o>>1,e,15),s=t((u<<7)+(o<<7>>u&127)-(n>>2),a,i),r<0?1+(i<<1)-s:0===s?1+(i<<1):s},this.reconstruct=function(e,t,r){var n=0,a=0;return(n=t+(r>>2))<0?e?-32768:0:(a=128+(127&n)<<7>>14-(n>>7&15),e?a-32768:a)},this.update=function(r,n,a,i,o,u,s,f){var l=0,c=0,p=0,d=0,m=0,_=0,h=0,g=0,v=0,y=0,b=0,D=0,S=0,w=0;if(w=s<0?1:0,c=32767&o,v=f.yl>>15,D=f.yl>>10&31,S=32+D<9?31744:S)+(y>>1)>>1,g=0===f.td?0:c<=b?0:1,f.yu=n+(a-n>>5),f.yu<544?f.yu=544:f.yu>5120&&(f.yu=5120),f.yl+=f.yu+(-f.yl>>6),1===g)f.pp[0]=0,f.pp[1]=0,f.zp[0]=0,f.zp[1]=0,f.zp[2]=0,f.zp[3]=0,f.zp[4]=0,f.zp[5]=0,d=0;else for(_=w^f.pk[0],d=f.pp[1]-(f.pp[1]>>7),0!==s&&((h=_?f.pp[0]:-f.pp[0])<-8191?d-=256:d+=h>8191?255:h>>5,w^f.pk[1]?d<=-12160?d=-12288:d>=12416?d=12288:d-=128:d<=-12416?d=-12288:d>=12160?d=12288:d+=128),f.pp[1]=d,f.pp[0]-=f.pp[0]>>8,0!==s&&(0===_?f.pp[0]+=192:f.pp[0]-=192),m=15360-d,f.pp[0]<-m?f.pp[0]=-m:f.pp[0]>m&&(f.pp[0]=m),l=0;l<6;l++)f.zp[l]-=5===r?f.zp[l]>>9:f.zp[l]>>8,32767&o&&((o^f.dq[l])>=0?f.zp[l]+=128:f.zp[l]-=128);for(l=5;l>0;l--)f.dq[l]=f.dq[l-1];return 0===c?f.dq[0]=o>=0?32:64544:(p=t(c,e,15),f.dq[0]=o>=0?(p<<6)+(c<<6>>p):(p<<6)+(c<<6>>p)-1024),f.sr[1]=f.sr[0],0===u?f.sr[0]=32:u>0?(p=t(u,e,15),f.sr[0]=(p<<6)+(u<<6>>p)):u>-32768?(p=t(c=-u,e,15),f.sr[0]=(p<<6)+(c<<6>>p)-1024):f.sr[0]=64544,f.pk[1]=f.pk[0],f.pk[0]=w,f.td=1===g?0:d<-11776?1:0,f.dms+=i-f.dms>>5,f.dml+=(i<<2)-f.dml>>7,1===g?f.ppp=256:n<1536?f.ppp+=512-f.ppp>>4:1===f.td?f.ppp+=512-f.ppp>>4:Math.abs((f.dms<<2)-f.dml)>=f.dml>>3?f.ppp+=512-f.ppp>>4:f.ppp+=-f.ppp>>4,f}},t.Texture=t.Shader=t.Script=t.Queue=t.Program=void 0,t.VideoBufferList=function(){var e=0,t=0,r=null;function n(){e=360,t=240,r=null,this._length=0,this.head=null,this.tail=null,this.curIdx=0}return n.prototype={push:function(e,n,a,i,o,u){var s=new VideoBufferNode(e,n,a,i,o,u);return this._length>0?(this.tail.next=s,s.previous=this.tail,this.tail=s):(this.head=s,this.tail=s),this._length+=1,null!==r&&this._length>=t&&r(),s},pop:function(){var e=null;return this._length>1&&(e=this.head,this.head=this.head.next,null!==this.head?this.head.previous=null:this.tail=null,this._length-=1),e},setMaxLength:function(t){(e=t)>360?e=360:e<30&&(e=30)},setBUFFERING:function(e){(t=e)>240?t=240:t<6&&(t=6)},setBufferFullCallback:function(e){r=e},searchTimestamp:function(e){var t=this.head,r=this._length,n=1;if(0===r||e<=0||null===t)throw new Error("Failure: non-existent node in this list.");for(;null!==t&&(t.timeStamp.timestamp!==e.timestamp||t.timeStamp.timestamp_usec!==e.timestamp_usec);)t=t.next,n++;return r0&&(T("mediaSample",t.mediaSample),T("videoRender",t.frameData))}else T("drop",e.decodedData);null!=e.resolution&&T("MSEResolutionChanged",e.resolution),null!=e.ivsDraw&&T("ivsDraw",e)}function T(e,t,r){var n={type:e,data:t,channelId:b,option:r};"canvasRender"===e?postMessage(n,[t.buffer]):postMessage(n)}},function(e,t,r){"use strict";var n=r(1);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=r(0),i=n(r(11)),o=n(r(12)),u=n(r(3));function s(){var e=7,t=7,r=2,n=3,a=4,i=5,o=8,s=16,f=32,l=255,c=0,p=null;function d(){c=0,p=new u.default}function m(r,a){var i=a,o=c+i>>n;return i=c+a&e,r[o]>>t-(i&t)&1}function _(e,t){var r=c>>n,a=8*(r+1)-c;if(a<8)for(var i=0;i<3;i++){var o=e[r+i];o=0==i?o>>a<>8-a|1<=0;o--,i++)a|=m(e,i)<921600&&!1===r?(n="video",L&&k>0&&k<=3&&(n="canvas")):n="canvas",n}function R(){this.decoder=new i.default,this.firstDiffTime=0,this.firstTime=0,this.lastMSW=0}return R.prototype={setReturnCallback:function(e){this.rtpReturnCallback=e},setBufferfullCallback:function(e){null!==this.videoBufferList&&this.videoBufferList.setBufferFullCallback(e)},getVideoBuffer:function(e){if(null!==this.videoBufferList)return this.videoBufferList.searchNodeAt(e)},clearBuffer:function(){null!==this.videoBufferList&&this.videoBufferList.clear()},findCurrent:function(){null!==this.videoBufferList&&this.videoBufferList.searchTimestamp(this.getTimeStamp())},setTimeStamp:function(e){this.timeData=e},getTimeStamp:function(){return this.timeData},ntohl:function(e){return(e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3]>>>0},appendBuffer:function(e,t,r){if(r+t.length>=e.length){var n=new Uint8Array(e.length+1048576);n.set(e,0),e=n}return e.set(t,r),e},getFramerate:function(){return k},setGovLength:function(e){F=e},getGovLength:function(){return F},setDecodingTime:function(e){this.decodingTime=e},getDropPercent:function(){return 0},getDropCount:function(){return 0},initStartTime:function(){this.firstDiffTime=0,this.calcGov=0},setCheckDelay:function(e){this.checkDelay=e},init:function(e){y=!1,r=!1,A=e,this.decoder.setIsFirstFrame(!1),this.videoBufferList=new a.VideoBufferList,this.firstDiffTime=0,this.checkDelay=!0,this.timeData=null},setFramerate:function(e){0>>0;R=N>>26===0?"2000":"20"+(N>>26);var H=Date.UTC(R,(N>>22&15)-1,N>>17&31,N>>12&31,N>>6&63,63&N)/1e3;if(L.timeStampmsw,H+=(new Date).getTimezoneOffset()/60*3600,A||253!==s[4]||(U=0!==s[5],A=B(L.width,L.height,U)),""!==A){if(0==this.firstTime)this.firstTime=H,this.lastMSW=0,I=(s[21]<<8)+s[20],_={timestamp:this.firstTime,timestamp_usec:0};else{var G,V=(s[21]<<8)+s[20];G=V>I?V-I:V+65535-I,this.lastMSW+=G,H>this.firstTime&&(this.lastMSW-=1e3),this.firstTime=H,_={timestamp:H,timestamp_usec:this.lastMSW},I=V}0!==this.getFramerate()&&"undefined"!==typeof this.getFramerate()||"undefined"===typeof this.getTimeStamp()||(this.setFramerate(Math.round(1e3/((_.timestamp-this.getTimeStamp().timestamp===0?0:1e3)+(_.timestamp_usec-this.getTimeStamp().timestamp_usec)))),a.debug.log("setFramerate"+Math.round(1e3/((_.timestamp-this.getTimeStamp().timestamp===0?0:1e3)+(_.timestamp_usec-this.getTimeStamp().timestamp_usec))))),this.setTimeStamp(_);for(var W=s[22],X=s.subarray(24+W,s.length-8),q=s.subarray(s.length-8,s.length),J=(q[7],q[6],q[5],q[4],[]),Y=0;Y<=X.length;)if(0==X[Y])if(0==X[Y+1])if(1==X[Y+2]){if(J.push(Y),5==(31&X[Y+=3])||1==(31&X[Y]))break}else 0==X[Y+2]?Y++:Y+=3;else Y+=2;else Y+=1;var Z="P";e=(s[21]<<8)+s[20];var K=0;for(Y=0;Y8e3&&(j.error={errorCode:101},this.rtpReturnCallback(j))),x=$,t!==u&&(this.decoder.free(),t=u,this.decoder.setOutputSize(t)),!0===p&&"P"===Z)return;!0===p&&(p=!1),"I"===Z&&d<2&&d++,m.frameData=null,!0===F&&!0===r||(m.frameData=this.decoder.decode(s)),m.timeStamp=null,_=null===_.timestamp?this.getTimeStamp():_,m.timeStamp=_}else{var ee=null;if(y?m.initSegmentData=null:(y=!0,L={id:1,width:D,height:S,type:"video",profileIdc:n.getSpsValue("profile_idc"),profileCompatibility:0,levelIdc:n.getSpsValue("level_idc"),sps:[g],pps:[v],timescale:1e3,fps:this.getFramerate()},a.debug.log(JSON.stringify(L)),m.initSegmentData=o.default.initSegment(L),m.codecInfo=n.getCodecInfo()),K||a.debug.log("11111111111111111111111111111111111111111"),"I"===Z){var te=K;ee=X.subarray(te,X.length)}else ee=X.subarray(K,X.length);var re=ee.length-4;ee[0]=(4278190080&re)>>>24,ee[1]=(16711680&re)>>>16,ee[2]=(65280&re)>>>8,ee[3]=255&re;var ne=this.getFramerate(),ae={duration:Math.round(1/ne*1e3),size:ee.length,frame_time_stamp:null,frameDuration:null};if(r)ae.frame_time_stamp=e,m.frameData=new Uint8Array(ee),m.mediaSample=ae;else{if(!1===F){if(ae.frame_time_stamp=1e3*_.timestamp+_.timestamp_usec-E,!1===b)ae.frame_time_stamp=0,E=1e3*_.timestamp+_.timestamp_usec,ae.frameDuration=0,h=ae,b=!0;else{var ie=h.frame_time_stamp,oe=ae.frame_time_stamp;ae.frameDuration=Math.abs(oe-ie),ae.frameDuration>3e3&&(ae.frameDuration=0),h=ae}m.frameData=new Uint8Array(ee),m.mediaSample=ae}_=null===_.timestamp?this.getTimeStamp():_,m.timeStamp=_}}var ue=w*T;if(!0===r&&(NaN.toFixed(0),ue>786432?(O("video"),j.decodeMode="video"):(O("canvas"),j.decodeMode="canvas")),m.playback=r,m.frameData.frameIndex=L.frameIndex,j.decodedData=m,!0===C)return"I"===Z&&M++,2===M&&(M=0,C=!1),void a.debug.info("H264Session::stop");this.rtpReturnCallback(j)}},findIFrame:function(){if(null!==this.videoBufferList){var e=this.videoBufferList.findIFrame();if(null===e||"undefined"===typeof e)return!1;var t={};return this.setTimeStamp(e.timeStamp),t.frameData=this.decoder.decode(e.buffer),t.timeStamp=e.timeStamp,t}},setInitSegment:function(){y=!1,f=null,l=null},setLessRate:function(e){L=e}},new R}},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){var n=r(8);function a(e,t){for(var r=0;r>>0).toString(16);return"00000000".substr(0,8-t.length)+t}function r(e,t,r){return e&t|~e&r}function n(e,t,r){return r&e|~r&t}function i(e,t,r){return e^t^r}function o(e,t,r){return t^(e|~r)}function u(e,t){return e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t]}function s(e){for(var t=[],r=0;r>>32-i),h=o}var a=l.length;l.push(128);var s=l.length%64;if(s>56){for(var f=0;f<64-s;f++)l.push(0);s=l.length%64}for(f=0;f<56-s;f++)l.push(0);l=l.concat(function(e){for(var t=[],r=0;r<8;r++)t.push(255&e),e>>>=8;return t}(8*a));var c=1732584193,d=4023233417,m=2562383102,_=271733878,h=0,g=0,v=0,y=0;for(f=0;f=0;s--)o=255&(u=arguments[s]),o<<=8,o|=255&(u>>>=8),o<<=8,o|=255&(u>>>=8),o<<=8,i+=t(o|=u>>>=8);return i}(_,m,d,c).toUpperCase()}()};t.default=function(e){return i.MD5(e)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=r(0);t.default=function(){var e,t,r,a,i,o,u,s,f,l,c,p,d,m,_,h=!1,g=0;function v(){v.prototype.setIsFirstFrame(!1)}return v.prototype={init:function(){n.debug.log("H264 Decoder init")},setOutputSize:function(e){if(i!==2*e){i=2*e;var t=Module._malloc(1),r=new Uint8Array(Module.HEAPU8.buffer,t,1);Module._DECODE_GetFreePort(r.byteOffset),g=r[0],r=null,Module._free(t),Module._DECODE_Init(g),o=Module._malloc(5242880),u=new Uint8Array(Module.HEAPU8.buffer,o,5242880);var n=2*e;s=Module._malloc(n),f=new Uint8Array(Module.HEAPU8.buffer,s,n),l=Module._malloc(4),c=new Uint8Array(Module.HEAPU8.buffer,l,4),p=Module._malloc(40),d=new Uint8Array(Module.HEAPU8.buffer,p,40)}},decode:function(n,i){e=Date.now(),u.set(n),Module._DECODE_InputOneFrame(g,u.byteOffset,n.length,f.byteOffset,c.byteOffset,d.byteOffset),a=d[16]+(d[17]<<8),r=d[18]+(d[19]<<8);var o=a*r*3/2;return _=null,m=null,_=new ArrayBuffer(o),(m=new Uint8Array(_)).set(Module.HEAPU8.subarray(f.byteOffset,f.byteOffset+o)),t=Date.now()-e,v.prototype.isFirstFrame()?a>0&&r>0?(e=Date.now(),{data:m,option:{ylen:a,height:r,beforeDecoding:e},width:a,height:r,codecType:"h264",decodingTime:t,frameType:i}):void 0:(v.prototype.setIsFirstFrame(!0),{firstFrame:!0})},setIsFirstFrame:function(e){h=e},isFirstFrame:function(){return h},free:function(){Module._DECODE_Stop(g),u=null,Module._free(o),f=null,Module._free(s),c=null,Module._free(l),d=null,Module._free(p),_=null,m=null}},new v}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=r(0);t.default=new function(){var e=[],t={};function r(){for(var r in e)e[r]=[r.charCodeAt(0),r.charCodeAt(1),r.charCodeAt(2),r.charCodeAt(3)];t.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),t.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),t.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),t.STSC=t.STCO=t.STTS,t.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),t.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]),t.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]),t.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),t.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),t.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}e={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var a=function(e){for(var t=8,r=Array.prototype.slice.call(arguments,1),n=0;n>>24&255,a[i++]=t>>>16&255,a[i++]=t>>>8&255,a[i++]=255&t,a.set(e,i),i+=4,n=0;n>8,255&t.channelcount,(65280&t.samplesize)>>8,255&t.samplesize,0,0,0,0,(65280&t.samplerate)>>8,255&t.samplerate,0,0]),function(t){var r=t.config,n=r.length,i=new Uint8Array([0,0,0,0,3,23+n,0,1,0,4,15+n,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([n]).concat(r).concat([6,1,2]));return a(e.esds,i)}(t))},o=function(r){return"audio"===r.type?a(e.stsd,t.STSD_PREFIX,i(r)):a(e.stsd,t.STSD_PREFIX,function(t){var r=t.sps||[],n=t.pps||[],i=[],o=[],u=0;for(u=0;u>>8),i.push(255&r[u].byteLength),i=i.concat(Array.prototype.slice.call(r[u]));for(u=0;u>>8),o.push(255&n[u].byteLength),o=o.concat(Array.prototype.slice.call(n[u]));return a(e.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,(65280&t.width)>>8,255&t.width,(65280&t.height)>>8,255&t.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,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,17,17]),a(e.avcC,new Uint8Array([1,t.profileIdc,t.profileCompatibility,t.levelIdc,255].concat([r.length]).concat(i).concat([n.length]).concat(o))))}(r))},u=function(r){var n=null;return n="audio"===r.type?a(e.smhd,t.SMHD):a(e.vmhd,t.VMHD),a(e.minf,n,a(e.dinf,a(e.dref,t.DREF)),function(r){return a(e.stbl,o(r),a(e.stts,t.STTS),a(e.stsc,t.STSC),a(e.stsz,t.STSZ),a(e.stco,t.STCO))}(r))},s=function(r){return a(e.mdia,function(t){var r=t.timescale,n=t.duration;return a(e.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,n>>>24&255,n>>>16&255,n>>>8&255,255&n,85,196,0,0]))}(r),function(r){var n=null;return n="audio"===r.type?t.HDLR_AUDIO:t.HDLR_VIDEO,a(e.hdlr,n)}(r),u(r))},f=function(t){return a(e.trak,function(t){var r=t.id,n=t.duration,i=t.width,o=t.height;return a(e.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,0,0,0,0,n>>>24&255,n>>>16&255,n>>>8&255,255&n,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,i>>>8&255,255&i,0,0,o>>>8&255,255&o,0,0]))}(t),s(t))},l=function(t){return a(e.mvex,function(t){var r=t.id,n=new Uint8Array([0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return a(e.trex,n)}(t))},c=function(t){var r,i,o=(r=t.timescale,i=t.duration,n.debug.log("mvhd: timescale: "+r+" duration: "+i),a(e.mvhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,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]))),u=f(t),s=l(t);return a(e.moov,o,u,s)},p=function(t,r){return"audio"===t.type?audioTrun(t,r):function(t,r){var n,i=null,o=null,u=0,s=r;if(null===(n=t.samples||[])[0].frameDuration)for(s+=24+4*n.length,i=trunHeader(n,s),u=0;u>>24,(16711680&o.size)>>>16,(65280&o.size)>>>8,255&o.size]);else for(i=function(e,t){return[0,0,3,5,(4278190080&e.length)>>>24,(16711680&e.length)>>>16,(65280&e.length)>>>8,255&e.length,(4278190080&t)>>>24,(16711680&t)>>>16,(65280&t)>>>8,255&t,0,0,0,0]}(n,s+=24+4*n.length+4*n.length),u=0;u>>24,(16711680&o.frameDuration)>>>16,(65280&o.frameDuration)>>>8,255&o.frameDuration,(4278190080&o.size)>>>24,(16711680&o.size)>>>16,(65280&o.size)>>>8,255&o.size]);return a(e.trun,new Uint8Array(i))}(t,r)},d=function(t,r){return a(e.moof,function(t){var r=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t]);return a(e.mfhd,r)}(t),function(t){var r,n,i;return r=a(e.tfhd,new Uint8Array([0,2,0,0,0,0,0,1])),n=a(e.tfdt,new Uint8Array([0,0,0,0,t.baseMediaDecodeTime>>>24&255,t.baseMediaDecodeTime>>>16&255,t.baseMediaDecodeTime>>>8&255,255&t.baseMediaDecodeTime])),i=p(t,72),a(e.traf,r,n,i)}(r))};return r.prototype={initSegment:function(r){var i=a(e.ftyp,t.FTYP);n.debug.log(r);var o=c(r),u=new Uint8Array(i.byteLength+o.byteLength);return u.set(i,0),u.set(o,i.byteLength),u},mediaSegment:function(t,r,n,i){var o=d(t,r),u=function(t){return a(e.mdat,t)}(n),s=null;return(s=new Uint8Array(o.byteLength+u.byteLength)).set(o),s.set(u,o.byteLength),s}},new r}},function(e,t,r){"use strict";var n=r(1);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=r(0),i=n(r(14)),o=n(r(3));function u(){var e=null,t=null,r=0,n=0,a=0,i=0,u=0;function s(){0,e=new o.default}function f(){return 0==a&&(i=function(){if(n>=r)return 0;var e=t[n++];return 0==e?(u++,n>--a&1}function l(e,t){for(var r=0;t>0;)r<<=1,r|=f(),t--;return r}function c(e,t){for(var a=0;n=1&&i<=5||n[1]||n[2]||n[3]||n[4]||n[5]||n[9]?e.put("general_inbld_flag",l(0,1)):e.put("general_reserved_zero_bit",l(0,1))}e.put("general_level_idc",l(0,8));var o=new Array(r),u=new Array(r);for(_=0;_0)for(var _=r;_<8;_++)s[_]=l(0,2);for(_=0;_=1&&f[_]<=5||9==f[_]||d[1]||d[2]||d[3]||d[4]||d[5]||d[9]?e.put("sub_layer_inbld_flag",l(0,1)):e.put("sub_layer_reserved_zero_bit",l(0,1))}u[_]&&e.put("sub_layer_level_idc",l(0,8))}}(1,e.get("sps_max_sub_layers_minus1"))),l(0,84),e.put("sps_seq_parameter_set_id",c()),r?(e.put("update_rep_format_flag",l(0,1)),e.get("update_rep_format_flag")&&e.put("sps_rep_format_idx",l(0,8))):(e.put("chroma_format_idc",c()),3===e.get("chroma_format_idc")&&e.put("separate_colour_plane_flag",l(0,1)),e.put("pic_width_in_luma_samples",c()),e.put("pic_height_in_luma_samples",c()),e.put("conformance_window_flag",l(0,1)),e.get("conformance_window_flag")&&(e.put("conf_win_left_offset",c()),e.put("conf_win_right_offset",c()),e.put("conf_win_top_offset",c()),e.put("conf_win_bottom_offset",c()))),!0},parse2:function(o){var s=o.length;if(o,t=o,r=o.length,n=0,a=0,i=0,u=0,0,e.clear(),s<20)return!1;l(0,16),l(0,4);var f=l(0,3);if(e.put("sps_max_sub_layers_minus1",f),f>6)return!1;l(0,1),l(0,2),l(0,1);l(0,5);l(0,32),l(0,1),l(0,1),l(0,1),l(0,1),l(0,43),l(0,1),e.put("general_level_idc",l(0,8));for(var p=[],d=[],m=0;m0)for(m=f;m<8;m++)l(0,2);for(m=0;m15)return!1;var h=c();return e.put("chroma_format_idc",h),!(_>3)&&(3==h&&l(0,1),e.put("pic_width_in_luma_samples",c()),e.put("pic_height_in_luma_samples",c()),l(0,1)&&(c(),c(),c(),c()),c()==c())},getSizeInfo:function(){var t=e.get("pic_width_in_luma_samples"),r=e.get("pic_height_in_luma_samples");if(e.get("conformance_window_flag")){var n=e.get("chroma_format_idc"),a=e.get("separate_colour_plane_flag");"undefined"===typeof a&&(a=0);var i=1!==n&&2!==n||0!==a?1:2,o=1===n&&0===a?2:1;t-=i*e.get("conf_win_right_offset")+i*e.get("conf_win_left_offset"),r-=o*e.get("conf_win_bottom_offset")+o*e.get("conf_win_top_offset")}return{width:t,height:r,decodeSize:t*r}},getSpsValue:function(t){return e.get(t)}},new s}t.default=function(){var e,t=0,r=0,n=0,o=0,s=new u,f={frameData:null,timeStamp:null},l={timestamp:null,timezone:null},c=0,p=0,d=null,m=0,_={width:0,height:0},h=0,g=0;function v(){this.decoder=(0,i.default)(),this.firstTime=0,this.lastMSW=0}return v.prototype={setReturnCallback:function(e){this.rtpReturnCallback=e},setBufferfullCallback:function(e){null!==this.videoBufferList&&this.videoBufferList.setBufferFullCallback(e)},getVideoBuffer:function(e){if(null!==this.videoBufferList)return this.videoBufferList.searchNodeAt(e)},clearBuffer:function(){null!==this.videoBufferList&&this.videoBufferList.clear()},findCurrent:function(){null!==this.videoBufferList&&this.videoBufferList.searchTimestamp(this.getTimeStamp())},ntohl:function(e){return(e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3]>>>0},appendBuffer:function(e,t,r){if(r+t.length>=e.length){var n=new Uint8Array(e.length+1048576);n.set(e,0),e=n}return e.set(t,r),e},setGovLength:function(e){d=e},getGovLength:function(){return d},setDecodingTime:function(e){this.decodingTime=e},getDropPercent:function(){return 0},getDropCount:function(){return 0},initStartTime:function(){this.firstDiffTime=0,this.calcGov=0},setCheckDelay:function(e){this.checkDelay=e},init:function(){this.decoder.setIsFirstFrame(!1),this.videoBufferList=new a.VideoBufferList,this.firstDiffTime=0,this.checkDelay=!0,this.timeData=null},parseRTPData:function(i,u,d,m,v){var y,b=null,D={},S=(u[19]<<24)+(u[18]<<16)+(u[17]<<8)+u[16]>>>0;y=S>>>26===0?"2000":"20"+(S>>>26);var w=Date.UTC(y,(S>>>22&15)-1,S>>>17&31,S>>>12&31,S>>>6&63,63&S)/1e3;if(w+=(new Date).getTimezoneOffset()/60*3600,0===this.firstTime)this.firstTime=w,this.lastMSW=0,r=(u[21]<<8)+u[20],l={timestamp:this.firstTime,timestamp_usec:0};else{var T,C=(u[21]<<8)+u[20];T=C>r?C-r:C+65535-r,this.lastMSW+=T,w>this.firstTime&&(this.lastMSW-=1e3),this.firstTime=w,l={timestamp:w,timestamp_usec:this.lastMSW},r=C}0!==this.getFramerate()&&"undefined"!==typeof this.getFramerate()||"undefined"===typeof this.getTimeStamp()||(this.setFramerate(Math.round(1e3/((l.timestamp-this.getTimeStamp().timestamp===0?0:1e3)+(l.timestamp_usec-this.getTimeStamp().timestamp_usec)))),a.debug.log("setFramerate"+Math.round(1e3/((l.timestamp-this.getTimeStamp().timestamp===0?0:1e3)+(l.timestamp_usec-this.getTimeStamp().timestamp_usec))))),this.setTimeStamp(l);var M=u[22];e=u.subarray(24+M,u.length-8),t=(u[21]<<8)+u[20];for(var x=[],I=0;I<=e.length;)if(0==e[I])if(0==e[I+1])if(1==e[I+2]){if(x.push(I),5==(31&e[I+=3])||1==(31&e[I]))break}else 0==e[I+2]?I++:I+=3;else I+=2;else I+=1;var A="P";for(I=0;I>1&63){default:break;case 33:A="I",s.parse2(b);var F=v;o=s.getSizeInfo().decodeSize,c=F.width,p=F.height,_.width==F.width&&_.height==F.height||(0!=_.width?(_.width=F.width,_.height=F.height,D.resolution=_,D.resolution.decodeMode="canvas",D.resolution.encodeMode="h265"):(_.width=F.width,_.height=F.height,D.decodeStart=_,D.decodeStart.decodeMode="canvas",D.decodeStart.encodeMode="h265"))}var k=1e3*l.timestamp+l.timestamp_usec;0==this.firstDiffTime?(h=0,this.firstDiffTime=Date.now()-k,a.debug.log("firstDiff: 0")):(k-g<0&&(this.firstDiffTime=h+(Date.now()-k).toFixed(0)),(h=Date.now()-k-this.firstDiffTime)<0&&(this.firstDiffTime=0,h=0),h>8e3&&(D.error={errorCode:101},this.rtpReturnCallback(D))),g=k,f.frameData=null,n!==o&&(this.decoder.free(),n=o,this.decoder.setOutputSize(n)),f.frameData=this.decoder.decode(u),f.frameData.frameType=A,f.frameData.frameIndex=v.frameIndex,f.timeStamp=null,l=null===l.timestamp?this.getTimeStamp():l,f.timeStamp=l,d&&(D.backupData={stream:e,frameType:A,width:c,height:p,codecType:"h265"},null!==l.timestamp&&"undefined"!==typeof l.timestamp?D.backupData.timestamp_usec=l.timestamp_usec:D.backupData.timestamp=(t/90).toFixed(0)),D.decodedData=f,this.rtpReturnCallback(D)},findIFrame:function(){if(null!==this.videoBufferList){var e=this.videoBufferList.findIFrame();if(null===e||"undefined"===typeof e)return!1;var t={};return this.setTimeStamp(e.timeStamp),t.frameData=this.decoder.decode(e.buffer),t.timeStamp=e.timeStamp,t}},getFramerate:function(){return m},setFramerate:function(e){00&&r>0?(e=Date.now(),{data:m,option:{ylen:a,height:r,beforeDecoding:e},width:a,height:r,codecType:"h265",decodingTime:t,frameType:i}):void 0:(v.prototype.setIsFirstFrame(!0),{firstFrame:!0})},setIsFirstFrame:function(e){h=e},isFirstFrame:function(){return h},free:function(){Module._DECODE_Stop(g),u=null,Module._free(o),f=null,Module._free(s),c=null,Module._free(l),d=null,Module._free(p),_=null,m=null}},new v}},function(e,t,r){"use strict";var n=r(1);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=r(0),i=n(r(16));t.default=function(){var e=0,t=0,r={frameData:null,timeStamp:null},n={timestamp:null,timezone:null};var o=0,u=0,s=0,f=0,l=null,c=null,p=null,d=0,m=0,_=0,h={width:0,height:0};function g(){this.decoder=new i.default,this.firstTime=0,this.lastMSW=0}return g.prototype={init:function(){this.decoder.setIsFirstFrame(!1),this.videoBufferList=new a.VideoBufferList,this.timeData=null},parseRTPData:function(i,p,d,g,v){var y,b=new Uint8Array(1048576);e=v.width,t=v.height,l={};var D=p[22],S=p.subarray(24+D,p.length-8);c=S.length;var w=(p[19]<<24)+(p[18]<<16)+(p[17]<<8)+p[16]>>>0;y=w>>26===0?"2000":"20"+(w>>26);var T=Date.UTC(y,(w>>22&15)-1,w>>17&31,w>>12&31,w>>6&63,63&w)/1e3;if(T-=28800,0===this.firstTime)this.firstTime=T,this.lastMSW=0,f=(p[21]<<8)+p[20],n={timestamp:this.firstTime,timestamp_usec:0};else{var C,M=(p[21]<<8)+p[20];C=M>f?M-f:M+65535-f,this.lastMSW+=C,T>this.firstTime&&(this.lastMSW-=1e3),this.firstTime=T,n={timestamp:T,timestamp_usec:this.lastMSW},f=M}0!==this.getFramerate()&&"undefined"!==typeof this.getFramerate()||"undefined"===typeof this.getTimeStamp()||this.setFramerate(Math.round(1e3/((n.timestamp-this.getTimeStamp().timestamp===0?0:1e3)+(n.timestamp_usec-this.getTimeStamp().timestamp_usec)))),this.setTimeStamp(n),s=(p[21]<<8)+p[20],u=c,(b=this.appendBuffer(b,S,o))[(o+=c)+u-2]=255,b[o+u-1]=217,h.width==e&&h.height==t||(0!=h.width?(h.width=e,h.height=t,l.resolution=h,l.resolution.decodeMode="canvas",l.resolution.encodeMode="mjpeg"):(h.width=e,h.height=t,l.decodeStart=h,l.decodeStart.decodeMode="canvas",l.decodeStart.encodeMode="mjpeg"));var x=1e3*n.timestamp+n.timestamp_usec;0==this.firstDiffTime?(m=0,this.firstDiffTime=Date.now()-x,a.debug.log("firstDiff: "+this.firstTime)):(x-_<0&&(this.firstDiffTime=m+(Date.now()-x).toFixed(0)),(m=Date.now()-x-this.firstDiffTime)<0&&(this.firstDiffTime=0,m=0),m>8e3&&(l.error={errorCode:101},this.rtpReturnCallback(l))),_=x,r.frameData=null,this.decoder.setResolution(e,t),r.frameData=this.decoder.decode(b.subarray(0,o)),r.timeStamp=null,n=null===n.timestamp?this.getTimeStamp():n,r.timeStamp=n,!0===d&&(l.backupData={stream:b.subarray(0,o),width:e,height:t,codecType:"mjpeg"},null!==n.timestamp&&"undefined"!==typeof n.timestamp?l.backupData.timestamp_usec=n.timestamp_usec:l.backupData.timestamp=(s/90).toFixed(0)),o=0,r.playback=!1,l.decodedData=r,this.rtpReturnCallback(l)},getVideoBuffer:function(e){if(null!==this.videoBufferList)return this.videoBufferList.searchNodeAt(e)},clearBuffer:function(){null!==this.videoBufferList&&this.videoBufferList.clear()},findCurrent:function(){null!==this.videoBufferList&&this.videoBufferList.searchTimestamp(this.getTimeStamp())},findIFrame:function(){null!==this.videoBufferList&&this.videoBufferList.findIFrame()},SetRtpInterlevedID:function(e){this.interleavedID=e},setTimeStamp:function(e){this.timeData=e},getTimeStamp:function(){return this.timeData},getRTPPacket:function(e,t){},calculatePacketTime:function(e){},ntohl:function(e){return(e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3]>>>0},appendBuffer:function(e,t,r){if(r+t.length>=e.length){var n=new Uint8Array(e.length+1048576);n.set(e,0),e=n}return e.set(t,r),e},setFramerate:function(e){00&&(s.fatherId=[]);for(var c=0;c0&&(s.track=[]);for(var p=0;p>2&3,r.coSafetyBelt=3&e[n],n+=1,r.mainSunvisor=e[n]>>2&3,r.coSunvisor=3&e[n],n+=1,t.attribute81.push(r),a}function _(e,t){t.hasOwnProperty("attribute82")||(t.attribute82=[]);var r={},n=1,a=e[n];return n+=1,r.plateEncode=e[n],n+=1,r.plateInfoLen=e[n],n+=1,r.plateInfo=e.subarray(n,n+r.plateInfoLen),t.attribute82.push(r),a}function h(e,t){t.hasOwnProperty("attribute83")||(t.attribute83=[]);var r={},n=1,a=e[n];return n+=1,r.color={},r.color.valid=e[n],n+=1,r.color.red=e[n],n+=1,r.color.green=e[n],n+=1,r.color.blue=e[n],n+=1,r.color.alpha=e[n],n+=1,r.country=String.fromCharCode.apply(null,e.subarray(n,n+4)),n+=4,r.plateType=(e[n+1]<<8)+e[n],n+=2,n+=1,r.plateWidth=(e[n+1]<<8)+e[n],t.attribute83.push(r),a}function g(e,t){t.hasOwnProperty("attribute84")||(t.attribute84=[]);var r={},n=1,a=e[n];n+=1,r.fatherCount=e[n],n+=1,r.trackCount=e[n],n+=1,r.trackType=e[n],n+=1,n+=3,r.fatherCount>0&&(r.fatherID=[]);for(var i=0;i0&&(r.track=[]);for(var o=0;o0&&(r.mainColorInfo=[]);for(var i=0;i>2&3,r.beard=3&e[n],t.attribute88.push(r),a}function S(e,t){t.hasOwnProperty("attribute89")||(t.attribute89=[]);var r={},n=1,a=e[n];n+=1,r.yawAngle=parseInt((e[n+1]<<8)+e[n]),n+=2,r.rollAngle=parseInt((e[n+1]<<8)+e[n]),n+=2,r.pitchAngle=parseInt((e[n+1]<<8)+e[n]);var i=(e[(n+=2)+1]<<8)+e[n],o=(e[(n+=2)+1]<<8)+e[n];n+=2,r.lEyePos=[i,o],i=(e[n+1]<<8)+e[n],o=(e[(n+=2)+1]<<8)+e[n],n+=2,r.rEyePos=[i,o],i=(e[n+1]<<8)+e[n],o=(e[(n+=2)+1]<<8)+e[n],n+=2,r.nosePos=[i,o],i=(e[n+1]<<8)+e[n],o=(e[(n+=2)+1]<<8)+e[n],n+=2,r.lMouthPos=[i,o],i=(e[n+1]<<8)+e[n],o=(e[(n+=2)+1]<<8)+e[n],n+=2,r.rMouthPos=[i,o];var u=e[n];n+=3,u>0&&(r.featurePos=[]);for(var s=0;s0&&(r.hangingCount=[]);for(var i=0;i0&&(r.tissueCount=[]),i=0;i0&&(r.sunVisorCount=[]),i=0;i0&&(r.annualInspectionCount=[]),i=0;i>>0;p=d>>26===0?"2000":"20"+(d>>26);var m=Date.UTC(p,(d>>22&15)-1,d>>17&31,d>>12&31,d>>6&63,63&d)/1e3;if(m-=28800,0===this.firstTime)this.firstTime=m,this.lastMSW=0,t=(a[21]<<8)+a[20],e={timestamp:this.firstTime,timestamp_usec:0};else{var _,h=(a[21]<<8)+a[20];_=h>=t?h-t:h+65535-t,this.lastMSW+=_,m>this.firstTime&&(this.lastMSW-=1e3),this.firstTime=m,e={timestamp:m,timestamp_usec:this.lastMSW},t=h}!function(t,n,a,i){var f=n[22],l=n.subarray(24+f,n.length-8);switch(t){case 0:a({ivsDraw:o(l),timeStamp:e,channel:i});break;case 5:a({ivsDraw:u(l),timeStamp:e,channel:i});break;case 6:break;case 14:var c=[];if(function(e,t){for(var n=e.length,a=0;a+4