aliyun-rtc-sdk 7.0.1 → 7.0.2
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.
|
@@ -157,4 +157,4 @@ t=0 0\r
|
|
|
157
157
|
a=extmap-allow-mixed`)!==-1){const $=Y.sdp.split(`
|
|
158
158
|
`).filter(ee=>ee.trim()!=="a=extmap-allow-mixed").join(`
|
|
159
159
|
`);w.RTCSessionDescription&&Y instanceof w.RTCSessionDescription?arguments[0]=new w.RTCSessionDescription({type:Y.type,sdp:$}):Y.sdp=$}return z.apply(this,arguments)}}function Ne(w,K){if(!w.RTCPeerConnection||!w.RTCPeerConnection.prototype)return;const z=w.RTCPeerConnection.prototype.addIceCandidate;z&&z.length!==0&&(w.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():z.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}const xe=function({window:w}={},K={shimChrome:!0,shimFirefox:!0,shimEdge:!0,shimSafari:!0}){const z=s,Y=function(ee){const J={browser:null,version:null};if(ee===void 0||!ee.navigator)return J.browser="Not a browser.",J;const{navigator:ie}=ee;if(ie.mozGetUserMedia)J.browser="firefox",J.version=p(ie.userAgent,/Firefox\/(\d+)\./,1);else if(ie.webkitGetUserMedia||ee.isSecureContext===!1&&ee.webkitRTCPeerConnection&&!ee.RTCIceGatherer)J.browser="chrome",J.version=p(ie.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(ie.mediaDevices&&ie.userAgent.match(/Edge\/(\d+).(\d+)$/))J.browser="edge",J.version=p(ie.userAgent,/Edge\/(\d+).(\d+)$/,2);else{if(!ee.RTCPeerConnection||!ie.userAgent.match(/AppleWebKit\/(\d+)\./))return J.browser="Not a supported browser.",J;J.browser="safari",J.version=p(ie.userAgent,/AppleWebKit\/(\d+)\./,1),J.supportsUnifiedPlan=ee.RTCRtpTransceiver&&"currentDirection"in ee.RTCRtpTransceiver.prototype}return J}(w),$={browserDetails:Y,commonShim:f,extractVersion:p,disableLog:r,disableWarnings:n};switch(Y.browser){case"chrome":if(!m||!I||!K.shimChrome)return z("Chrome shim is not included in this adapter release."),$;if(Y.version===null)return z("Chrome shim can not determine version, not shimming."),$;z("adapter.js shimming chrome."),$.browserShim=m,Ne(w,Y),h(w,Y),g(w),I(w,Y),v(w),A(w,Y),D(w),b(w),T(w),H(w,Y),Ae(w),Pe(w),we(w,Y),Te(w),je(w,Y);break;case"firefox":if(!u||!Q||!K.shimFirefox)return z("Firefox shim is not included in this adapter release."),$;z("adapter.js shimming firefox."),$.browserShim=u,Ne(w,Y),q(w,Y),Q(w,Y),G(w),re(w),te(w),Z(w),oe(w),se(w),ce(w),ue(w),he(w),Ae(w),Pe(w),we(w,Y),Te(w);break;case"edge":if(!c||!P||!K.shimEdge)return z("MS edge shim is not included in this adapter release."),$;z("adapter.js shimming edge."),$.browserShim=c,N(w),O(w),P(w,Y),F(w),we(w,Y),Te(w);break;case"safari":if(!x||!K.shimSafari)return z("Safari shim is not included in this adapter release."),$;z("adapter.js shimming safari."),$.browserShim=x,Ne(w,Y),Re(w),_e(w),le(w),fe(w),Ee(w),Ce(w),pe(w),De(w),Ae(w),we(w,Y),Te(w),je(w,Y);break;default:z("Unsupported browser!")}return $}({window:typeof window>"u"?void 0:window}),me=xe},6834:(U,C,y)=>{y.r(C),y.d(C,{default:()=>u});var m=y(5512),c=y.n(m);function u(){return c()('/*! aliyun rts sdk - ver2.12.3 created:2025/4/15 16:14:52 */(()=>{"use strict";var e={917:(e,r)=>{var t,n,a,o;Object.defineProperty(r,"__esModule",{value:!0}),r.DEFAULT_RETRY_DATACHANNEL_TIMEOUT=r.DEFAULT_HEARTBEAT_TIMEOUT=r.DEFAULT_RETRY_PUBLISH_INTERVAL=r.DEFAULT_RETRY_SUBSCRIBE_INTERVAL=r.DEFAULT_RETRY_PUBLISH_LIMIT=r.DEFAULT_RETRY_SUBSCRIBE_LIMIT=r.EWorkerAction=r.EWorkerSource=r.EConnectStatus=r.TrackType=void 0,function(e){e.AUDIO="audio",e.VIDEO="video"}(t||(r.TrackType=t={})),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"}(n||(r.EConnectStatus=n={})),function(e){e.Sender="sender",e.Receiver="receiver"}(a||(r.EWorkerSource=a={})),function(e){e.Setup="setup",e.InserSEI="insertSEI"}(o||(r.EWorkerAction=o={})),r.DEFAULT_RETRY_SUBSCRIBE_LIMIT=5,r.DEFAULT_RETRY_PUBLISH_LIMIT=5,r.DEFAULT_RETRY_SUBSCRIBE_INTERVAL=2e3,r.DEFAULT_RETRY_PUBLISH_INTERVAL=2e3,r.DEFAULT_HEARTBEAT_TIMEOUT=8,r.DEFAULT_RETRY_DATACHANNEL_TIMEOUT=8e3},594:(e,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.readUUID=r.discardEPB=r.insertEPB=r.SODBtoRBSP=r.convertPayloadSize=r.NALU=r.SEI=r.parseSei=r.insertSei=void 0;r.insertSei=function(e,r,a,o){void 0===a&&(a=5);for(var i=e.data,u=new DataView(i),c=0;;){if(1===u.getUint32(c)){u.getUint8(c+4);var s=new t(r,a,o).buffer,f=new n(s).buffer,T=new ArrayBuffer(f.byteLength+i.byteLength),E=new Uint8Array(T),l=new Uint8Array(f);E.set(l);var d=new Uint8Array(i);E.set(d,f.byteLength),e.data=T,c+=1;break}if((c+=1)+4>=u.byteLength)break}};r.parseSei=function(e){for(var t=[],n=new DataView(e),a=0;;){var o=a,i=n.getUint32(o);if(o+=4,1===i){if(6===(31&n.getUint8(o++))){for(var u=n.getUint8(o++),c=5===u?16:0,s=0;255==n.getUint8(o);)o++,s+=255;if((s+=n.getUint8(o++))>0&&n.byteLength>o+s){var f=new Uint8Array(n.buffer),T="";if(5===u){var E=f.slice(o,o+c);T=(0,r.readUUID)((0,r.discardEPB)(E))}var l=f.slice(o+c,o+s);o+=s,t.push({payloadType:u,uuid:T,data:l.buffer})}}a=o}else a+=1;if(a+4>=n.byteLength)break}return t};var t=function(e,t,n){void 0===t&&(t=5);var a=5===t?16:0,o=e.byteLength+a,i=(0,r.convertPayloadSize)(o),u=i.buffer.byteLength,c=new ArrayBuffer(1+u+a+e.byteLength),s=new Uint8Array(c),f=0;if(s[f++]=t,s.set(i,f),f+=i.byteLength,5===t){n=(n||"00000000-0000-0000-0000-000000000000").replace(/-/g,"");for(var T=0;T<16;T++)s[f+T]=parseInt(n.substr(2*T,2),16);f+=16}var E=new Uint8Array(e);s.set(E,f);var l=(0,r.SODBtoRBSP)(s);this.buffer=l.buffer};r.SEI=t;var n=function(e){var r=new Uint8Array([0,0,0,1]),t=new Uint8Array([6]),n=new ArrayBuffer(r.byteLength+t.byteLength+e.byteLength),a=new Uint8Array(n);a.set(r),a.set(t,r.byteLength),a.set(new Uint8Array(e),r.byteLength+t.byteLength),this.buffer=n};r.NALU=n;r.convertPayloadSize=function(e){if(e<=0)throw new Error("payloadSize must be a positive integer.");for(var r=Math.ceil(e/255),t=new ArrayBuffer(r),n=new DataView(t),a=0;a<r-1;a++)n.setUint8(a,255);return n.setUint8(r-1,e%255&255),new Uint8Array(t)};r.SODBtoRBSP=function(e){for(var t=new Uint8Array(e),n="",a=0;a<t.length;a++)n+=t[a].toString(2).padStart(8,"0");for(n+="1";n.length%8!=0;)n+="0";var o=n.length/8,i=new Uint8Array(o);for(a=0;a<o;a++)i[a]=parseInt(n.slice(8*a,8*a+8),2);return(0,r.insertEPB)(i)};r.insertEPB=function(e){for(var r=[],t=0,n=0;n<e.length;n++)r.push(e[n]),0===e[n]?2===++t&&n<e.length-1&&e[n+1]<=3&&(r.push(3),t=0):t=0;return new Uint8Array(r)};r.discardEPB=function(e){for(var r=e.byteLength,t=[],n=1;n<r-2;)0===e[n]&&0===e[n+1]&&3===e[n+2]?(t.push(n+2),n+=2):n++;if(0===t.length)return e;var a=r-t.length,o=new Uint8Array(a),i=0;for(n=0;n<a;i++,n++)i===t[0]&&(i++,t.shift()),o[n]=e[i];return o};r.readUUID=function(e){if(16!==e.length)throw new Error("UUID must be 16 bytes long.");var r=e.reduce((function(e,r){return e+r.toString(16).padStart(2,"0")}),"");return"".concat(r.slice(0,8),"-").concat(r.slice(8,12),"-").concat(r.slice(12,16),"-").concat(r.slice(16,20),"-").concat(r.slice(20))}},718:function(e,r){var t=this&&this.__spreadArray||function(e,r,t){if(t||2===arguments.length)for(var n,a=0,o=r.length;a<o;a++)!n&&a in r||(n||(n=Array.prototype.slice.call(r,0,a)),n[a]=r[a]);return e.concat(n||Array.prototype.slice.call(r))};Object.defineProperty(r,"__esModule",{value:!0}),r.hebtLog=r.createUUID=r.evaluateNetworkCondition=r.makeCancelable=r.hasVideoTrack=r.hasAudioTrack=r.getVideoTrack=r.getAudioTrack=r.pruneSubUrl=r.getJitterBufferDelayAvg=void 0;r.getJitterBufferDelayAvg=function(e,r){return e&&r?Number(e)/Number(r)*1e3:-1};r.pruneSubUrl=function(e,r){var t=e||"";return t=t.replace("@subaudio=no","").replace("@subvideo=no",""),r&&(t=t.split("?")[0]),t};r.getAudioTrack=function(e){return e.getAudioTracks()[0]};r.getVideoTrack=function(e){return e.getVideoTracks()[0]};r.hasAudioTrack=function(e){return e.getAudioTracks().length>0};r.hasVideoTrack=function(e){return e.getVideoTracks().length>0};r.makeCancelable=function(e){var r=!1;return{promise:new Promise((function(t,n){e.then((function(e){return r?n({isCanceled:!0}):t(e)})),e.catch((function(e){return n(r?{isCanceled:!0}:e)}))})),cancel:function(){r=!0}}};r.evaluateNetworkCondition=function(e,r,t,n,a){var o=0;if(!navigator.onLine)return o=6;var i=[{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}],u=-1,c=-1,s=-1;if("number"==typeof r&&r>=0||"number"==typeof t&&t>=0){u=0;var f=!1,T=!1;"number"==typeof r&&r>=0&&(u+=r,f=!0),"number"==typeof t&&t>=0&&(u+=t,T=!0),f&&!T&&(u*=2),T&&!f&&(u*=1.8)}if("number"==typeof e&&e>=0&&(s=e),"number"==typeof n&&n>=0||"number"==typeof a&&a>=0){c=0;"number"==typeof n&&n>=0&&(c+=n),"number"==typeof a&&a>=0&&(c+=a)}var E;if((E=4*(-1!==u?1:0)+2*(-1!==s?1:0)+(-1!==c?1:0))>0){var l=1.2*u*i[E-1].loss+s/1500*i[E-1].rtt+c/3e3*i[E-1].jbd;o=l<=.1?1:l<=.23?2:l<=.36?3:l<=.49?4:5}else o=0;return o};r.createUUID=function(e,r){var t,n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),a=[];if(r=r||n.length,e)for(t=0;t<e;t++)a[t]=n[0|Math.random()*r];else{var o=void 0;for(a[8]=a[13]=a[18]=a[23]="-",a[14]="4",t=0;t<36;t++)a[t]||(o=0|16*Math.random(),a[t]=n[19==t?3&o|8:o])}return a.join("")};r.hebtLog=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];window.RTS_HEBT_DEBUG&&console.log.apply(console,t(["[rts hebt]"],e,!1))}}},r={};function t(n){var a=r[n];if(void 0!==a)return a.exports;var o=r[n]={exports:{}};return e[n].call(o.exports,o,o.exports,t),o.exports}var n,a,o,i,u,c,s;a=t(594),o=t(718),i=t(917),u=self,c=function(e,r,t,o){if(e===i.EWorkerSource.Sender){var u=new TransformStream({transform:function(e,r){e.type&&(n&&((0,a.insertSei)(e,n.sei,n.payloadType,n.uuid),void 0===n.repeatCount?n=null:-1!==n.repeatCount&&(n.repeatCount--,n.repeatCount<0&&(n=null))),o&&o(e)),r.enqueue(e)}});r.pipeThrough(u).pipeTo(t)}else e===i.EWorkerSource.Receiver&&(u=new TransformStream({transform:function(e,r){e.type&&o&&o(e),r.enqueue(e)}}),r.pipeThrough(u).pipeTo(t))},s=function(e){var r=e.data.slice(0);u.postMessage({type:"encodedFrame",data:r,frameInfo:{type:e.type,timestamp:e.timestamp}},[r]),r=null},u.RTCTransformEvent&&(u.onrtctransform=function(e){var r=e.transformer,t=r.options.source,n=r.readable,a=r.writable;c(t,n,a,(function(e){t===i.EWorkerSource.Receiver&&s(e)}))}),onmessage=function(e){switch(e.data.operation){case i.EWorkerAction.Setup:r=e.data,t=r.source,a=r.readable,u=r.writable,c(t,a,u,(function(e){t===i.EWorkerSource.Receiver&&s(e)}));break;case i.EWorkerAction.InserSEI:!function(e){(n=e)&&(n.uuid=(0,o.createUUID)().toLowerCase(),n.repeatCount=n.repeatCount||0)}(e.data)}var r,t,a,u}})();',"Worker",void 0,void 0)}},5512:U=>{U.exports=function(C,y,m,c){var u=self||window;try{try{var x;try{x=new u.Blob([C])}catch{(x=new(u.BlobBuilder||u.WebKitBlobBuilder||u.MozBlobBuilder||u.MSBlobBuilder)).append(C),x=x.getBlob()}var f=u.URL||u.webkitURL,a=f.createObjectURL(x),d=new u[y](a,m);return f.revokeObjectURL(a),d}catch{return new u[y]("data:application/javascript,".concat(encodeURIComponent(C)),m)}}catch{if(!c)throw Error("Inline worker is not supported");return new u[y](c,m)}}},2632:(U,C,y)=>{y.r(C),y.d(C,{default:()=>p});function m(e,r,n){Object.defineProperty(e,r,{writable:!0,enumerable:!0,configurable:!0,value:n})}Array(32);var c,u,x;class f{constructor(r){var n,s;this.timer=null,this.time=10,this.count=10,this.arr=[],this.time=(n=r.time)!=null?n:10,this.count=(s=r.count)!=null?s: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 n={__logs__:r};return this.opt.tags&&(n.__tags__=this.opt.tags),this.opt.topic&&(n.__topic__=this.opt.topic),this.opt.source&&(n.__source__=this.opt.source),JSON.stringify(n)}platformSend(){if(this.opt.sendPayload&&typeof this.opt.sendPayload=="function"){const r=this.assemblePayload();this.opt.sendPayload(this.url,r)}}transString(r){let n={};for(let s in r)typeof r[s]=="object"?n[s]=JSON.stringify(r[s]):n[s]=String(r[s]);return n}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 n=this.transString(r);this.arr.push(n),this.sendInner()}sendImmediate(r){const n=this.transString(r);this.arr.push(n),this.sendImmediateInner()}sendBatchLogs(r){const n=r.map(s=>this.transString(s));this.arr.push(...n),this.sendInner()}sendBatchLogsImmediate(r){const n=r.map(s=>this.transString(s));this.arr.push(...n),this.sendImmediateInner()}}function a(e,r){const n=new window.XMLHttpRequest;n.open("POST",`${e}?APIVersion=0.6.0`,!0),n.send(r)}function d(e,r){try{if(r.length>=32768)return void a(e,r);(function(n,s){return!(!navigator||!navigator.sendBeacon)&&navigator.sendBeacon(`${n}?APIVersion=0.6.0`,s)})(e,r)||a(e,r)}catch(n){window&&window.console&&typeof window.console.error=="function"&&(console.error(`Failed to log to ali log service because of this exception:
|
|
160
|
-
`+n),console.error("Failed log data:",e))}}class p extends f{constructor(r){super(Object.assign({},r,{installUnloadHook:n=>{window.addEventListener("beforeunload",()=>{n()})},sendPayload:(n,s)=>{d(n,s)}}))}}c=window,u="SLS_Tracker",x=p,m(c,u,x)},4198:U=>{U.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"}]}')}},L={};function X(U){var C=L[U];if(C!==void 0)return C.exports;var y=L[U]={exports:{}};return k[U].call(y.exports,y,y.exports,X),y.exports}return X.n=U=>{var C=U&&U.__esModule?()=>U.default:()=>U;return X.d(C,{a:C}),C},X.d=(U,C)=>{for(var y in C)X.o(C,y)&&!X.o(U,y)&&Object.defineProperty(U,y,{enumerable:!0,get:C[y]})},X.o=(U,C)=>Object.prototype.hasOwnProperty.call(U,C),X.r=U=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(U,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(U,"__esModule",{value:!0})},X(8156)})())})(Vr);for(var jn=Vr.exports,Be=[],Gt=0;Gt<256;++Gt)Be.push((Gt+256).toString(16).slice(1));function Wn(j,B=0){return(Be[j[B+0]]+Be[j[B+1]]+Be[j[B+2]]+Be[j[B+3]]+"-"+Be[j[B+4]]+Be[j[B+5]]+"-"+Be[j[B+6]]+Be[j[B+7]]+"-"+Be[j[B+8]]+Be[j[B+9]]+"-"+Be[j[B+10]]+Be[j[B+11]]+Be[j[B+12]]+Be[j[B+13]]+Be[j[B+14]]+Be[j[B+15]]).toLowerCase()}var rt,Gn=new Uint8Array(16);function zn(){if(!rt&&(rt=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!rt))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return rt(Gn)}var qn=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Hr={randomUUID:qn};function nt(j,B,k){if(Hr.randomUUID&&!B&&!j)return Hr.randomUUID();j=j||{};var L=j.random||(j.rng||zn)();return L[6]=L[6]&15|64,L[8]=L[8]&63|128,Wn(L)}var Kn=/d{1,4}|D{3,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|W{1,2}|[LlopSZN]|"[^"]*"|'[^']*'/g,Yn=/\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(j,B,k,L){if(arguments.length===1&&typeof j=="string"&&!/\d/.test(j)&&(B=j,j=void 0),j=j||j===0?j:new Date,j instanceof Date||(j=new Date(j)),isNaN(j))throw TypeError("Invalid date");B=String(jr[B]||B||jr.default);var X=B.slice(0,4);(X==="UTC:"||X==="GMT:")&&(B=B.slice(4),k=!0,X==="GMT:"&&(L=!0));var U=function(){return k?"getUTC":"get"},C=function(){return j[U()+"Date"]()},y=function(){return j[U()+"Day"]()},m=function(){return j[U()+"Month"]()},c=function(){return j[U()+"FullYear"]()},u=function(){return j[U()+"Hours"]()},x=function(){return j[U()+"Minutes"]()},f=function(){return j[U()+"Seconds"]()},a=function(){return j[U()+"Milliseconds"]()},d=function(){return k?0:j.getTimezoneOffset()},p=function(){return Qn(j)},e=function(){return Jn(j)},r={d:function(){return C()},dd:function(){return He(C())},ddd:function(){return Ue.dayNames[y()]},DDD:function(){return Wr({y:c(),m:m(),d:C(),_:U(),dayName:Ue.dayNames[y()],short:!0})},dddd:function(){return Ue.dayNames[y()+7]},DDDD:function(){return Wr({y:c(),m:m(),d:C(),_:U(),dayName:Ue.dayNames[y()+7]})},m:function(){return m()+1},mm:function(){return He(m()+1)},mmm:function(){return Ue.monthNames[m()]},mmmm:function(){return Ue.monthNames[m()+12]},yy:function(){return String(c()).slice(2)},yyyy:function(){return He(c(),4)},h:function(){return u()%12||12},hh:function(){return He(u()%12||12)},H:function(){return u()},HH:function(){return He(u())},M:function(){return x()},MM:function(){return He(x())},s:function(){return f()},ss:function(){return He(f())},l:function(){return He(a(),3)},L:function(){return He(Math.floor(a()/10))},t:function(){return u()<12?Ue.timeNames[0]:Ue.timeNames[1]},tt:function(){return u()<12?Ue.timeNames[2]:Ue.timeNames[3]},T:function(){return u()<12?Ue.timeNames[4]:Ue.timeNames[5]},TT:function(){return u()<12?Ue.timeNames[6]:Ue.timeNames[7]},Z:function(){return L?"GMT":k?"UTC":$n(j)},o:function(){return(d()>0?"-":"+")+He(Math.floor(Math.abs(d())/60)*100+Math.abs(d())%60,4)},p:function(){return(d()>0?"-":"+")+He(Math.floor(Math.abs(d())/60),2)+":"+He(Math.floor(Math.abs(d())%60),2)},S:function(){return["th","st","nd","rd"][C()%10>3?0:(C()%100-C()%10!=10)*C()%10]},W:function(){return p()},WW:function(){return He(p())},N:function(){return e()}};return B.replace(Kn,function(n){return n in r?r[n]():n.slice(1,n.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"},Ue={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"]},He=function(B){var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;return String(B).padStart(k,"0")},Wr=function(B){var k=B.y,L=B.m,X=B.d,U=B._,C=B.dayName,y=B.short,m=y===void 0?!1:y,c=new Date,u=new Date;u.setDate(u[U+"Date"]()-1);var x=new Date;x.setDate(x[U+"Date"]()+1);var f=function(){return c[U+"Date"]()},a=function(){return c[U+"Month"]()},d=function(){return c[U+"FullYear"]()},p=function(){return u[U+"Date"]()},e=function(){return u[U+"Month"]()},r=function(){return u[U+"FullYear"]()},n=function(){return x[U+"Date"]()},s=function(){return x[U+"Month"]()},t=function(){return x[U+"FullYear"]()};return d()===k&&a()===L&&f()===X?m?"Tdy":"Today":r()===k&&e()===L&&p()===X?m?"Ysd":"Yesterday":t()===k&&s()===L&&n()===X?m?"Tmw":"Tomorrow":C},Qn=function(B){var k=new Date(B.getFullYear(),B.getMonth(),B.getDate());k.setDate(k.getDate()-(k.getDay()+6)%7+3);var L=new Date(k.getFullYear(),0,4);L.setDate(L.getDate()-(L.getDay()+6)%7+3);var X=k.getTimezoneOffset()-L.getTimezoneOffset();k.setHours(k.getHours()-X);var U=(k-L)/(864e5*7);return 1+Math.floor(U)},Jn=function(B){var k=B.getDay();return k===0&&(k=7),k},$n=function(B){return(String(B).match(Yn)||[""]).pop().replace(Xn,"").replace(/GMT\+0000/g,"UTC")},qt;(function(j){j.prod="rs.rtn.aliyuncs.com",j.pre="prs.rtn.aliyuncs.com"})(qt||(qt={}));var Gr;(function(j){j[j.ByClient=0]="ByClient",j[j.KickOut=1]="KickOut",j[j.ChannelClosed=2]="ChannelClosed",j[j.Restore=3]="Restore",j[j.Expired=4]="Expired",j[j.Reconnect=5]="Reconnect",j[j.ReconnectExhausted=6]="ReconnectExhausted"})(Gr||(Gr={}));const zr="7.0.1";class Yt{static getVersionNumber(){let B=zr.split("."),k="";return B.forEach(L=>{L.length===1?k+="0"+L:k+=L}),parseInt(k)}static queryingParam(B){let k=[];if(B)for(let L in B)k.push(L+"="+B[L]);return k.join("&")}static getQueryParams(B){const k=window.location.search.substring(1).split("&");for(let L=0;L<k.length;L++){const X=k[L].split("=");if(decodeURIComponent(X[0])===B)return decodeURIComponent(X[1])}}static createCallid(B=""){const k=nt();return B&&k&&k.length>B.length?`${B}${k.substring(B.length)}`:k}static checkSubOptionsValid(B){if(B){const{audio:k,video:L,screen:X}=B;if(k===!1&&L===!1&&X===!1)return!1}return!0}static async isNetworkAvailable(){const B=qt.prod,{onLine:k}=navigator;if(!k)return!1;try{return await fetch(`https://${B}/roomserver/v1/ws/version`),!0}catch{return!1}}static toString(B){let k;if(B instanceof Error)k=B.message;else if(typeof B=="string")k=B;else try{k=JSON.stringify(B)}catch{k="undefined"}return k}static paramArrayToString(B){let k="";for(let L=0;L<B.length;L++){k!==""&&(k+=" ");let X=Yt.toString(B[L]);k+=X}return k}}const Zn=(j,B)=>j.find(k=>{if(typeof k.test=="function")return k.test(B);if(Array.isArray(k.test))return k.test.some(L=>typeof L=="string"?B.indexOf(L)>-1:L instanceof RegExp?L.test(B):!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 j="unknown";try{const B=navigator.userAgent||"",k=Zn(ei,B);if(!k)return j;j=k.describe(B)}catch{}return j};var ri=Object.defineProperty,ni=(j,B,k)=>B in j?ri(j,B,{enumerable:!0,configurable:!0,writable:!0,value:k}):j[B]=k,Oe=(j,B,k)=>ni(j,typeof B!="symbol"?B+"":B,k);const{BrowserUtil:qr,SystenUtil:Kr}=jn.AliRTS,ii=ti(),oi="woMMssV6jmyol9fr",ai=200,it=10*60*1e3,ot={host:"cn-hangzhou.log.aliyuncs.com",project:"alivc-aio",logstore:"logger",time:10,count:10};function Kt(){return zt(new Date,"HH:MM:ss.l")}function Yr(){return zt(new Date,"isoDate")}var Fe;(function(j){j[j.DEBUG=0]="DEBUG",j[j.INFO=1]="INFO",j[j.API=2]="API",j[j.WARNING=3]="WARNING",j[j.ERROR=4]="ERROR",j[j.NONE=5]="NONE"})(Fe||(Fe={}));var Ye;(function(j){j[j.TASK_UPLOAD_BEGIN=710201]="TASK_UPLOAD_BEGIN",j[j.SESSION_UPLOAD_BEGIN=710202]="SESSION_UPLOAD_BEGIN",j[j.SESSION_UPLOAD_ING=710203]="SESSION_UPLOAD_ING",j[j.SESSION_UPLOAD_END=710204]="SESSION_UPLOAD_END",j[j.TASK_UPLOAD_END=710205]="TASK_UPLOAD_END"})(Ye||(Ye={}));class si{constructor(){Oe(this,"tracker"),Oe(this,"slsPlugin"),Oe(this,"stsData"),Oe(this,"stsExpiration",Date.now()),Oe(this,"clientId",nt()),Oe(this,"bSesid",nt()),Oe(this,"logLevel",Fe.WARNING),Oe(this,"appId",""),Oe(this,"sessionId",""),Oe(this,"logCache",[]),Oe(this,"updateTaskTimer"),Oe(this,"endReported",!0),Oe(this,"logSequence",0),Oe(this,"sendLogBeforeUnload",async B=>{if(!this.slsPlugin)return;this.logSequence+=1,B.unshift(this.getLogParams(Ye.SESSION_UPLOAD_ING,{log:`[${Yr()} ${Kt()}] [INF] beforeunload`,stat_log_seq:this.logSequence}));const k=`https://${ot.project}.${ot.host}/logstores/${ot.logstore}`,L={__logs__:B.map(C=>this.slsPlugin.transString(C))},{data:X,header:U}=await this.slsPlugin.process(k,JSON.stringify(L));fetch(k,{keepalive:!0,method:"POST",headers:U,body:X})}),Oe(this,"logMethod",(B,k=console.log)=>(...L)=>{let X=Kt();this.logLevel<=B&&k(X,...L);let U=Yt.paramArrayToString(L);B>Fe.DEBUG&&this.addLog(U)}),Oe(this,"d",this.logMethod(Fe.DEBUG,console.debug)),Oe(this,"i",this.logMethod(Fe.INFO)),Oe(this,"w",this.logMethod(Fe.WARNING,console.warn)),Oe(this,"e",this.logMethod(Fe.ERROR,(...B)=>{const[k,...L]=B;console.error(k,"<error>",L)})),Oe(this,"ev",this.logMethod(Fe.API)),Oe(this,"a",this.logMethod(Fe.API,(...B)=>{const[k,...L]=B;if(L.length>2){const X=`${L[1]}`;X.startsWith("__g__")&&console.group(`${X.substring(5)}_${L[2]}`)}console.log(k,...L)})),Oe(this,"ar",this.logMethod(Fe.API,(...B)=>{const[k,...L]=B;console.log(k,...L),L.length>2&&`${L[1]}`.startsWith("__g__")&&console.groupEnd()})),Oe(this,"ae",this.logMethod(Fe.API,(...B)=>{const[k,...L]=B;console.error(k,"<error>",...L),L.length>2&&`${L[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=nt(),this.endReported=!0,this.logSequence=0,this.appId="",this.sessionId=""}async startSTSUpdateTask(){this.updateTaskTimer&&clearTimeout(this.updateTaskTimer);try{const B=await this.refreshSTSToken();this.createTracker(B)}catch{}this.updateTaskTimer=setTimeout(()=>{this.startSTSUpdateTask()},it)}async refreshSTSToken(){if(!this.stsData||this.stsExpiration<=Date.now()-it){const B=await this.requestSTSToken(),k=new Date(B?.Expiration).getTime()||0,L=Date.now()+it;this.stsExpiration=Math.max(k,L),this.stsData=B}return this.stsData}requestSTSToken(){const B=Date.now(),k=`${this.clientId}|${oi}|${B}`,L={Action:"AssumeSlsRoleV2",AuthInfo:$e.MD5(k).toString($e.enc.Hex),ClientId:this.clientId,BusinessType:"logger",AppVersion:"1.0",Version:"2017-03-14",AuthTimestamp:`${B}`,TerminalType:"web",DeviceModel:"",Format:"JSON",SignatureMethod:"HMAC-SHA1",SignatureVersion:"1.0",Timestamp:zt(B,"isoUtcDateTime")},X=`https://slsrole.alicdn.com/?${new URLSearchParams(L).toString()}`;return fetch(X).then(U=>U.json()).then(U=>JSON.parse(window.atob(U.SlsAuthResult)))}createTracker(B){if(!this.tracker){const k={accessKeyId:B.AccessKeyId,accessKeySecret:B.AccessKeySecret,securityToken:B.SecurityToken,refreshSTSTokenInterval:it,stsTokenFreshTime:void 0,refreshSTSToken:()=>{this.refreshSTSToken().then(U=>{k.accessKeyId=U.AccessKeyId,k.accessKeySecret=U.AccessKeySecret,k.securityToken=U.SecurityToken}).catch(()=>{})}},L=new er(ot),X=Fr(k);L.useStsPlugin(X),this.slsPlugin=X,this.tracker=L,this.reportStartAndCache()}}changeConfig(B){B.logLevel!==void 0&&B.logLevel>=Fe.DEBUG&&B.logLevel<=Fe.NONE&&(this.logLevel=B.logLevel)}setSessionID(B,k){!B||!k||(this.appId=B,this.sessionId=k,this.reportStartAndCache())}reportStartAndCache(){if(!this.tracker||!this.sessionId)return;this.endReported=!1;const B={task_btm_sec:0,task_duration:0,task_etm_sec:0,task_type:"session"},k=[this.getLogParams(Ye.TASK_UPLOAD_BEGIN,B),this.getLogParams(Ye.SESSION_UPLOAD_BEGIN,B)];this.tracker.sendBatchLogsImmediate(k),this.logCache.forEach(L=>{this.sendLog(L)})}reportEnd(B=!1){if(!this.tracker||!this.sessionId||this.endReported){this.reset();return}const k={task_btm_sec:0,task_duration:0,task_etm_sec:0,task_type:"session"},L=[this.getLogParams(Ye.SESSION_UPLOAD_END,k),this.getLogParams(Ye.TASK_UPLOAD_END,k)];B?this.sendLogBeforeUnload(L):(this.tracker.sendBatchLogsImmediate(L),this.endReported=!0),this.reset()}getLogParams(B,k){return{appid:`${window.location.host}`,appid_list:this.appId,appver:"",b_sesid:this.bSesid,biz_type:"rtc",cpu_info:ii,db:qr.browserName,dm:qr.browserVersion,install_uuid:this.clientId,logger_v:"0.0.1",os:Kr.systemName,osv:Kr.systemVersion,p_sesid:this.bSesid,sdk_version:zr,sdkname:"AliRTCSdk",stm:Date.now(),tar_pf:"web",traceid:this.sessionId,event_id:B,...k||{}}}sendLog(B){if(!this.tracker||!this.sessionId)return;this.logSequence+=1;const k=this.getLogParams(Ye.SESSION_UPLOAD_ING,{log:B,stat_log_seq:this.logSequence});this.tracker.send(k)}addLog(B){const k=Kt(),L=`[${Yr()} ${k}] ${B}`;!this.sessionId||!this.tracker?(this.logCache.push(L),this.logCache.length>=ai&&this.logCache.shift()):this.sendLog(L)}}var ci=Object.defineProperty,ui=(j,B,k)=>B in j?ci(j,B,{enumerable:!0,configurable:!0,writable:!0,value:k}):j[B]=k,di=(j,B,k)=>ui(j,B+"",k);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(B){this.getLogger().changeConfig({logLevel:B})}static setSessionID(B,k){this.getLogger().setSessionID(B,k)}static reportEnd(){this.getLogger().reportEnd()}static interface(...B){this.getLogger().a("[API]",...B)}static interfaceResult(B,k,L,...X){L?this.getLogger().ar("[ARE]",B,k,...X):this.getLogger().ae("[ARE]",B,k,...X)}static event(...B){this.getLogger().ev("[EVT]",...B)}static debug(...B){this.getLogger().d("[DBG]",...B)}static info(...B){this.getLogger().i("[INF]",...B)}static warn(...B){this.getLogger().w("[WARN]",...B)}static error(...B){this.getLogger().e("[ERR]",...B)}}di(Ze,"logger");var li=Object.defineProperty,pi=(j,B,k)=>B in j?li(j,B,{enumerable:!0,configurable:!0,writable:!0,value:k}):j[B]=k,et=(j,B,k)=>pi(j,typeof B!="symbol"?B+"":B,k);const Xr=48e3,at="[AliyunAudio3A] ";class fi extends Jr{constructor(B){super("AliRtcAudioProcessPlugin",$r.AliRtcSdkStreamTypeCapture,Zr.AUDIO),et(this,"audioProcessor"),et(this,"slsReporter"),et(this,"audioContext",new AudioContext({sampleRate:Xr})),et(this,"farNode"),et(this,"createNode",k=>this.audioContext.createMediaStreamSource(new MediaStream([k]))),this.options=B,this.slsReporter=B?.slsReporter,this.zIndex=7,document.addEventListener("click",this.activeAudioContext)}activeAudioContext(){this.audioContext.resume(),document.removeEventListener("click",this.activeAudioContext)}audioUpdated(B){return this.lastInputAudioTrack?.id!==B.currentAudioTrack?.id}videoUpdated(B){return console.log("videoUpdated",B),!1}setOptions(B){this.farNode||!B.farMediaStream||(this.farNode=this.audioContext.createMediaStreamSource(B.farMediaStream),this.audioProcessor&&this.audioProcessor?.addFarNode(this.farNode),this.options={...this.options,...B})}isSupported(){return Jt.isSupported()}shouldUpdate(B){return!!(B.originAudioTrack&&!this.audioProcessor||!B.originAudioTrack&&this.audioProcessor)}async process(B){if(!B.currentAudioTrack){B.updateAudioTrack(),this.clear(B);return}if(!this.audioProcessor){Ze.info(at,"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,wasmCdnPath:this.options.wasmCdnPath||"https://g.alicdn.com/code/npm/@ali/aliyun-audio-3a/0.0.5/"});const k=this.createNode(B.currentAudioTrack);await this.audioProcessor.createProcessor(this.audioContext,k,1,Xr,this.farNode),this.audioProcessor.on("dumpdata",(L,X)=>{let U=3e3;X.includes("far")?U=5e3:X.includes("output")?U=1e4:X.includes("meta")&&(U=8e3),setTimeout(()=>{const C=URL.createObjectURL(L),y=document.createElement("a");y.href=C,y.download=X,document.body.appendChild(y),y.click(),document.body.removeChild(y)},U)}),this.audioProcessor.on("loadsuccess",()=>{Ze.info(at,"loadsuccess"),this.options.dumpAudioData&&this.audioProcessor?.startDump()}),this.audioProcessor.on("loaderror",L=>{Ze.info(at,"loaderror:",L?.message)}),this.audioProcessor.on("outputlog",L=>{Ze.info(at,"outputlog:",L)}),this.audioProcessor.on("statdata",L=>{L&&this.slsReporter?.reportPublishAudio3A("","","",L||"")}),B.updateAudioTrack(this.audioProcessor.targetMediaTrack)}}clear(B){this.options.dumpAudioData&&this.audioProcessor?.stopDump(),super.clear(B),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};
|
|
160
|
+
`+n),console.error("Failed log data:",e))}}class p extends f{constructor(r){super(Object.assign({},r,{installUnloadHook:n=>{window.addEventListener("beforeunload",()=>{n()})},sendPayload:(n,s)=>{d(n,s)}}))}}c=window,u="SLS_Tracker",x=p,m(c,u,x)},4198:U=>{U.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"}]}')}},L={};function X(U){var C=L[U];if(C!==void 0)return C.exports;var y=L[U]={exports:{}};return k[U].call(y.exports,y,y.exports,X),y.exports}return X.n=U=>{var C=U&&U.__esModule?()=>U.default:()=>U;return X.d(C,{a:C}),C},X.d=(U,C)=>{for(var y in C)X.o(C,y)&&!X.o(U,y)&&Object.defineProperty(U,y,{enumerable:!0,get:C[y]})},X.o=(U,C)=>Object.prototype.hasOwnProperty.call(U,C),X.r=U=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(U,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(U,"__esModule",{value:!0})},X(8156)})())})(Vr);for(var jn=Vr.exports,Be=[],Gt=0;Gt<256;++Gt)Be.push((Gt+256).toString(16).slice(1));function Wn(j,B=0){return(Be[j[B+0]]+Be[j[B+1]]+Be[j[B+2]]+Be[j[B+3]]+"-"+Be[j[B+4]]+Be[j[B+5]]+"-"+Be[j[B+6]]+Be[j[B+7]]+"-"+Be[j[B+8]]+Be[j[B+9]]+"-"+Be[j[B+10]]+Be[j[B+11]]+Be[j[B+12]]+Be[j[B+13]]+Be[j[B+14]]+Be[j[B+15]]).toLowerCase()}var rt,Gn=new Uint8Array(16);function zn(){if(!rt&&(rt=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!rt))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return rt(Gn)}var qn=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Hr={randomUUID:qn};function nt(j,B,k){if(Hr.randomUUID&&!B&&!j)return Hr.randomUUID();j=j||{};var L=j.random||(j.rng||zn)();return L[6]=L[6]&15|64,L[8]=L[8]&63|128,Wn(L)}var Kn=/d{1,4}|D{3,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|W{1,2}|[LlopSZN]|"[^"]*"|'[^']*'/g,Yn=/\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(j,B,k,L){if(arguments.length===1&&typeof j=="string"&&!/\d/.test(j)&&(B=j,j=void 0),j=j||j===0?j:new Date,j instanceof Date||(j=new Date(j)),isNaN(j))throw TypeError("Invalid date");B=String(jr[B]||B||jr.default);var X=B.slice(0,4);(X==="UTC:"||X==="GMT:")&&(B=B.slice(4),k=!0,X==="GMT:"&&(L=!0));var U=function(){return k?"getUTC":"get"},C=function(){return j[U()+"Date"]()},y=function(){return j[U()+"Day"]()},m=function(){return j[U()+"Month"]()},c=function(){return j[U()+"FullYear"]()},u=function(){return j[U()+"Hours"]()},x=function(){return j[U()+"Minutes"]()},f=function(){return j[U()+"Seconds"]()},a=function(){return j[U()+"Milliseconds"]()},d=function(){return k?0:j.getTimezoneOffset()},p=function(){return Qn(j)},e=function(){return Jn(j)},r={d:function(){return C()},dd:function(){return He(C())},ddd:function(){return Ue.dayNames[y()]},DDD:function(){return Wr({y:c(),m:m(),d:C(),_:U(),dayName:Ue.dayNames[y()],short:!0})},dddd:function(){return Ue.dayNames[y()+7]},DDDD:function(){return Wr({y:c(),m:m(),d:C(),_:U(),dayName:Ue.dayNames[y()+7]})},m:function(){return m()+1},mm:function(){return He(m()+1)},mmm:function(){return Ue.monthNames[m()]},mmmm:function(){return Ue.monthNames[m()+12]},yy:function(){return String(c()).slice(2)},yyyy:function(){return He(c(),4)},h:function(){return u()%12||12},hh:function(){return He(u()%12||12)},H:function(){return u()},HH:function(){return He(u())},M:function(){return x()},MM:function(){return He(x())},s:function(){return f()},ss:function(){return He(f())},l:function(){return He(a(),3)},L:function(){return He(Math.floor(a()/10))},t:function(){return u()<12?Ue.timeNames[0]:Ue.timeNames[1]},tt:function(){return u()<12?Ue.timeNames[2]:Ue.timeNames[3]},T:function(){return u()<12?Ue.timeNames[4]:Ue.timeNames[5]},TT:function(){return u()<12?Ue.timeNames[6]:Ue.timeNames[7]},Z:function(){return L?"GMT":k?"UTC":$n(j)},o:function(){return(d()>0?"-":"+")+He(Math.floor(Math.abs(d())/60)*100+Math.abs(d())%60,4)},p:function(){return(d()>0?"-":"+")+He(Math.floor(Math.abs(d())/60),2)+":"+He(Math.floor(Math.abs(d())%60),2)},S:function(){return["th","st","nd","rd"][C()%10>3?0:(C()%100-C()%10!=10)*C()%10]},W:function(){return p()},WW:function(){return He(p())},N:function(){return e()}};return B.replace(Kn,function(n){return n in r?r[n]():n.slice(1,n.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"},Ue={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"]},He=function(B){var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;return String(B).padStart(k,"0")},Wr=function(B){var k=B.y,L=B.m,X=B.d,U=B._,C=B.dayName,y=B.short,m=y===void 0?!1:y,c=new Date,u=new Date;u.setDate(u[U+"Date"]()-1);var x=new Date;x.setDate(x[U+"Date"]()+1);var f=function(){return c[U+"Date"]()},a=function(){return c[U+"Month"]()},d=function(){return c[U+"FullYear"]()},p=function(){return u[U+"Date"]()},e=function(){return u[U+"Month"]()},r=function(){return u[U+"FullYear"]()},n=function(){return x[U+"Date"]()},s=function(){return x[U+"Month"]()},t=function(){return x[U+"FullYear"]()};return d()===k&&a()===L&&f()===X?m?"Tdy":"Today":r()===k&&e()===L&&p()===X?m?"Ysd":"Yesterday":t()===k&&s()===L&&n()===X?m?"Tmw":"Tomorrow":C},Qn=function(B){var k=new Date(B.getFullYear(),B.getMonth(),B.getDate());k.setDate(k.getDate()-(k.getDay()+6)%7+3);var L=new Date(k.getFullYear(),0,4);L.setDate(L.getDate()-(L.getDay()+6)%7+3);var X=k.getTimezoneOffset()-L.getTimezoneOffset();k.setHours(k.getHours()-X);var U=(k-L)/(864e5*7);return 1+Math.floor(U)},Jn=function(B){var k=B.getDay();return k===0&&(k=7),k},$n=function(B){return(String(B).match(Yn)||[""]).pop().replace(Xn,"").replace(/GMT\+0000/g,"UTC")},qt;(function(j){j.prod="rs.rtn.aliyuncs.com",j.pre="prs.rtn.aliyuncs.com"})(qt||(qt={}));var Gr;(function(j){j[j.ByClient=0]="ByClient",j[j.KickOut=1]="KickOut",j[j.ChannelClosed=2]="ChannelClosed",j[j.Restore=3]="Restore",j[j.Expired=4]="Expired",j[j.Reconnect=5]="Reconnect",j[j.ReconnectExhausted=6]="ReconnectExhausted"})(Gr||(Gr={}));const zr="7.0.2";class Yt{static getVersionNumber(){let B=zr.split("."),k="";return B.forEach(L=>{L.length===1?k+="0"+L:k+=L}),parseInt(k)}static queryingParam(B){let k=[];if(B)for(let L in B)k.push(L+"="+B[L]);return k.join("&")}static getQueryParams(B){const k=window.location.search.substring(1).split("&");for(let L=0;L<k.length;L++){const X=k[L].split("=");if(decodeURIComponent(X[0])===B)return decodeURIComponent(X[1])}}static createCallid(B=""){const k=nt();return B&&k&&k.length>B.length?`${B}${k.substring(B.length)}`:k}static checkSubOptionsValid(B){if(B){const{audio:k,video:L,screen:X}=B;if(k===!1&&L===!1&&X===!1)return!1}return!0}static async isNetworkAvailable(){const B=qt.prod,{onLine:k}=navigator;if(!k)return!1;try{return await fetch(`https://${B}/roomserver/v1/ws/version`),!0}catch{return!1}}static toString(B){let k;if(B instanceof Error)k=B.message;else if(typeof B=="string")k=B;else try{k=JSON.stringify(B)}catch{k="undefined"}return k}static paramArrayToString(B){let k="";for(let L=0;L<B.length;L++){k!==""&&(k+=" ");let X=Yt.toString(B[L]);k+=X}return k}}const Zn=(j,B)=>j.find(k=>{if(typeof k.test=="function")return k.test(B);if(Array.isArray(k.test))return k.test.some(L=>typeof L=="string"?B.indexOf(L)>-1:L instanceof RegExp?L.test(B):!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 j="unknown";try{const B=navigator.userAgent||"",k=Zn(ei,B);if(!k)return j;j=k.describe(B)}catch{}return j};var ri=Object.defineProperty,ni=(j,B,k)=>B in j?ri(j,B,{enumerable:!0,configurable:!0,writable:!0,value:k}):j[B]=k,Oe=(j,B,k)=>ni(j,typeof B!="symbol"?B+"":B,k);const{BrowserUtil:qr,SystenUtil:Kr}=jn.AliRTS,ii=ti(),oi="woMMssV6jmyol9fr",ai=200,it=10*60*1e3,ot={host:"cn-hangzhou.log.aliyuncs.com",project:"alivc-aio",logstore:"logger",time:10,count:10};function Kt(){return zt(new Date,"HH:MM:ss.l")}function Yr(){return zt(new Date,"isoDate")}var Fe;(function(j){j[j.DEBUG=0]="DEBUG",j[j.INFO=1]="INFO",j[j.API=2]="API",j[j.WARNING=3]="WARNING",j[j.ERROR=4]="ERROR",j[j.NONE=5]="NONE"})(Fe||(Fe={}));var Ye;(function(j){j[j.TASK_UPLOAD_BEGIN=710201]="TASK_UPLOAD_BEGIN",j[j.SESSION_UPLOAD_BEGIN=710202]="SESSION_UPLOAD_BEGIN",j[j.SESSION_UPLOAD_ING=710203]="SESSION_UPLOAD_ING",j[j.SESSION_UPLOAD_END=710204]="SESSION_UPLOAD_END",j[j.TASK_UPLOAD_END=710205]="TASK_UPLOAD_END"})(Ye||(Ye={}));class si{constructor(){Oe(this,"tracker"),Oe(this,"slsPlugin"),Oe(this,"stsData"),Oe(this,"stsExpiration",Date.now()),Oe(this,"clientId",nt()),Oe(this,"bSesid",nt()),Oe(this,"logLevel",Fe.WARNING),Oe(this,"appId",""),Oe(this,"sessionId",""),Oe(this,"logCache",[]),Oe(this,"updateTaskTimer"),Oe(this,"endReported",!0),Oe(this,"logSequence",0),Oe(this,"sendLogBeforeUnload",async B=>{if(!this.slsPlugin)return;this.logSequence+=1,B.unshift(this.getLogParams(Ye.SESSION_UPLOAD_ING,{log:`[${Yr()} ${Kt()}] [INF] beforeunload`,stat_log_seq:this.logSequence}));const k=`https://${ot.project}.${ot.host}/logstores/${ot.logstore}`,L={__logs__:B.map(C=>this.slsPlugin.transString(C))},{data:X,header:U}=await this.slsPlugin.process(k,JSON.stringify(L));fetch(k,{keepalive:!0,method:"POST",headers:U,body:X})}),Oe(this,"logMethod",(B,k=console.log)=>(...L)=>{let X=Kt();this.logLevel<=B&&k(X,...L);let U=Yt.paramArrayToString(L);B>Fe.DEBUG&&this.addLog(U)}),Oe(this,"d",this.logMethod(Fe.DEBUG,console.debug)),Oe(this,"i",this.logMethod(Fe.INFO)),Oe(this,"w",this.logMethod(Fe.WARNING,console.warn)),Oe(this,"e",this.logMethod(Fe.ERROR,(...B)=>{const[k,...L]=B;console.error(k,"<error>",L)})),Oe(this,"ev",this.logMethod(Fe.API)),Oe(this,"a",this.logMethod(Fe.API,(...B)=>{const[k,...L]=B;if(L.length>2){const X=`${L[1]}`;X.startsWith("__g__")&&console.group(`${X.substring(5)}_${L[2]}`)}console.log(k,...L)})),Oe(this,"ar",this.logMethod(Fe.API,(...B)=>{const[k,...L]=B;console.log(k,...L),L.length>2&&`${L[1]}`.startsWith("__g__")&&console.groupEnd()})),Oe(this,"ae",this.logMethod(Fe.API,(...B)=>{const[k,...L]=B;console.error(k,"<error>",...L),L.length>2&&`${L[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=nt(),this.endReported=!0,this.logSequence=0,this.appId="",this.sessionId=""}async startSTSUpdateTask(){this.updateTaskTimer&&clearTimeout(this.updateTaskTimer);try{const B=await this.refreshSTSToken();this.createTracker(B)}catch{}this.updateTaskTimer=setTimeout(()=>{this.startSTSUpdateTask()},it)}async refreshSTSToken(){if(!this.stsData||this.stsExpiration<=Date.now()-it){const B=await this.requestSTSToken(),k=new Date(B?.Expiration).getTime()||0,L=Date.now()+it;this.stsExpiration=Math.max(k,L),this.stsData=B}return this.stsData}requestSTSToken(){const B=Date.now(),k=`${this.clientId}|${oi}|${B}`,L={Action:"AssumeSlsRoleV2",AuthInfo:$e.MD5(k).toString($e.enc.Hex),ClientId:this.clientId,BusinessType:"logger",AppVersion:"1.0",Version:"2017-03-14",AuthTimestamp:`${B}`,TerminalType:"web",DeviceModel:"",Format:"JSON",SignatureMethod:"HMAC-SHA1",SignatureVersion:"1.0",Timestamp:zt(B,"isoUtcDateTime")},X=`https://slsrole.alicdn.com/?${new URLSearchParams(L).toString()}`;return fetch(X).then(U=>U.json()).then(U=>JSON.parse(window.atob(U.SlsAuthResult)))}createTracker(B){if(!this.tracker){const k={accessKeyId:B.AccessKeyId,accessKeySecret:B.AccessKeySecret,securityToken:B.SecurityToken,refreshSTSTokenInterval:it,stsTokenFreshTime:void 0,refreshSTSToken:()=>{this.refreshSTSToken().then(U=>{k.accessKeyId=U.AccessKeyId,k.accessKeySecret=U.AccessKeySecret,k.securityToken=U.SecurityToken}).catch(()=>{})}},L=new er(ot),X=Fr(k);L.useStsPlugin(X),this.slsPlugin=X,this.tracker=L,this.reportStartAndCache()}}changeConfig(B){B.logLevel!==void 0&&B.logLevel>=Fe.DEBUG&&B.logLevel<=Fe.NONE&&(this.logLevel=B.logLevel)}setSessionID(B,k){!B||!k||(this.appId=B,this.sessionId=k,this.reportStartAndCache())}reportStartAndCache(){if(!this.tracker||!this.sessionId)return;this.endReported=!1;const B={task_btm_sec:0,task_duration:0,task_etm_sec:0,task_type:"session"},k=[this.getLogParams(Ye.TASK_UPLOAD_BEGIN,B),this.getLogParams(Ye.SESSION_UPLOAD_BEGIN,B)];this.tracker.sendBatchLogsImmediate(k),this.logCache.forEach(L=>{this.sendLog(L)})}reportEnd(B=!1){if(!this.tracker||!this.sessionId||this.endReported){this.reset();return}const k={task_btm_sec:0,task_duration:0,task_etm_sec:0,task_type:"session"},L=[this.getLogParams(Ye.SESSION_UPLOAD_END,k),this.getLogParams(Ye.TASK_UPLOAD_END,k)];B?this.sendLogBeforeUnload(L):(this.tracker.sendBatchLogsImmediate(L),this.endReported=!0),this.reset()}getLogParams(B,k){return{appid:`${window.location.host}`,appid_list:this.appId,appver:"",b_sesid:this.bSesid,biz_type:"rtc",cpu_info:ii,db:qr.browserName,dm:qr.browserVersion,install_uuid:this.clientId,logger_v:"0.0.1",os:Kr.systemName,osv:Kr.systemVersion,p_sesid:this.bSesid,sdk_version:zr,sdkname:"AliRTCSdk",stm:Date.now(),tar_pf:"web",traceid:this.sessionId,event_id:B,...k||{}}}sendLog(B){if(!this.tracker||!this.sessionId)return;this.logSequence+=1;const k=this.getLogParams(Ye.SESSION_UPLOAD_ING,{log:B,stat_log_seq:this.logSequence});this.tracker.send(k)}addLog(B){const k=Kt(),L=`[${Yr()} ${k}] ${B}`;!this.sessionId||!this.tracker?(this.logCache.push(L),this.logCache.length>=ai&&this.logCache.shift()):this.sendLog(L)}}var ci=Object.defineProperty,ui=(j,B,k)=>B in j?ci(j,B,{enumerable:!0,configurable:!0,writable:!0,value:k}):j[B]=k,di=(j,B,k)=>ui(j,B+"",k);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(B){this.getLogger().changeConfig({logLevel:B})}static setSessionID(B,k){this.getLogger().setSessionID(B,k)}static reportEnd(){this.getLogger().reportEnd()}static interface(...B){this.getLogger().a("[API]",...B)}static interfaceResult(B,k,L,...X){L?this.getLogger().ar("[ARE]",B,k,...X):this.getLogger().ae("[ARE]",B,k,...X)}static event(...B){this.getLogger().ev("[EVT]",...B)}static debug(...B){this.getLogger().d("[DBG]",...B)}static info(...B){this.getLogger().i("[INF]",...B)}static warn(...B){this.getLogger().w("[WARN]",...B)}static error(...B){this.getLogger().e("[ERR]",...B)}}di(Ze,"logger");var li=Object.defineProperty,pi=(j,B,k)=>B in j?li(j,B,{enumerable:!0,configurable:!0,writable:!0,value:k}):j[B]=k,et=(j,B,k)=>pi(j,typeof B!="symbol"?B+"":B,k);const Xr=48e3,at="[AliyunAudio3A] ";class fi extends Jr{constructor(B){super("AliRtcAudioProcessPlugin",$r.AliRtcSdkStreamTypeCapture,Zr.AUDIO),et(this,"audioProcessor"),et(this,"slsReporter"),et(this,"audioContext",new AudioContext({sampleRate:Xr})),et(this,"farNode"),et(this,"createNode",k=>this.audioContext.createMediaStreamSource(new MediaStream([k]))),this.options=B,this.slsReporter=B?.slsReporter,this.zIndex=7,document.addEventListener("click",this.activeAudioContext)}activeAudioContext(){this.audioContext.resume(),document.removeEventListener("click",this.activeAudioContext)}audioUpdated(B){return this.lastInputAudioTrack?.id!==B.currentAudioTrack?.id}videoUpdated(B){return console.log("videoUpdated",B),!1}setOptions(B){this.farNode||!B.farMediaStream||(this.farNode=this.audioContext.createMediaStreamSource(B.farMediaStream),this.audioProcessor&&this.audioProcessor?.addFarNode(this.farNode),this.options={...this.options,...B})}isSupported(){return Jt.isSupported()}shouldUpdate(B){return!!(B.originAudioTrack&&!this.audioProcessor||!B.originAudioTrack&&this.audioProcessor)}async process(B){if(!B.currentAudioTrack){B.updateAudioTrack(),this.clear(B);return}if(!this.audioProcessor){Ze.info(at,"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,wasmCdnPath:this.options.wasmCdnPath||"https://g.alicdn.com/code/npm/@ali/aliyun-audio-3a/0.0.5/"});const k=this.createNode(B.currentAudioTrack);await this.audioProcessor.createProcessor(this.audioContext,k,1,Xr,this.farNode),this.audioProcessor.on("dumpdata",(L,X)=>{let U=3e3;X.includes("far")?U=5e3:X.includes("output")?U=1e4:X.includes("meta")&&(U=8e3),setTimeout(()=>{const C=URL.createObjectURL(L),y=document.createElement("a");y.href=C,y.download=X,document.body.appendChild(y),y.click(),document.body.removeChild(y)},U)}),this.audioProcessor.on("loadsuccess",()=>{Ze.info(at,"loadsuccess"),this.options.dumpAudioData&&this.audioProcessor?.startDump()}),this.audioProcessor.on("loaderror",L=>{Ze.info(at,"loaderror:",L?.message)}),this.audioProcessor.on("outputlog",L=>{Ze.info(at,"outputlog:",L)}),this.audioProcessor.on("statdata",L=>{L&&this.slsReporter?.reportPublishAudio3A("","","",L||"")}),B.updateAudioTrack(this.audioProcessor.targetMediaTrack)}}clear(B){this.options.dumpAudioData&&this.audioProcessor?.stopDump(),super.clear(B),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/package.json
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aliyun-rtc-sdk",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "rtc web sdk of aliyun",
|
|
6
6
|
"main": "dist/aliyun-rtc-sdk.umd.js",
|
|
7
7
|
"module": "dist/aliyun-rtc-sdk.es.js",
|
|
8
8
|
"types": "dist/types/index.d.ts",
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@ali/aliyun-audio-3a": "^0.0.5",
|
|
11
10
|
"@aliyun-sls/web-sts-plugin": "^0.3.5",
|
|
12
11
|
"@aliyun-sls/web-track-browser": "^0.3.5",
|
|
13
12
|
"aliyun-queen-engine": "^6.3.3",
|