代码拉取完成,页面将自动刷新
同步操作将从 starRTC/starrtc-web 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
var StarRtc=window.NameSpace||{};if(void 0===APP_PRODUCT_ID)var i=0,APP_PRODUCT_ID={R:i++,O:i++,_:i++,t:i++,s:i++,S:i++,N:i++,i:i++,I:i++,A:i++,o:i++};if(void 0===ACTION_GROUP_ID){i=0;var ACTION_GROUP_ID={V:i++,M:i++,C:i++,P:i++,T:i++,u:i++}}if(void 0===MSG_TYPE){i=0;var MSG_TYPE={L:i++,G:i++,D:i++,l:i++,p:i++}}if(void 0===MSG_DATA_TYPE){i=0;var MSG_DATA_TYPE={U:i++,v:i++,H:i++,k:i++}}if(void 0===ENCRYPT_TYPE){i=0;var ENCRYPT_TYPE={m:i++,g:i++}}if(void 0===AG_MSG_VOIP_CTRL)var AG_MSG_VOIP_CTRL={h:1e3,Y:1001,F:1002,W:1003,K:1004};if(void 0===AG_MSG){i=0;var AG_MSG={B:i++,J:i++,j:i++,X:i++,$:i++,q:i++,Z:i++,RR:i++,ER:i++,OR:i++,eR:i++,_R:i++,aR:i++,tR:i++,rR:i++,nR:i++,sR:i++,cR:i++,SR:i++,NR:i++,iR:i++,IR:i++,AR:i++,oR:i++,VR:i++,MR:i++,CR:i++,PR:i++,TR:i++,uR:i++,LR:i++,GR:i++,DR:i++,lR:i++,fR:i++,pR:i++}}if(void 0===CHAT_ROOM_TYPE){i=1;var CHAT_ROOM_TYPE={UR:i++,vR:i++}}if(void 0===AG_CHATROOMMOONSERVER){i=0;var AG_CHATROOMMOONSERVER={dR:i++,bR:i++,HR:i++,kR:i++,mR:i++,gR:i++,yR:i++,wR:i++,hR:i++,YR:i++,xR:i++,FR:i++,WR:i++,KR:i++,BR:i++,JR:i++,jR:i++,QR:i++,XR:i++,$R:i++,qR:i++,zR:i++,ZR:i++,RE:i++,EE:i++,OE:i++,eE:i++,_E:i++,aE:i++,tE:i++,rE:i++,nE:i++,sE:i++,cE:i++,SE:i++,NE:i++,iE:i++}}if(void 0===AG_VOIPMOONSERVER){i=0;var AG_VOIPMOONSERVER={IE:i++,AE:i++,oE:i++,VE:i++,ME:i++,CE:i++,PE:i++,TE:i++,uE:i++,LE:i++,GE:i++,DE:i++,lE:i++,fE:i++,pE:i++,UE:i++,vE:i++,dE:i++,bE:i++,HE:i++,kE:i++,mE:i++,gE:i++,yE:i++,wE:i++,hE:i++,YE:i++,xE:i++,FE:i++,WE:i++,KE:i++,BE:i++,JE:i++,jE:i++,QE:i++,XE:i++,$E:i++,qE:i++,zE:i++}}if(void 0===AG_LIVESRCMOONSERVER){i=0;var AG_LIVESRCMOONSERVER={ZE:i++,RO:i++,EO:i++,OO:i++,eO:i++,_O:i++,aO:i++,tO:i++,rO:i++,nO:i++,sO:i++,cO:i++,SO:i++,NO:i++,iO:i++,IO:i++,AO:i++,oO:i++,VO:i++,MO:i++,CO:i++,PO:i++,TO:i++,uO:i++,LO:i++,GO:i++,DO:i++,lO:i++,fO:i++,pO:i++,UO:i++,vO:i++,dO:i++,bO:i++,HO:i++,kO:i++,mO:i++,gO:i++,yO:i++,wO:i++,hO:i++,YO:i++,xO:i++,FO:i++,WO:i++,KO:i++,BO:i++,JO:i++,jO:i++,QO:i++,XO:i++,$O:i++,qO:i++,zO:i++,ZO:i++,Re:i++,Ee:i++,Oe:i++,ee:i++,_e:i++,ae:i++,te:i++,re:i++}}if(void 0===AG_LIVEVDNMOONSERVER){i=0;var AG_LIVEVDNMOONSERVER={ne:i++,se:i++,ce:i++,Se:i++,Ne:i++,ie:i++,Ie:i++,Ae:i++,oe:i++,Ve:i++,Me:i++,Ce:i++,Pe:i++,Te:i++,ue:i++,Le:i++,Ge:i++,De:i++,le:i++,fe:i++,pe:i++,Ue:i++,ve:i++}}function clone(R){if(null==R||"object"!=typeof R)return R;if(R instanceof Date)return(E=new Date).setTime(R.getTime()),E;if(R instanceof Array){for(var E=[],O=R.length,e=0;e<O;++e)E[e]=clone(R[e]);return E}if(R instanceof Object){E={};for(var _ in R)R.hasOwnProperty(_)&&(E[_]=clone(R[_]));return E}throw new Error("Unable to copy obj! Its type isn't supported.")}StarRtc.AUtils=new function(){var i,I=this,l="",U="",v="",d="";function C(R,E){for(var O=H(R),e=k(f(O.length.toString(16))),_=H(E),a=k(f(_.length.toString(16))),t=new Uint8Array(O.length+_.length+8),r=0,n=e.length,s=r;s<n;s++)t[s]=e[s-r];n=(r=n)+O.length;for(s=r;s<n;s++)t[s]=O[s-r];n=(r=n)+a.length;for(s=r;s<n;s++)t[s]=a[s-r];n=(r=n)+_.length;for(s=r;s<n;s++)t[s]=_[s-r];return t}function A(R){var E=new Uint8Array(R),O=0,e=parseInt("0x"+M(E.slice(O,O+4)));O+=4;var _=V(E.slice(O,O+e));O+=e;var a=parseInt("0x"+M(E.slice(O,O+4)));return O+=4,{digest:_,content:V(E.slice(O,O+a))}}function f(R){var E=8-R.length;return"00000000".substr(0,E)+R}function b(R){var E=4-R.length;return"0000".substr(0,E)+R}function o(R,E){var O=new Array(R+1).join("0"),e=R-E.length;return O.substr(0,e)+E}function H(R){var E,O,e=new Array;E=R.length;for(var _=0;_<E;_++)65536<=(O=R.charCodeAt(_))&&O<=1114111?(e.push(O>>18&7|240),e.push(O>>12&63|128),e.push(O>>6&63|128),e.push(63&O|128)):2048<=O&&O<=65535?(e.push(O>>12&15|224),e.push(O>>6&63|128),e.push(63&O|128)):128<=O&&O<=2047?(e.push(O>>6&31|192),e.push(63&O|128)):e.push(255&O);return e}function V(R){if("string"==typeof R)return R;for(var E="",O=R,e=0;e<O.length;e++){var _=O[e].toString(2),a=_.match(/^1+?(?=0)/);if(a&&8==_.length){for(var t=a[0].length,r=O[e].toString(2).slice(7-t),n=1;n<t;n++)r+=O[n+e].toString(2).slice(2);E+=String.fromCharCode(parseInt(r,2)),e+=t-1}else E+=String.fromCharCode(O[e])}return E}function k(R){var E=0,O=R.length;if(O%2!=0)return null;O/=2;for(var e=new Array,_=0;_<O;_++){var a=R.substr(E,2),t=parseInt("0x"+a);e.push(t),E+=2}return e}function M(R){for(var E="",O=0;O<R.length;O++){var e=R[O].toString(16);1==e.length&&(e="0"+e),E+=e}return E}function m(R,E,O){var e=E;for(var _ in O)for(var a=O[_],t=0;t<a.length;t++,e++)R[e]=a[t]}I.msgMaxLen=0,I.setUserInfo=function(R,E,O){v=(l=R)+"_"+(U=E),d=O},I.clear=function(){d=v=U=l="",I.msgMaxLen=0,clearInterval(i)},I.parseProtocol=function(R,c){var E=new Blob([R],{type:"text/plain"}),S=new FileReader;S.readAsArrayBuffer(E),S.onload=function(R){var E=new Uint8Array(S.result);console.info("parseProtocol:",E);var O=E[0],e=E.slice(1,5),_=E[5],a=E.slice(6,8),t=E.slice(8,10),r=E[10],n=E.slice(11,E.byteLength-2);console.info("parseProtocol: msgArr = ",n);var s=E.slice(E.byteLength-2,E.byteLength);c({appid:O,plength:e,appver:_,rese1:a,rese2:t,actionid:r,msgArr:n,end:s})}},I.packageProtocol=function(R,E,O){var e=R,_=new Array(255,255),a=new Array(255,255),t=E,r=(new Array(18,52),O),n=new Uint8Array(r),s=k(f((r.byteLength+12).toString(16))),c=new ArrayBuffer(r.byteLength+13),S=new Uint8Array(c);S[0]=e;for(var N=1;N<5;N++)S[N]=s[N-1];S[5]=1,S[6]=_[0],S[7]=_[1],S[8]=a[0],S[9]=a[1],S[10]=t;for(N=11;N<11+n.byteLength;N++)S[N]=n[N-11];return S[11+n.byteLength]=18,S[12+n.byteLength]=52,console.log("packageProtocol",S),S},I.constructAuthMsg=function(){for(var R=k(b(AG_MSG.B.toString(16))),E=H(v),O=k(b(E.length.toString(16))),e=H(d),_=new Uint8Array(E.length+36),a=0,t=R.length,r=a;r<t;r++)_[r]=R[r];t=(a=t)+O.length;for(r=a;r<t;r++)_[r]=O[r-a];t=(a=t)+E.length;for(r=a;r<t;r++)_[r]=E[r-a];t=(a=t)+e.length;for(r=a;r<t;r++)_[r]=e[r-a];a=0;var n=[];return n.push(R),n.push(O),n.push(E),n.push(e),m(_,a,n),_},I.constructSingleMsg=function(R,E,O,e,_){var a=k(b(AG_MSG.q.toString(16))),t=H(v),r=k(b(t.length.toString(16))),n=H(l+"_"+R),s=k(b(n.length.toString(16))),c=k(f(E.toString(16))),S=ENCRYPT_TYPE.m,N=MSG_DATA_TYPE.v;null!=_&&(N=_);var i={fromId:U,targetId:R,time:"0",msgIndex:E,type:"1",code:"0",contentData:e},I=C(O,JSON.stringify(i)),A=k(f(I.length.toString(16))),o=new Uint8Array(t.length+n.length+I.length+16),V=[];return V.push(a),V.push(r),V.push(t),V.push(s),V.push(n),V.push(c),V.push([S]),V.push([N]),V.push(A),V.push(I),m(o,0,V),o},I.constructGroupMsg=function(R,E,O,e){var _=k(b(AG_MSG.rR.toString(16))),a=H(""),t=k(b(a.length.toString(16))),r=k(f(E.toString(16))),n=H(l+"_"+R),s=k(b(n.length.toString(16))),c=H(v),S=k(b(c.length.toString(16))),N=ENCRYPT_TYPE.m,i=MSG_DATA_TYPE.v,I={fromId:U,targetId:R,time:"0",msgIndex:E,type:"1",code:"0",contentData:e},A=C(O,JSON.stringify(I)),o=k(f(A.length.toString(16))),V=new Uint8Array(a.length+n.length+c.length+A.length+18),M=[];return M.push(_),M.push(t),M.push(a),M.push(r),M.push(s),M.push(n),M.push(S),M.push(c),M.push([N]),M.push([i]),M.push(o),M.push(A),m(V,0,M),V},I.constructReceivedMsg=function(R){var E=k(b(AG_MSG.CR.toString(16))),O=H(v),e=k(b(O.length.toString(16))),_=new Uint8Array(R),a=new Uint8Array(O.length+12),t=[];return t.push(E),t.push(e),t.push(O),t.push(_),m(a,0,t),a},I.constructSingleCtrlMsg=function(R,E,O,e,_){var a=k(b(AG_MSG.q.toString(16))),t=H(v),r=k(b(t.length.toString(16))),n=H(l+"_"+R),s=k(b(n.length.toString(16))),c=k(f(E.toString(16))),S=ENCRYPT_TYPE.m,N=MSG_DATA_TYPE.U,i={fromId:U,targetId:R,time:"0",msgIndex:E,type:"0",code:_,contentData:e},I=C(O,JSON.stringify(i)),A=k(f(I.length.toString(16))),o=new Uint8Array(t.length+n.length+I.length+16),V=[];return V.push(a),V.push(r),V.push(t),V.push(s),V.push(n),V.push(c),V.push([S]),V.push([N]),V.push(A),V.push(I),m(o,0,V),o},I.constructVOIPProtocol=function(R,E){var O,e=[],_=k(b(R.toString(16))),a=H(v),t=k(b(a.length.toString(16))),r=H(d),n=k(b(r.length.toString(16)));switch(R){case AG_VOIPMOONSERVER.VE:case AG_VOIPMOONSERVER.CE:var s=H(l+"_"+E.targetId),c=k(b(s.length.toString(16))),S=k(o(8,parseInt(E.audioSSRC).toString(16))),N=k(o(8,parseInt(E.videoSSRC).toString(16)));O=new Uint8Array(2+(2+a.length)+(2+r.length)+(2+s.length)+4+4),e.push(_),e.push(t),e.push(a),e.push(n),e.push(r),e.push(c),e.push(s),e.push(S),e.push(N);break;case AG_VOIPMOONSERVER.uE:var i=E.isActive;O=new Uint8Array(3),e.push(_),e.push([i])}return m(O,0,e),O},I.constructSrcProtocol=function(R,E){var O,e=[],_=k(b(R.toString(16))),a=k(b((I=H(v)).length.toString(16))),t=k(b((A=H(d)).length.toString(16)));switch(R){case AG_LIVESRCMOONSERVER.oO:case AG_LIVESRCMOONSERVER.VO:var r=k(b(E.conCurrentNum.toString(16))),n=k(b((0).toString(16))),s=k(b((N=H(E.roomId)).length.toString(16))),c=E.liveType,S=k(b((M=H(E.extra)).length.toString(16)));O=new Uint8Array(2+(2+I.length)+(2+A.length)+2+2+(2+N.length)+1+(2+M.length)),e.push(_),e.push(a),e.push(I),e.push(t),e.push(A),e.push(r),e.push(n),e.push(s),e.push(N),e.push([c]),e.push(S),e.push(M);break;case AG_LIVESRCMOONSERVER.MO:r=k(b(conCurrentNum.toString(16))),n=k(b((0).toString(16))),s=k(b((N=H(roomId)).length.toString(16))),S=k(b((M=H(extra)).length.toString(16)));var N,i=k(b((C=H(spec)).length.toString(16)));e.push(_),e.push(a),e.push(I),e.push(t),e.push(A),e.push(r),e.push(n),e.push(s),e.push(N),e.push(S),e.push(M),e.push(i),e.push(C);break;case AG_LIVESRCMOONSERVER.CO:_=k(b(R.toString(16))),a=k(b((I=H(U)).length.toString(16))),t=k(b((A=H(d)).length.toString(16))),n=k(b((0).toString(16)));var I,A,o=k(b((V=H(groupId)).length.toString(16)));S=k(b((M=H(extra)).length.toString(16)));e.push(_),e.push(a),e.push(I),e.push(t),e.push(A),e.push(n),e.push(o),e.push(V),e.push(S),e.push(M);break;case AG_LIVESRCMOONSERVER.PO:var V,M,C;n=k(b((0).toString(16))),o=k(b((V=H(groupId)).length.toString(16))),S=k(b((M=H(extra)).length.toString(16))),i=k(b((C=H(spec)).length.toString(16)));e.push(_),e.push(a),e.push(I),e.push(t),e.push(A),e.push(n),e.push(o),e.push(V),e.push(S),e.push(M),e.push(i),e.push(C);break;case AG_LIVESRCMOONSERVER.TO:var P=H(channelId),T=H(avParam),u=k(b(T.length.toString(16)));e.push(_),e.push(a),e.push(I),e.push(t),e.push(A),e.push(P),e.push(u),e.push(T);break;case AG_LIVESRCMOONSERVER.LO:P=H(channelId);var L=k(b((G=H(upUserId)).length.toString(16)));e.push(_),e.push(a),e.push(I),e.push(t),e.push(A),e.push(P),e.push(L),e.push(G);break;case AG_LIVESRCMOONSERVER.GO:case AG_LIVESRCMOONSERVER.DO:case AG_LIVESRCMOONSERVER.lO:var G;P=H(channelId),L=k(b((G=H(upUserId)).length.toString(16)));e.push(_),e.push(a),e.push(I),e.push(t),e.push(A),e.push(P),e.push(L),e.push(G);break;case AG_LIVESRCMOONSERVER.fO:case AG_LIVESRCMOONSERVER.pO:P=H(E.channelId);O=new Uint8Array(2+(2+I.length)+(2+A.length)+16),e.push(_),e.push(a),e.push(I),e.push(t),e.push(A),e.push(P);break;case AG_LIVESRCMOONSERVER.UO:for(var D=E.streamConfig,l=new Uint8Array(16),f=0;f<16;f++)null!=D[f]?l[f]=D[f]:l[f]=0;O=new Uint8Array(18),e.push(_),e.push(l);break;case AG_LIVESRCMOONSERVER.vO:P=H(channelId);e.push(_),e.push(P);break;case AG_LIVESRCMOONSERVER.bO:e.push(_);break;case AG_LIVESRCMOONSERVER.dO:var p=H(E.streamData);O=new Uint8Array(3+p.length),e.push(_),e.push([E.streamDataType]),e.push(p)}return m(O,0,e),O},I.constructVdnProtocol=function(R,E){var O,e=[],_=k(b(R.toString(16))),a=H(v),t=k(b(a.length.toString(16))),r=H(d),n=k(b(r.length.toString(16)));switch(R){case AG_LIVEVDNMOONSERVER.ce:var s=k(o(8,E.ssrc.toString(16)));O=new Uint8Array(6),e.push(_),e.push(s);break;case AG_LIVEVDNMOONSERVER.Se:var c=H(E.channelId);O=new Uint8Array(18+(2+a.length)+(2+r.length)),e.push(_),e.push(c),e.push(t),e.push(a),e.push(n),e.push(r);break;case AG_LIVEVDNMOONSERVER.Ne:case AG_LIVEVDNMOONSERVER.ie:O=new Uint8Array(2),e.push(_);break;case AG_LIVEVDNMOONSERVER.oe:case AG_LIVEVDNMOONSERVER.Ie:c=H(E.channelId);O=new Uint8Array(18),e.push(_),e.push(c);break;case AG_LIVEVDNMOONSERVER.Ae:for(var S=E.streamConfig,N=new Uint8Array(16),i=0;i<16;i++)null!=S[i]?N[i]=S[i]:N[i]=0;O=new Uint8Array(18),e.push(_),e.push(N)}return m(O,0,e),O},I.constructChatProtocol=function(R,E){var O,e=[],_=k(b(R.toString(16))),a=H(v),t=k(b(a.length.toString(16))),r=H(d),n=k(b(r.length.toString(16)));if(R==AG_CHATROOMMOONSERVER.dR){var s=E.roomType,c=k(b(E.conCurrentNum.toString(16))),S=H(E.userDefineData),N=k(f(S.length.toString(16)));O=new Uint8Array(2+(2+a.length)+(2+r.length)+1+2+(4+S.length)),e.push(_),e.push(t),e.push(a),e.push(n),e.push(r),e.push([s]),e.push(c),e.push(N),e.push(S)}else if(R==AG_CHATROOMMOONSERVER.bR)O=new Uint8Array(2),e.push(_);else if(R==AG_CHATROOMMOONSERVER.HR){var i=H(l+"_"+E.banUserId),I=k(b(i.length.toString(16))),A=k(b(E.banTime.toString(16)));O=new Uint8Array(2+(2+i.length)+2),e.push(_),e.push(I),e.push(i),e.push(A)}else if(R==AG_CHATROOMMOONSERVER.kR){var o=H(l+"_"+E.kickOutUserId),V=k(b(o.length.toString(16)));O=new Uint8Array(2+(2+o.length)),e.push(_),e.push(V),e.push(o)}else if(R==AG_CHATROOMMOONSERVER.mR)O=new Uint8Array(2),e.push(_);else if(R==AG_CHATROOMMOONSERVER.gR){var M=H(E.roomId);O=new Uint8Array(2+(2+a.length)+(2+r.length)+16),e.push(_),e.push(t),e.push(a),e.push(n),e.push(r),e.push(M)}else if(R==AG_CHATROOMMOONSERVER.yR);else if(R==AG_CHATROOMMOONSERVER.wR)O=new Uint8Array(2),e.push(_);else if(R==AG_CHATROOMMOONSERVER.hR){var C={fromId:U,targetId:E.roomId,time:"0",msgIndex:E.msgIndex,type:"1",code:"0",contentData:E.msg},P=H(JSON.stringify(C)),T=k(f(P.length.toString(16)));O=new Uint8Array(2+(4+P.length)),e.push(_),e.push(T),e.push(P)}else if(R==AG_CHATROOMMOONSERVER.YR){C={fromId:U,targetId:E.roomId,time:"0",msgIndex:E.msgIndex,type:E.type,code:E.code,contentData:E.msg};var u=H(JSON.stringify(C)),L=k(f(u.length.toString(16))),G=H(l+"_"+E.toUserId),D=k(b(G.length.toString(16)));O=new Uint8Array(2+(2+G.length)+(4+u.length)),e.push(_),e.push(D),e.push(G),e.push(L),e.push(u)}else AG_CHATROOMMOONSERVER.xR;return m(O,0,e),O},I.constructWebrtcUploadMsgProtocol=function(R,E,O,e){var _=k(b(AG_LIVESRCMOONSERVER.uO.toString(16))),a=H(v),t=k(b(a.length.toString(16))),r=H(d),n=k(b(r.length.toString(16))),s=H(e),c=k(o(8,R.toString(16))),S=k(o(8,E.toString(16))),N=k(o(8,O.toString(16))),i=new Uint8Array(a.length+r.length+34);return m(i,0,[_,t,a,n,r,s,c,S,N]),i},I.parseMessage=function(R){var E,O=new Uint8Array(R);switch(parseInt("0x"+M(O.slice(0,2)))){case AG_MSG.J:O=new Uint8Array(R);StarRtc.AUtils.msgMaxLen=parseInt("0x"+M(O.slice(2,4))),console.log("登录成功,最大消息长度:",StarRtc.AUtils.msgMaxLen),StarRtc.StarManager.send(StarRtc.AUtils.packageProtocol(APP_PRODUCT_ID.R,ACTION_GROUP_ID.V,I.constructHeartBeatMsg(AG_MSG.X))),i=setInterval(function(){StarRtc.StarManager.send(StarRtc.AUtils.packageProtocol(APP_PRODUCT_ID.R,ACTION_GROUP_ID.V,I.constructHeartBeatMsg(AG_MSG.X)))},15e3);break;case AG_MSG.j:console.log("登录失败");break;case AG_MSG.$:console.log("心跳反馈");break;case AG_MSG.VR:console.log("服务器收到消息");break;case AG_MSG.MR:console.log("收到消息");parseInt("0x"+M(O.slice(10,14)));var e=15;switch(O[14]){case MSG_TYPE.L:console.log("单聊消息");var _=parseInt("0x"+M(O.slice(e,e+2)));e+=2;var a=V(O.slice(e,e+_)),t=O[e+=_];switch(e+=1,t){case ENCRYPT_TYPE.m:var r=parseInt("0x"+M(O.slice(e,e+4)));e+=4;var n=A(O.slice(e,e+r));console.log(a,n.digest,n.content),StarRtc.StarManager.getSingleMessage(a,n.digest,n.content);break;case ENCRYPT_TYPE.g:}break;case MSG_TYPE.G:console.log("群消息");var s=parseInt("0x"+M(O.slice(e,e+2)));e+=2;var c=V(O.slice(e,e+s));e+=s;_=parseInt("0x"+M(O.slice(e,e+2)));e+=2;a=V(O.slice(e,e+_)),t=O[e+=_];switch(e+=1,t){case ENCRYPT_TYPE.m:r=parseInt("0x"+M(O.slice(e,e+4)));e+=4;n=A(O.slice(e,e+r));console.log(c,a,n.digest,n.content),StarRtc.StarManager.getGroupMessage(c,a,n.digest,n.content);break;case ENCRYPT_TYPE.g:}break;case MSG_TYPE.D:console.log("群私信消息");s=parseInt("0x"+M(O.slice(e,e+2)));e+=2;c=V(O.slice(e,e+s));e+=s;_=parseInt("0x"+M(O.slice(e,e+2)));e+=2;a=V(O.slice(e,e+_)),t=O[e+=_];switch(e+=1,t){case ENCRYPT_TYPE.m:r=parseInt("0x"+M(O.slice(e,e+4)));e+=4;n=A(O.slice(e,e+r));console.log(c,a,n.digest,n.content),StarRtc.StarManager.getGroupPrivateMessage(c,a,n.digest,n.content);break;case ENCRYPT_TYPE.g:}break;case MSG_TYPE.l:console.log("推送群信息");s=parseInt("0x"+M(O.slice(e,e+2)));e+=2;c=V(O.slice(e,e+s));e+=s;r=parseInt("0x"+M(O.slice(e,e+4)));e+=4;n=A(O.slice(e,e+r));console.log(c,n.digest,n.content),StarRtc.StarManager.getGroupPushMessage(c,n.digest,n.content);break;case MSG_TYPE.p:console.log("推送系统信息");r=parseInt("0x"+M(O.slice(e,e+4)));e+=4;n=A(O.slice(e,e+r));console.log(n.digest,n.content),StarRtc.StarManager.getSystemPushMessage(n.digest,n.content)}E=O.slice(2,10),console.log("发送消息回执"),StarRtc.StarManager.send(StarRtc.AUtils.packageProtocol(APP_PRODUCT_ID.R,ACTION_GROUP_ID.V,StarRtc.AUtils.constructReceivedMsg(E)));break;case AG_MSG.PR:var S=parseInt("0x"+M(O.slice(2,4))),N=V(O.slice(6,O.byteLength));console.log("报错:",S,N),StarRtc.StarManager.getErrorMessage(S,N)}},I.parseSrcMoonServerMessage=function(R,E){var O=new Uint8Array(R);switch(parseInt("0x"+M(O.slice(0,2)))){case AG_LIVESRCMOONSERVER.gO:M(O.slice(18,20));var e=parseInt("0x"+M(O.slice(18,20)));E({type:"srcApplyUpload",status:"success",fingerprint:V(O.slice(20,20+e))});break;case AG_LIVESRCMOONSERVER.yO:var _=parseInt("0x"+M(O.slice(2,4)));E({type:"srcApplyUpload",status:"failed",msg:N=V(O.slice(4,4+_))});break;case AG_LIVESRCMOONSERVER.ee:console.log("webrtc心跳反馈");break;case AG_LIVESRCMOONSERVER._e:for(var a=parseInt("0x"+M(O.slice(2,3))),t=3,r=O.length,n={siv:a,uperInfos:{}};t<r;){var s=parseInt("0x"+M(O.slice(t,t+1)));t+=1;var c=parseInt("0x"+M(O.slice(t,t+2)));t+=2;var S=V(O.slice(t,t+c));t+=c,n.uperInfos[s]={upId:s,userId:S}}E({type:"uperStreamInfoUpdate",status:"success",msg:n});break;case AG_LIVESRCMOONSERVER.Oe:E({type:"stopStream",status:"success"});break;case AG_LIVESRCMOONSERVER.qO:E({type:"streamConfig",status:"success",channelId:V(O.slice(2,18))});break;case AG_LIVESRCMOONSERVER.zO:E({type:"streamConfig",status:"failed",channelId:V(O.slice(2,18))});break;case AG_LIVESRCMOONSERVER.XO:E({type:"delChannel",status:"success",channelId:V(O.slice(2,18))});break;case AG_LIVESRCMOONSERVER.$O:_=parseInt("0x"+M(O.slice(2,4)));var N=V(O.slice(4,4+_));E({type:"delChannel",status:"failed",channelId:V(O.slice(4+_,4+_+16)),msg:N});break;case AG_LIVESRCMOONSERVER.HO:E({type:"createChannel",status:"success",channelId:V(O.slice(2,18))});break;case AG_LIVESRCMOONSERVER.kO:_=parseInt("0x"+M(O.slice(2,4)));E({type:"createChannel",status:"failed",msg:N=V(O.slice(4,4+_))});break;case AG_LIVESRCMOONSERVER.ae:s=parseInt("0x"+M(O.slice(2,3))),a=parseInt("0x"+M(O.slice(3,4)));var i=V(O.slice(5));E({type:"streamData",status:"success",upId:s,siv:a,streamDataType:parseInt("0x"+M(O.slice(4,5))),streamData:i});break;case AG_LIVESRCMOONSERVER.te:(N={}).errId=parseInt("0x"+M(O.slice(2,4))),N.errStrlen=parseInt("0x"+M(O.slice(4,6))),N.errStr=V(O.slice(6,6+N.errStrlen)),E({type:"serverErr",status:"failed",msg:N})}},I.parseVdnMoonServerMessage=function(R,E){var O=new Uint8Array(R);switch(parseInt("0x"+M(O.slice(0,2)))){case AG_LIVEVDNMOONSERVER.Ve:var e=parseInt("0x"+M(O.slice(2,4)));E({type:"vdnWebrtcReg",status:"success",fingerprint:V(O.slice(4,4+e))});break;case AG_LIVEVDNMOONSERVER.Me:for(var _=V(O.slice(2,18)),a=parseInt("0x"+M(O.slice(18,19))),t=19,r=O.length,n={siv:a,uperInfos:{}};t<r;){var s=parseInt("0x"+M(O.slice(t,t+1)));t+=1;var c=parseInt("0x"+M(O.slice(t,t+2)));t+=2;var S=V(O.slice(t,t+c));t+=c,n.uperInfos[s]={upId:s,userId:S}}E({type:"vdnApplyDownload",status:"success",channelId:_,uperInfos:n});break;case AG_LIVEVDNMOONSERVER.Ce:console.log("vdn 心跳反馈");break;case AG_LIVEVDNMOONSERVER.Pe:var N=parseInt("0x"+M(O.slice(2,4))),i=V(O.slice(4,4+N));E({type:"vdnApplyDownload",status:"failed",channelId:_=V(O.slice(4+N,4+N+16)),failedStatus:i});break;case AG_LIVEVDNMOONSERVER.Te:E({type:"streamConfig",status:"success",channelId:_=V(O.slice(2,18))});break;case AG_LIVEVDNMOONSERVER.ue:E({type:"streamConfig",status:"failed",channelId:_=V(O.slice(2,18))});break;case AG_LIVEVDNMOONSERVER.Le:break;case AG_LIVEVDNMOONSERVER.Ge:E({type:"streamData",status:"success",upId:s=parseInt("0x"+M(O.slice(2,3))),siv:a=parseInt("0x"+M(O.slice(3,4))),streamDataType:parseInt("0x"+M(O.slice(4,5))),streamData:V(O.slice(5))});break;case AG_LIVEVDNMOONSERVER.De:case AG_LIVEVDNMOONSERVER.le:case AG_LIVEVDNMOONSERVER.fe:break;case AG_LIVEVDNMOONSERVER.Ue:var I={};I.errId=parseInt("0x"+M(O.slice(2,4))),I.errStrlen=parseInt("0x"+M(O.slice(4,6))),I.errStr=V(O.slice(6,6+I.errStrlen)),E({type:"serverErr",status:"failed",msg:I})}},I.parseChatMoonServerMessage=function(R,E){var O=new Uint8Array(R),e=parseInt("0x"+M(O.slice(0,2)));switch(e){case AG_CHATROOMMOONSERVER.FR:E({type:"createChatRoom",status:"success",chatroomId:a=V(O.slice(2,18)),maxContentLen:parseInt("0x"+M(O.slice(18,20)))});break;case AG_CHATROOMMOONSERVER.WR:var _=parseInt("0x"+M(O.slice(2,4)));E({type:"createChatRoom",status:"failed",status:V(O.slice(4,4+_))});break;case AG_CHATROOMMOONSERVER.KR:E({type:"deleteChatRoom",status:"success",roomId:a=V(O.slice(2,18))});break;case AG_CHATROOMMOONSERVER.BR:var a=V(O.slice(2,18));_=parseInt("0x"+M(O.slice(18,20)));E({type:"deleteChatRoom",status:"failed",status:V(O.slice(20,20+_)),roomId:a});break;case AG_CHATROOMMOONSERVER.JR:case AG_CHATROOMMOONSERVER.jR:case AG_CHATROOMMOONSERVER.QR:case AG_CHATROOMMOONSERVER.XR:break;case AG_CHATROOMMOONSERVER.$R:case AG_CHATROOMMOONSERVER.qR:E({type:"joinChatRoom",status:"success",roomId:a=V(O.slice(2,18)),maxContentLen:parseInt("0x"+M(O.slice(18,20)))});break;case AG_CHATROOMMOONSERVER.zR:a=V(O.slice(2,18)),_=parseInt("0x"+M(O.slice(18,20)));E({type:"joinChatRoom",status:"failed",failedStatus:V(O.slice(20,20+_)),roomId:a});break;case AG_CHATROOMMOONSERVER.ZR:console.log("chatRoom心跳反馈");break;case AG_CHATROOMMOONSERVER.RE:case AG_CHATROOMMOONSERVER.EE:var t=parseInt("0x"+M(O.slice(2,4))),r=V(O.slice(4,4+t)),n=parseInt("0x"+M(O.slice(4+t,4+t+4))),s=V(O.slice(4+t+4,4+t+4+n));E({type:e==AG_CHATROOMMOONSERVER.RE?"recvChatPrivateMsg":"recvChatMsg",status:"success",fromUserId:r,msg:s});break;case AG_CHATROOMMOONSERVER.OE:E({type:"chatroomUserBannedMsg",status:"success",banTime:parseInt("0x"+M(O.slice(2,4)))});break;case AG_CHATROOMMOONSERVER.eE:E({type:"chatroomUserKicked",status:"success"});break;case AG_CHATROOMMOONSERVER._E:break;case AG_CHATROOMMOONSERVER.aE:(s={}).errId=parseInt("0x"+M(O.slice(2,4))),s.errStrlen=parseInt("0x"+M(O.slice(4,6))),s.errStr=V(O.slice(6,6+s.errStrlen)),E({type:"serverErr",status:"failed",msg:s});break;case AG_CHATROOMMOONSERVER.tE:}},I.parseVoipMoonServerMessage=function(R,E){var O=new Uint8Array(R);switch(parseInt("0x"+M(O.slice(0,2)))){case AG_VOIPMOONSERVER.LE:E({type:"voipCallingAck",status:"success"});break;case AG_VOIPMOONSERVER.DE:var e=parseInt("0x"+M(O.slice(2,4)));E({type:"voipCalling",status:"success",fingerprint:V(O.slice(4,4+e))});break;case AG_VOIPMOONSERVER.lE:(_={}).errId=parseInt("0x"+M(O.slice(2,4))),_.errStrlen=parseInt("0x"+M(O.slice(4,6))),_.errStr=V(O.slice(6,6+_.errStrlen)),E({type:"voipCalling",status:"failed",msg:_});break;case AG_VOIPMOONSERVER.pE:e=parseInt("0x"+M(O.slice(2,4)));E({type:"voipResponseing",status:"success",fingerprint:V(O.slice(4,4+e))});break;case AG_VOIPMOONSERVER.UE:(_={}).errId=parseInt("0x"+M(O.slice(2,4))),_.errStrlen=parseInt("0x"+M(O.slice(4,6))),_.errStr=V(O.slice(6,6+_.errStrlen)),E({type:"voipResponseing",status:"failed",msg:_});break;case AG_VOIPMOONSERVER.vE:case AG_VOIPMOONSERVER.dE:break;case AG_VOIPMOONSERVER.bE:var _;(_={}).errId=parseInt("0x"+M(O.slice(2,4))),_.errStrlen=parseInt("0x"+M(O.slice(4,6))),_.errStr=V(O.slice(6,6+_.errStrlen)),E({type:"serverErr",status:"failed",msg:_})}},I.constructHeartBeatMsg=function(R){return new Uint8Array(k(b(R.toString(16))))}},StarRtc.StarManager=new function(){var _=this,R="starRTC v1.0.0",a="",t="",r="",n="",s="",E=null,c=null,S="";_.version=function(){return console.log(R),R},_.login=function(R,E,O,e){"WebSocket"in window?(r=(a=R)+"_"+(t=E),n=O,c=e,$.get("https://ips.starrtc.com:9920?userId="+r+"&authKey="+n,function(R,E){if(console.log("authKey 验证:",E,R),"success"===E){var O=JSON.parse(R);1==O.status&&(s=O.data,$.get("https://ips.starrtc.com:9904?userId="+r,function(R,E){E="success";console.log("消息调度:",E,R);var O=JSON.parse(R);1==O.status&&(S="wss://"+O.data,_.connect())}))}})):(console.log("当前浏览器 Not support websocket"),e("当前浏览器 Not support websocket","connect failed"))},_.connect=function(){console.log("WebSocket:"+S),(E=new WebSocket(S)).onerror=function(){console.log("WebSocket连接发生错误"),c("WebSocket连接发生错误","connect failed")},E.onopen=function(){console.log("WebSocket连接成功"),c("WebSocket连接成功","connect success"),StarRtc.AUtils.setUserInfo(a,t,s),StarRtc.StarManager.send(StarRtc.AUtils.packageProtocol(APP_PRODUCT_ID.R,ACTION_GROUP_ID.V,StarRtc.AUtils.constructAuthMsg()))},E.onmessage=function(R){console.log("onmessage",R.data),c(R.data,"onmessage")},E.onclose=function(){console.log("WebSocket连接关闭"),c("WebSocket连接关闭","connect closed"),E=null}},_.close=function(){console.log("关闭WebSocket连接"),StarRtc.AUtils.clear(),null!=E&&E.close()},_.send=function(R){null!=E&&E.send(R)},_.getSingleMessage=function(R,E,O){var e=R.split("_");2==e.length&&(R=e[1]),c({fromId:R,digest:E,msg:O},"onSingleMessage")},_.getErrorMessage=function(R,E){c({errId:R,errStr:E},"onErrorMessage")},_.getGroupMessage=function(R,E,O,e){var _=E.split("_");2==_.length&&(E=_[1]);var a=R.split("_");2==a.length&&(R=a[1]),c({groupId:R,fromId:E,digest:O,msg:e},"onGroupMessage")},_.getGroupPrivateMessage=function(R,E,O,e){var _=E.split("_");2==_.length&&(E=_[1]);var a=R.split("_");2==a.length&&(R=a[1]),c({groupId:R,fromId:E,digest:O,msg:e},"onGroupPrivateMessage")},_.getGroupPushMessage=function(R,E,O){var e=R.split("_");2==e.length&&(R=e[1]),c({groupId:R,digest:E,msg:O},"onGroupPushMessage")},_.getSystemPushMessage=function(R,E){c({digest:R,msg:E},"onSystemPushMessage")},window.onbeforeunload=function(){_.close()}},StarRtc.Instance=new function(){var _=this,n="",s="",c="",a=null,e=null,t=0;_.version=function(){return StarRtc.StarManager.version()};var r=function(R,E){switch(E){case"connect failed":case"connect success":case"connect closed":a(R,E);break;case"onmessage":StarRtc.AUtils.parseProtocol(R,function(R){switch(R.appid){case APP_PRODUCT_ID.R:StarRtc.AUtils.parseMessage(R.msgArr)}});break;case"onSingleMessage":R.msg=JSON.parse(R.msg);var O=E;if(0==R.msg.type)switch(R.msg.code){case AG_MSG_VOIP_CTRL.h:R.type="voipCall",O="onVoipMessage";break;case AG_MSG_VOIP_CTRL.Y:R.type="voipRefuse",O="onVoipMessage";break;case AG_MSG_VOIP_CTRL.F:R.type="voipHangup",O="onVoipMessage";break;case AG_MSG_VOIP_CTRL.W:R.type="voipBusy",O="onVoipMessage";break;case AG_MSG_VOIP_CTRL.K:R.type="voipConnect",O="onVoipMessage";break;default:R.type="voipSingleMsg"}else R.type="voipSingleMsg";(null!=e?e:a)(R,O);break;case"onGroupMessage":case"onGroupPrivateMessage":case"onGroupPushMessage":case"onSystemPushMessage":case"onErrorMessage":null!=e&&e(R,E),a(R,E)}};_.login=function(R,E,O,e){(n=R)+"_"+(s=E),c=O,a=e,StarRtc.StarManager.login(R,E,O,r)},_.logout=function(){StarRtc.StarManager.close()},_.sendSingleMsg=function(R,E,O,e){StarRtc.StarManager.send(StarRtc.AUtils.packageProtocol(APP_PRODUCT_ID.R,ACTION_GROUP_ID.V,StarRtc.AUtils.constructSingleMsg(R,++t,E,O,e)))},_.sendGroupMsg=function(R,E,O){StarRtc.StarManager.send(StarRtc.AUtils.packageProtocol(APP_PRODUCT_ID.R,ACTION_GROUP_ID.V,StarRtc.AUtils.constructGroupMsg(R,++t,E,O)))},_.sendSingleCtrlMsg=function(R,E,O,e){StarRtc.StarManager.send(StarRtc.AUtils.packageProtocol(APP_PRODUCT_ID.R,ACTION_GROUP_ID.V,StarRtc.AUtils.constructSingleCtrlMsg(R,++t,E,O,e)))},_.sendVoipCtrlMsg=function(R,E){var O="";E==AG_MSG_VOIP_CTRL.h&&(O=JSON.stringify({VoIP_protocal_type:"TCP",VoIP_server_IP:"voip.starrtc.com",VoIP_server_Port:10086})),_.sendSingleCtrlMsg(R,"新消息",O,E)},_.sendVoipCallMsg=function(R){_.sendVoipCtrlMsg(R,AG_MSG_VOIP_CTRL.h)},_.sendVoipRefuseMsg=function(R){_.sendVoipCtrlMsg(R,AG_MSG_VOIP_CTRL.Y)},_.sendVoipHungupMsg=function(R){_.sendVoipCtrlMsg(R,AG_MSG_VOIP_CTRL.F)},_.sendVoipBusyMsg=function(R){_.sendVoipCtrlMsg(R,AG_MSG_VOIP_CTRL.W)},_.sendVoipConnectMsg=function(R){_.sendVoipCtrlMsg(R,AG_MSG_VOIP_CTRL.K)},_.setIMExtraback=function(R){e=R},_.getStarRoomSDK=function(R,E,O,e,_,a,t){var r=new StarRtc.StarRoomSDK(R,E,O,e,_,a,t);return r.login(n,s,c),r},_.getVideoMeetingRoomSDK=function(R,E,O){return _.getStarRoomSDK("src",R,E,O,3,1)},_.getVideoLiveRoomSDK=function(R,E,O,e){return _.getStarRoomSDK(R,E,O,e,3,2)},_.getVoipRoomSDK=function(R,E,O){return _.getStarRoomSDK("voip",R,E,O,2,0,_)}},StarRtc.WebrtcWebsocket=function(R,E){var O,e=this,_=E,a=R,t=null;return e.startHeartBeat=function(R){t.send(R),O=setInterval(function(){t.send(R)},5e3)},e.stopHeartBeat=function(){clearInterval(O)},e.connect=function(R){console.log("webrtcConnect"+R),(t=new WebSocket(R)).onerror=function(R){console.log("WebSocket连接发生错误"),a({msg:"WebSocket连接发生错误",data:R.data},"connect failed")},t.onopen=function(){console.log("WebSocket连接成功"),a({msg:"WebSocket连接成功"},"connect success")},t.onmessage=function(R){console.log("onmessage",R.data),a(R.data,"onmessage")},t.onclose=function(R){console.log("WebSocket连接关闭"),e.stopHeartBeat(),a({msg:"WebSocket连接关闭",data:R.code},"connect closed"),t=null}},e.starConnect=function(e){$.get(_,function(R,E){if(console.log("消息调度:",E,R),"success"===E){var O=JSON.parse(R);1==O.status?e("success",O.data):e("failed")}else e("failed")})},e.send=function(R){t.send(R)},e.close=function(){null!=t&&t.close()},e.readyState=function(){return null!=t?t.readyState:-1},e},StarRtc.StarRoomSDK=function(R,E,O,e,_,a,t){var r="我要上麦!",n=this,s=E,c=R,S=e,N=O,i=_||3,I=0!=(1&i),A=0!=(2&i),o=null,V=null,M=null,C=null,P=t;function T(R){if(null!=R){var E=R.getState();0<=E&&E<2&&R.sigDisconnect()}}function u(){var R=!0;return I&&(R=R&&(3==M.getState()||-1==M.getState())),A&&(R=R&&(3==o.getState()||-1==o.getState())),R}null!=P&&"voip"==R&&P.setIMExtraback(function(R,E){L(R,"onVoipMessage")});var L=function(R,E){switch(R.userData=S,R.obj=n,E){case"connect success":A?o.sigConnect():N(R,E,s);break;case"connect failed":case"connect closed":A&&T(o),u()&&N(R,E,s);break;case"onmessage":break;case"onChatRoomMessage":switch(R.type){case"createChatRoom":"success"==R.status&&(S.roomInfo.ID=R.chatroomId,A&&(V.roomInfo.Name=R.chatroomId,o.createNew()));break;case"deleteChatRoom":"success"==R.status&&(A?o.deleteCurrRoom():N(R,E,s));break;case"joinChatRoom":"success"==R.status&&A&&o.joinRoom();break;case"recvChatPrivateMsg":if(0==R.msg.type)switch(R.msg.code){case 2e3:R.msg.msgType="apply";break;case 2002:R.msg.msgType="applyAgree";break;case 2004:R.msg.msgType="applyDisagree";break;case 2200:R.msg.msgType="linkStop";break;case 2100:R.msg.msgType="invite";break;case 2102:R.msg.msgType="inviteAgree";break;case 2106:R.msg.msgType="inviteDisagree";break;case 2104:R.msg.msgType="inviteLinkStart";break;default:R.msg.msgType="common"}}N(R,E,s);break;case"onVoipMessage":switch(R.type){case"voipCall":P.sendVoipBusyMsg(R.fromId);break;case"voipHangup":R.fromId==S.roomInfo.targetId&&(n.leaveRoom(!0),N(R,E,s));break;case"voipBusy":n.leaveRoom(!0),N(R,E,s);break;case"voipRefuse":default:N(R,E,s)}}};return V=clone(S),C=clone(S),A&&I&&(V.roomInfo.ID=S.roomInfo.ID.substring(0,16),C.roomInfo.ID=S.roomInfo.ID.substring(16,33)),A&&(o=new StarRtc.StarVideoSDK(R,E,function(R,E){switch(R.userData=S,R.obj=n,E){case"connect success":N(R,E,s);break;case"connect closed":case"connect failed":I&&T(M),u()&&N(R,E,s);break;case"onmessage":break;case"onWebrtcMessage":switch(R.type){case"delChannel":"success"==R.status?N(R,E,s):alert("删除视频会议失败");break;case"createChannel":"success"==R.status&&(I?(S.roomInfo.ID=R.channelId+S.roomInfo.ID,O=S.roomInfo,_="",1==(e=a)?_="https://api.starrtc.com/demo/meeting/store?ID="+O.ID+"&Name="+O.Name+"&Creator="+O.Creator:2==e&&(_="https://api.starrtc.com/demo/live/store?ID="+O.ID+"&Name="+O.Name+"&Creator="+O.Creator),$.get(_)):S.roomInfo.ID=R.channelId),N(R,E,s);break;case"voipCallingAck":null!=P&&P.sendVoipCallMsg(S.roomInfo.targetId);break;case"voipResponseing":"success"==R.status&&null!=P&&P.sendVoipConnectMsg(S.roomInfo.targetId);break;default:N(R,E,s)}}var O,e,_},V,a)),I&&(M=new StarRtc.StarChatSDK(E,L,C)),n.login=function(R,E,O){R+"_"+E,O,I&&M.login(R,E,O),A&&o.login(R,E,O)},n.sigConnect=function(){I?M.sigConnect():A&&o.sigConnect()},n.sigDisconnect=function(){A?o.sigDisconnect():I&&M.sigDisconnect()},n.createNew=function(){I?M.createNew():A&&o.createNew()},n.deleteCurrRoom=function(){I?M.deleteCurrRoom():A&&o.deleteCurrRoom()},n.createStream=function(R){A&&o.createStream(R)},n.joinRoom=function(){I&&"new"!=s?M.joinRoom():A&&o.joinRoom()},n.leaveRoom=function(R){if(A){switch(c){case"voip":var E=R||!1;null==P||E||P.sendVoipHungupMsg(S.roomInfo.targetId),P.setIMExtraback(null)}o.leaveRoom(E)}else I&&M.leaveRoom()},n.streamConfigChange=function(R){A&&o.streamConfigChange(R)},n.sendChatMsg=function(R){I&&M.sendChatMsg(R)},n.sendVoipMsg=function(R){"voip"==c&&null!=P&&P.sendSingleMsg(S.roomInfo.targetId,"新媒体",R)},n.sendChatPrivateMsg=function(R,E){I&&M.sendChatPrivateMsg(R,E)},n.sendApplyMsg=function(){I&&A&&"vdn"==c&&M.sendChatCtrlPrivateMsg(S.roomInfo.Creator,r,2e3)},n.sendApplyAgreeMsg=function(R){I&&A&&"src"==c&&M.sendChatCtrlPrivateMsg(R,r,2002)},n.sendApplyDisagreeMsg=function(R){I&&A&&"src"==c&&M.sendChatCtrlPrivateMsg(R,r,2004)},n.sendInviteLinkMsg=function(R){I&&A&&"src"==c&&M.sendChatCtrlPrivateMsg(R,r,2100)},n.sendInviteLinkAgreeMsg=function(){I&&A&&"vdn"==c&&M.sendChatCtrlPrivateMsg(S.roomInfo.Creator,r,2102)},n.sendInviteLinkDisagreeMsg=function(){I&&A&&"vdn"==c&&M.sendChatCtrlPrivateMsg(S.roomInfo.Creator,r,2106)},n.sendInviteLinkStartMsg=function(){I&&A&&"vdn"==c&&M.sendChatCtrlPrivateMsg(S.roomInfo.Creator,r,2104)},n.sendLinkStopMsg=function(R){I&&A&&"src"==c&&M.sendChatCtrlPrivateMsg(R,r,2200)},n.kickOutUser=function(R){I&&M.kickOutUser(R)},n.sendStreamData=function(R){A&&"src"==c&&o.sendStreamData(R)},n},StarRtc.StarVideoSDK=function(R,E,O,e,_){var n,s,c=this,S="",N=e,i=R,I=O,A=E,o=null,V="",M={},C={},a=_||1,P={siv:0,uperInfos:{}},T=StarWebRTC();T.init();var u=!1,t=function(R){switch(R.type){case"createOffer":if("success"==R.status){switch(i){case"src":R.channelId=N.roomInfo.ID;break;case"vdn":R.ssrc=R.bigVideoSSRC;break;case"voip":R.targetId=N.roomInfo.targetId,R.videoSSRC=R.bigVideoSSRC}c.joinRoomInternal(R)}break;case"applyAnswer":R.status}},r=function(R,E){var O={type:"streamCreated",streamObj:E};O.userData=N,O.obj=c,O.status="success"==R?"success":"failed",I(O,"onWebrtcMessage",A)},L=function(R,E){switch(R.userData=N,R.obj=c,E){case"connect success":var O=null;switch(i){case"src":O=StarRtc.AUtils.packageProtocol(APP_PRODUCT_ID.N,ACTION_GROUP_ID.P,StarRtc.AUtils.constructHeartBeatMsg(AG_LIVESRCMOONSERVER.bO));break;case"vdn":O=StarRtc.AUtils.packageProtocol(APP_PRODUCT_ID.i,ACTION_GROUP_ID.P,StarRtc.AUtils.constructHeartBeatMsg(AG_LIVEVDNMOONSERVER.ie))}o.startHeartBeat(O),T.setServerInfo({serverIp:M.ip,serverPort:M.webrtcPort}),I(R,E,A);break;case"connect failed":case"connect closed":T.destroy(),o=null,I(R,E,A);break;case"onmessage":StarRtc.AUtils.parseProtocol(R,function(R){R.appid==APP_PRODUCT_ID.N?StarRtc.AUtils.parseSrcMoonServerMessage(R.msgArr,function(R){L(R,"onWebrtcMessage")}):R.appid==APP_PRODUCT_ID.i?StarRtc.AUtils.parseVdnMoonServerMessage(R.msgArr,function(R){L(R,"onWebrtcMessage")}):R.appid==APP_PRODUCT_ID.I&&StarRtc.AUtils.parseVoipMoonServerMessage(R.msgArr,function(R){L(R,"onWebrtcMessage")})});break;case"onWebrtcMessage":switch(R.type){case"uperStreamInfoUpdate":if("success"==R.status){if(u)for(var e=0;e<7;++e){var _=T.getStreamByIndex(e),a=void 0;0!=Object.keys(P.uperInfos).length&&(a=P.uperInfos[e]);var t=R.msg.uperInfos[e];if(null==a&&null!=t)t.userId!=S&&I({type:"addUploader",upId:t.upId,upUserId:t.userId,streamInfo:_,room:c},E,A);else if(null!=a&&null==t){var r=s==a.upId;r&&(s=n=void 0),T.resetStreamInfo(_),I({type:"removeUploader",upId:a.upId,upUserId:a.userId,streamInfo:_,bigFlag:r,room:c},E,A)}else null!=a&&null!=t&&a.userId!=t.userId&&I({type:"changeUploader",upId:t.upId,oldUpUserId:a.userId,newUpUserId:t.userId,streamInfo:_,room:c},E,A)}P=R.msg}break;case"vdnWebrtcReg":if("success"==R.status)switch(i){case"vdn":V=R.fingerprint,o.send(StarRtc.AUtils.packageProtocol(APP_PRODUCT_ID.i,ACTION_GROUP_ID.P,StarRtc.AUtils.constructVdnProtocol(AG_LIVEVDNMOONSERVER.Se,{channelId:N.roomInfo.ID})))}break;case"vdnApplyDownload":"success"==R.status&&T.emit("_webrtc_apply_ok",V,function(){u=!0,L({type:"uperStreamInfoUpdate",status:"success",msg:R.uperInfos},"onWebrtcMessage")}),I(R,E,A);break;case"srcApplyUpload":"success"==R.status?(R.tmpData=C,console.log("收到_webrtc_apply_ok"),T.emit("_webrtc_apply_ok",R.fingerprint,function(){u=!0,cloneObj=clone(P),P.uperInfos={},L({type:"uperStreamInfoUpdate",status:"success",msg:cloneObj},"onWebrtcMessage")})):console.log("收到_webrtc_apply_failed"),I(R,E,A);break;case"streamConfig":if("success"==R.status){if(n==s){_=T.getStreamByIndex(n);T.switchStreamInfo(_);break}if(null!=n){_=T.getStreamByIndex(n);T.switchStreamInfo(_)}if(null!=s){_=T.getStreamByIndex(s);T.switchStreamInfo(_)}}break;case"createChannel":"success"==R.status&&(N.roomInfo.ID=R.channelId),I(R,E,A);break;case"delChannel":"success"==R.status&&(N.roomInfo.ID=""),I(R,E,A);break;case"serverErr":break;case"voipResponseing":case"voipCalling":"success"==R.status&&(console.log("收到_webrtc_apply_ok"),T.emit("_webrtc_apply_ok",R.fingerprint,function(){L({type:"voipStreamReady",status:"success"},"onWebrtcMessage")})),I(R,E,A);break;case"voipStreamReady":_=T.getStreamByIndex(0);T.switchStreamInfo(_),I({type:"voipStreamReady",streamObj:_.streamObj,room:c},E,A);break;default:I(R,E,A)}}};return c.login=function(R,E,O){S=R+"_"+E,O},c.sigConnect=function(){var R="https://ips.starrtc.com:9929/?userId="+S;switch(i){case"src":R="https://ips.starrtc.com:9929/?userId="+S;break;case"vdn":R="https://ips.starrtc.com:9926/?userId="+S+"&channelId="+N.channelId}(o=new StarRtc.WebrtcWebsocket(L,R)).starConnect(function(R,E){if("success"==R){M.websocketPort=E.websocketPort,M.webrtcPort=E.webrtcPort,M.ip="101.200.40.53";var O;"voip"==i&&(E.ip="voip.starrtc.com",M.websocketPort="10087",M.webrtcPort="10088",E.websocketPort=M.websocketPort,E.webrtcPort=M.webrtcPort),O="wss://"+E.ip+":"+E.websocketPort,o.connect(O)}})},c.sigDisconnect=function(){null!=o&&(o.close(),o=null)},c.createNew=function(){if(null!=o)switch(i){case"src":var R="1";2==a&&(R="2");var E=AG_LIVESRCMOONSERVER.oO;1==N.roomInfo.Type&&(E=AG_LIVESRCMOONSERVER.VO),o.send(StarRtc.AUtils.packageProtocol(APP_PRODUCT_ID.N,ACTION_GROUP_ID.P,StarRtc.AUtils.constructSrcProtocol(E,{conCurrentNum:7,roomId:N.roomInfo.Name,extra:R,liveType:parseInt(R)})))}},c.deleteCurrRoom=function(){if(null!=o)switch(i){case"src":o.send(StarRtc.AUtils.packageProtocol(APP_PRODUCT_ID.N,ACTION_GROUP_ID.P,StarRtc.AUtils.constructSrcProtocol(AG_LIVESRCMOONSERVER.pO,{channelId:N.roomInfo.ID})))}},c.createStream=function(R){null==R&&(R={video:{width:{min:640,ideal:640,max:640},height:{min:480,ideal:480,max:480},frameRate:{ideal:15,max:15}},audio:!0}),T.createStream(R,r)},c.joinRoom=function(){T.emit("ready",t,"voip"==i)},c.joinRoomInternal=function(R){switch(C=R,i){case"src":o.send(StarRtc.AUtils.packageProtocol(APP_PRODUCT_ID.N,ACTION_GROUP_ID.P,StarRtc.AUtils.constructWebrtcUploadMsgProtocol(parseInt(R.audioSSRC),parseInt(R.smallVideoSSRC),parseInt(R.bigVideoSSRC),R.channelId)));break;case"vdn":o.send(StarRtc.AUtils.packageProtocol(APP_PRODUCT_ID.i,ACTION_GROUP_ID.P,StarRtc.AUtils.constructVdnProtocol(AG_LIVEVDNMOONSERVER.ce,{ssrc:parseInt(R.ssrc)})));break;case"voip":"call"==A?o.send(StarRtc.AUtils.packageProtocol(APP_PRODUCT_ID.I,ACTION_GROUP_ID.T,StarRtc.AUtils.constructVOIPProtocol(AG_VOIPMOONSERVER.VE,R))):"response"==A&&o.send(StarRtc.AUtils.packageProtocol(APP_PRODUCT_ID.I,ACTION_GROUP_ID.T,StarRtc.AUtils.constructVOIPProtocol(AG_VOIPMOONSERVER.CE,R)))}},c.leaveRoom=function(R){if(null!=o&&1==o.readyState())switch(i){case"src":o.send(StarRtc.AUtils.packageProtocol(APP_PRODUCT_ID.N,ACTION_GROUP_ID.P,StarRtc.AUtils.constructSrcProtocol(AG_LIVESRCMOONSERVER.fO,{channelId:N.roomInfo.ID})));break;case"vdn":o.send(StarRtc.AUtils.packageProtocol(APP_PRODUCT_ID.i,ACTION_GROUP_ID.P,StarRtc.AUtils.constructVdnProtocol(AG_LIVEVDNMOONSERVER.Ne,{})));case"voip":o.send(StarRtc.AUtils.packageProtocol(APP_PRODUCT_ID.I,ACTION_GROUP_ID.T,StarRtc.AUtils.constructVOIPProtocol(AG_VOIPMOONSERVER.uE,{isActive:R?0:1})))}},c.streamConfigChange=function(R){if(null!=o){s==R?(s=n,n=R):(n=s,s=R);var E=T.getStreamInfos(),O=[];for(var e in E){var _=0;_=n==s?E[e].switchFlag?1:2:e==n?1:e==s?2:E[e].switchFlag?2:1,O.push(_)}switch(i){case"src":o.send(StarRtc.AUtils.packageProtocol(APP_PRODUCT_ID.N,ACTION_GROUP_ID.P,StarRtc.AUtils.constructSrcProtocol(AG_LIVESRCMOONSERVER.UO,{streamConfig:O})));break;case"vdn":o.send(StarRtc.AUtils.packageProtocol(APP_PRODUCT_ID.i,ACTION_GROUP_ID.P,StarRtc.AUtils.constructVdnProtocol(AG_LIVEVDNMOONSERVER.Ae,{streamConfig:O})))}}},c.getState=function(){return null!=o?o.readyState():-1},c.getType=function(){return i},c.sendStreamData=function(R){switch(i){case"src":o.send(StarRtc.AUtils.packageProtocol(APP_PRODUCT_ID.N,ACTION_GROUP_ID.P,StarRtc.AUtils.constructSrcProtocol(AG_LIVESRCMOONSERVER.dO,{streamData:R,streamDataType:8})))}},c},StarRtc.StarChatSDK=function(R,E,O){var e=this,_="",a="",t={},r=O,n=E,s=R,c=null,S=0,N=function(R,E){switch(R.userData=r,R.obj=e,E){case"connect success":var O;O=StarRtc.AUtils.packageProtocol(APP_PRODUCT_ID.O,ACTION_GROUP_ID.M,StarRtc.AUtils.constructHeartBeatMsg(AG_CHATROOMMOONSERVER.mR)),c.startHeartBeat(O),n(R,E,s);break;case"connect failed":case"connect closed":c=null,n(R,E,s);break;case"onmessage":StarRtc.AUtils.parseProtocol(R,function(R){R.appid==APP_PRODUCT_ID.O&&StarRtc.AUtils.parseChatMoonServerMessage(R.msgArr,function(R){N(R,"onChatRoomMessage")})});break;case"onChatRoomMessage":switch(R.type){case"createChatRoom":"success"==R.status&&(r.roomInfo.ID=R.chatroomId);break;case"deleteChatRoom":case"joinChatRoom":R.status;break;case"recvChatPrivateMsg":case"recvChatMsg":if(R.msg=JSON.parse(R.msg),R.msg.fromId==_)return}n(R,E,s)}};return e.login=function(R,E,O){a=R+"_"+(_=E),O},e.sigConnect=function(){var R="https://ips.starrtc.com:9907/?userId="+a;(c=new StarRtc.WebrtcWebsocket(N,R)).starConnect(function(R,E){if(R){var O=E.split(":");t.ip=O[0],t.port=O[1];var e="wss://"+t.ip+":"+t.port;c.connect(e)}})},e.sigDisconnect=function(){null!=c&&(c.close(),c=null)},e.createNew=function(){c.send(StarRtc.AUtils.packageProtocol(APP_PRODUCT_ID.O,ACTION_GROUP_ID.M,StarRtc.AUtils.constructChatProtocol(AG_CHATROOMMOONSERVER.dR,{roomType:0==r.roomInfo.Type?1:2,conCurrentNum:100,userDefineData:r.roomInfo.Name})))},e.sendChatMsg=function(R){c.send(StarRtc.AUtils.packageProtocol(APP_PRODUCT_ID.O,ACTION_GROUP_ID.M,StarRtc.AUtils.constructChatProtocol(AG_CHATROOMMOONSERVER.hR,{roomId:r.roomInfo.ID,digest:"新消息",msgIndex:++S,msg:R})))},e.sendChatPrivateMsg=function(R,E){c.send(StarRtc.AUtils.packageProtocol(APP_PRODUCT_ID.O,ACTION_GROUP_ID.M,StarRtc.AUtils.constructChatProtocol(AG_CHATROOMMOONSERVER.YR,{toUserId:R,roomId:r.roomInfo.ID,digest:"新消息",msgIndex:++S,msg:E,type:"1",code:"0"})))},e.sendChatCtrlPrivateMsg=function(R,E,O){c.send(StarRtc.AUtils.packageProtocol(APP_PRODUCT_ID.O,ACTION_GROUP_ID.M,StarRtc.AUtils.constructChatProtocol(AG_CHATROOMMOONSERVER.YR,{toUserId:R,roomId:r.roomInfo.ID,digest:"新消息",msgIndex:++S,msg:E,type:"0",code:O})))},e.kickOutUser=function(R){c.send(StarRtc.AUtils.packageProtocol(APP_PRODUCT_ID.O,ACTION_GROUP_ID.M,StarRtc.AUtils.constructChatProtocol(AG_CHATROOMMOONSERVER.kR,{kickOutUserId:R})))},e.deleteCurrRoom=function(){c.send(StarRtc.AUtils.packageProtocol(APP_PRODUCT_ID.O,ACTION_GROUP_ID.M,StarRtc.AUtils.constructChatProtocol(AG_CHATROOMMOONSERVER.bR)))},e.joinRoom=function(){c.send(StarRtc.AUtils.packageProtocol(APP_PRODUCT_ID.O,ACTION_GROUP_ID.M,StarRtc.AUtils.constructChatProtocol(AG_CHATROOMMOONSERVER.gR,{roomId:r.roomInfo.ID})))},e.leaveRoom=function(){c.send(StarRtc.AUtils.packageProtocol(APP_PRODUCT_ID.O,ACTION_GROUP_ID.M,StarRtc.AUtils.constructChatProtocol(AG_CHATROOMMOONSERVER.wR)))},e.getState=function(){return null!=c?c.readyState():-1},e};
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。