aliyun-rtc-sdk 7.1.4 → 7.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/aliyun-rtc-sdk.es.js +5775 -5775
- package/dist/aliyun-rtc-sdk.umd.js +17 -17
- package/dist/plugins/audioProcessPlugin.d.ts +1468 -1467
- package/dist/plugins/audioProcessPlugin.js +1 -1
- package/dist/types/index.d.ts +4 -3
- package/package.json +1 -1
|
@@ -160,4 +160,4 @@ t=0 0\r
|
|
|
160
160
|
a=extmap-allow-mixed`)!==-1){const Z=X.sdp.split(`
|
|
161
161
|
`).filter(ee=>ee.trim()!=="a=extmap-allow-mixed").join(`
|
|
162
162
|
`);I.RTCSessionDescription&&X instanceof I.RTCSessionDescription?arguments[0]=new I.RTCSessionDescription({type:X.type,sdp:Z}):X.sdp=Z}return q.apply(this,arguments)}}function ke(I,K){if(!I.RTCPeerConnection||!I.RTCPeerConnection.prototype)return;const q=I.RTCPeerConnection.prototype.addIceCandidate;q&&q.length!==0&&(I.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?(K.browser==="chrome"&&K.version<78||K.browser==="firefox"&&K.version<68||K.browser==="safari")&&arguments[0]&&arguments[0].candidate===""?Promise.resolve():q.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}const Ue=function({window:I}={},K={shimChrome:!0,shimFirefox:!0,shimEdge:!0,shimSafari:!0}){const q=o,X=function(ee){const $={browser:null,version:null};if(ee===void 0||!ee.navigator)return $.browser="Not a browser.",$;const{navigator:oe}=ee;if(oe.mozGetUserMedia)$.browser="firefox",$.version=a(oe.userAgent,/Firefox\/(\d+)\./,1);else if(oe.webkitGetUserMedia||ee.isSecureContext===!1&&ee.webkitRTCPeerConnection&&!ee.RTCIceGatherer)$.browser="chrome",$.version=a(oe.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(oe.mediaDevices&&oe.userAgent.match(/Edge\/(\d+).(\d+)$/))$.browser="edge",$.version=a(oe.userAgent,/Edge\/(\d+).(\d+)$/,2);else{if(!ee.RTCPeerConnection||!oe.userAgent.match(/AppleWebKit\/(\d+)\./))return $.browser="Not a supported browser.",$;$.browser="safari",$.version=a(oe.userAgent,/AppleWebKit\/(\d+)\./,1),$.supportsUnifiedPlan=ee.RTCRtpTransceiver&&"currentDirection"in ee.RTCRtpTransceiver.prototype}return $}(I),Z={browserDetails:X,commonShim:v,extractVersion:a,disableLog:r,disableWarnings:i};switch(X.browser){case"chrome":if(!m||!O||!K.shimChrome)return q("Chrome shim is not included in this adapter release."),Z;if(X.version===null)return q("Chrome shim can not determine version, not shimming."),Z;q("adapter.js shimming chrome."),Z.browserShim=m,ke(I,X),E(I,X),b(I),O(I,X),l(I),D(I,X),A(I),R(I),C(I),U(I,X),De(I),Me(I),Ce(I,X),Oe(I),Pe(I,X);break;case"firefox":if(!f||!G||!K.shimFirefox)return q("Firefox shim is not included in this adapter release."),Z;q("adapter.js shimming firefox."),Z.browserShim=f,ke(I,X),B(I,X),G(I,X),z(I),te(I),J(I),re(I),ie(I),ce(I),se(I),ue(I),pe(I),De(I),Me(I),Ce(I,X),Oe(I);break;case"edge":if(!d||!F||!K.shimEdge)return q("MS edge shim is not included in this adapter release."),Z;q("adapter.js shimming edge."),Z.browserShim=d,N(I),H(I),F(I,X),P(I),Ce(I,X),Oe(I);break;case"safari":if(!y||!K.shimSafari)return q("Safari shim is not included in this adapter release."),Z;q("adapter.js shimming safari."),Z.browserShim=y,ke(I,X),ge(I),Re(I),Ee(I),de(I),ve(I),be(I),fe(I),Te(I),De(I),Ce(I,X),Oe(I),Pe(I,X);break;default:q("Unsupported browser!")}return Z}({window:typeof window>"u"?void 0:window}),Ae=Ue},6834:(j,T,_)=>{_.r(T),_.d(T,{default:()=>f});var m=_(5512),d=_.n(m);function f(){return d()('/*! aliyun rts sdk - ver2.13.0 created:2025/7/24 20:19:04 */(()=>{"use strict";var e={28:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.default={version:"2.13.0",protocol_version:2,sdk_version:"0.0.1"}},917:(e,t)=>{var r,o,n,i;Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_RETRY_DATACHANNEL_TIMEOUT=t.DEFAULT_HEARTBEAT_TIMEOUT=t.DEFAULT_RETRY_PUBLISH_INTERVAL=t.DEFAULT_RETRY_SUBSCRIBE_INTERVAL=t.DEFAULT_RETRY_PUBLISH_LIMIT=t.DEFAULT_RETRY_SUBSCRIBE_LIMIT=t.EWorkerAction=t.EWorkerSource=t.EConnectStatus=t.TrackType=void 0,function(e){e.AUDIO="audio",e.VIDEO="video"}(r||(t.TrackType=r={})),function(e){e[e.CONNECT_STATUS_DISCONNECTED=0]="CONNECT_STATUS_DISCONNECTED",e[e.CONNECT_STATUS_CONNECTING=1]="CONNECT_STATUS_CONNECTING",e[e.CONNECT_STATUS_CONNECTED=2]="CONNECT_STATUS_CONNECTED",e[e.CONNECT_STATUS_RECONNECTING=3]="CONNECT_STATUS_RECONNECTING"}(o||(t.EConnectStatus=o={})),function(e){e.Sender="sender",e.Receiver="receiver"}(n||(t.EWorkerSource=n={})),function(e){e.Setup="setup",e.InserSEI="insertSEI",e.UpdatePubStats="updatePubStats",e.UpdateSubStats="updateSubStats",e.SwitchCumuDelay="switchCumuDelay"}(i||(t.EWorkerAction=i={})),t.DEFAULT_RETRY_SUBSCRIBE_LIMIT=5,t.DEFAULT_RETRY_PUBLISH_LIMIT=5,t.DEFAULT_RETRY_SUBSCRIBE_INTERVAL=2e3,t.DEFAULT_RETRY_PUBLISH_INTERVAL=2e3,t.DEFAULT_HEARTBEAT_TIMEOUT=8,t.DEFAULT_RETRY_DATACHANNEL_TIMEOUT=8e3},649:function(e,t,r){var o,n,i=this&&this.__assign||function(){return i=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},i.apply(this,arguments)},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.CumuDelaySeiPayloadParser=t.CumuDelaySeiPayload=t.ECumuDelayGrtnKey=t.ECumuDelayPubSdkKey=t.ECumuDelayAVCommonKey=t.ECumuDelayVideoKey=t.ECumuDelayGrtnExportKey=t.ECumuDelaySubKey=t.CUMU_DELAY_UUID=t.CUMU_DELAY_SEI_PAYLOAD_TYPE=void 0;var s,u,l,A,C=a(r(28));t.CUMU_DELAY_SEI_PAYLOAD_TYPE=99,t.CUMU_DELAY_UUID=[32,36,16,9,16,23,7,1,150,117,25,212,25,129,3,7],function(e){e.SophonAudioDual="sophon_audio_dual",e.SophonVideoCamera="sophon_video_camera",e.SophonVideoCameraSmall="sophon_video_camera_small",e.SophonVideoCameraSuper="sophon_video_camera_super",e.SophonVideoScreenShare="sophon_video_screen_share",e.SophonAudio="sophon_audio",e.SophonVideoCameraLarge="sophon_video_camera_large",e.RtsAudio="rts audio",e.RtsVideo="rts video"}(s||(s={})),function(e){e[e.Web=0]="Web",e[e.iOS=1]="iOS",e[e.Android=2]="Android"}(u||(u={})),function(e){e.VTotalCost="VTotalCost",e.VAssemblyCost="VAssemblyCost",e.VJitterBufferDelay="VJitterBufferDelay",e.VDecPlugCost="VDecPlugCost",e.DownRTTHalf="DownRTTHalf"}(l||(t.ECumuDelaySubKey=l={})),function(e){e.TOTAL_COST="TOTAL_COST",e.ENTER_GRTN_TIMESTAMP="ENTER_GRTN_TIMESTAMP",e.LEAVE_GRTN_TIMESTAMP="LEAVE_GRTN_TIMESTAMP"}(A||(t.ECumuDelayGrtnExportKey=A={}));var c,T,f,d,E,_,y,S=((o={})[s.SophonAudioDual]=4,o[s.SophonVideoCamera]=5,o[s.SophonVideoCameraSmall]=6,o[s.SophonVideoCameraSuper]=7,o[s.SophonVideoScreenShare]=8,o[s.SophonAudio]=9,o[s.SophonVideoCameraLarge]=10,o[s.RtsAudio]=11,o[s.RtsVideo]=12,o);(n={})[S[s.SophonAudioDual]]=s.SophonAudioDual,n[S[s.SophonVideoCamera]]=s.SophonVideoCamera,n[S[s.SophonVideoCameraSmall]]=s.SophonVideoCameraSmall,n[S[s.SophonVideoCameraSuper]]=s.SophonVideoCameraSuper,n[S[s.SophonVideoScreenShare]]=s.SophonVideoScreenShare,n[S[s.SophonAudio]]=s.SophonAudio,n[S[s.SophonVideoCameraLarge]]=s.SophonVideoCameraLarge,n[S[s.RtsAudio]]=s.RtsAudio,n[S[s.RtsVideo]]=s.RtsVideo;!function(e){e[e.VTotalCost=4]="VTotalCost",e[e.CapDeviceCost=5]="CapDeviceCost",e[e.PushExtCost=6]="PushExtCost",e[e.CapPlugCost=7]="CapPlugCost",e[e.PrepThrCost=8]="PrepThrCost",e[e.PrepPlugCost=9]="PrepPlugCost",e[e.DispThrCost=10]="DispThrCost",e[e.DispPlugCost=11]="DispPlugCost",e[e.VEncThrCost=12]="VEncThrCost",e[e.VEncPlugCost=13]="VEncPlugCost"}(c||(t.ECumuDelayVideoKey=c={})),function(e){e[e.ATotalCost=24]="ATotalCost",e[e.ASourceCCost=25]="ASourceCCost",e[e.AMixerCost=26]="AMixerCost",e[e.AEncodeCCost=27]="AEncodeCCost",e[e.AAIClientQuestionTimestampHEAD=28]="AAIClientQuestionTimestampHEAD",e[e.AAIClientQuestionTimestampTAIL=29]="AAIClientQuestionTimestampTAIL",e[e.AAIClientAnswerTimestampHEAD=30]="AAIClientAnswerTimestampHEAD",e[e.AAIClientAnswerTimestampTAIL=31]="AAIClientAnswerTimestampTAIL",e[e.AAIClientScentenceId=32]="AAIClientScentenceId",e[e.AAIClientSourceCost=33]="AAIClientSourceCost",e[e.AAIClientMixerCost=34]="AAIClientMixerCost",e[e.AAIClientEncoderCost=35]="AAIClientEncoderCost",e[e.AAILinuxReceiveCost=36]="AAILinuxReceiveCost",e[e.AAILinuxNeteqCost=37]="AAILinuxNeteqCost",e[e.AAILinuxRemoteSourceCost=38]="AAILinuxRemoteSourceCost",e[e.AAILinuxPlayMixerCost=39]="AAILinuxPlayMixerCost",e[e.AAILinuxPlayCost=40]="AAILinuxPlayCost",e[e.AAIClientQuestionUidDigestHEAD=41]="AAIClientQuestionUidDigestHEAD",e[e.AAIClientQuestionUidDigestTAIL=42]="AAIClientQuestionUidDigestTAIL",e[e.AIClinetSmartDenoise=43]="AIClinetSmartDenoise"}(T||(T={})),function(e){e[e.NetsdkThrCost=44]="NetsdkThrCost",e[e.QosThrCost=45]="QosThrCost",e[e.PacerCost=46]="PacerCost",e[e.UpRTTHalf=47]="UpRTTHalf",e[e.AIClientNetsdkThrCost=48]="AIClientNetsdkThrCost",e[e.AIClientQosThrCost=49]="AIClientQosThrCost",e[e.AIClientPacerCost=50]="AIClientPacerCost",e[e.AIClientUpRTTHalf=51]="AIClientUpRTTHalf"}(f||(t.ECumuDelayAVCommonKey=f={})),function(e){e[e.AIAsrCost=64]="AIAsrCost",e[e.AILlmCost=65]="AILlmCost",e[e.AITtsCost=66]="AITtsCost",e[e.AIMuteCost=67]="AIMuteCost",e[e.AIAgentTotalCost=68]="AIAgentTotalCost",e[e.AIAgentExtraAvatarCost=69]="AIAgentExtraAvatarCost"}(d||(d={})),function(e){e[e.PubSdkType=100]="PubSdkType",e[e.PubSdkVersion=101]="PubSdkVersion"}(E||(t.ECumuDelayPubSdkKey=E={})),function(e){e[e.NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_INTERNAL_RTT_HALF=121]="NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_INTERNAL_RTT_HALF",e[e.NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_GRTN_NODE_BEF_PACER=122]="NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_GRTN_NODE_BEF_PACER",e[e.NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_GRTN_NODE_PACER_COST=123]="NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_GRTN_NODE_PACER_COST",e[e.NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_DOWN_RTT_HALF=124]="NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_DOWN_RTT_HALF"}(_||(t.ECumuDelayGrtnKey=_={})),function(e){e[e.AIGRTNInternalRTTHalf=104]="AIGRTNInternalRTTHalf",e[e.AIGRTNBeforePacer=105]="AIGRTNBeforePacer",e[e.AIGRTNPacerCost=106]="AIGRTNPacerCost",e[e.AIGRTNDownRTTHalf=107]="AIGRTNDownRTTHalf"}(y||(y={}));var p=function(e){e.msid=s.SophonAudio;var t=S[e.msid];t||console.warn("No mapped msid for cumuDelay",e.msid);var r=new ArrayBuffer(e.sendTs?8:4);if(e.sendTs){var o=Math.floor(performance.now()+performance.timeOrigin-e.windowTimeOrigin);o>=Math.pow(2,32)-1&&(o=0);var n=new DataView(r);n.setUint8(0,8),n.setUint8(1,0),n.setUint8(2,t),n.setUint8(3,5),n.setUint32(4,o)}else new Uint8Array(r).set([0,0,t,1]);e.kv[E.PubSdkType]=u.Web,e.kv[E.PubSdkVersion]=Number(C.default.version.split(".").join("").split("-")[0]);var a=Object.keys(e.kv).length;a>256&&console.warn("Too much kv");var l,A,T,d,_=1+3*a+1,y=new ArrayBuffer(_),p=new DataView(y);p.setInt8(0,a),Object.keys(e.kv).forEach((function(t,r){t in i(i(i({},c),f),E)||console.warn("Unknown CumuDelay key: ".concat(t));var o=e.kv[t],n=1+3*r;p.setUint8(n,parseInt(t)),p.setUint16(n+1,o)})),p.setUint8(_-1,128),this.buffer=(l=r,A=y,T=new ArrayBuffer(l.byteLength+A.byteLength),(d=new Uint8Array(T)).set(new Uint8Array(l),0),d.set(new Uint8Array(A),l.byteLength),T)};t.CumuDelaySeiPayload=p;var h=function(e){var t;this.pub={},this.grtn={},this.AIPub={},this.AISub={},this.AIAgent={},this.AIGrtn={},this.other={};var r,o,n=new v(e),i=(n.readBits(3),n.readBits()),a=n.readBits(),s=n.readBits(),u=n.readBits(),l=n.readBits();n.readBits(8),n.readBits(8),n.readBits(8),1===i&&n.readBits(16);if(1===a){var C=n.readBits(32);this.pub.timestamp=C,this.pub.timestampRecv=Math.floor(performance.now())}1===s&&n.readBits(16);1===u&&(r=n.readBits(32)),1===l&&(o=n.readBits(32)),r&&o&&(this.grtn=((t={})[A.TOTAL_COST]=o-r,t[A.ENTER_GRTN_TIMESTAMP]=r,t[A.LEAVE_GRTN_TIMESTAMP]=o,t));for(var S=n.readBits(8),p=0;p<S;p++){var h=n.readBits(8),m=n.readBits(16);if(I(h,[c.VTotalCost,c.VEncPlugCost])||I(h,[T.ATotalCost,T.AEncodeCCost])||I(h,[f.NetsdkThrCost,f.UpRTTHalf])||I(h,[E.PubSdkType,E.PubSdkVersion])){var b=c[h]||T[h]||f[h]||E[h];this.pub[b]=m}else if(I(h,[T.AAIClientQuestionTimestampHEAD,T.AAIClientEncoderCost])||I(h,[f.AIClientNetsdkThrCost,f.AIClientUpRTTHalf]))b=T[h]||f[h],this.AIPub[b]=m;else if(I(h,[T.AAILinuxReceiveCost,T.AIClinetSmartDenoise]))b=T[h],this.AISub[b]=m;else if(I(h,[d.AIAsrCost,d.AIAgentExtraAvatarCost]))b=d[h],this.AIAgent[b]=m;else if(I(h,[y.AIGRTNInternalRTTHalf,y.AIGRTNDownRTTHalf])){b=y[h];for(var D=0,U="".concat(b,"_").concat(D);this.AIGrtn.hasOwnProperty(U);)U="".concat(b,"_").concat(D++);this.AIGrtn[U]=m}else if(I(h,[_.NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_INTERNAL_RTT_HALF,_.NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_DOWN_RTT_HALF])){for(b=_[h],D=0,U="".concat(b,"_").concat(D);this.grtn.hasOwnProperty(U);)U="".concat(b,"_").concat(D++);this.grtn[U]=m}else this.other[h]=m}};function I(e,t){return e>=t[0]&&e<=t[1]}t.CumuDelaySeiPayloadParser=h;var v=function(){function e(e){this.byteOffset=0,this.bitOffset=0;var t=new Uint8Array(e);this.buffer=t}return e.prototype.readBits=function(e){void 0===e&&(e=1);for(var t=0,r=0;r<e;){if(this.byteOffset>=this.buffer.byteLength)throw new Error("readBits out of range");var o=8-this.bitOffset,n=Math.min(o,e-r);t=t<<n|this.getBitsFromByte(this.buffer,this.byteOffset,this.bitOffset,this.bitOffset+n-1),this.bitOffset+=n,r+=n,8===this.bitOffset&&(this.byteOffset++,this.bitOffset=0)}return 32===e&&(t>>>=0),t},e.prototype.hasNext=function(){return this.byteOffset<this.buffer.byteLength},e.prototype.getBitsFromByte=function(e,t,r,o){if(t<0||t>=e.byteLength||r<0||o>7||r>o)throw new Error("Invalid parameters");return e[t]>>7-o&(1<<o-r+1)-1},e}()},594:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.readUUID=t.discardEPB=t.insertEPB=t.SODBtoRBSP=t.convertPayloadSize=t.NALU=t.SEI=t.parseSei=t.insertSei=void 0;var o=r(649);t.insertSei=function(e,t,r,o){void 0===r&&(r=5);for(var a=e.data,s=new DataView(a),u=0;;){if(1===s.getUint32(u)){s.getUint8(u+4);var l=new n(t,r,o).buffer,A=new i(l).buffer,C=new ArrayBuffer(A.byteLength+a.byteLength),c=new Uint8Array(C),T=new Uint8Array(A);c.set(T);var f=new Uint8Array(a);c.set(f,A.byteLength),e.data=C,u+=1;break}if((u+=1)+4>=s.byteLength)break}};t.parseSei=function(e){for(var r=[],o=new DataView(e),n=0;;){var i=n,s=o.getUint32(i);if(i+=4,1===s){if(6===(31&o.getUint8(i++))){for(var u=o.getUint8(i++),l=a(u)?16:0,A=0;255==o.getUint8(i);)i++,A+=255;if((A+=o.getUint8(i++))>0&&o.byteLength>i+A){var C=new Uint8Array(o.buffer),c="";if(a(u)){var T=C.slice(i,i+l);c=(0,t.readUUID)((0,t.discardEPB)(T))}var f=C.slice(i+l,i+A);i+=A,r.push({payloadType:u,uuid:c,data:f.buffer})}}n=i}else n+=1;if(n+4>=o.byteLength)break}return r};var n=function(e,r,o){void 0===r&&(r=5);var n=a(r)?16:0,i=e.byteLength+n,s=(0,t.convertPayloadSize)(i),u=s.buffer.byteLength,l=new ArrayBuffer(1+u+n+e.byteLength),A=new Uint8Array(l),C=0;if(A[C++]=r,A.set(s,C),C+=s.byteLength,a(r)){o=(o||"00000000-0000-0000-0000-000000000000").replace(/-/g,"");for(var c=0;c<16;c++)A[C+c]=parseInt(o.substr(2*c,2),16);C+=16}var T=new Uint8Array(e);A.set(T,C);var f=(0,t.SODBtoRBSP)(A);this.buffer=f.buffer};t.SEI=n;var i=function(e){var t=new Uint8Array([0,0,0,1]),r=new Uint8Array([6]),o=new ArrayBuffer(t.byteLength+r.byteLength+e.byteLength),n=new Uint8Array(o);n.set(t),n.set(r,t.byteLength),n.set(new Uint8Array(e),t.byteLength+r.byteLength),this.buffer=o};t.NALU=i;t.convertPayloadSize=function(e){if(e<=0)throw new Error("payloadSize must be a positive integer.");for(var t=Math.ceil(e/255),r=new ArrayBuffer(t),o=new DataView(r),n=0;n<t-1;n++)o.setUint8(n,255);return o.setUint8(t-1,e%255&255),new Uint8Array(r)};t.SODBtoRBSP=function(e){for(var r=new Uint8Array(e),o="",n=0;n<r.length;n++)o+=r[n].toString(2).padStart(8,"0");for(o+="1";o.length%8!=0;)o+="0";var i=o.length/8,a=new Uint8Array(i);for(n=0;n<i;n++)a[n]=parseInt(o.slice(8*n,8*n+8),2);return(0,t.insertEPB)(a)};t.insertEPB=function(e){for(var t=[],r=0,o=0;o<e.length;o++)t.push(e[o]),0===e[o]?2===++r&&o<e.length-1&&e[o+1]<=3&&(t.push(3),r=0):r=0;return new Uint8Array(t)};t.discardEPB=function(e){for(var t=e.byteLength,r=[],o=1;o<t-2;)0===e[o]&&0===e[o+1]&&3===e[o+2]?(r.push(o+2),o+=2):o++;if(0===r.length)return e;var n=t-r.length,i=new Uint8Array(n),a=0;for(o=0;o<n;a++,o++)a===r[0]&&(a++,r.shift()),i[o]=e[a];return i};t.readUUID=function(e){if(16!==e.length)throw new Error("UUID must be 16 bytes long.");var t=e.reduce((function(e,t){return e+t.toString(16).padStart(2,"0")}),"");return"".concat(t.slice(0,8),"-").concat(t.slice(8,12),"-").concat(t.slice(12,16),"-").concat(t.slice(16,20),"-").concat(t.slice(20))};var a=function(e){return 5===e||e===o.CUMU_DELAY_SEI_PAYLOAD_TYPE}},718:function(e,t){var r=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var o,n=0,i=t.length;n<i;n++)!o&&n in t||(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.hebtLog=t.createUUID=t.evaluateNetworkCondition=t.makeCancelable=t.hasVideoTrack=t.hasAudioTrack=t.getVideoTrack=t.getAudioTrack=t.pruneSubUrl=t.getJitterBufferDelayAvg=void 0,t.lowercaseFirstLetter=function(e){return e.replace(/([A-Za-z])/,(function(e){return e.toLowerCase()}))},t.underlineToCamelCase=function(e){return e.replace(/_([a-z])/g,(function(e,t){return t.toUpperCase()}))};t.getJitterBufferDelayAvg=function(e,t){return e&&t?Number(e)/Number(t)*1e3:-1};t.pruneSubUrl=function(e,t){var r=e||"";return r=r.replace("@subaudio=no","").replace("@subvideo=no",""),t&&(r=r.split("?")[0]),r};t.getAudioTrack=function(e){return e.getAudioTracks()[0]};t.getVideoTrack=function(e){return e.getVideoTracks()[0]};t.hasAudioTrack=function(e){return e.getAudioTracks().length>0};t.hasVideoTrack=function(e){return e.getVideoTracks().length>0};t.makeCancelable=function(e){var t=!1;return{promise:new Promise((function(r,o){e.then((function(e){return t?o({isCanceled:!0}):r(e)})),e.catch((function(e){return o(t?{isCanceled:!0}:e)}))})),cancel:function(){t=!0}}};t.evaluateNetworkCondition=function(e,t,r,o,n){var i=0;if(!navigator.onLine)return i=6;var a=[{loss:0,rtt:0,jbd:1},{loss:0,rtt:1,jbd:0},{loss:0,rtt:.5,jbd:.5},{loss:1,rtt:0,jbd:0},{loss:.8,rtt:0,jbd:.2},{loss:.8,rtt:.2,jbd:0},{loss:.6,rtt:.2,jbd:.2}],s=-1,u=-1,l=-1;if("number"==typeof t&&t>=0||"number"==typeof r&&r>=0){s=0;var A=!1,C=!1;"number"==typeof t&&t>=0&&(s+=t,A=!0),"number"==typeof r&&r>=0&&(s+=r,C=!0),A&&!C&&(s*=2),C&&!A&&(s*=1.8)}if("number"==typeof e&&e>=0&&(l=e),"number"==typeof o&&o>=0||"number"==typeof n&&n>=0){u=0;"number"==typeof o&&o>=0&&(u+=o),"number"==typeof n&&n>=0&&(u+=n)}var c;if((c=4*(-1!==s?1:0)+2*(-1!==l?1:0)+(-1!==u?1:0))>0){var T=1.2*s*a[c-1].loss+l/1500*a[c-1].rtt+u/3e3*a[c-1].jbd;i=T<=.1?1:T<=.23?2:T<=.36?3:T<=.49?4:5}else i=0;return i};t.createUUID=function(e,t){var r,o="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),n=[];if(t=t||o.length,e)for(r=0;r<e;r++)n[r]=o[0|Math.random()*t];else{var i=void 0;for(n[8]=n[13]=n[18]=n[23]="-",n[14]="4",r=0;r<36;r++)n[r]||(i=0|16*Math.random(),n[r]=o[19==r?3&i|8:i])}return n.join("")};t.hebtLog=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];window.RTS_HEBT_DEBUG&&console.log.apply(console,r(["[rts hebt]"],e,!1))}}},t={};function r(o){var n=t[o];if(void 0!==n)return n.exports;var i=t[o]={exports:{}};return e[o].call(i.exports,i,i.exports,r),i.exports}var o,n,i,a,s,u,l,A,C,c,T,f;a=r(594),s=r(718),u=r(649),l=r(917),A=self,C=!1,c=0,T=function(e,t,r,s){if(e===l.EWorkerSource.Sender){var A=new TransformStream({transform:function(e,t){var r=e;if(e.type){if(o)try{(!o.keyframeOnly||o.keyframeOnly&&"key"===e.type)&&((0,a.insertSei)(e,o.sei,o.payloadType,o.uuid),void 0===o.repeatCount?o=null:-1!==o.repeatCount&&(o.repeatCount--,o.repeatCount<0&&(o=null)))}catch(t){e=r,console.log("error in inserting user SEI",t)}else if(C)try{if("key"===e.type&&n){var i={};n.v_encode_time_avg&&(i[u.ECumuDelayVideoKey.VEncPlugCost]=Math.ceil(n.v_encode_time_avg)),n.v_packet_send_delay_avg&&(i[u.ECumuDelayAVCommonKey.PacerCost]=Math.ceil(n.v_packet_send_delay_avg)),n.rtt&&(i[u.ECumuDelayAVCommonKey.UpRTTHalf]=Math.ceil(n.rtt/2*1e3)),i[u.ECumuDelayVideoKey.VTotalCost]=Math.ceil((i[u.ECumuDelayVideoKey.VEncPlugCost]||0)+(i[u.ECumuDelayAVCommonKey.PacerCost]||0)),(0,a.insertSei)(e,new u.CumuDelaySeiPayload({msid:n.vMsid||"",kv:i,sendTs:!0,windowTimeOrigin:c}).buffer,u.CUMU_DELAY_SEI_PAYLOAD_TYPE,(0,a.readUUID)(new Uint8Array(u.CUMU_DELAY_UUID)))}}catch(t){e=r,console.log("error in inserting cumuDelay SEI",t)}r=null,s&&s(e)}t.enqueue(e)}});t.pipeThrough(A).pipeTo(r)}else e===l.EWorkerSource.Receiver&&(A=new TransformStream({transform:function(e,t){var r,o,n,a,l,A,C,c,T,f,d,E=e;if(e.type){try{if(i){var _=((r={})[u.ECumuDelaySubKey.DownRTTHalf]=Math.ceil(((null===(n=null===(o=i.video)||void 0===o?void 0:o.transportStats)||void 0===n?void 0:n.rtt)||0)/2*1e3),r[u.ECumuDelaySubKey.VAssemblyCost]=Math.ceil((null===(l=null===(a=i.video)||void 0===a?void 0:a.inboundRtpStatsPerSec)||void 0===l?void 0:l.totalAssemblyTimeAvg)||0),r[u.ECumuDelaySubKey.VJitterBufferDelay]=Math.ceil((null===(C=null===(A=i.video)||void 0===A?void 0:A.inboundRtpStatsPerSec)||void 0===C?void 0:C.jitterBufferDelayAvg)||0),r[u.ECumuDelaySubKey.VDecPlugCost]=Math.ceil((null===(T=null===(c=i.video)||void 0===c?void 0:c.inboundRtpStatsPerSec)||void 0===T?void 0:T.decodeTimeAvg)||0),r[u.ECumuDelaySubKey.VTotalCost]=Math.ceil((null===(d=null===(f=i.video)||void 0===f?void 0:f.inboundRtpStatsPerSec)||void 0===d?void 0:d.totalProcessingDelayAvg)||0),r);_[u.ECumuDelaySubKey.VTotalCost]||(_[u.ECumuDelaySubKey.VTotalCost]=Math.ceil((_[u.ECumuDelaySubKey.VAssemblyCost]||0)+(_[u.ECumuDelaySubKey.VJitterBufferDelay]||0)+(_[u.ECumuDelaySubKey.VDecPlugCost]||0))),e.subStats=_}}catch(t){console.log("error in parsing SEI",t),e=E}E=null,s&&s(e)}delete e.subStats,t.enqueue(e)}}),t.pipeThrough(A).pipeTo(r))},f=function(e){var t=e.data.slice(0);A.postMessage({type:"encodedFrame",data:t,frameInfo:{type:e.type,timestamp:e.timestamp},subStats:e.subStats},[t]),t=null},A.RTCTransformEvent&&(A.onrtctransform=function(e){var t=e.transformer,r=t.options.source,o=t.readable,n=t.writable;T(r,o,n,(function(e){r===l.EWorkerSource.Receiver&&f(e)}))}),onmessage=function(e){switch(e.data.operation){case l.EWorkerAction.Setup:t=e.data,r=t.source,a=t.readable,u=t.writable,T(r,a,u,(function(e){r===l.EWorkerSource.Receiver&&f(e)}));break;case l.EWorkerAction.InserSEI:!function(e){(o=e)&&(o.uuid=(0,s.createUUID)().toLowerCase(),o.repeatCount=o.repeatCount||0)}(e.data);break;case l.EWorkerAction.UpdatePubStats:!function(e){n=e.stats}(e.data);break;case l.EWorkerAction.UpdateSubStats:!function(e){i=e.stats}(e.data);break;case l.EWorkerAction.SwitchCumuDelay:!function(e){C=e.enable,c=e.windowTimeOrigin}(e.data)}var t,r,a,u}})();',"Worker",void 0,void 0)}},5512:j=>{j.exports=function(T,_,m,d){var f=self||window;try{try{var y;try{y=new f.Blob([T])}catch{(y=new(f.BlobBuilder||f.WebKitBlobBuilder||f.MozBlobBuilder||f.MSBlobBuilder)).append(T),y=y.getBlob()}var v=f.URL||f.webkitURL,s=v.createObjectURL(y),c=new f[_](s,m);return v.revokeObjectURL(s),c}catch{return new f[_]("data:application/javascript,".concat(encodeURIComponent(T)),m)}}catch{if(!d)throw Error("Inline worker is not supported");return new f[_](d,m)}}},2632:(j,T,_)=>{_.r(T),_.d(T,{default:()=>a});function m(e,r,i){Object.defineProperty(e,r,{writable:!0,enumerable:!0,configurable:!0,value:i})}Array(32);var d,f,y;class v{constructor(r){var i,o;this.timer=null,this.time=10,this.count=10,this.arr=[],this.time=(i=r.time)!=null?i:10,this.count=(o=r.count)!=null?o:10,r.host.startsWith("http://")||r.host.startsWith("https://")?this.url=r.host+"/logstores/"+r.logstore+"/track":this.url="https://"+r.project+"."+r.host+"/logstores/"+r.logstore+"/track",this.opt=r,r.installUnloadHook&&typeof r.installUnloadHook=="function"&&r.installUnloadHook(()=>{this.sendImmediateInner()})}assemblePayload(r=this.arr){const i={__logs__:r};return this.opt.tags&&(i.__tags__=this.opt.tags),this.opt.topic&&(i.__topic__=this.opt.topic),this.opt.source&&(i.__source__=this.opt.source),JSON.stringify(i)}platformSend(){if(this.opt.sendPayload&&typeof this.opt.sendPayload=="function"){const r=this.assemblePayload();this.opt.sendPayload(this.url,r)}}transString(r){let i={};for(let o in r)typeof r[o]=="object"?i[o]=JSON.stringify(r[o]):i[o]=String(r[o]);return i}sendImmediateInner(){this.arr&&this.arr.length>0&&(this.platformSend(),this.timer!=null&&(clearTimeout(this.timer),this.timer=null),this.arr=[])}sendInner(){if(this.timer)this.arr.length>=this.count&&(clearTimeout(this.timer),this.timer=null,this.sendImmediateInner());else{const r=this;this.arr.length>=this.count||this.time<=0?this.sendImmediateInner():this.timer=setTimeout(function(){r.sendImmediateInner()},1e3*this.time)}}send(r){const i=this.transString(r);this.arr.push(i),this.sendInner()}sendImmediate(r){const i=this.transString(r);this.arr.push(i),this.sendImmediateInner()}sendBatchLogs(r){const i=r.map(o=>this.transString(o));this.arr.push(...i),this.sendInner()}sendBatchLogsImmediate(r){const i=r.map(o=>this.transString(o));this.arr.push(...i),this.sendImmediateInner()}}function s(e,r){const i=new window.XMLHttpRequest;i.open("POST",`${e}?APIVersion=0.6.0`,!0),i.send(r)}function c(e,r){try{if(r.length>=32768)return void s(e,r);(function(i,o){return!(!navigator||!navigator.sendBeacon)&&navigator.sendBeacon(`${i}?APIVersion=0.6.0`,o)})(e,r)||s(e,r)}catch(i){window&&window.console&&typeof window.console.error=="function"&&(console.error(`Failed to log to ali log service because of this exception:
|
|
163
|
-
`+i),console.error("Failed log data:",e))}}class a extends v{constructor(r){super(Object.assign({},r,{installUnloadHook:i=>{window.addEventListener("beforeunload",()=>{i()})},sendPayload:(i,o)=>{c(i,o)}}))}}d=window,f="SLS_Tracker",y=a,m(d,f,y)},4198:j=>{j.exports=JSON.parse('{"name":"axios","version":"0.21.4","description":"Promise based HTTP client for the browser and node.js","main":"index.js","scripts":{"test":"grunt test","start":"node ./sandbox/server.js","build":"NODE_ENV=production grunt build","preversion":"npm test","version":"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json","postversion":"git push && git push --tags","examples":"node ./examples/server.js","coveralls":"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js","fix":"eslint --fix lib/**/*.js"},"repository":{"type":"git","url":"https://github.com/axios/axios.git"},"keywords":["xhr","http","ajax","promise","node"],"author":"Matt Zabriskie","license":"MIT","bugs":{"url":"https://github.com/axios/axios/issues"},"homepage":"https://axios-http.com","devDependencies":{"coveralls":"^3.0.0","es6-promise":"^4.2.4","grunt":"^1.3.0","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^23.0.0","grunt-karma":"^4.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^4.0.2","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1","karma":"^6.3.2","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^2.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^4.3.6","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.8","karma-webpack":"^4.0.2","load-grunt-tasks":"^3.5.2","minimist":"^1.2.0","mocha":"^8.2.1","sinon":"^4.5.0","terser-webpack-plugin":"^4.2.3","typescript":"^4.0.5","url-search-params":"^0.10.0","webpack":"^4.44.2","webpack-dev-server":"^3.11.0"},"browser":{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},"jsdelivr":"dist/axios.min.js","unpkg":"dist/axios.min.js","typings":"./index.d.ts","dependencies":{"follow-redirects":"^1.14.0"},"bundlesize":[{"path":"./dist/axios.min.js","threshold":"5kB"}]}')}},V={};function Q(j){var T=V[j];if(T!==void 0)return T.exports;var _=V[j]={exports:{}};return M[j].call(_.exports,_,_.exports,Q),_.exports}return Q.n=j=>{var T=j&&j.__esModule?()=>j.default:()=>j;return Q.d(T,{a:T}),T},Q.d=(j,T)=>{for(var _ in T)Q.o(T,_)&&!Q.o(j,_)&&Object.defineProperty(j,_,{enumerable:!0,get:T[_]})},Q.o=(j,T)=>Object.prototype.hasOwnProperty.call(j,T),Q.r=j=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(j,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(j,"__esModule",{value:!0})},Q(8156)})())})(Vr);for(var jn=Vr.exports,Le=[],Gt=0;Gt<256;++Gt)Le.push((Gt+256).toString(16).slice(1));function Wn(Y,L=0){return(Le[Y[L+0]]+Le[Y[L+1]]+Le[Y[L+2]]+Le[Y[L+3]]+"-"+Le[Y[L+4]]+Le[Y[L+5]]+"-"+Le[Y[L+6]]+Le[Y[L+7]]+"-"+Le[Y[L+8]]+Le[Y[L+9]]+"-"+Le[Y[L+10]]+Le[Y[L+11]]+Le[Y[L+12]]+Le[Y[L+13]]+Le[Y[L+14]]+Le[Y[L+15]]).toLowerCase()}var nt,Gn=new Uint8Array(16);function zn(){if(!nt&&(nt=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!nt))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return nt(Gn)}var Yn=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Hr={randomUUID:Yn};function it(Y,L,M){if(Hr.randomUUID&&!L&&!Y)return Hr.randomUUID();Y=Y||{};var V=Y.random||(Y.rng||zn)();return V[6]=V[6]&15|64,V[8]=V[8]&63|128,Wn(V)}var qn=/d{1,4}|D{3,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|W{1,2}|[LlopSZN]|"[^"]*"|'[^']*'/g,Kn=/\b(?:[A-Z]{1,3}[A-Z][TC])(?:[-+]\d{4})?|((?:Australian )?(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time)\b/g,Xn=/[^-+\dA-Z]/g;function zt(Y,L,M,V){if(arguments.length===1&&typeof Y=="string"&&!/\d/.test(Y)&&(L=Y,Y=void 0),Y=Y||Y===0?Y:new Date,Y instanceof Date||(Y=new Date(Y)),isNaN(Y))throw TypeError("Invalid date");L=String(jr[L]||L||jr.default);var Q=L.slice(0,4);(Q==="UTC:"||Q==="GMT:")&&(L=L.slice(4),M=!0,Q==="GMT:"&&(V=!0));var j=function(){return M?"getUTC":"get"},T=function(){return Y[j()+"Date"]()},_=function(){return Y[j()+"Day"]()},m=function(){return Y[j()+"Month"]()},d=function(){return Y[j()+"FullYear"]()},f=function(){return Y[j()+"Hours"]()},y=function(){return Y[j()+"Minutes"]()},v=function(){return Y[j()+"Seconds"]()},s=function(){return Y[j()+"Milliseconds"]()},c=function(){return M?0:Y.getTimezoneOffset()},a=function(){return Qn(Y)},e=function(){return Jn(Y)},r={d:function(){return T()},dd:function(){return je(T())},ddd:function(){return Ve.dayNames[_()]},DDD:function(){return Wr({y:d(),m:m(),d:T(),_:j(),dayName:Ve.dayNames[_()],short:!0})},dddd:function(){return Ve.dayNames[_()+7]},DDDD:function(){return Wr({y:d(),m:m(),d:T(),_:j(),dayName:Ve.dayNames[_()+7]})},m:function(){return m()+1},mm:function(){return je(m()+1)},mmm:function(){return Ve.monthNames[m()]},mmmm:function(){return Ve.monthNames[m()+12]},yy:function(){return String(d()).slice(2)},yyyy:function(){return je(d(),4)},h:function(){return f()%12||12},hh:function(){return je(f()%12||12)},H:function(){return f()},HH:function(){return je(f())},M:function(){return y()},MM:function(){return je(y())},s:function(){return v()},ss:function(){return je(v())},l:function(){return je(s(),3)},L:function(){return je(Math.floor(s()/10))},t:function(){return f()<12?Ve.timeNames[0]:Ve.timeNames[1]},tt:function(){return f()<12?Ve.timeNames[2]:Ve.timeNames[3]},T:function(){return f()<12?Ve.timeNames[4]:Ve.timeNames[5]},TT:function(){return f()<12?Ve.timeNames[6]:Ve.timeNames[7]},Z:function(){return V?"GMT":M?"UTC":$n(Y)},o:function(){return(c()>0?"-":"+")+je(Math.floor(Math.abs(c())/60)*100+Math.abs(c())%60,4)},p:function(){return(c()>0?"-":"+")+je(Math.floor(Math.abs(c())/60),2)+":"+je(Math.floor(Math.abs(c())%60),2)},S:function(){return["th","st","nd","rd"][T()%10>3?0:(T()%100-T()%10!=10)*T()%10]},W:function(){return a()},WW:function(){return je(a())},N:function(){return e()}};return L.replace(qn,function(i){return i in r?r[i]():i.slice(1,i.length-1)})}var jr={default:"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",paddedShortDate:"mm/dd/yyyy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:sso",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'",expiresHeaderFormat:"ddd, dd mmm yyyy HH:MM:ss Z"},Ve={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"],timeNames:["a","p","am","pm","A","P","AM","PM"]},je=function(L){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;return String(L).padStart(M,"0")},Wr=function(L){var M=L.y,V=L.m,Q=L.d,j=L._,T=L.dayName,_=L.short,m=_===void 0?!1:_,d=new Date,f=new Date;f.setDate(f[j+"Date"]()-1);var y=new Date;y.setDate(y[j+"Date"]()+1);var v=function(){return d[j+"Date"]()},s=function(){return d[j+"Month"]()},c=function(){return d[j+"FullYear"]()},a=function(){return f[j+"Date"]()},e=function(){return f[j+"Month"]()},r=function(){return f[j+"FullYear"]()},i=function(){return y[j+"Date"]()},o=function(){return y[j+"Month"]()},t=function(){return y[j+"FullYear"]()};return c()===M&&s()===V&&v()===Q?m?"Tdy":"Today":r()===M&&e()===V&&a()===Q?m?"Ysd":"Yesterday":t()===M&&o()===V&&i()===Q?m?"Tmw":"Tomorrow":T},Qn=function(L){var M=new Date(L.getFullYear(),L.getMonth(),L.getDate());M.setDate(M.getDate()-(M.getDay()+6)%7+3);var V=new Date(M.getFullYear(),0,4);V.setDate(V.getDate()-(V.getDay()+6)%7+3);var Q=M.getTimezoneOffset()-V.getTimezoneOffset();M.setHours(M.getHours()-Q);var j=(M-V)/(864e5*7);return 1+Math.floor(j)},Jn=function(L){var M=L.getDay();return M===0&&(M=7),M},$n=function(L){return(String(L).match(Kn)||[""]).pop().replace(Xn,"").replace(/GMT\+0000/g,"UTC")},Yt;(function(Y){Y.prod="rs.rtn.aliyuncs.com",Y.pre="prs.rtn.aliyuncs.com"})(Yt||(Yt={}));var Gr;(function(Y){Y[Y.ByClient=0]="ByClient",Y[Y.KickOut=1]="KickOut",Y[Y.ChannelClosed=2]="ChannelClosed",Y[Y.Restore=3]="Restore",Y[Y.Expired=4]="Expired",Y[Y.Reconnect=5]="Reconnect",Y[Y.ReconnectExhausted=6]="ReconnectExhausted"})(Gr||(Gr={}));const zr="7.1.4";class Kt{static getVersionNumber(){let L=zr.split("."),M="";return L.forEach(V=>{V.length===1?M+="0"+V:M+=V}),parseInt(M)}static queryingParam(L){let M=[];if(L)for(let V in L)M.push(V+"="+L[V]);return M.join("&")}static getQueryParams(L){const M=window.location.search.substring(1).split("&");for(let V=0;V<M.length;V++){const Q=M[V].split("=");if(decodeURIComponent(Q[0])===L)return decodeURIComponent(Q[1])}}static createCallid(L=""){const M=it();return L&&M&&M.length>L.length?`${L}${M.substring(L.length)}`:M}static checkSubOptionsValid(L){if(L){const{audio:M,video:V,screen:Q}=L;if(M===!1&&V===!1&&Q===!1)return!1}return!0}static async isNetworkAvailable(){const L=Yt.prod,{onLine:M}=navigator;if(!M)return!1;try{return await fetch(`https://${L}/roomserver/v1/ws/version`),!0}catch{return!1}}static toString(L){let M;if(L instanceof Error)M=L.message;else if(typeof L=="string")M=L;else try{M=JSON.stringify(L)}catch{M="undefined"}return M}static paramArrayToString(L){let M="";for(let V=0;V<L.length;V++){M!==""&&(M+=" ");let Q=Kt.toString(L[V]);M+=Q}return M}}const Zn=(Y,L)=>Y.find(M=>{if(typeof M.test=="function")return M.test(L);if(Array.isArray(M.test))return M.test.some(V=>typeof V=="string"?L.indexOf(V)>-1:V instanceof RegExp?V.test(L):!1)}),ei=[{test:["wow64","win64","x64"],describe(){return"amd64"}},{test:["i686","x86"],describe(){return"x86"}},{test:["aarch64","arm64"],describe(){return"arm64"}},{test:["arm"],describe(){return"arm"}}],ti=()=>{let Y="unknown";try{const L=navigator.userAgent||"",M=Zn(ei,L);if(!M)return Y;Y=M.describe(L)}catch{}return Y};var ri=Object.defineProperty,ni=(Y,L,M)=>L in Y?ri(Y,L,{enumerable:!0,configurable:!0,writable:!0,value:M}):Y[L]=M,we=(Y,L,M)=>ni(Y,typeof L!="symbol"?L+"":L,M);const{BrowserUtil:Yr,SystenUtil:qr}=jn.AliRTS,ii=ti(),oi="woMMssV6jmyol9fr",ai=200,ot=10*60*1e3,at={host:"cn-hangzhou.log.aliyuncs.com",project:"alivc-aio",logstore:"logger",time:10,count:10};function qt(){return zt(new Date,"HH:MM:ss.l")}function Kr(){return zt(new Date,"isoDate")}var He;(function(Y){Y[Y.DEBUG=0]="DEBUG",Y[Y.INFO=1]="INFO",Y[Y.API=2]="API",Y[Y.WARNING=3]="WARNING",Y[Y.ERROR=4]="ERROR",Y[Y.NONE=5]="NONE"})(He||(He={}));var Ke;(function(Y){Y[Y.TASK_UPLOAD_BEGIN=710201]="TASK_UPLOAD_BEGIN",Y[Y.SESSION_UPLOAD_BEGIN=710202]="SESSION_UPLOAD_BEGIN",Y[Y.SESSION_UPLOAD_ING=710203]="SESSION_UPLOAD_ING",Y[Y.SESSION_UPLOAD_END=710204]="SESSION_UPLOAD_END",Y[Y.TASK_UPLOAD_END=710205]="TASK_UPLOAD_END"})(Ke||(Ke={}));class si{constructor(){we(this,"tracker"),we(this,"slsPlugin"),we(this,"stsData"),we(this,"stsExpiration",Date.now()),we(this,"clientId",it()),we(this,"bSesid",it()),we(this,"logLevel",He.WARNING),we(this,"appId",""),we(this,"sessionId",""),we(this,"logCache",[]),we(this,"updateTaskTimer"),we(this,"endReported",!0),we(this,"logSequence",0),we(this,"sendLogBeforeUnload",async L=>{if(!this.slsPlugin)return;this.logSequence+=1,L.unshift(this.getLogParams(Ke.SESSION_UPLOAD_ING,{log:`[${Kr()} ${qt()}] [INF] beforeunload`,stat_log_seq:this.logSequence}));const M=`https://${at.project}.${at.host}/logstores/${at.logstore}`,V={__logs__:L.map(T=>this.slsPlugin.transString(T))},{data:Q,header:j}=await this.slsPlugin.process(M,JSON.stringify(V));fetch(M,{keepalive:!0,method:"POST",headers:j,body:Q})}),we(this,"logMethod",(L,M=console.log)=>(...V)=>{let Q=qt();this.logLevel<=L&&M(Q,...V);let j=Kt.paramArrayToString(V);L>He.DEBUG&&this.addLog(j)}),we(this,"d",this.logMethod(He.DEBUG,console.debug)),we(this,"i",this.logMethod(He.INFO)),we(this,"w",this.logMethod(He.WARNING,console.warn)),we(this,"e",this.logMethod(He.ERROR,(...L)=>{const[M,...V]=L;console.error(M,"<error>",V)})),we(this,"ev",this.logMethod(He.API)),we(this,"a",this.logMethod(He.API,(...L)=>{const[M,...V]=L;if(V.length>2){const Q=`${V[1]}`;Q.startsWith("__g__")&&console.group(`${Q.substring(5)}_${V[2]}`)}console.log(M,...V)})),we(this,"ar",this.logMethod(He.API,(...L)=>{const[M,...V]=L;console.log(M,...V),V.length>2&&`${V[1]}`.startsWith("__g__")&&console.groupEnd()})),we(this,"ae",this.logMethod(He.API,(...L)=>{const[M,...V]=L;console.error(M,"<error>",...V),V.length>2&&`${V[1]}`.startsWith("__g__")&&console.groupEnd()})),window.addEventListener("beforeunload",()=>{this.reportEnd(!0)})}init(){this.reset(),this.startSTSUpdateTask()}destroy(){this.updateTaskTimer&&clearTimeout(this.updateTaskTimer)}reset(){this.bSesid=it(),this.endReported=!0,this.logSequence=0,this.appId="",this.sessionId=""}async startSTSUpdateTask(){this.updateTaskTimer&&clearTimeout(this.updateTaskTimer);try{const L=await this.refreshSTSToken();this.createTracker(L)}catch{}this.updateTaskTimer=setTimeout(()=>{this.startSTSUpdateTask()},ot)}async refreshSTSToken(){if(!this.stsData||this.stsExpiration<=Date.now()-ot){const L=await this.requestSTSToken(),M=new Date(L?.Expiration).getTime()||0,V=Date.now()+ot;this.stsExpiration=Math.max(M,V),this.stsData=L}return this.stsData}requestSTSToken(){const L=Date.now(),M=`${this.clientId}|${oi}|${L}`,V={Action:"AssumeSlsRoleV2",AuthInfo:et.MD5(M).toString(et.enc.Hex),ClientId:this.clientId,BusinessType:"logger",AppVersion:"1.0",Version:"2017-03-14",AuthTimestamp:`${L}`,TerminalType:"web",DeviceModel:"",Format:"JSON",SignatureMethod:"HMAC-SHA1",SignatureVersion:"1.0",Timestamp:zt(L,"isoUtcDateTime")},Q=`https://slsrole.alicdn.com/?${new URLSearchParams(V).toString()}`;return fetch(Q).then(j=>j.json()).then(j=>JSON.parse(window.atob(j.SlsAuthResult)))}createTracker(L){if(!this.tracker){const M={accessKeyId:L.AccessKeyId,accessKeySecret:L.AccessKeySecret,securityToken:L.SecurityToken,refreshSTSTokenInterval:ot,stsTokenFreshTime:void 0,refreshSTSToken:()=>{this.refreshSTSToken().then(j=>{M.accessKeyId=j.AccessKeyId,M.accessKeySecret=j.AccessKeySecret,M.securityToken=j.SecurityToken}).catch(()=>{})}},V=new er(at),Q=Fr(M);V.useStsPlugin(Q),this.slsPlugin=Q,this.tracker=V,this.reportStartAndCache()}}changeConfig(L){L.logLevel!==void 0&&L.logLevel>=He.DEBUG&&L.logLevel<=He.NONE&&(this.logLevel=L.logLevel)}setSessionID(L,M){!L||!M||(this.appId=L,this.sessionId=M,this.reportStartAndCache())}reportStartAndCache(){if(!this.tracker||!this.sessionId)return;this.endReported=!1;const L={task_btm_sec:0,task_duration:0,task_etm_sec:0,task_type:"session"},M=[this.getLogParams(Ke.TASK_UPLOAD_BEGIN,L),this.getLogParams(Ke.SESSION_UPLOAD_BEGIN,L)];this.tracker.sendBatchLogsImmediate(M),this.logCache.forEach(V=>{this.sendLog(V)})}reportEnd(L=!1){if(!this.tracker||!this.sessionId||this.endReported){this.reset();return}const M={task_btm_sec:0,task_duration:0,task_etm_sec:0,task_type:"session"},V=[this.getLogParams(Ke.SESSION_UPLOAD_END,M),this.getLogParams(Ke.TASK_UPLOAD_END,M)];L?this.sendLogBeforeUnload(V):(this.tracker.sendBatchLogsImmediate(V),this.endReported=!0),this.reset()}getLogParams(L,M){return{appid:`${window.location.host}`,appid_list:this.appId,appver:"",b_sesid:this.bSesid,biz_type:"rtc",cpu_info:ii,db:Yr.browserName,dm:Yr.browserVersion,install_uuid:this.clientId,logger_v:"0.0.1",os:qr.systemName,osv:qr.systemVersion,p_sesid:this.bSesid,sdk_version:zr,sdkname:"AliRTCSdk",stm:Date.now(),tar_pf:"web",traceid:this.sessionId,event_id:L,...M||{}}}sendLog(L){if(!this.tracker||!this.sessionId)return;this.logSequence+=1;const M=this.getLogParams(Ke.SESSION_UPLOAD_ING,{log:L,stat_log_seq:this.logSequence});this.tracker.send(M)}addLog(L){const M=qt(),V=`[${Kr()} ${M}] ${L}`;!this.sessionId||!this.tracker?(this.logCache.push(V),this.logCache.length>=ai&&this.logCache.shift()):this.sendLog(V)}}var ci=Object.defineProperty,ui=(Y,L,M)=>L in Y?ci(Y,L,{enumerable:!0,configurable:!0,writable:!0,value:M}):Y[L]=M,di=(Y,L,M)=>ui(Y,L+"",M);class Ze{static getLogger(){return this.logger||(this.logger=new si),this.logger}static init(){this.getLogger().init()}static destroy(){this.getLogger().destroy()}static setLogLevel(L){this.getLogger().changeConfig({logLevel:L})}static setSessionID(L,M){this.getLogger().setSessionID(L,M)}static reportEnd(){this.getLogger().reportEnd()}static interface(...L){this.getLogger().a("[API]",...L)}static interfaceResult(L,M,V,...Q){V?this.getLogger().ar("[ARE]",L,M,...Q):this.getLogger().ae("[ARE]",L,M,...Q)}static event(...L){this.getLogger().ev("[EVT]",...L)}static debug(...L){this.getLogger().d("[DBG]",...L)}static info(...L){this.getLogger().i("[INF]",...L)}static warn(...L){this.getLogger().w("[WARN]",...L)}static error(...L){this.getLogger().e("[ERR]",...L)}}di(Ze,"logger");var li=Object.defineProperty,pi=(Y,L,M)=>L in Y?li(Y,L,{enumerable:!0,configurable:!0,writable:!0,value:M}):Y[L]=M,Xe=(Y,L,M)=>pi(Y,typeof L!="symbol"?L+"":L,M);const Xr=48e3,tt="[AliyunAudio3A] ";class fi extends Jr{constructor(L){super("AliRtcAudioProcessPlugin",$r.AliRtcSdkStreamTypeCapture,Zr.AUDIO),Xe(this,"audioProcessor"),Xe(this,"slsReporter"),Xe(this,"enableSoft3ACheck",!1),Xe(this,"useHardOnly",!1),Xe(this,"lastDiffOutputLog",""),Xe(this,"audioContext",new AudioContext({sampleRate:Xr})),Xe(this,"farNode"),Xe(this,"createNode",M=>this.audioContext.createMediaStreamSource(new MediaStream([M]))),this.options=L,this.slsReporter=L?.slsReporter,this.enableSoft3ACheck=L?.enableSoft3ACheck||!1,this.useHardOnly=L?.useHardOnly||!1,this.zIndex=7,document.addEventListener("click",this.activeAudioContext)}activeAudioContext(){this.audioContext.resume(),document.removeEventListener("click",this.activeAudioContext)}audioUpdated(L){return this.lastInputAudioTrack?.id!==L.currentAudioTrack?.id}videoUpdated(L){return console.log("videoUpdated",L),!1}setOptions(L){this.farNode||!L.farMediaStream||(this.farNode=this.audioContext.createMediaStreamSource(L.farMediaStream),this.audioProcessor&&this.audioProcessor?.addFarNode(this.farNode),this.options={...this.options,...L})}isSupported(){return Jt.isSupported()}shouldUpdate(L){return!!(L.originAudioTrack&&!this.audioProcessor||!L.originAudioTrack&&this.audioProcessor)}async process(L){if(!L.currentAudioTrack){L.updateAudioTrack(),this.clear(L);return}if(!this.audioProcessor){Ze.info(tt,"create audio processor this.options:",this.options),this.audioProcessor=new Jt({aecOn:!0,ansOn:!0,agcOn:!0,dumpOn:this.options?.dumpAudioData||!1,aiaecOn:this.options.aiaecOn||!1,useHardOnly:this.useHardOnly,wasmCdnPath:this.options.wasmCdnPath||"https://g.alicdn.com/code/npm/@ali/aliyun-audio-3a/0.0.6/"}),this.audioProcessor.on("dumpdata",(V,Q)=>{let j=3e3;Q.includes("far")?j=5e3:Q.includes("output")?j=1e4:Q.includes("meta")&&(j=8e3),setTimeout(()=>{const T=URL.createObjectURL(V),_=document.createElement("a");_.href=T,_.download=Q,document.body.appendChild(_),_.click(),document.body.removeChild(_)},j)}),this.audioProcessor.on("loadsuccess",()=>{Ze.info(tt,"loadsuccess"),this.enableSoft3ACheck||L.updateAudioTrack(this.audioProcessor?.targetMediaTrack),this.options.dumpAudioData&&this.audioProcessor?.startDump()}),this.audioProcessor.on("loaderror",V=>{Ze.error(tt,"loaderror:",V?.message),this.emit("error",V)}),this.audioProcessor.on("outputlog",V=>{Ze.info(tt,"outputlog:",V),V?.includes("diff")&&(this.lastDiffOutputLog=V||"")}),this.audioProcessor.on("statdata",V=>{if(V)try{let Q=V;if(this.lastDiffOutputLog){const j=this.extractDiffValue(this.lastDiffOutputLog),T=JSON.parse(V);j!==null&&(T.diff=j);const _=this.extractLeakValue(this.lastDiffOutputLog);_!==null&&(T.leak=_),Q=JSON.stringify(T)}this.slsReporter?.reportPublishAudio3A("","","",Q)}catch(Q){Ze.error(tt,"statdata error:",Q)}});const M=this.createNode(L.currentAudioTrack);await this.audioProcessor.createProcessor(this.audioContext,M,1,Xr,this.farNode)}}extractDiffValue(L){if(!L)return null;const M=L.match(/diff\s*=\s*(-?\d+\.?\d*)/);return M?parseFloat(M[1]):null}extractLeakValue(L){if(!L)return null;const M=L.match(/leak\s*=\s*(-?\d+\.?\d*)/);return M?parseFloat(M[1]):null}clear(L){this.options.dumpAudioData&&this.audioProcessor?.stopDump(),super.clear(L),this.audioProcessor?.destroy(),this.audioProcessor=void 0,document.removeEventListener("click",this.activeAudioContext),this.farNode?.disconnect(),this.farNode=void 0}dump(){this.audioProcessor?.stopDump()}}export{fi as default};
|
|
163
|
+
`+i),console.error("Failed log data:",e))}}class a extends v{constructor(r){super(Object.assign({},r,{installUnloadHook:i=>{window.addEventListener("beforeunload",()=>{i()})},sendPayload:(i,o)=>{c(i,o)}}))}}d=window,f="SLS_Tracker",y=a,m(d,f,y)},4198:j=>{j.exports=JSON.parse('{"name":"axios","version":"0.21.4","description":"Promise based HTTP client for the browser and node.js","main":"index.js","scripts":{"test":"grunt test","start":"node ./sandbox/server.js","build":"NODE_ENV=production grunt build","preversion":"npm test","version":"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json","postversion":"git push && git push --tags","examples":"node ./examples/server.js","coveralls":"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js","fix":"eslint --fix lib/**/*.js"},"repository":{"type":"git","url":"https://github.com/axios/axios.git"},"keywords":["xhr","http","ajax","promise","node"],"author":"Matt Zabriskie","license":"MIT","bugs":{"url":"https://github.com/axios/axios/issues"},"homepage":"https://axios-http.com","devDependencies":{"coveralls":"^3.0.0","es6-promise":"^4.2.4","grunt":"^1.3.0","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^23.0.0","grunt-karma":"^4.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^4.0.2","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1","karma":"^6.3.2","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^2.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^4.3.6","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.8","karma-webpack":"^4.0.2","load-grunt-tasks":"^3.5.2","minimist":"^1.2.0","mocha":"^8.2.1","sinon":"^4.5.0","terser-webpack-plugin":"^4.2.3","typescript":"^4.0.5","url-search-params":"^0.10.0","webpack":"^4.44.2","webpack-dev-server":"^3.11.0"},"browser":{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},"jsdelivr":"dist/axios.min.js","unpkg":"dist/axios.min.js","typings":"./index.d.ts","dependencies":{"follow-redirects":"^1.14.0"},"bundlesize":[{"path":"./dist/axios.min.js","threshold":"5kB"}]}')}},V={};function Q(j){var T=V[j];if(T!==void 0)return T.exports;var _=V[j]={exports:{}};return M[j].call(_.exports,_,_.exports,Q),_.exports}return Q.n=j=>{var T=j&&j.__esModule?()=>j.default:()=>j;return Q.d(T,{a:T}),T},Q.d=(j,T)=>{for(var _ in T)Q.o(T,_)&&!Q.o(j,_)&&Object.defineProperty(j,_,{enumerable:!0,get:T[_]})},Q.o=(j,T)=>Object.prototype.hasOwnProperty.call(j,T),Q.r=j=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(j,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(j,"__esModule",{value:!0})},Q(8156)})())})(Vr);for(var jn=Vr.exports,Le=[],Gt=0;Gt<256;++Gt)Le.push((Gt+256).toString(16).slice(1));function Wn(Y,L=0){return(Le[Y[L+0]]+Le[Y[L+1]]+Le[Y[L+2]]+Le[Y[L+3]]+"-"+Le[Y[L+4]]+Le[Y[L+5]]+"-"+Le[Y[L+6]]+Le[Y[L+7]]+"-"+Le[Y[L+8]]+Le[Y[L+9]]+"-"+Le[Y[L+10]]+Le[Y[L+11]]+Le[Y[L+12]]+Le[Y[L+13]]+Le[Y[L+14]]+Le[Y[L+15]]).toLowerCase()}var nt,Gn=new Uint8Array(16);function zn(){if(!nt&&(nt=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!nt))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return nt(Gn)}var Yn=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Hr={randomUUID:Yn};function it(Y,L,M){if(Hr.randomUUID&&!L&&!Y)return Hr.randomUUID();Y=Y||{};var V=Y.random||(Y.rng||zn)();return V[6]=V[6]&15|64,V[8]=V[8]&63|128,Wn(V)}var qn=/d{1,4}|D{3,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|W{1,2}|[LlopSZN]|"[^"]*"|'[^']*'/g,Kn=/\b(?:[A-Z]{1,3}[A-Z][TC])(?:[-+]\d{4})?|((?:Australian )?(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time)\b/g,Xn=/[^-+\dA-Z]/g;function zt(Y,L,M,V){if(arguments.length===1&&typeof Y=="string"&&!/\d/.test(Y)&&(L=Y,Y=void 0),Y=Y||Y===0?Y:new Date,Y instanceof Date||(Y=new Date(Y)),isNaN(Y))throw TypeError("Invalid date");L=String(jr[L]||L||jr.default);var Q=L.slice(0,4);(Q==="UTC:"||Q==="GMT:")&&(L=L.slice(4),M=!0,Q==="GMT:"&&(V=!0));var j=function(){return M?"getUTC":"get"},T=function(){return Y[j()+"Date"]()},_=function(){return Y[j()+"Day"]()},m=function(){return Y[j()+"Month"]()},d=function(){return Y[j()+"FullYear"]()},f=function(){return Y[j()+"Hours"]()},y=function(){return Y[j()+"Minutes"]()},v=function(){return Y[j()+"Seconds"]()},s=function(){return Y[j()+"Milliseconds"]()},c=function(){return M?0:Y.getTimezoneOffset()},a=function(){return Qn(Y)},e=function(){return Jn(Y)},r={d:function(){return T()},dd:function(){return je(T())},ddd:function(){return Ve.dayNames[_()]},DDD:function(){return Wr({y:d(),m:m(),d:T(),_:j(),dayName:Ve.dayNames[_()],short:!0})},dddd:function(){return Ve.dayNames[_()+7]},DDDD:function(){return Wr({y:d(),m:m(),d:T(),_:j(),dayName:Ve.dayNames[_()+7]})},m:function(){return m()+1},mm:function(){return je(m()+1)},mmm:function(){return Ve.monthNames[m()]},mmmm:function(){return Ve.monthNames[m()+12]},yy:function(){return String(d()).slice(2)},yyyy:function(){return je(d(),4)},h:function(){return f()%12||12},hh:function(){return je(f()%12||12)},H:function(){return f()},HH:function(){return je(f())},M:function(){return y()},MM:function(){return je(y())},s:function(){return v()},ss:function(){return je(v())},l:function(){return je(s(),3)},L:function(){return je(Math.floor(s()/10))},t:function(){return f()<12?Ve.timeNames[0]:Ve.timeNames[1]},tt:function(){return f()<12?Ve.timeNames[2]:Ve.timeNames[3]},T:function(){return f()<12?Ve.timeNames[4]:Ve.timeNames[5]},TT:function(){return f()<12?Ve.timeNames[6]:Ve.timeNames[7]},Z:function(){return V?"GMT":M?"UTC":$n(Y)},o:function(){return(c()>0?"-":"+")+je(Math.floor(Math.abs(c())/60)*100+Math.abs(c())%60,4)},p:function(){return(c()>0?"-":"+")+je(Math.floor(Math.abs(c())/60),2)+":"+je(Math.floor(Math.abs(c())%60),2)},S:function(){return["th","st","nd","rd"][T()%10>3?0:(T()%100-T()%10!=10)*T()%10]},W:function(){return a()},WW:function(){return je(a())},N:function(){return e()}};return L.replace(qn,function(i){return i in r?r[i]():i.slice(1,i.length-1)})}var jr={default:"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",paddedShortDate:"mm/dd/yyyy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:sso",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'",expiresHeaderFormat:"ddd, dd mmm yyyy HH:MM:ss Z"},Ve={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"],timeNames:["a","p","am","pm","A","P","AM","PM"]},je=function(L){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;return String(L).padStart(M,"0")},Wr=function(L){var M=L.y,V=L.m,Q=L.d,j=L._,T=L.dayName,_=L.short,m=_===void 0?!1:_,d=new Date,f=new Date;f.setDate(f[j+"Date"]()-1);var y=new Date;y.setDate(y[j+"Date"]()+1);var v=function(){return d[j+"Date"]()},s=function(){return d[j+"Month"]()},c=function(){return d[j+"FullYear"]()},a=function(){return f[j+"Date"]()},e=function(){return f[j+"Month"]()},r=function(){return f[j+"FullYear"]()},i=function(){return y[j+"Date"]()},o=function(){return y[j+"Month"]()},t=function(){return y[j+"FullYear"]()};return c()===M&&s()===V&&v()===Q?m?"Tdy":"Today":r()===M&&e()===V&&a()===Q?m?"Ysd":"Yesterday":t()===M&&o()===V&&i()===Q?m?"Tmw":"Tomorrow":T},Qn=function(L){var M=new Date(L.getFullYear(),L.getMonth(),L.getDate());M.setDate(M.getDate()-(M.getDay()+6)%7+3);var V=new Date(M.getFullYear(),0,4);V.setDate(V.getDate()-(V.getDay()+6)%7+3);var Q=M.getTimezoneOffset()-V.getTimezoneOffset();M.setHours(M.getHours()-Q);var j=(M-V)/(864e5*7);return 1+Math.floor(j)},Jn=function(L){var M=L.getDay();return M===0&&(M=7),M},$n=function(L){return(String(L).match(Kn)||[""]).pop().replace(Xn,"").replace(/GMT\+0000/g,"UTC")},Yt;(function(Y){Y.prod="rs.rtn.aliyuncs.com",Y.pre="prs.rtn.aliyuncs.com"})(Yt||(Yt={}));var Gr;(function(Y){Y[Y.ByClient=0]="ByClient",Y[Y.KickOut=1]="KickOut",Y[Y.ChannelClosed=2]="ChannelClosed",Y[Y.Restore=3]="Restore",Y[Y.Expired=4]="Expired",Y[Y.Reconnect=5]="Reconnect",Y[Y.ReconnectExhausted=6]="ReconnectExhausted"})(Gr||(Gr={}));const zr="7.1.5";class Kt{static getVersionNumber(){let L=zr.split("."),M="";return L.forEach(V=>{V.length===1?M+="0"+V:M+=V}),parseInt(M)}static queryingParam(L){let M=[];if(L)for(let V in L)M.push(V+"="+L[V]);return M.join("&")}static getQueryParams(L){const M=window.location.search.substring(1).split("&");for(let V=0;V<M.length;V++){const Q=M[V].split("=");if(decodeURIComponent(Q[0])===L)return decodeURIComponent(Q[1])}}static createCallid(L=""){const M=it();return L&&M&&M.length>L.length?`${L}${M.substring(L.length)}`:M}static checkSubOptionsValid(L){if(L){const{audio:M,video:V,screen:Q}=L;if(M===!1&&V===!1&&Q===!1)return!1}return!0}static async isNetworkAvailable(){const L=Yt.prod,{onLine:M}=navigator;if(!M)return!1;try{return await fetch(`https://${L}/roomserver/v1/ws/version`),!0}catch{return!1}}static toString(L){let M;if(L instanceof Error)M=L.message;else if(typeof L=="string")M=L;else try{M=JSON.stringify(L)}catch{M="undefined"}return M}static paramArrayToString(L){let M="";for(let V=0;V<L.length;V++){M!==""&&(M+=" ");let Q=Kt.toString(L[V]);M+=Q}return M}}const Zn=(Y,L)=>Y.find(M=>{if(typeof M.test=="function")return M.test(L);if(Array.isArray(M.test))return M.test.some(V=>typeof V=="string"?L.indexOf(V)>-1:V instanceof RegExp?V.test(L):!1)}),ei=[{test:["wow64","win64","x64"],describe(){return"amd64"}},{test:["i686","x86"],describe(){return"x86"}},{test:["aarch64","arm64"],describe(){return"arm64"}},{test:["arm"],describe(){return"arm"}}],ti=()=>{let Y="unknown";try{const L=navigator.userAgent||"",M=Zn(ei,L);if(!M)return Y;Y=M.describe(L)}catch{}return Y};var ri=Object.defineProperty,ni=(Y,L,M)=>L in Y?ri(Y,L,{enumerable:!0,configurable:!0,writable:!0,value:M}):Y[L]=M,we=(Y,L,M)=>ni(Y,typeof L!="symbol"?L+"":L,M);const{BrowserUtil:Yr,SystenUtil:qr}=jn.AliRTS,ii=ti(),oi="woMMssV6jmyol9fr",ai=200,ot=10*60*1e3,at={host:"cn-hangzhou.log.aliyuncs.com",project:"alivc-aio",logstore:"logger",time:10,count:10};function qt(){return zt(new Date,"HH:MM:ss.l")}function Kr(){return zt(new Date,"isoDate")}var He;(function(Y){Y[Y.DEBUG=0]="DEBUG",Y[Y.INFO=1]="INFO",Y[Y.API=2]="API",Y[Y.WARNING=3]="WARNING",Y[Y.ERROR=4]="ERROR",Y[Y.NONE=5]="NONE"})(He||(He={}));var Ke;(function(Y){Y[Y.TASK_UPLOAD_BEGIN=710201]="TASK_UPLOAD_BEGIN",Y[Y.SESSION_UPLOAD_BEGIN=710202]="SESSION_UPLOAD_BEGIN",Y[Y.SESSION_UPLOAD_ING=710203]="SESSION_UPLOAD_ING",Y[Y.SESSION_UPLOAD_END=710204]="SESSION_UPLOAD_END",Y[Y.TASK_UPLOAD_END=710205]="TASK_UPLOAD_END"})(Ke||(Ke={}));class si{constructor(){we(this,"tracker"),we(this,"slsPlugin"),we(this,"stsData"),we(this,"stsExpiration",Date.now()),we(this,"clientId",it()),we(this,"bSesid",it()),we(this,"logLevel",He.WARNING),we(this,"appId",""),we(this,"sessionId",""),we(this,"logCache",[]),we(this,"updateTaskTimer"),we(this,"endReported",!0),we(this,"logSequence",0),we(this,"sendLogBeforeUnload",async L=>{if(!this.slsPlugin)return;this.logSequence+=1,L.unshift(this.getLogParams(Ke.SESSION_UPLOAD_ING,{log:`[${Kr()} ${qt()}] [INF] beforeunload`,stat_log_seq:this.logSequence}));const M=`https://${at.project}.${at.host}/logstores/${at.logstore}`,V={__logs__:L.map(T=>this.slsPlugin.transString(T))},{data:Q,header:j}=await this.slsPlugin.process(M,JSON.stringify(V));fetch(M,{keepalive:!0,method:"POST",headers:j,body:Q})}),we(this,"logMethod",(L,M=console.log)=>(...V)=>{let Q=qt();this.logLevel<=L&&M(Q,...V);let j=Kt.paramArrayToString(V);L>He.DEBUG&&this.addLog(j)}),we(this,"d",this.logMethod(He.DEBUG,console.debug)),we(this,"i",this.logMethod(He.INFO)),we(this,"w",this.logMethod(He.WARNING,console.warn)),we(this,"e",this.logMethod(He.ERROR,(...L)=>{const[M,...V]=L;console.error(M,"<error>",V)})),we(this,"ev",this.logMethod(He.API)),we(this,"a",this.logMethod(He.API,(...L)=>{const[M,...V]=L;if(V.length>2){const Q=`${V[1]}`;Q.startsWith("__g__")&&console.group(`${Q.substring(5)}_${V[2]}`)}console.log(M,...V)})),we(this,"ar",this.logMethod(He.API,(...L)=>{const[M,...V]=L;console.log(M,...V),V.length>2&&`${V[1]}`.startsWith("__g__")&&console.groupEnd()})),we(this,"ae",this.logMethod(He.API,(...L)=>{const[M,...V]=L;console.error(M,"<error>",...V),V.length>2&&`${V[1]}`.startsWith("__g__")&&console.groupEnd()})),window.addEventListener("beforeunload",()=>{this.reportEnd(!0)})}init(){this.reset(),this.startSTSUpdateTask()}destroy(){this.updateTaskTimer&&clearTimeout(this.updateTaskTimer)}reset(){this.bSesid=it(),this.endReported=!0,this.logSequence=0,this.appId="",this.sessionId=""}async startSTSUpdateTask(){this.updateTaskTimer&&clearTimeout(this.updateTaskTimer);try{const L=await this.refreshSTSToken();this.createTracker(L)}catch{}this.updateTaskTimer=setTimeout(()=>{this.startSTSUpdateTask()},ot)}async refreshSTSToken(){if(!this.stsData||this.stsExpiration<=Date.now()-ot){const L=await this.requestSTSToken(),M=new Date(L?.Expiration).getTime()||0,V=Date.now()+ot;this.stsExpiration=Math.max(M,V),this.stsData=L}return this.stsData}requestSTSToken(){const L=Date.now(),M=`${this.clientId}|${oi}|${L}`,V={Action:"AssumeSlsRoleV2",AuthInfo:et.MD5(M).toString(et.enc.Hex),ClientId:this.clientId,BusinessType:"logger",AppVersion:"1.0",Version:"2017-03-14",AuthTimestamp:`${L}`,TerminalType:"web",DeviceModel:"",Format:"JSON",SignatureMethod:"HMAC-SHA1",SignatureVersion:"1.0",Timestamp:zt(L,"isoUtcDateTime")},Q=`https://slsrole.alicdn.com/?${new URLSearchParams(V).toString()}`;return fetch(Q).then(j=>j.json()).then(j=>JSON.parse(window.atob(j.SlsAuthResult)))}createTracker(L){if(!this.tracker){const M={accessKeyId:L.AccessKeyId,accessKeySecret:L.AccessKeySecret,securityToken:L.SecurityToken,refreshSTSTokenInterval:ot,stsTokenFreshTime:void 0,refreshSTSToken:()=>{this.refreshSTSToken().then(j=>{M.accessKeyId=j.AccessKeyId,M.accessKeySecret=j.AccessKeySecret,M.securityToken=j.SecurityToken}).catch(()=>{})}},V=new er(at),Q=Fr(M);V.useStsPlugin(Q),this.slsPlugin=Q,this.tracker=V,this.reportStartAndCache()}}changeConfig(L){L.logLevel!==void 0&&L.logLevel>=He.DEBUG&&L.logLevel<=He.NONE&&(this.logLevel=L.logLevel)}setSessionID(L,M){!L||!M||(this.appId=L,this.sessionId=M,this.reportStartAndCache())}reportStartAndCache(){if(!this.tracker||!this.sessionId)return;this.endReported=!1;const L={task_btm_sec:0,task_duration:0,task_etm_sec:0,task_type:"session"},M=[this.getLogParams(Ke.TASK_UPLOAD_BEGIN,L),this.getLogParams(Ke.SESSION_UPLOAD_BEGIN,L)];this.tracker.sendBatchLogsImmediate(M),this.logCache.forEach(V=>{this.sendLog(V)})}reportEnd(L=!1){if(!this.tracker||!this.sessionId||this.endReported){this.reset();return}const M={task_btm_sec:0,task_duration:0,task_etm_sec:0,task_type:"session"},V=[this.getLogParams(Ke.SESSION_UPLOAD_END,M),this.getLogParams(Ke.TASK_UPLOAD_END,M)];L?this.sendLogBeforeUnload(V):(this.tracker.sendBatchLogsImmediate(V),this.endReported=!0),this.reset()}getLogParams(L,M){return{appid:`${window.location.host}`,appid_list:this.appId,appver:"",b_sesid:this.bSesid,biz_type:"rtc",cpu_info:ii,db:Yr.browserName,dm:Yr.browserVersion,install_uuid:this.clientId,logger_v:"0.0.1",os:qr.systemName,osv:qr.systemVersion,p_sesid:this.bSesid,sdk_version:zr,sdkname:"AliRTCSdk",stm:Date.now(),tar_pf:"web",traceid:this.sessionId,event_id:L,...M||{}}}sendLog(L){if(!this.tracker||!this.sessionId)return;this.logSequence+=1;const M=this.getLogParams(Ke.SESSION_UPLOAD_ING,{log:L,stat_log_seq:this.logSequence});this.tracker.send(M)}addLog(L){const M=qt(),V=`[${Kr()} ${M}] ${L}`;!this.sessionId||!this.tracker?(this.logCache.push(V),this.logCache.length>=ai&&this.logCache.shift()):this.sendLog(V)}}var ci=Object.defineProperty,ui=(Y,L,M)=>L in Y?ci(Y,L,{enumerable:!0,configurable:!0,writable:!0,value:M}):Y[L]=M,di=(Y,L,M)=>ui(Y,L+"",M);class Ze{static getLogger(){return this.logger||(this.logger=new si),this.logger}static init(){this.getLogger().init()}static destroy(){this.getLogger().destroy()}static setLogLevel(L){this.getLogger().changeConfig({logLevel:L})}static setSessionID(L,M){this.getLogger().setSessionID(L,M)}static reportEnd(){this.getLogger().reportEnd()}static interface(...L){this.getLogger().a("[API]",...L)}static interfaceResult(L,M,V,...Q){V?this.getLogger().ar("[ARE]",L,M,...Q):this.getLogger().ae("[ARE]",L,M,...Q)}static event(...L){this.getLogger().ev("[EVT]",...L)}static debug(...L){this.getLogger().d("[DBG]",...L)}static info(...L){this.getLogger().i("[INF]",...L)}static warn(...L){this.getLogger().w("[WARN]",...L)}static error(...L){this.getLogger().e("[ERR]",...L)}}di(Ze,"logger");var li=Object.defineProperty,pi=(Y,L,M)=>L in Y?li(Y,L,{enumerable:!0,configurable:!0,writable:!0,value:M}):Y[L]=M,Xe=(Y,L,M)=>pi(Y,typeof L!="symbol"?L+"":L,M);const Xr=48e3,tt="[AliyunAudio3A] ";class fi extends Jr{constructor(L){super("AliRtcAudioProcessPlugin",$r.AliRtcSdkStreamTypeCapture,Zr.AUDIO),Xe(this,"audioProcessor"),Xe(this,"slsReporter"),Xe(this,"enableSoft3ACheck",!1),Xe(this,"useHardOnly",!1),Xe(this,"lastDiffOutputLog",""),Xe(this,"audioContext",new AudioContext({sampleRate:Xr})),Xe(this,"farNode"),Xe(this,"createNode",M=>this.audioContext.createMediaStreamSource(new MediaStream([M]))),this.options=L,this.slsReporter=L?.slsReporter,this.enableSoft3ACheck=L?.enableSoft3ACheck||!1,this.useHardOnly=L?.useHardOnly||!1,this.zIndex=7,document.addEventListener("click",this.activeAudioContext)}activeAudioContext(){this.audioContext.resume(),document.removeEventListener("click",this.activeAudioContext)}audioUpdated(L){return this.lastInputAudioTrack?.id!==L.currentAudioTrack?.id}videoUpdated(L){return console.log("videoUpdated",L),!1}setOptions(L){this.farNode||!L.farMediaStream||(this.farNode=this.audioContext.createMediaStreamSource(L.farMediaStream),this.audioProcessor&&this.audioProcessor?.addFarNode(this.farNode),this.options={...this.options,...L})}isSupported(){return Jt.isSupported()}shouldUpdate(L){return!!(L.originAudioTrack&&!this.audioProcessor||!L.originAudioTrack&&this.audioProcessor)}async process(L){if(!L.currentAudioTrack){L.updateAudioTrack(),this.clear(L);return}if(!this.audioProcessor){Ze.info(tt,"create audio processor this.options:",this.options),this.audioProcessor=new Jt({aecOn:!0,ansOn:!0,agcOn:!0,dumpOn:this.options?.dumpAudioData||!1,aiaecOn:this.options.aiaecOn||!1,useHardOnly:this.useHardOnly,wasmCdnPath:this.options.wasmCdnPath||"https://g.alicdn.com/code/npm/@ali/aliyun-audio-3a/0.0.6/"}),this.audioProcessor.on("dumpdata",(V,Q)=>{let j=3e3;Q.includes("far")?j=5e3:Q.includes("output")?j=1e4:Q.includes("meta")&&(j=8e3),setTimeout(()=>{const T=URL.createObjectURL(V),_=document.createElement("a");_.href=T,_.download=Q,document.body.appendChild(_),_.click(),document.body.removeChild(_)},j)}),this.audioProcessor.on("loadsuccess",()=>{Ze.info(tt,"loadsuccess"),this.enableSoft3ACheck||L.updateAudioTrack(this.audioProcessor?.targetMediaTrack),this.options.dumpAudioData&&this.audioProcessor?.startDump()}),this.audioProcessor.on("loaderror",V=>{Ze.error(tt,"loaderror:",V?.message),this.emit("error",V)}),this.audioProcessor.on("outputlog",V=>{Ze.info(tt,"outputlog:",V),V?.includes("diff")&&(this.lastDiffOutputLog=V||"")}),this.audioProcessor.on("statdata",V=>{if(V)try{let Q=V;if(this.lastDiffOutputLog){const j=this.extractDiffValue(this.lastDiffOutputLog),T=JSON.parse(V);j!==null&&(T.diff=j);const _=this.extractLeakValue(this.lastDiffOutputLog);_!==null&&(T.leak=_),Q=JSON.stringify(T)}this.slsReporter?.reportPublishAudio3A("","","",Q)}catch(Q){Ze.error(tt,"statdata error:",Q)}});const M=this.createNode(L.currentAudioTrack);await this.audioProcessor.createProcessor(this.audioContext,M,1,Xr,this.farNode)}}extractDiffValue(L){if(!L)return null;const M=L.match(/diff\s*=\s*(-?\d+\.?\d*)/);return M?parseFloat(M[1]):null}extractLeakValue(L){if(!L)return null;const M=L.match(/leak\s*=\s*(-?\d+\.?\d*)/);return M?parseFloat(M[1]):null}clear(L){this.options.dumpAudioData&&this.audioProcessor?.stopDump(),super.clear(L),this.audioProcessor?.destroy(),this.audioProcessor=void 0,document.removeEventListener("click",this.activeAudioContext),this.farNode?.disconnect(),this.farNode=void 0}dump(){this.audioProcessor?.stopDump()}}export{fi as default};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -2601,6 +2601,7 @@ declare interface JoinInfo {
|
|
|
2601
2601
|
|
|
2602
2602
|
declare interface JoinResult {
|
|
2603
2603
|
l1ip?: string;
|
|
2604
|
+
l1subip?: string;
|
|
2604
2605
|
pushstreamurl: string;
|
|
2605
2606
|
tid: string;
|
|
2606
2607
|
users: JoinInfo[];
|
|
@@ -2776,7 +2777,6 @@ declare class LocalUser extends User {
|
|
|
2776
2777
|
constructor(config: LocalUserConfig);
|
|
2777
2778
|
get url(): string;
|
|
2778
2779
|
set url(value: string);
|
|
2779
|
-
set preferredPubL1Ip(value: string);
|
|
2780
2780
|
get joined(): boolean;
|
|
2781
2781
|
get isPublishing(): boolean;
|
|
2782
2782
|
get publishStreams(): PublishStreamInfo;
|
|
@@ -3926,6 +3926,7 @@ declare class RtsManager extends default_2<RtsManagerEventListener> {
|
|
|
3926
3926
|
private _publishingTracks;
|
|
3927
3927
|
private parameter;
|
|
3928
3928
|
preferredPubL1Ip?: string;
|
|
3929
|
+
preferredSubL1Ip?: string;
|
|
3929
3930
|
constructor(localStreamManager: LocalStreamManager, slsReporter: SLSReporter, parameter: Parameter);
|
|
3930
3931
|
private addRTSListener;
|
|
3931
3932
|
/**
|
|
@@ -3965,7 +3966,7 @@ declare class RtsManager extends default_2<RtsManagerEventListener> {
|
|
|
3965
3966
|
private httpSubscribe;
|
|
3966
3967
|
private subscribeAdd;
|
|
3967
3968
|
subscribeDelete(subscribeOptions: RemoteSubscribeOptions): Promise<ISubDeleteResult | undefined>;
|
|
3968
|
-
|
|
3969
|
+
subscribeStop(streamUrl: string): Promise<void>;
|
|
3969
3970
|
subscribeAddDataChannel(streamUrl: string): Promise<any>;
|
|
3970
3971
|
subscribeStopDatachannel(streamUrl: string, datachannel: any): Promise<any>;
|
|
3971
3972
|
publish(streamUrl: string, callId: string, isResume?: boolean, reason?: PublishReason): Promise<{
|
|
@@ -3973,7 +3974,7 @@ declare class RtsManager extends default_2<RtsManagerEventListener> {
|
|
|
3973
3974
|
l1ip?: string;
|
|
3974
3975
|
}>;
|
|
3975
3976
|
private reportSubscribeLatency;
|
|
3976
|
-
subscribe(remoteSubscribeOptions: RemoteSubscribeOptions, reason: SubscribeReason, callId: string, remoteCallId: string, startTs: number): Promise<any>;
|
|
3977
|
+
subscribe(remoteSubscribeOptions: RemoteSubscribeOptions, reason: SubscribeReason, callId: string, remoteCallId: string, startTs: number, retryCount?: number): Promise<any>;
|
|
3977
3978
|
getSubscribeVideoStats(streamUrl: string, msid?: string): Promise<unknown>;
|
|
3978
3979
|
getSubscribeAudioStats(streamUrl: string, msid?: string): Promise<unknown>;
|
|
3979
3980
|
getStreamByMsid(config: any): LocalStream | RemoteStream;
|