trtc-calling-js.js
42.4 KB
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("trtc-js-sdk"),require("tsignaling")):"function"==typeof define&&define.amd?define(["trtc-js-sdk","tsignaling"],e):"object"==typeof exports?exports.TRTCCalling=e(require("trtc-js-sdk"),require("tsignaling")):t.TRTCCalling=e(t.TRTC,t.TSignaling)}(window,(function(t,e){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=6)}([function(t,e,n){"use strict";n.r(e),n.d(e,"isMap",(function(){return i})),n.d(e,"isSet",(function(){return r})),n.d(e,"isFile",(function(){return o})),n.d(e,"isNumber",(function(){return s})),n.d(e,"isString",(function(){return a})),n.d(e,"isObject",(function(){return l})),n.d(e,"isPlainObject",(function(){return u})),n.d(e,"isArray",(function(){return c})),n.d(e,"isUndefined",(function(){return d})),n.d(e,"isNativeClass",(function(){return f})),n.d(e,"isArrayOrObject",(function(){return p})),n.d(e,"isFunction",(function(){return _})),n.d(e,"isInstanceOfError",(function(){return g})),n.d(e,"getType",(function(){return I})),n.d(e,"TimeUtil",(function(){return C})),n.d(e,"stringifyError",(function(){return m})),n.d(e,"map2String",(function(){return y})),n.d(e,"randomString",(function(){return T})),n.d(e,"isValidType",(function(){return D})),n.d(e,"mapKeys",(function(){return L})),n.d(e,"mapValues",(function(){return S})),n.d(e,"generateRandomRoomID",(function(){return A})),n.d(e,"formatDuration",(function(){return w})),n.d(e,"compareVersion",(function(){return O}));const i=function(t){return"map"===I(t)},r=function(t){return"set"===I(t)},o=function(t){return"file"===I(t)},s=function(t){return null!==t&&("number"==typeof t&&!isNaN(t-0)||"object"==typeof t&&t.constructor===Number)},a=function(t){return"string"==typeof t},l=function(t){return null!==t&&"object"==typeof t},u=function(t){if("object"!=typeof t||null===t)return!1;const e=Object.getPrototypeOf(t);if(null===e)return!0;let n=e;for(;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return e===n},c=function(t){return"function"==typeof Array.isArray?Array.isArray(t):"array"===I(t)},d=function(t){return void 0===t},h=/^class\s/,f=function(t){return"function"==typeof t&&h.test(t.toString())},p=function(t){return c(t)||l(t)},_=function(t){return"function"==typeof t},g=function(t){return t instanceof Error},I=function(t){return Object.prototype.toString.call(t).match(/^\[object (.*)\]$/)[1].toLowerCase()};let v=0;Date.now||(Date.now=function(){return(new Date).getTime()});const C={now:function(){0===v&&(v=Date.now()-1);const t=Date.now()-v;return t>4294967295?(v+=4294967295,Date.now()-v):t},utc:function(){return Math.round(Date.now()/1e3)}},m=function(t){return JSON.stringify(t,["message","code"])},y=function(t){if(!i(t))return"not a map!!!";let e="";for(const[n,r]of t.entries()){if(i(r))return"[k="+n+" -> "+y(r);e+="[k="+n+" v="+r+"] "}return e},E="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",b=E.length,T=function(){let t="";for(let e=32;e>0;--e)t+=E[Math.floor(Math.random()*b)];return t},D=function(t,e){for(const n in t)if(t[n]===e)return!0;return!1};function L(t,e){const n={};return Object.keys(t).forEach(i=>{n[e(t[i],i)]=t[i]}),n}function S(t,e){const n={};return Object.keys(t).forEach(i=>{n[i]=e(t[i],i)}),n}function A(){return Math.round(1e8*Math.random())}function N(t){return t<10?"0"+t:t}function w(t){if(t<60)return"00:00:"+N(t);if(t<3600){const e=parseInt(t/60),n=t-60*e;return`00:${N(e)}:${N(n)}`}const e=parseInt(t/3600),n=t-3600*e,i=parseInt(n/60),r=n-60*i;return`${N(e)}:${N(i)}:${N(r)}`}function O(t,e){t=t.split("."),e=e.split(".");const n=Math.max(t.length,e.length);for(;t.length<n;)t.push("0");for(;e.length<n;)e.push("0");for(let i=0;i<n;i++){const n=parseInt(t[i]),r=parseInt(e[i]);if(n>r)return 1;if(n<r)return-1}return 0}},function(t,e,n){"use strict";(function(t){let n,i;n="undefined"!=typeof console?console:void 0!==t&&t.console?t.console:"undefined"!=typeof window&&window.console?window.console:{};const r=function(){},o=["assert","clear","count","debug","dir","dirxml","error","exception","group","groupCollapsed","groupEnd","info","log","markTimeline","profile","profileEnd","table","time","timeEnd","timeStamp","trace","warn"];let s=o.length;for(;s--;)i=o[s],console[i]||(n[i]=r);n.methods=o,e.a=n}).call(this,n(9))},function(t,e,n){"use strict";n.r(e);var i=n(1),r=n(0);let o=0;const s=new Map;function a(){const t=new Date;return"TRTCCalling "+t.toLocaleTimeString("en-US",{hour12:!1})+"."+function(t){let e;switch(t.toString().length){case 1:e="00"+t;break;case 2:e="0"+t;break;default:e=t}return e}(t.getMilliseconds())+":"}const l={_data:[],_length:0,_visible:!1,arguments2String(t){let e;if(1===t.length)e=a()+t[0];else{e=a();for(let n=0,i=t.length;n<i;n++)Object(r.isArrayOrObject)(t[n])?Object(r.isInstanceOfError)(t[n])?e+=Object(r.stringifyError)(t[n]):e+=JSON.stringify(t[n]):e+=t[n],e+=" "}return e},debug:function(){if(o<=-1){const t=this.arguments2String(arguments);l.record(t,"debug"),i.a.debug(t)}},log:function(){if(o<=0){const t=this.arguments2String(arguments);l.record(t,"log"),i.a.log(t)}},info:function(){if(o<=1){const t=this.arguments2String(arguments);l.record(t,"info"),i.a.info(t)}},warn:function(){if(o<=2){const t=this.arguments2String(arguments);l.record(t,"warn"),i.a.warn(t)}},error:function(){if(o<=3){const t=this.arguments2String(arguments);l.record(t,"error"),i.a.error(t)}},time:function(t){s.set(t,r.TimeUtil.now())},timeEnd:function(t){if(s.has(t)){const e=r.TimeUtil.now()-s.get(t);return s.delete(t),e}return i.a.warn(`未找到对应label: ${t}, 请在调用 logger.timeEnd 前,调用 logger.time`),0},setLevel:function(t){t<4&&i.a.log(a()+"set level from "+o+" to "+t),o=t},getLevel:function(){return o},record:function(t,e){1100===l._length&&(l._data.splice(0,100),l._length=1e3),l._length++,l._data.push(`${t} [${e}] \n`)},getLog:function(){return l._data}};e.default=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BUSINESS_ID=e.ACTION_TYPE=e.CALL_STATUS=e.CALL_TYPE=void 0,function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.AUDIO_CALL=1]="AUDIO_CALL",t[t.VIDEO_CALL=2]="VIDEO_CALL"}(e.CALL_TYPE||(e.CALL_TYPE={})),function(t){t.IDLE="idle",t.CALLING="calling",t.CONNECTED="connected"}(e.CALL_STATUS||(e.CALL_STATUS={})),function(t){t[t.INVITE=1]="INVITE",t[t.CANCEL_INVITE=2]="CANCEL_INVITE",t[t.ACCEPT_INVITE=3]="ACCEPT_INVITE",t[t.REJECT_INVITE=4]="REJECT_INVITE",t[t.INVITE_TIMEOUT=5]="INVITE_TIMEOUT"}(e.ACTION_TYPE||(e.ACTION_TYPE={})),function(t){t[t.SIGNAL=1]="SIGNAL"}(e.BUSINESS_ID||(e.BUSINESS_ID={}))},function(e,n){e.exports=t},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.EVENT=void 0,e.EVENT={ERROR:"onError",INVITED:"onInvited",GROUP_CALL_INVITEE_LIST_UPDATE:"onGroupCallInviteeListUpdate",USER_ENTER:"onUserEnter",USER_LEAVE:"onUserLeave",REJECT:"onReject",NO_RESP:"onNoResp",LINE_BUSY:"onLineBusy",CALLING_CANCEL:"onCallingCancel",KICKED_OUT:"onKickedOut",CALLING_TIMEOUT:"onCallingTimeout",CALL_END:"onCallEnd",CALLING_END:"onCallEnd",USER_VIDEO_AVAILABLE:"onUserVideoAvailable",USER_AUDIO_AVAILABLE:"onUserAudioAvailable",USER_VOICE_VOLUME:"onUserVoiceVolume"}},function(t,e,n){"use strict";var i=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))},r=this&&this.__generator||function(t,e){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},o=this&&this.__spreadArrays||function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var i=Array(t),r=0;for(e=0;e<n;e++)for(var o=arguments[e],s=0,a=o.length;s<a;s++,r++)i[r]=o[s];return i};Object.defineProperty(e,"__esModule",{value:!0});var s=n(7),a=n(0),l=n(8),u=n(4),c=n(10),d=n(12),h=n(5),f=n(2),p=n(3),_=n(13),g="TRTCCalling",I=function(){function t(t){f.default.info(g+" version:"+_.version),this._outerEmitter=new s.default,this._delegate=new d.default(this._outerEmitter),this._tsignalingClient=new c.default(this,t),this._sdkAppID=t.SDKAppID,this._trtcClient=null,this._userID="",this._userSig="",this._inviterInviteID="",this._callTimeout=0,this._callStatus=p.CALL_STATUS.IDLE,this._callType=p.CALL_TYPE.UNKNOWN,this._roomID=0,this._isInviter=!1,this._isGroupCall=!1,this._inviteeList=[],this._unHandledInviteeList=[]}return t.prototype.getUserID=function(){return this._userID},t.prototype.getCallType=function(){return this._callType},t.prototype.isInviter=function(){return this._isInviter},t.prototype.getInviteeList=function(){return this._inviteeList},t.prototype.setInviteeList=function(t){this._inviteeList=o(t)},t.prototype.getUnHandledInviteeList=function(){return this._unHandledInviteeList},t.prototype.setUnHandledInviteeList=function(t){this._unHandledInviteeList=o(t),f.default.debug(g+".setUnHandledInviteeList",this._unHandledInviteeList)},t.prototype.isGroupCall=function(){return this._isGroupCall},t.prototype.setIsGroupCall=function(t){this._isGroupCall=t},t.prototype.getGroupID=function(){return this._groupID},t.prototype.setGroupID=function(t){this._groupID=t},t.prototype.hasRemoteConnectedUsers=function(){return this.getRemoteStreamCount()>0},t.prototype.getRemoteStreamCount=function(){return this._trtcClient?this._trtcClient.getRemoteStreams().length:0},t.prototype.setLogLevel=function(t){f.default.setLevel(t),this._tsignalingClient.setLogLevel(t),u.Logger.setLogLevel(t+1)},t.prototype.on=function(t,e,n){this._outerEmitter.on(t,e,n||this)},t.prototype.off=function(t,e,n){this._outerEmitter.off(t,e,n||this)},t.prototype.login=function(t){return i(this,void 0,void 0,(function(){var e,n;return r(this,(function(i){return f.default.debug(g+".login - params:",t),e=t.userID,n=t.userSig,this._userID=e,this._userSig=n,[2,this._tsignalingClient.login({userID:e,userSig:n})]}))}))},t.prototype.logout=function(){return i(this,void 0,void 0,(function(){return r(this,(function(t){return f.default.debug(g+".logout"),this._userID="",this._userSig="",this._resetTRTCClient(),[2,this._tsignalingClient.logout()]}))}))},t.prototype.call=function(t){return i(this,void 0,void 0,(function(){var e,n,i,o,s;return r(this,(function(r){switch(r.label){case 0:return f.default.debug(g+".call - params:",t),e=t.userID,n=t.type,i=t.timeout,o=void 0===i?0:i,this._callTimeout=o,this._callStatus=p.CALL_STATUS.CALLING,this._callType=n,this._isInviter=!0,this._inviterID=this._userID,this._isGroupCall=!1,this._groupID="",this._trtcClient||(this._roomID=a.generateRandomRoomID(),this._trtcClient=new l.default({sdkAppID:this._sdkAppID,userID:this._userID,userSig:this._userSig,roomID:this._roomID,trtcCalling:this})),[4,this._tsignalingClient.invite({userID:e,type:n,roomID:this._roomID,timeout:this._callTimeout})];case 1:return 0===(s=r.sent()).code?this.setInviterInviteID(s.inviteID):this.setInviterInviteID(""),[2,s]}}))}))},t.prototype.setInviterInviteID=function(t){this._inviterInviteID=t},t.prototype.getInviterID=function(){return this._inviterID},t.prototype.setInviterID=function(t){this._inviterID=t},t.prototype.groupCall=function(t){return i(this,void 0,void 0,(function(){var e,n,i,o,s,u;return r(this,(function(r){switch(r.label){case 0:return f.default.debug(g+".groupCall - params:",t),e=t.userIDList,n=t.type,i=t.groupID,o=t.timeout,s=void 0===o?0:o,this._callTimeout=s,this._callType=n,this._isInviter=!0,this._isGroupCall=!0,this._inviterID=this._userID,this._groupID=i,this.setInviteeList(e),this.setUnHandledInviteeList(e),this._trtcClient||(this._roomID=a.generateRandomRoomID(),this._callStatus=p.CALL_STATUS.CALLING,this._trtcClient=new l.default({sdkAppID:this._sdkAppID,userID:this._userID,userSig:this._userSig,roomID:this._roomID,trtcCalling:this})),[4,this._tsignalingClient.inviteInGroup({groupID:i,userIDList:e,type:n,roomID:this._roomID,timeout:this._callTimeout})];case 1:return 0===(u=r.sent()).code?this.setInviterInviteID(u.inviteID):this.setInviterInviteID(""),[2,u]}}))}))},t.prototype.accept=function(t){return i(this,void 0,void 0,(function(){var e,n,i,o,s,a,u=this;return r(this,(function(r){switch(r.label){case 0:f.default.debug(g+".accept - params:",t),e=t.inviteID,n=t.roomID,i=t.callType,r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this._tsignalingClient.accept({inviteID:e,callType:i})];case 2:return o=r.sent(),[3,4];case 3:return s=r.sent(),f.default.error(s),[2];case 4:return this._callType=i,this._callStatus=p.CALL_STATUS.CONNECTED,this.isGroupCall()&&(a=this._unHandledInviteeList.filter((function(t){return t!==u._userID})),this.setUnHandledInviteeList(a)),this._trtcClient=new l.default({sdkAppID:this._sdkAppID,userID:this._userID,userSig:this._userSig,roomID:n,trtcCalling:this}),[4,this._trtcClient.join()];case 5:return r.sent(),[2,o]}}))}))},t.prototype.reject=function(t){return i(this,void 0,void 0,(function(){var e,n,i,o;return r(this,(function(r){switch(r.label){case 0:return f.default.debug(g+".reject - params:",t),e=t.inviteID,n=t.isBusy,i=t.callType,[4,this._tsignalingClient.reject({inviteID:e,callType:i,isBusy:n})];case 1:return o=r.sent(),n||this._resetTRTCClient(),[2,o]}}))}))},t.prototype.hangup=function(){return i(this,void 0,void 0,(function(){var t;return r(this,(function(e){switch(e.label){case 0:return f.default.debug(g+".hangup - callStatus:"+this._callStatus+" inviteID:"+this._inviterInviteID),this._callStatus!==p.CALL_STATUS.CALLING?[3,2]:[4,this._tsignalingClient.cancel({inviteID:this._inviterInviteID})];case 1:return t=e.sent(),[3,4];case 2:return this._callStatus!==p.CALL_STATUS.CONNECTED?[3,4]:[4,this._trtcClient.leave()];case 3:t=e.sent(),e.label=4;case 4:return this._resetTRTCClient(),[2,t]}}))}))},t.prototype.startRemoteView=function(t){return i(this,void 0,void 0,(function(){var e,n;return r(this,(function(i){return f.default.debug(g+".startRemoteView - params:",t),e=t.userID,n=t.videoViewDomID,[2,this._trtcClient.playVideo({domID:n,type:"remote",userID:e})]}))}))},t.prototype.stopRemoteView=function(t){f.default.debug(g+".stopRemoteView - params:",t);var e=t.userID,n=t.videoViewDomID;this._trtcClient.stopVideo({domID:n,type:"remote",userID:e})},t.prototype.startLocalView=function(t){return i(this,void 0,void 0,(function(){var e,n;return r(this,(function(i){return f.default.debug(g+".startLocalView - params:",t),e=t.userID,n=t.videoViewDomID,[2,this._trtcClient.playVideo({domID:n,type:"local",userID:e})]}))}))},t.prototype.stopLocalView=function(t){f.default.debug(g+".stopLocalView - params:",t);var e=t.userID,n=t.videoViewDomID;this._trtcClient.stopVideo({domID:n,type:"local",userID:e})},t.prototype.openCamera=function(){f.default.debug(g+".openCamera"),this._trtcClient.unMuteLocalVideo()},t.prototype.closeCamera=function(){f.default.debug(g+".closeCamera"),this._trtcClient.muteLocalVideo()},t.prototype.setMicMute=function(t){f.default.debug(g+".setMicMute - isMute:"+t),t?this._trtcClient.muteLocalAudio():this._trtcClient.unMuteLocalAudio()},t.prototype._resetTRTCClient=function(){f.default.debug(g+"._resetTRTCClient"),this._trtcClient=null,this._isInviter=!1,this._isGroupCall=!1,this._groupID="",this._callStatus=p.CALL_STATUS.IDLE,this._inviteeList=[],this._unHandledInviteeList=[],this._inviterInviteID="";var t=document.getElementById("_trtc_calling_layer");t&&(t.innerHTML="")},t.prototype.getCallStatus=function(){return this._callStatus},t.prototype.changeCallStatus=function(t){this._callStatus!==t&&(f.default.debug(g+".changeCallStatus from "+this._callStatus+" to "+t),this._callStatus=t)},t.prototype.extractCallingInfoFromMessage=function(t){if(!t)return"";if("TIMCustomElem"!==t.type)return"";var e=JSON.parse(t.payload.data);if(f.default.debug(g+".extractCallingInfoFromMessage - signalingData:",t.payload.data),e.businessID!==p.BUSINESS_ID.SIGNAL)return"";switch(e.actionType){case p.ACTION_TYPE.INVITE:var n=JSON.parse(e.data);return n.call_end>0?"结束通话,通话时长:"+a.formatDuration(n.call_end):0!==n.call_end&&n.room_id?"发起通话":"结束群聊";case p.ACTION_TYPE.CANCEL_INVITE:return"取消通话";case p.ACTION_TYPE.ACCEPT_INVITE:return"已接听";case p.ACTION_TYPE.REJECT_INVITE:return"拒绝通话";case p.ACTION_TYPE.INVITE_TIMEOUT:return"无应答";default:return""}},t.EVENT=h.EVENT,t.CALL_TYPE=p.CALL_TYPE,t}();e.default=I},function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return s}));const i=Function.prototype.apply,r=new WeakMap;function o(t){return r.has(t)||r.set(t,{}),r.get(t)}class s{constructor(t=null,e=console){const n=o(this);return n._events=new Set,n._callbacks={},n._console=e,n._maxListeners=null===t?null:parseInt(t,10),this}_addCallback(t,e,n,i){return this._getCallbacks(t).push({callback:e,context:n,weight:i}),this._getCallbacks(t).sort((t,e)=>t.weight>e.weight),this}_getCallbacks(t){return o(this)._callbacks[t]}_getCallbackIndex(t,e){return this._has(t)?this._getCallbacks(t).findIndex(t=>t.callback===e):null}_achieveMaxListener(t){return null!==o(this)._maxListeners&&o(this)._maxListeners<=this.listenersNumber(t)}_callbackIsExists(t,e,n){const i=this._getCallbackIndex(t,e),r=-1!==i?this._getCallbacks(t)[i]:void 0;return-1!==i&&r&&r.context===n}_has(t){return o(this)._events.has(t)}on(t,e,n=null,i=1){const r=o(this);if("function"!=typeof e)throw new TypeError(e+" is not a function");return this._has(t)?(this._achieveMaxListener(t)&&r._console.warn(`Max listeners (${r._maxListeners}) for event "${t}" is reached!`),this._callbackIsExists(...arguments)&&r._console.warn(`Event "${t}" already has the callback ${e}.`)):(r._events.add(t),r._callbacks[t]=[]),this._addCallback(...arguments),this}once(t,e,n=null,r=1){const o=(...r)=>(this.off(t,o),i.call(e,n,r));return this.on(t,o,n,r)}off(t,e=null){const n=o(this);let i;return this._has(t)&&(null===e?(n._events.delete(t),n._callbacks[t]=null):(i=this._getCallbackIndex(t,e),-1!==i&&(n._callbacks[t].splice(i,1),this.off(...arguments)))),this}emit(t,...e){return this._has(t)&&this._getCallbacks(t).forEach(t=>i.call(t.callback,t.context,e)),this}clear(){const t=o(this);return t._events.clear(),t._callbacks={},this}listenersNumber(t){return this._has(t)?this._getCallbacks(t).length:null}}},function(t,e,n){"use strict";var i=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))},r=this&&this.__generator||function(t,e){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};Object.defineProperty(e,"__esModule",{value:!0});var o=n(4),s=n(2),a=n(3),l=n(0),u="TRTCClient",c=function(){function t(t){this._sdkAppID=t.sdkAppID,this._userID=t.userID,this._userSig=t.userSig,this._roomID=t.roomID,this._trtcCalling=t.trtcCalling,this._connectStartTime=0,this._isJoined=!1,this._isPublished=!1,this._localStream=null,this._remoteStreams=[];var e=o.VERSION;l.compareVersion(e,"4.7.0")>=0?o.checkSystemRequirements().then((function(t){t.result||s.default.log(u+".您的浏览器不兼容此应用!\n建议下载最新版Chrome浏览器")})):o.checkSystemRequirements().then((function(t){t||s.default.log(u+".您的浏览器不兼容此应用!\n建议下载最新版Chrome浏览器")}))}return t.prototype.getRemoteStreams=function(){return this._remoteStreams},t.prototype.getCamera=function(){return i(this,void 0,void 0,(function(){var t;return r(this,(function(e){switch(e.label){case 0:return[4,o.getCameras()];case 1:return t=e.sent(),s.default.debug(u+".getCamera - "+JSON.stringify(t)),t.length>0?[2,t[0]]:[2,null]}}))}))},t.prototype.getMicrophone=function(){return i(this,void 0,void 0,(function(){var t;return r(this,(function(e){switch(e.label){case 0:return[4,o.getMicrophones()];case 1:return t=e.sent(),s.default.debug(u+".getMicrophone - "+JSON.stringify(t)),t.length>0?[2,t[0]]:[2,null]}}))}))},t.prototype.join=function(){return i(this,void 0,void 0,(function(){var t,e,n,i,l;return r(this,(function(r){switch(r.label){case 0:return[4,this.getCamera()];case 1:return t=r.sent(),[4,this.getMicrophone()];case 2:if(e=r.sent(),!t||!e)return s.default.warn(u+".join - invalid camera or microphone"),[2];if(this._isJoined)return s.default.warn(u+".join - duplicate RtcClient.join() observed"),[2];this._client=o.createClient({mode:"rtc",sdkAppId:this._sdkAppID,userId:this._userID,userSig:this._userSig}),this.handleEvents(),r.label=3;case 3:return r.trys.push([3,11,,12]),[4,this._client.join({roomId:this._roomID})];case 4:if(r.sent(),this._isJoined=!0,n=this.getCallType(),s.default.debug(u+".join - join room success, callType:"+n),n===a.CALL_TYPE.AUDIO_CALL?this._localStream=o.createStream({audio:!0,video:!1,userId:this._userID,microphoneId:e.deviceId}):n===a.CALL_TYPE.VIDEO_CALL&&(this._localStream=o.createStream({audio:!0,video:!0,userId:this._userID,cameraId:t.deviceId,microphoneId:e.deviceId})),!this._localStream)return s.default.debug(u+".join - invalid callType"),[2];this._localStream.setVideoProfile("480p"),r.label=5;case 5:return r.trys.push([5,8,,10]),[4,this._localStream.initialize()];case 6:return r.sent(),s.default.debug(u+".join - initialize local stream success"),this._localStream.on("player-state-changed",(function(t){s.default.debug(u+".join - local stream "+t.type+" player is "+t.state)})),[4,this.publish()];case 7:return r.sent(),this._trtcCalling.changeCallStatus(a.CALL_STATUS.CONNECTED),[3,10];case 8:return i=r.sent(),s.default.error(u+".join - failed to initialize local stream - "+i),[4,navigator.mediaDevices.getUserMedia({audio:!0,video:!0})];case 9:return r.sent(),[3,10];case 10:return[3,12];case 11:return l=r.sent(),s.default.error(u+".join - join room failed! "+l),[3,12];case 12:return[2]}}))}))},t.prototype.playVideo=function(t){s.default.debug(u+".playVideo - params:",t);var e=t.domID,n=t.type,i=t.userID;if("local"===n&&this._localStream.play(e),"remote"===n){var r=this._remoteStreams.find((function(t){return t.getUserId()===i}));r&&r.play(e)}},t.prototype.stopVideo=function(t){s.default.debug(u+".stopVideo - params:",t);t.domID;var e=t.type,n=t.userID;if("local"===e&&this._localStream.stop(),"remote"===e){var i=this._remoteStreams.find((function(t){return t.getUserId()===n}));i&&i.stop()}},t.prototype.getCallType=function(){return this._trtcCalling.getCallType()},t.prototype.getRoomID=function(){return this._roomID},t.prototype.leave=function(){return i(this,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return this._isJoined?[4,this.unpublish()]:(s.default.warn(u+".leave - please join() firstly"),[2]);case 1:return t.sent(),[4,this._client.leave()];case 2:return t.sent(),this._localStream.stop(),this._localStream.close(),this._localStream=null,this._isJoined=!1,[2]}}))}))},t.prototype.publish=function(){return i(this,void 0,void 0,(function(){var t;return r(this,(function(e){switch(e.label){case 0:if(!this._isJoined)return s.default.warn(u+".publish - please join() firstly"),[2];if(this._isPublished)return s.default.warn(u+".publish - duplicate RtcClient.publish() observed"),[2];e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this._client.publish(this._localStream)];case 2:return e.sent(),[3,4];case 3:return t=e.sent(),s.default.error(u+".publish - failed to publish local stream "+t),this._isPublished=!1,[3,4];case 4:return this._isPublished=!0,[2]}}))}))},t.prototype.unpublish=function(){return i(this,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return this._isJoined?this._isPublished?[4,this._client.unpublish(this._localStream)]:(s.default.warn(u+".unpublish - RtcClient.unpublish() called but not published yet"),[2]):(s.default.warn(u+".unpublish - please join() firstly"),[2]);case 1:return t.sent(),this._isPublished=!1,[2]}}))}))},t.prototype.handleEvents=function(){var t=this;this._client.on("error",(function(t){s.default.error(u+".handleEvents - client on error "+t)})),this._client.on("client-banned",(function(t){s.default.error(u+".handleEvents - client has been banned for "+t)})),this._client.on("peer-join",(function(e){var n=e.userId;s.default.debug(u+".handleEvents - peer-join "+n),t._connectStartTime||(t._connectStartTime=Date.now())})),this._client.on("peer-leave",(function(e){return i(t,void 0,void 0,(function(){var t,n,i,o;return r(this,(function(r){switch(r.label){case 0:return t=e.userId,n=this._remoteStreams.filter((function(e){return e.getUserId()!==t})),i=this._trtcCalling.getUnHandledInviteeList(),o=this._trtcCalling.isGroupCall(),s.default.debug(u+".handleEvents - peer-leave isGroupCall:"+o+" userID:"+t+", remainStreamsCount:"+n.length+" unHandledListLength:"+i.length),o&&0!==i.length?[2]:0!==n.length?[3,3]:[4,this.leave()];case 1:return r.sent(),[4,this._trtcCalling._tsignalingClient.lastOneHangup({userIDList:[t],callType:this.getCallType(),callEnd:Math.round((Date.now()-this._connectStartTime)/1e3)})];case 2:r.sent(),this._trtcCalling._resetTRTCClient(),this._connectStartTime=0,r.label=3;case 3:return[2]}}))}))})),this._client.on("stream-added",(function(e){var n=e.stream,i=n.getId(),r=n.getUserId();s.default.debug(u+".handleEvents - remote stream added, userID:"+r+" streamID:"+i+" type:"+n.getType()),t._client.subscribe(n)})),this._client.on("stream-subscribed",(function(e){var n=e.stream;t._remoteStreams.push(n);var i=n.getUserId();t._trtcCalling._delegate.onUserEnter(i);var r="_trtc_calling_audio_call-"+i;if(t.getCallType()===a.CALL_TYPE.AUDIO_CALL){var o=document.getElementById("_trtc_calling_layer");o||((o=document.createElement("div")).setAttribute("id","_trtc_calling_layer"),o.style.display="none",document.body.appendChild(o));var s=document.createElement("div");s.setAttribute("id",r),o.appendChild(s),n.play(r)}})),this._client.on("stream-removed",(function(e){var n=e.stream,i=n.getId(),r=n.getUserId(),o="_trtc_calling_audio_call-"+r;if(n.stop(),n.close(),t._remoteStreams=t._remoteStreams.filter((function(t){return t.getId()!==i})),t._trtcCalling._delegate.onUserLeave(r),t.getCallType()===a.CALL_TYPE.AUDIO_CALL){var l=document.getElementById("_trtc_calling_layer"),c=document.getElementById(o);l&&c&&l.removeChild(c)}s.default.debug(u+".handleEvents - remote stream-removed, streamID:"+i+" type:"+n.getType())})),this._client.on("stream-updated",(function(t){var e=t.stream,n=e.getType(),i=e.hasAudio(),r=e.hasVideo();s.default.debug(u+".handleEvents - stream-updated, type:"+n+" hasAudio:"+i+" hasVideo:"+r)})),this._client.on("mute-audio",(function(e){s.default.debug(u+".handleEvents - "+e.userId+" mute audio"),t._trtcCalling._delegate.onUserAudioAvailable({userID:e.userId,isAudioAvailable:!1})})),this._client.on("unmute-audio",(function(e){s.default.debug(u+".handleEvents - "+e.userId+" unmute audio"),t._trtcCalling._delegate.onUserAudioAvailable({userID:e.userId,isAudioAvailable:!0})})),this._client.on("mute-video",(function(e){s.default.debug(u+".handleEvents - "+e.userId+" mute video"),t._trtcCalling._delegate.onUserVideoAvailable({userID:e.userId,isVideoAvailable:!1})})),this._client.on("unmute-video",(function(e){s.default.debug(u+".handleEvents - "+e.userId+" unmute video"),t._trtcCalling._delegate.onUserVideoAvailable({userID:e.userId,isVideoAvailable:!0})})),this._client.on("connection-state-changed",(function(t){s.default.debug(u+".handleEvents - RtcClient state changed from "+t.prevState+" to "+t.state)}))},t.prototype.muteLocalVideo=function(){this._localStream.muteVideo()},t.prototype.unMuteLocalVideo=function(){this._localStream.unmuteVideo()},t.prototype.muteLocalAudio=function(){this._localStream.muteAudio()},t.prototype.unMuteLocalAudio=function(){this._localStream.unmuteAudio()},t}();e.default=c},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){"use strict";var i=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))},r=this&&this.__generator||function(t,e){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};Object.defineProperty(e,"__esModule",{value:!0});var o=n(11),s=n(2),a=n(3),l=n(0),u="TSignalClient",c=function(){function t(t,e){this._trtcCalling=t,this._tsignaling=new o(e),this._tsignalingReady=!1,this.initEvents()}return t.prototype.setLogLevel=function(t){this._tsignaling.setLogLevel(t)},t.prototype.initEvents=function(){var t=this._tsignaling;t.on(o.EVENT.SDK_READY,this.onSdkReady,this),t.on(o.EVENT.SDK_NOT_READY,this.onSdkNotReady,this),t.on(o.EVENT.NEW_INVITATION_RECEIVED,this.onNewInvitationReceived,this),t.on(o.EVENT.INVITEE_ACCEPTED,this.onInviteeAccepted,this),t.on(o.EVENT.INVITEE_REJECTED,this.onInviteeRejected,this),t.on(o.EVENT.INVITATION_CANCELLED,this.onInvitationCancelled,this),t.on(o.EVENT.INVITATION_TIMEOUT,this.onInvitationTimeout,this),t.on(o.EVENT.KICKED_OUT,this.onKickedOut,this),t.on(o.EVENT.NET_STATE_CHANGE,this.onNetStateChange,this)},t.prototype.onSdkReady=function(){this._tsignalingReady=!0},t.prototype.onSdkNotReady=function(){this._tsignalingReady=!1},t.prototype.onNewInvitationReceived=function(t){var e=this._trtcCalling.getCallStatus();s.default.debug(u+".onNewInvitationReceived - params:",t,"currentCallStatus:"+e);var n=t.data,i=n.inviter,r=n.inviteeList,o=n.data,c=n.inviteID,d=n.groupID,h=JSON.parse(o);if(this._isOnACall()||e===a.CALL_STATUS.CALLING)return this._trtcCalling.reject({inviteID:c,callType:h.call_type,isBusy:!0}),void this._trtcCalling._delegate.onLineBusy(i,this._trtcCalling.getUserID());var f=!!(d||r.length>=2);if(f){if(!h.room_id||0===h.call_end)return void this._trtcCalling._delegate.onCallEnd(i,h.call_end||0)}else if(l.isNumber(h.call_end)&&h.call_end>0)return void this._trtcCalling._delegate.onCallEnd(i,h.call_end);this._trtcCalling.setInviterID(i),f&&(this._trtcCalling.setIsGroupCall(f),this._trtcCalling.setInviteeList(r),this._trtcCalling.setUnHandledInviteeList(r),this._trtcCalling.setGroupID(d)),this._trtcCalling.changeCallStatus(a.CALL_STATUS.CALLING),this._trtcCalling._delegate.onInvited({sponsor:i,userIDList:r,isFromGroup:f,inviteID:c,inviteData:{version:h.version,callType:h.call_type,callEnd:0,roomID:h.room_id}})},t.prototype.onInviteeAccepted=function(t){s.default.debug(u+".onInviteeAccepted - params:",t);var e=t.data.invitee;if(this._trtcCalling.isGroupCall()){var n=this._trtcCalling.getUnHandledInviteeList().filter((function(t){return t!==e}));this._trtcCalling.setUnHandledInviteeList(n)}this._trtcCalling.isInviter()&&this._trtcCalling._trtcClient.join()},t.prototype.onInviteeRejected=function(t){s.default.debug(u+".onInviteeRejected - params:",t);var e=t.data.invitee,n=t.data.inviter,i=JSON.parse(t.data.data);if("line_busy"===i.line_busy||""===i.line_busy?this._trtcCalling._delegate.onLineBusy(n,e):this._trtcCalling._delegate.onReject(e),this._trtcCalling.isGroupCall()){var r=this._trtcCalling.getUnHandledInviteeList();r=r.filter((function(t){return t!==e})),this._trtcCalling.setUnHandledInviteeList(r),0===r.length&&(this._trtcCalling.getCallStatus()===a.CALL_STATUS.CALLING&&this._trtcCalling._resetTRTCClient(),this._trtcCalling.getCallStatus()===a.CALL_STATUS.CONNECTED&&(this._trtcCalling.hasRemoteConnectedUsers()||this._trtcCalling._delegate.onCallEnd(e,0)))}else this._trtcCalling._resetTRTCClient()},t.prototype.onInvitationCancelled=function(t){s.default.debug(u+".onInvitationCancelled - params:",t),this._trtcCalling._delegate.onCallingCancel(),this._trtcCalling._resetTRTCClient()},t.prototype.onInvitationTimeout=function(t){var e=t.data,n=e.inviter,i=e.inviteeList,r=e.isSelfTimeout,o=this._trtcCalling.getUserID(),l=this._trtcCalling.isGroupCall(),c=n===o,d=this._isOnACall(),h=this._trtcCalling.getRemoteStreamCount();if(s.default.debug(u+".onInvitationTimeout - params:",t,"currentUserID:"+o+" isInviter:"+c+" isGroupCall:"+l+" isOnACall:"+d+" remoteStreamCount:"+h),!d&&r&&c)return this._trtcCalling._delegate.onNoResp(n,i),this._trtcCalling.hangup(),void this._trtcCalling._delegate.onCallEnd(n,0);if(this._trtcCalling._delegate.onCallingTimeout(n,i),l){var f=this._trtcCalling.getUnHandledInviteeList(),p=[];f.forEach((function(t){-1===i.indexOf(t)&&p.push(t)})),this._trtcCalling.setUnHandledInviteeList(p),0===h&&0===p.length&&(d?(this._trtcCalling.hangup(),this.lastOneHangup({userIDList:[n],callType:this._trtcCalling.getCallType(),callEnd:0})):(this._trtcCalling._delegate.onCallEnd(n,0),this._trtcCalling.changeCallStatus(a.CALL_STATUS.IDLE)))}else this._trtcCalling._delegate.onCallEnd(n,0),this._trtcCalling.changeCallStatus(a.CALL_STATUS.IDLE)},t.prototype._isOnACall=function(){return this._trtcCalling.getCallStatus()===a.CALL_STATUS.CONNECTED},t.prototype.onKickedOut=function(){s.default.debug(u+".onKickedOut"),this._trtcCalling._delegate.onKickedOut(),this._trtcCalling.changeCallStatus(a.CALL_STATUS.IDLE)},t.prototype.onNetStateChange=function(){s.default.debug(u+".onNetStateChange")},t.prototype.login=function(t){return i(this,void 0,void 0,(function(){return r(this,(function(e){return[2,this._tsignaling.login(t)]}))}))},t.prototype.logout=function(){return i(this,void 0,void 0,(function(){return r(this,(function(t){return[2,this._tsignaling.logout()]}))}))},t.prototype.invite=function(t){return i(this,void 0,void 0,(function(){var e,n,i,o;return r(this,(function(r){return e=t.userID,n=t.type,i=t.roomID,o=t.timeout,[2,this._tsignaling.invite({userID:e,data:JSON.stringify({version:0,call_type:n,room_id:i}),timeout:o})]}))}))},t.prototype.inviteInGroup=function(t){return i(this,void 0,void 0,(function(){var e,n,i,o,s;return r(this,(function(r){return e=t.groupID,n=t.userIDList,i=t.roomID,o=t.type,s=t.timeout,[2,this._tsignaling.inviteInGroup({groupID:e,inviteeList:n,data:JSON.stringify({version:0,call_type:o,room_id:i}),timeout:s})]}))}))},t.prototype.lastOneHangup=function(t){return i(this,void 0,void 0,(function(){var e,n,i;return r(this,(function(r){switch(r.label){case 0:return s.default.debug(u+".lastOneHangup - params:",t),e=t.userIDList,n=t.callType,i=t.callEnd,this._trtcCalling.isGroupCall()?[4,this._tsignaling.inviteInGroup({inviteeList:e,groupID:this._trtcCalling.getGroupID(),data:JSON.stringify({version:0,call_type:n,call_end:i}),timeout:0})]:[3,2];case 1:return r.sent(),[3,4];case 2:return[4,this._tsignaling.invite({userID:e[0],data:JSON.stringify({version:0,call_type:n,call_end:i}),timeout:0})];case 3:r.sent(),r.label=4;case 4:return this._trtcCalling._delegate.onCallEnd(this._trtcCalling.getInviterID(),i),[2]}}))}))},t.prototype.accept=function(t){return i(this,void 0,void 0,(function(){var e,n;return r(this,(function(i){return e=t.inviteID,n=t.callType,[2,this._tsignaling.accept({inviteID:e,data:JSON.stringify({version:0,call_type:n})})]}))}))},t.prototype.reject=function(t){return i(this,void 0,void 0,(function(){var e,n,i,o;return r(this,(function(r){return e=t.inviteID,n=t.callType,i=t.isBusy,o={version:0,call_type:n},i&&(o.line_busy="line_busy"),[2,this._tsignaling.reject({inviteID:e,data:JSON.stringify(o)})]}))}))},t.prototype.cancel=function(t){return i(this,void 0,void 0,(function(){var e;return r(this,(function(n){return e=t.inviteID,[2,this._tsignaling.cancel({inviteID:e,data:JSON.stringify({version:4,businessID:"av_call",call_type:this._trtcCalling.getCallType()})})]}))}))},t}();e.default=c},function(t,n){t.exports=e},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(5),r=n(2),o="TRTCCallingDelegate",s=function(){function t(t){this._eventEmitter=t}return t.prototype.onError=function(t,e){r.default.debug(o+".onError code:"+t+" msg:"+e),this._eventEmitter.emit(i.EVENT.ERROR,{code:t,msg:e})},t.prototype.onInvited=function(t){r.default.debug(o+".onInvited params:",t);var e=t.sponsor,n=t.userIDList,s=t.isFromGroup,a=t.inviteData,l=t.inviteID;this._eventEmitter.emit(i.EVENT.INVITED,{sponsor:e,userIDList:n,isFromGroup:s,inviteData:a,inviteID:l})},t.prototype.onGroupCallInviteeListUpdate=function(t){r.default.debug(o+".onGroupCallInviteeListUpdate userIDList:",t),this._eventEmitter.emit(i.EVENT.GROUP_CALL_INVITEE_LIST_UPDATE,{userIDList:t})},t.prototype.onUserEnter=function(t){r.default.debug(o+".onUserEnter userID:"+t),this._eventEmitter.emit(i.EVENT.USER_ENTER,{userID:t})},t.prototype.onUserLeave=function(t){r.default.debug(o+".onUserLeave userID:"+t),this._eventEmitter.emit(i.EVENT.USER_LEAVE,{userID:t})},t.prototype.onReject=function(t){r.default.debug(o+".onReject userID:"+t),this._eventEmitter.emit(i.EVENT.REJECT,{userID:t})},t.prototype.onNoResp=function(t,e){r.default.debug(o+".onNoResp userIDList:",e),this._eventEmitter.emit(i.EVENT.NO_RESP,{sponsor:t,userIDList:e})},t.prototype.onLineBusy=function(t,e){r.default.debug(o+".onLineBusy sponsor:"+t+" userID:"+e),this._eventEmitter.emit(i.EVENT.LINE_BUSY,{sponsor:t,userID:e})},t.prototype.onCallingCancel=function(){r.default.debug(o+".onCallingCancel"),this._eventEmitter.emit(i.EVENT.CALLING_CANCEL,{})},t.prototype.onKickedOut=function(){r.default.debug(o+".onKickedOut"),this._eventEmitter.emit(i.EVENT.KICKED_OUT,{})},t.prototype.onCallingTimeout=function(t,e){r.default.debug(o+".onCallingTimeout userIDList:",e),this._eventEmitter.emit(i.EVENT.CALLING_TIMEOUT,{sponsor:t,userIDList:e})},t.prototype.onCallEnd=function(t,e){r.default.debug(o+".onCallEnd userID:"+t+" callEnd:"+e),this._eventEmitter.emit(i.EVENT.CALLING_END,{userID:t,callEnd:e})},t.prototype.onUserVideoAvailable=function(t){r.default.debug(o+".onUserVideoAvailable params:",t);var e=t.userID,n=t.isVideoAvailable;this._eventEmitter.emit(i.EVENT.USER_VIDEO_AVAILABLE,{userID:e,isVideoAvailable:n})},t.prototype.onUserAudioAvailable=function(t){r.default.debug(o+".onUserAudioAvailable params:",t);var e=t.userID,n=t.isAudioAvailable;this._eventEmitter.emit(i.EVENT.USER_AUDIO_AVAILABLE,{userID:e,isAudioAvailable:n})},t.prototype.onUserVoiceVolume=function(t){this._eventEmitter.emit(i.EVENT.USER_AUDIO_AVAILABLE,{volumeMap:t})},t}();e.default=s},function(t){t.exports=JSON.parse('{"name":"trtc-calling-js","version":"0.6.0","description":"腾讯云 TRTC CALLING SDK","main":"index","dependencies":{"EventEmitter":"^1.0.0","trtc-js-sdk":"4.7.1","tsignaling":"^0.3.0"},"devDependencies":{"@typescript-eslint/eslint-plugin":"^4.6.0","@typescript-eslint/parser":"^4.6.0","docdash-blue":"^1.1.3","eslint":"^7.12.1","fs-extra":"^9.0.1","jsdoc":"^3.6.5","pretty":"^2.0.0","replace":"^1.2.0","ts-loader":"^8.0.2","typescript":"^3.9.7","webpack":"^4.44.1","webpack-cli":"^3.3.12"},"scripts":{"build":"webpack --config webpack.config.js","build_withcopy":"npm run build && cp dist/npm/index.js ../TIM-demo-web/node_modules/trtc-calling-js/index.js","build:package":"node build/package-bundle.js","lint":"eslint . --ext .ts","fix":"eslint . --ext .ts --fix","prerelease":"npm run lint && npm run build && npm run doc && npm run build:package","ts2js":"tsc src/index.ts --outDir build/ts2js --lib es2015,DOM","doc":"npm run ts2js && npm run doc:clean && npm run doc:build","doc:build":"./node_modules/.bin/jsdoc -c build/jsdoc/jsdoc.json && node ./build/jsdoc/fix-doc.js","doc:clean":"node ./build/jsdoc/clean-doc.js"},"repository":{"type":"git","url":"git@git.code.oa.com:TRDCWeb/trtc-calling-webrtc.git"},"author":"Tencent Cloud Terminal R&D Center","license":"ISC"}')}]).default}));