@rongcloud/plugin-call-plus 2.1.2 → 2.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/wrapper/index.esm.js +1 -1
- package/wrapper/index.js +1 -1
package/package.json
CHANGED
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
"license": "LGPL 2.1",
|
|
27
27
|
"description": "@rongcloud/plugin-call-plus",
|
|
28
28
|
"homepage": "https://www.rongcloud.cn",
|
|
29
|
-
"version": "2.1.
|
|
29
|
+
"version": "2.1.3",
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@rongcloud/engine": "^5.8.2",
|
|
32
|
-
"@rongcloud/plugin-rtc": "^5.
|
|
32
|
+
"@rongcloud/plugin-rtc": "^5.7.0"
|
|
33
33
|
}
|
|
34
34
|
}
|
package/wrapper/index.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{EventEmitter as e,ConversationType as t,ErrorCode as _,isUndefined as n,LogL as i}from"@rongcloud/engine";import{RCCallPlusSessionUserState as r,RCCallPlusCallState as o,RCCallPlusCode as a,RCCallPlusReason as l,RCCallPlusMediaType as E,RCCallPlusMediaTypeChangeResult as s,RCCallPlusType as u}from"@rongcloud/plugin-call-plus";var c,I,R,O,L,C,N=function(e,t){return N=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var _ in t)Object.prototype.hasOwnProperty.call(t,_)&&(e[_]=t[_])},N(e,t)};function d(e,t,_,n){return new(_||(_=Promise))((function(i,r){function o(e){try{l(n.next(e))}catch(e){r(e)}}function a(e){try{l(n.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof _?t:new _((function(e){e(t)}))).then(o,a)}l((n=n.apply(e,t||[])).next())}))}function T(e,t){var _,n,i,r,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(a){return function(l){return function(a){if(_)throw new TypeError("Generator is already executing.");for(;r&&(r=0,a[0]&&(o=0)),o;)try{if(_=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,n=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],n=0}finally{_=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}"function"==typeof SuppressedError&&SuppressedError,function(e){e[e.AUDIO=1]="AUDIO",e[e.AUDIO_VIDEO=2]="AUDIO_VIDEO"}(c||(c={})),function(e){e[e.SUCCESS=1e4]="SUCCESS",e[e.STATE_MACHINE_EXIT=53200]="STATE_MACHINE_EXIT",e[e.SEND_MSG_ERROR=53201]="SEND_MSG_ERROR",e[e.REJECTED_BY_BLACKLIST=53202]="REJECTED_BY_BLACKLIST",e[e.NOT_IN_GROUP=53203]="NOT_IN_GROUP",e[e.GET_LOCAL_AUDIO_TRACK_ERROR=53301]="GET_LOCAL_AUDIO_TRACK_ERROR",e[e.GET_LOCAL_VIDEO_TRACK_ERROR=53302]="GET_LOCAL_VIDEO_TRACK_ERROR",e[e.GET_LOCAL_AUDIO_AND_VIDEO_TRACK_ERROR=53303]="GET_LOCAL_AUDIO_AND_VIDEO_TRACK_ERROR",e[e.JOIN_ROOM_ERROR=53304]="JOIN_ROOM_ERROR",e[e.AUDIO_PUBLISH_ERROR=53305]="AUDIO_PUBLISH_ERROR",e[e.VIDEO_PUBLISH_ERROR=53306]="VIDEO_PUBLISH_ERROR",e[e.AUDIO_AND_VIDEO_PUBLISH_ERROR=53307]="AUDIO_AND_VIDEO_PUBLISH_ERROR",e[e.QUERY_JOINED_USER_INFO_ERROR=53308]="QUERY_JOINED_USER_INFO_ERROR",e[e.MISSING_VIDEO_TRACK_ERROR=53309]="MISSING_VIDEO_TRACK_ERROR",e[e.UNPUBLISH_VIDEO_ERROR=53310]="UNPUBLISH_VIDEO_ERROR",e[e.CONVERSATION_NOT_GROUP_ERROR=53311]="CONVERSATION_NOT_GROUP_ERROR",e[e.NOT_IN_ROOM_ERROR=53312]="NOT_IN_ROOM_ERROR",e[e.PARAM_ERROR=53313]="PARAM_ERROR",e[e.NOT_IN_CALL=53314]="NOT_IN_CALL",e[e.MEDIATYPE_INVALID=53315]="MEDIATYPE_INVALID",e[e.NOT_VIDEO_CALL=53316]="NOT_VIDEO_CALL",e[e.RTC_SERVICE_UNAVAILABLE=53317]="RTC_SERVICE_UNAVAILABLE",e[e.USER_LIST_INVAILD=53318]="USER_LIST_INVAILD",e[e.CALL_ID_INVALID=53319]="CALL_ID_INVALID",e[e.TRANSACTION_ID_INVALID=53320]="TRANSACTION_ID_INVALID",e[e.USER_ID_INVALID=53321]="USER_ID_INVALID",e[e.SINGLE_CALL_NOT_SUPPORT_MULTI_PERSON=53322]="SINGLE_CALL_NOT_SUPPORT_MULTI_PERSON",e[e.MICROPHONE_CLOSED=53323]="MICROPHONE_CLOSED",e[e.MEDIA_RESOURCE_INVALIED=53324]="MEDIA_RESOURCE_INVALIED",e[e.NOT_INSTALL_RTC_PLUGIN=53325]="NOT_INSTALL_RTC_PLUGIN",e[e.PLAY_MEDIA_FAILED=53326]="PLAY_MEDIA_FAILED",e[e.VIDEO_VIEW_NOT_SET=53327]="VIDEO_VIEW_NOT_SET"}(I||(I={})),function(e){e[e.NONE=0]="NONE",e[e.WAITING=1]="WAITING",e[e.KEEPING=2]="KEEPING"}(R||(R={})),function(e){e[e.WAITING=0]="WAITING",e[e.KEEPING=1]="KEEPING",e[e.END=2]="END"}(O||(O={})),function(e){e[e.CANCEL=1]="CANCEL",e[e.REJECT=2]="REJECT",e[e.HANGUP=3]="HANGUP",e[e.BUSY_LINE=4]="BUSY_LINE",e[e.NO_RESPONSE=5]="NO_RESPONSE",e[e.ENGINE_UNSUPPORTED=6]="ENGINE_UNSUPPORTED",e[e.NETWORK_ERROR=7]="NETWORK_ERROR",e[e.GET_MEDIA_RESOURCES_ERROR=8]="GET_MEDIA_RESOURCES_ERROR",e[e.PUBLISH_ERROR=9]="PUBLISH_ERROR",e[e.SUBSCRIBE_ERROR=10]="SUBSCRIBE_ERROR",e[e.REMOTE_CANCEL=11]="REMOTE_CANCEL",e[e.REMOTE_REJECT=12]="REMOTE_REJECT",e[e.REMOTE_HANGUP=13]="REMOTE_HANGUP",e[e.REMOTE_BUSY_LINE=14]="REMOTE_BUSY_LINE",e[e.REMOTE_NO_RESPONSE=15]="REMOTE_NO_RESPONSE",e[e.REMOTE_ENGINE_UNSUPPORTED=16]="REMOTE_ENGINE_UNSUPPORTED",e[e.REMOTE_NETWORK_ERROR=17]="REMOTE_NETWORK_ERROR",e[e.REMOTE_GET_MEDIA_RESOURCE_ERROR=18]="REMOTE_GET_MEDIA_RESOURCE_ERROR",e[e.REMOTE_PUBLISH_ERROR=19]="REMOTE_PUBLISH_ERROR",e[e.REMOTE_SUBSCRIBE_ERROR=20]="REMOTE_SUBSCRIBE_ERROR",e[e.OTHER_CLIENT_JOINED_CALL=21]="OTHER_CLIENT_JOINED_CALL",e[e.OTHER_CLIENT_IN_CALL=22]="OTHER_CLIENT_IN_CALL",e[e.KICKED_BY_SERVER=23]="KICKED_BY_SERVER",e[e.ACCEPT_SYSTEM_CALL=24]="ACCEPT_SYSTEM_CALL",e[e.REMOTE_OTHER_CLIENT_JOINED_CALL=31]="REMOTE_OTHER_CLIENT_JOINED_CALL",e[e.REMOTE_OTHER_CLIENT_IN_CALL=32]="REMOTE_OTHER_CLIENT_IN_CALL",e[e.REMOTE_KICKED_BY_SERVER=33]="REMOTE_KICKED_BY_SERVER",e[e.REMOTE_ACCEPT_SYSTEM_CALL=34]="REMOTE_ACCEPT_SYSTEM_CALL",e[e.ACCEPT_BY_OTHER_CLIENT=101]="ACCEPT_BY_OTHER_CLIENT",e[e.HANGUP_BY_OTHER_CLIENT=102]="HANGUP_BY_OTHER_CLIENT",e[e.ADDED_TO_BLACKLIST=103]="ADDED_TO_BLACKLIST",e[e.SERVICE_NOT_OPENED=104]="SERVICE_NOT_OPENED"}(C||(C={})),(L={})[C.CANCEL]=C.REMOTE_CANCEL,L[C.REJECT]=C.REMOTE_REJECT,L[C.HANGUP]=C.REMOTE_HANGUP,L[C.BUSY_LINE]=C.REMOTE_BUSY_LINE,L[C.NO_RESPONSE]=C.REMOTE_NO_RESPONSE,L[C.ENGINE_UNSUPPORTED]=C.REMOTE_ENGINE_UNSUPPORTED,L[C.NETWORK_ERROR]=C.REMOTE_NETWORK_ERROR,L[C.GET_MEDIA_RESOURCES_ERROR]=C.REMOTE_GET_MEDIA_RESOURCE_ERROR,L[C.PUBLISH_ERROR]=C.REMOTE_PUBLISH_ERROR,L[C.SUBSCRIBE_ERROR]=C.REMOTE_SUBSCRIBE_ERROR,L[C.OTHER_CLIENT_JOINED_CALL]=C.REMOTE_OTHER_CLIENT_JOINED_CALL,L[C.OTHER_CLIENT_IN_CALL]=C.REMOTE_OTHER_CLIENT_IN_CALL,L[C.KICKED_BY_SERVER]=C.REMOTE_KICKED_BY_SERVER,L[C.REMOTE_NO_RESPONSE]=C.NO_RESPONSE,L[C.ACCEPT_SYSTEM_CALL]=C.REMOTE_ACCEPT_SYSTEM_CALL;var S,A=function(e){var t=null;switch(e){case r.IDLE:t=R.NONE;break;case r.CALLING:case r.INVITED:case r.RINGING:t=R.WAITING;break;case r.BUSYLINE_RINGING:case r.BUSYLINE_WAIT:t=R.NONE;break;case r.CONNECTING:t=R.WAITING;break;case r.ONCALL:t=R.KEEPING;break;case r.ONPHONE:t=R.WAITING;break;case r.ENDED:case r.NO_ANSWER:case r.MISSED:case r.CANCELLED:case r.DECLINED:case r.ERROR:default:t=R.NONE}return t},f=function(e){var t=null;switch(e){case a.SUCCESS:t=I.SUCCESS;break;case a.PARAM_ERROR:t=I.PARAM_ERROR;break;case a.SESSION_EXIST:t=I.STATE_MACHINE_EXIT;break;case a.NOT_IN_CALL:t=I.NOT_IN_CALL;break;case a.MEDIATYPE_INVALID:t=I.MEDIATYPE_INVALID;break;case a.NOT_VIDEO_CALL:t=I.NOT_VIDEO_CALL;break;case a.RTC_SERVICE_UNAVAILABLE:t=I.RTC_SERVICE_UNAVAILABLE;break;case a.USER_LIST_INVAILD:t=I.USER_LIST_INVAILD;break;case a.CALL_ID_INVALID:t=I.CALL_ID_INVALID;break;case a.TRANSACTION_ID_INVALID:t=I.TRANSACTION_ID_INVALID;break;case a.USER_ID_INVALID:t=I.USER_ID_INVALID;break;case a.SINGLE_CALL_NOT_SUPPORT_MULTI_PERSON:t=I.SINGLE_CALL_NOT_SUPPORT_MULTI_PERSON;break;case a.CAMERA_CLOSED:t=I.MISSING_VIDEO_TRACK_ERROR;break;case a.MICROPHONE_CLOSED:t=I.MICROPHONE_CLOSED;break;case a.MEDIA_RESOURCE_INVALIED:t=I.MEDIA_RESOURCE_INVALIED;break;case a.NOT_INSTALL_RTC_PLUGIN:t=I.NOT_INSTALL_RTC_PLUGIN;break;case a.PLAY_MEDIA_FAILED:t=I.PLAY_MEDIA_FAILED;break;case a.VIDEO_VIEW_NOT_SET:t=I.VIDEO_VIEW_NOT_SET;break;default:t=e}return t},g=function(e,t){var _=null;switch(e){case l.BUSYLINE_RINGING:_=t?C.BUSY_LINE:C.REMOTE_BUSY_LINE;break;case l.ON_DEVICE_DISABLE:_=C.REMOTE_GET_MEDIA_RESOURCE_ERROR;break;case l.ENDED:_=t?C.HANGUP:C.REMOTE_HANGUP;break;case l.NO_ANSWER:_=C.REMOTE_NO_RESPONSE;break;case l.MISSED:_=C.NO_RESPONSE;break;case l.CANCELLED:_=t?C.CANCEL:C.REMOTE_CANCEL;break;case l.DECLINED:_=t?C.REJECT:C.REMOTE_REJECT;break;case l.OTHER_CLIENT_ACCEPT:_=C.ACCEPT_BY_OTHER_CLIENT;break;case l.PUBLISH_ERR:_=C.PUBLISH_ERROR;break;case l.SUBSCRIBE_ERR:_=C.SUBSCRIBE_ERROR;break;case l.ACCEPT_CARRIER:_=t?C.ACCEPT_SYSTEM_CALL:C.REMOTE_ACCEPT_SYSTEM_CALL;break;case l.KICKED_BY_SERVER:_=C.KICKED_BY_SERVER;break;case l.CONNECTION_ERR:_=C.NETWORK_ERROR;break;case l.OTHER_CLIENT_JOINED:_=t?C.OTHER_CLIENT_JOINED_CALL:C.REMOTE_OTHER_CLIENT_JOINED_CALL;break;case l.OTHER_CLIENT_IN_ROOM:_=C.OTHER_CLIENT_IN_CALL;break;case l.OTHER_CLIENT_HANGUP:_=C.HANGUP_BY_OTHER_CLIENT;break;case l.REMOTE_PUBLISH_ERROR:_=C.REMOTE_PUBLISH_ERROR;break;case l.REMOTE_SUBSCRIBE_ERROR:_=C.REMOTE_SUBSCRIBE_ERROR;break;case l.REMOTE_KICKED_BY_SERVER:_=C.REMOTE_KICKED_BY_SERVER;break;case l.REMOTE_CONNECTION_ERROR:_=C.REMOTE_NETWORK_ERROR;break;case l.ABNORMAL_END:_=t?C.NETWORK_ERROR:C.REMOTE_NETWORK_ERROR;break;case l.OTHER_CLIENT_CALLING:_=C.REMOTE_OTHER_CLIENT_JOINED_CALL;break;case l.JOIN_ROOM_ERR:_=C.NETWORK_ERROR;break;case l.LOGOUT:_=C.HANGUP;break;case l.OTHER_CLIENT_LOGIN:_=C.NETWORK_ERROR;break;case l.REMOTE_JOIN_RTC_ERROR:_=C.REMOTE_NETWORK_ERROR;break;case l.REMOTE_LOGOUT:_=C.REMOTE_HANGUP;break;case l.REMOTE_OTHER_CLIENT_LOGIN:_=C.REMOTE_NETWORK_ERROR;break;case l.REMOTE_OTHER_JOINED_RTC:_=C.REMOTE_OTHER_CLIENT_JOINED_CALL;break;case l.REMOTE_OTHER_CLIENT_IN_RTC:_=C.REMOTE_OTHER_CLIENT_IN_CALL;break;default:_=C.NETWORK_ERROR}return _};!function(e){e.L_CALL_PLUS_WRAPPER_INIT_O="L-call_plus_wrapper_init-O",e.L_CALL_CLIENT_REGISTER_USER_INFO_O="L-call_client_register_user_info-O",e.L_CALL_CLIENT_START_CROSS_CALL_O="L-call_client_start_cross_call-O",e.L_CALL_CLIENT_CALL_T="L-call_client_call-T",e.L_CALL_CLIENT_CALL_R="L-call_client_call-R",e.L_CALL_CLIENT_CALL_IN_GROUP_T="L-call_client_call_in_group-T",e.L_CALL_CLIENT_CALL_IN_GROUP_R="L-call_client_call_in_group-R",e.L_CALL_CLIENT_SET_PUSH_CONFIG_O="L-call_client_set_push_config-O",e.L_CALL_SESSION_REGISTER_SESSION_LISTENER_O="L-call_session_register_session_listener-O",e.L_CALL_SESSION_CHANGE_AUDIO_DEVICE_T="L-call_session_change_audio_device-T",e.L_CALL_SESSION_CHANGE_AUDIO_DEVICE_R="L-call_session_change_audio_device-R",e.L_CALL_SESSION_INVITE_T="L-call_session_invite-T",e.L_CALL_SESSION_INVITE_R="L-call_session_invite-R",e.L_CALL_SESSION_ACCEPT_T="L-call_session_accept-T",e.L_CALL_SESSION_ACCEPT_R="L-call_session_accept-R",e.L_CALL_SESSION_HUNGUP_T="L-call_session_hungup-T",e.L_CALL_SESSION_HUNGUP_R="L-call_session_hungup-R",e.L_CALL_SESSION_DESCEND_ABILITY_T="L-call_session_descend_ability-T",e.L_CALL_SESSION_DESCEND_ABILITY_P="L-call_session_descend_ability-P",e.L_CALL_SESSION_DESCEND_ABILITY_R="L-call_session_descend_ability-R",e.L_CALL_SESSION_DISABLE_VIDEO_TRACK_T="L-call_session_disable_video_track-T",e.L_CALL_SESSION_DISABLE_VIDEO_TRACK_R="L-call_session_disable_video_track-R",e.L_CALL_SESSION_ENABLE_VIDEO_TRACK_T="L-call_session_enable_video_track-T",e.L_CALL_SESSION_ENABLE_VIDEO_TRACK_R="L-call_session_enable_video_track-R",e.L_CALL_SESSION_DISABLE_AUDIO_TRACK_T="L-call_session_disable_audio_track-T",e.L_CALL_SESSION_DISABLE_AUDIO_TRACK_R="L-call_session_disable_audio_track-R",e.L_CALL_SESSION_ENABLE_AUDIO_TRACK_T="L-call_session_enable_audio_track-T",e.L_CALL_SESSION_ENABLE_AUDIO_TRACK_R="L-call_session_enable_audio_track-R",e.L_CALL_EXECUTE_EVENT_LISTENER_O="L-call_execute_event_listener-O",e.L_CALL_CLIENT_GET_JOINED_ROOM_INFO_E="L-call_client_get_joined_room_info-E"}(S||(S={}));var p,b=function(){function e(e){Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_listener",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}return Object.defineProperty(e.prototype,"registerEventListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._listener=e}}),Object.defineProperty(e.prototype,"_callAppListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,_=[],n=1;n<arguments.length;n++)_[n-1]=arguments[n];return d(this,void 0,void 0,(function(){var n,i;return T(this,(function(r){switch(r.label){case 0:if(!(n=null===(t=this._listener)||void 0===t?void 0:t[e]))return[2];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,n.apply(void 0,_)];case 2:return r.sent(),[3,4];case 3:return i=r.sent(),this._logger.error(S.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventName:e,name:i.name,message:i.message})),[3,4];case 4:return[2]}}))}))}}),Object.defineProperty(e.prototype,"onRinging",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.info(S.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onRinging",sender:e,sessionId:t.getSessionId()})),this._callAppListener("onRinging",e,t)}}),Object.defineProperty(e.prototype,"onAccept",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.info(S.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onAccept",sender:e,sessionId:t.getSessionId()})),this._callAppListener("onAccept",e,t)}}),Object.defineProperty(e.prototype,"onHungup",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,_){this._logger.info(S.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onHungup",sender:e,reason:t,sessionId:_.getSessionId()})),this._callAppListener("onHungup",e,t,_)}}),Object.defineProperty(e.prototype,"onMemberModify",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,_){this._logger.info(S.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onMemberModify",sender:e,invitedUsers:t,sessionId:_.getSessionId()})),this._callAppListener("onMemberModify",e,t,_)}}),Object.defineProperty(e.prototype,"onMediaModify",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,_){this._logger.info(S.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onMediaModify",sender:e,mediaType:t,sessionId:_.getSessionId()})),this._callAppListener("onMediaModify",e,t,_)}}),Object.defineProperty(e.prototype,"onTrackReady",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,_){this._logger.info(S.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onTrackReady",userId:e,mediaType:t,sessionId:null==_?void 0:_.getSessionId()})),this._callAppListener("onTrackReady",e,t,_)}}),Object.defineProperty(e.prototype,"onAudioMuteChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.info(S.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onAudioMuteChange",muteUser:e,sessionId:t.getSessionId()})),this._callAppListener("onAudioMuteChange",e,t)}}),Object.defineProperty(e.prototype,"onVideoMuteChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.info(S.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onVideoMuteChange",muteUser:e,sessionId:t.getSessionId()})),this._callAppListener("onVideoMuteChange",e,t)}}),Object.defineProperty(e.prototype,"onTrackSubscribeFail",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.info(S.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onTrackSubscribeFail",code:e,sessionId:t.getSessionId()})),this._callAppListener("onTrackSubscribeFail",e,t)}}),Object.defineProperty(e.prototype,"onSendPacketLoss",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.debug(S.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onSendPacketLoss",packetLostRate:e,delay:t})),this._callAppListener("onSendPacketLoss",e,t)}}),Object.defineProperty(e.prototype,"onReceivePacketLoss",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(S.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onReceivePacketLoss",data:e})),this._callAppListener("onReceivePacketLoss",e)}}),e}();!function(e){e.INNER_ON_RINGING="inner-on-ringing",e.INNER_ON_ACCEPT="inner-on-accept",e.INNER_ON_HANGUP="inner-on-hangup",e.INNER_ON_TRACK_READY="inner-on-track-ready",e.INNER_ON_MEMBER_MODIFY="inner-on-member-modify",e.INNER_ON_MEDIA_MODIFY="inner-on-media-modify",e.INNER_ON_AUDIO_MUTE_CHANGE="inner-on-audio-mute-change",e.INNER_ON_VIDEO_MUTE_CHANGE="inner-on-video-mute-change",e.INNER_ON_TRACK_SUBSCRIBE_FAIL="inner-on-track-subscribe-fail",e.INNER_ON_SELF_HANGUP="inner-on-self-hangup"}(p||(p={}));var h,v=function(e){function t(t,_,n,i,r,o,a,l,E){var s=e.call(this)||this;return Object.defineProperty(s,"_callId",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(s,"_callPlusClient",{enumerable:!0,configurable:!0,writable:!0,value:_}),Object.defineProperty(s,"_channelId",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(s,"_targetId",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(s,"_callType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(s,"_mediaType",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(s,"_context",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(s,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:l}),Object.defineProperty(s,"_options",{enumerable:!0,configurable:!0,writable:!0,value:E}),Object.defineProperty(s,"_descendResolve",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(s,"_audioConfigBuilder",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(s,"_videoConfigBuilder",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(s,"_reportAppEventModule",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),s._audioConfigBuilder=s._callPlusClient.createAudioConfigBuilder(),s._videoConfigBuilder=s._callPlusClient.createVideoConfigBuilder(),s._reportAppEventModule=new b(l),s}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function _(){this.constructor=e}N(e,t),e.prototype=null===t?Object.create(t):(_.prototype=t.prototype,new _)}(t,e),Object.defineProperty(t.prototype,"registerSessionListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this._logger.info(S.L_CALL_SESSION_REGISTER_SESSION_LISTENER_O,Object.keys(e).join(",")),this._reportAppEventModule.registerEventListener(e),this.on(p.INNER_ON_RINGING,(function(e,_){t._reportAppEventModule.onRinging(e,_)})),this.on(p.INNER_ON_ACCEPT,(function(e,_){t._reportAppEventModule.onAccept(e,_)})),this.on(p.INNER_ON_HANGUP,(function(e,_,n){t._reportAppEventModule.onHungup(e,_,n)})),this.on(p.INNER_ON_TRACK_READY,(function(e,_,n){t._reportAppEventModule.onTrackReady(e,_,n)})),this.on(p.INNER_ON_MEMBER_MODIFY,(function(e,_,n){t._reportAppEventModule.onMemberModify(e,_,n)})),this.on(p.INNER_ON_MEDIA_MODIFY,(function(e,_,n,i){var r,o;t._descendResolve[i]?(t._logger.info(S.L_CALL_SESSION_DESCEND_ABILITY_R,"success, transactionId: ".concat(i)),null===(o=(r=t._descendResolve)[i])||void 0===o||o.call(r,{code:I.SUCCESS}),delete t._descendResolve[i]):t._reportAppEventModule.onMediaModify(e,_,n)})),this.on(p.INNER_ON_AUDIO_MUTE_CHANGE,(function(e,_){t._reportAppEventModule.onAudioMuteChange(e,_)})),this.on(p.INNER_ON_VIDEO_MUTE_CHANGE,(function(e,_){t._reportAppEventModule.onVideoMuteChange(e,_)})),this.on(p.INNER_ON_TRACK_SUBSCRIBE_FAIL,(function(e,_){var n,i;null===(i=(n=t._reportAppEventModule).onTrackSubscribeFail)||void 0===i||i.call(n,e,_)}))}}),Object.defineProperty(t.prototype,"changeAudioDevice",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return d(this,void 0,void 0,(function(){var t,_,n,i;return T(this,(function(r){switch(r.label){case 0:return t=this._logger.createTraceId(),this._logger.info(S.L_CALL_SESSION_CHANGE_AUDIO_DEVICE_T,JSON.stringify(e),t),e?(_=e.micphoneId,n=e.sampleRate,this._callPlusClient.setAudioConfig({microphoneId:_,sampleRate:n}),[4,this._callPlusClient.switchMicrophone(_)]):(this._logger.error(S.L_CALL_SESSION_CHANGE_AUDIO_DEVICE_R,"errorCode: ".concat(I.PARAM_ERROR),t),[2,{code:I.PARAM_ERROR}]);case 1:return(i=r.sent().code)!==a.SUCCESS?(this._logger.error(S.L_CALL_SESSION_CHANGE_AUDIO_DEVICE_R,"errorCode: ".concat(f(i)),t),[2,{code:f(i)}]):(this._logger.info(S.L_CALL_SESSION_CHANGE_AUDIO_DEVICE_R,"success",t),[2,{code:f(i)}])}}))}))}}),Object.defineProperty(t.prototype,"invite",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var _;return void 0===t&&(t={}),d(this,void 0,void 0,(function(){var n,i;return T(this,(function(r){switch(r.label){case 0:return n=this._logger.createTraceId(),this._logger.info(S.L_CALL_SESSION_INVITE_T,JSON.stringify({userIds:e,options:t}),n),[4,this._callPlusClient.invite(e,null===(_=this._options)||void 0===_?void 0:_.callPushConfig,t.extra)];case 1:return(i=r.sent().code)!==a.SUCCESS?(this._logger.error(S.L_CALL_SESSION_INVITE_R,"errorCode: ".concat(f(i)),n),[2,{code:f(i)}]):(this._logger.info(S.L_CALL_SESSION_INVITE_R,"success",n),[2,{code:f(i)}])}}))}))}}),Object.defineProperty(t.prototype,"accept",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t;return d(this,void 0,void 0,(function(){var _,n,i,r,o,l;return T(this,(function(E){switch(E.label){case 0:return _=this._logger.createTraceId(),this._logger.info(S.L_CALL_SESSION_ACCEPT_T,JSON.stringify(e),_),e&&(n=e.audio,i=e.video,(null==n?void 0:n.micphoneId)&&this._audioConfigBuilder.setDefaultMicrophoneId(n.micphoneId),(null==n?void 0:n.sampleRate)&&this._audioConfigBuilder.setSampleRate(n.sampleRate),(null==i?void 0:i.cameraId)&&this._videoConfigBuilder.setDefaultCameraId(i.cameraId),(null==i?void 0:i.frameRate)&&this._videoConfigBuilder.setFrameRate(i.frameRate),(null==i?void 0:i.resolution)&&this._videoConfigBuilder.setVideoResolution(i.resolution)),r=this._audioConfigBuilder.build(),o=this._videoConfigBuilder.build(),this._callPlusClient.setAudioConfig(r),this._callPlusClient.setVideoConfig(o),[4,this._callPlusClient.accept(this._callId,null===(t=this._options)||void 0===t?void 0:t.callPushConfig)];case 1:return(l=E.sent().code)!==a.SUCCESS?(this._logger.error(S.L_CALL_SESSION_ACCEPT_R,"errorCode: ".concat(f(l)),_),[2,{code:f(l)}]):(this._logger.info(S.L_CALL_SESSION_ACCEPT_R,"success",_),[2,{code:f(l)}])}}))}))}}),Object.defineProperty(t.prototype,"hungup",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return d(this,void 0,void 0,(function(){var t,_;return T(this,(function(n){switch(n.label){case 0:return t=this._logger.createTraceId(),this._logger.info(S.L_CALL_SESSION_HUNGUP_T,"",t),this.emit(p.INNER_ON_SELF_HANGUP),[4,this._callPlusClient.hangup(this._callId,null===(e=this._options)||void 0===e?void 0:e.hangupPushConfig)];case 1:return(_=n.sent().code)!==a.SUCCESS&&this._logger.error(S.L_CALL_SESSION_HUNGUP_R,"errorCode: ".concat(f(_)),t),this._logger.info(S.L_CALL_SESSION_HUNGUP_R,"success",t),[2,{code:f(_)}]}}))}))}}),Object.defineProperty(t.prototype,"descendAbility",{enumerable:!1,configurable:!0,writable:!0,value:function(){return d(this,void 0,void 0,(function(){var e,t=this;return T(this,(function(_){return e=this._logger.createTraceId(),this._logger.info(S.L_CALL_SESSION_DESCEND_ABILITY_T,"",e),[2,new Promise((function(_){t._callPlusClient.requestChangeMediaType(E.AUDIO).then((function(n){var i=n.code,r=n.transactionId;if(i!==a.SUCCESS)return t._logger.error(S.L_CALL_SESSION_DESCEND_ABILITY_R,"errorCode: ".concat(f(i)),e),void _({code:f(i)});t._logger.info(S.L_CALL_SESSION_DESCEND_ABILITY_P,"transactionId: ".concat(r),e),t._descendResolve[r]=_}))}))]}))}))}}),Object.defineProperty(t.prototype,"disableVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return d(this,void 0,void 0,(function(){var e,t;return T(this,(function(_){switch(_.label){case 0:return e=this._logger.createTraceId(),this._logger.info(S.L_CALL_SESSION_DISABLE_VIDEO_TRACK_T,"",e),[4,this._callPlusClient.stopCamera()];case 1:return(t=_.sent().code)!==a.SUCCESS?(this._logger.error(S.L_CALL_SESSION_DISABLE_VIDEO_TRACK_R,"errorCode: ".concat(f(t)),e),[2,{code:f(t)}]):(this._logger.info(S.L_CALL_SESSION_DISABLE_VIDEO_TRACK_R,"success",e),[2,{code:f(t)}])}}))}))}}),Object.defineProperty(t.prototype,"enableVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return d(this,void 0,void 0,(function(){var e,t;return T(this,(function(_){switch(_.label){case 0:return e=this._logger.createTraceId(),this._logger.info(S.L_CALL_SESSION_ENABLE_VIDEO_TRACK_T,"",e),[4,this._callPlusClient.startCamera()];case 1:return(t=_.sent().code)!==a.SUCCESS?(this._logger.error(S.L_CALL_SESSION_ENABLE_VIDEO_TRACK_R,"errorCode: ".concat(f(t)),e),[2,{code:f(t)}]):(this._logger.info(S.L_CALL_SESSION_ENABLE_VIDEO_TRACK_R,"success",e),[2,{code:f(t)}])}}))}))}}),Object.defineProperty(t.prototype,"disableAudioTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return d(this,void 0,void 0,(function(){var e,t;return T(this,(function(_){switch(_.label){case 0:return e=this._logger.createTraceId(),this._logger.info(S.L_CALL_SESSION_DISABLE_AUDIO_TRACK_T,"",e),[4,this._callPlusClient.stopMicrophone()];case 1:return(t=_.sent().code)!==a.SUCCESS?(this._logger.error(S.L_CALL_SESSION_DISABLE_AUDIO_TRACK_R,"errorCode: ".concat(f(t)),e),[2,{code:f(t)}]):(this._logger.info(S.L_CALL_SESSION_DISABLE_AUDIO_TRACK_R,"success",e),[2,{code:f(t)}])}}))}))}}),Object.defineProperty(t.prototype,"enableAudioTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return d(this,void 0,void 0,(function(){var e,t;return T(this,(function(_){switch(_.label){case 0:return e=this._logger.createTraceId(),this._logger.info(S.L_CALL_SESSION_ENABLE_AUDIO_TRACK_T,"",e),[4,this._callPlusClient.startMicrophone()];case 1:return(t=_.sent().code)!==a.SUCCESS?(this._logger.error(S.L_CALL_SESSION_ENABLE_AUDIO_TRACK_R,"errorCode: ".concat(f(t)),e),[2,{code:f(t)}]):(this._logger.info(S.L_CALL_SESSION_ENABLE_AUDIO_TRACK_R,"success",e),[2,{code:f(t)}])}}))}))}}),Object.defineProperty(t.prototype,"getSessionId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._callId}}),Object.defineProperty(t.prototype,"getRTCSessionId",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._callPlusClient.getCurrentCallSession();return this._callId!==(null==e?void 0:e.getCallId())?null:this._callPlusClient.getRTCSessionId()}}),Object.defineProperty(t.prototype,"getTargetId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._targetId}}),Object.defineProperty(t.prototype,"getChannelId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._channelId}}),Object.defineProperty(t.prototype,"getConversationType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._callType}}),Object.defineProperty(t.prototype,"getRemoteUsers",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=this._callPlusClient.getCurrentCallSession();if(this._callId!==(null==t?void 0:t.getCallId()))return[];var _=(null==t?void 0:t.getUserList())||[];return null==_?void 0:_.map((function(t){var _=t.userId,n=t.state;return{userId:_,state:A(n),isCaller:_===e.getCallerId(),isRemote:_!==e._context.getCurrentId()}}))}}),Object.defineProperty(t.prototype,"getUserState",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this._callPlusClient.getCurrentCallSession();if(this._callId!==(null==t?void 0:t.getCallId()))return R.NONE;var _=null==t?void 0:t.getUserList().filter((function(t){return t.userId===e}))[0].state;return A(_)}}),Object.defineProperty(t.prototype,"getState",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._callPlusClient.getCurrentCallSession();return function(e){var t=null;switch(e){case o.IDLE:t=O.END;break;case o.CALLING:case o.INVITED:case o.RINGING:case o.BUSYLINE_RINGING:case o.BUSYLINE_WAIT:t=O.WAITING;break;case o.CONNECTING:case o.ONCALL:t=O.KEEPING;break;case o.ENDED:case o.NOANSWER:case o.MISSED:case o.CANCELED:case o.DECLINED:case o.ERROR:default:t=O.END}return t}(this._callId===(null==e?void 0:e.getCallId())?null==e?void 0:e.getState():o.ENDED)}}),Object.defineProperty(t.prototype,"getCallerId",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._callPlusClient.getCurrentCallSession();return this._callId!==(null==e?void 0:e.getCallId())?"":e.getCreatorUserId()}}),Object.defineProperty(t.prototype,"getMediaType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._mediaType===E.AUDIO?c.AUDIO:c.AUDIO_VIDEO}}),t}(e),P=function(){function e(e,t,_,n){Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:_}),Object.defineProperty(this,"_options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_callPlusClient",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_targetId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_channelId",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_session",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_sessionStartTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_listener",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_mediaType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_audioConfigBuilder",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_videoConfigBuilder",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_callPushConfig",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_hangupPushConfig",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_isSelfHangup",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_reportAppEventModule",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._callPlusClient=n.callPlusClient,this._reportAppEventModule=new b(_),this._setCallPlusEventListener(),this._audioConfigBuilder=this._callPlusClient.createAudioConfigBuilder(),this._videoConfigBuilder=this._callPlusClient.createVideoConfigBuilder()}return Object.defineProperty(e.prototype,"_setCallPlusEventListener",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,_=0,n={},i={};this._callPlusClient.setCallPlusEventListener({onReceivedCall:function(_,n){return void 0===n&&(n="{}"),d(this,void 0,void 0,(function(){var i,r,o;return T(this,(function(a){return i=_.getCallId(),e._session?(e._callPlusClient.hangup(i,e._hangupPushConfig),[2]):(e._targetId=JSON.parse(n).targetId||"",e._channelId=JSON.parse(n).channelId||"",e._mediaType=_.getMediaType()===E.AUDIO?c.AUDIO:c.AUDIO_VIDEO,r=_.getCallType(),o=r===u.MULTI?t.GROUP:t.PRIVATE,e._session=new v(i,e._callPlusClient,e._channelId,e._targetId,o,_.getMediaType(),e._context,e._logger),e._session.on(p.INNER_ON_SELF_HANGUP,(function(){e._isSelfHangup=!0})),e._options.onSession(e._session,JSON.parse(n).callLibExtra||""),[2])}))}))},onRemoteUserInvited:function(t,_,n){var i,r={userId:_},o=t.map((function(e){return{userId:e}}));e._listener?e._reportAppEventModule.onMemberModify(r,o,e._session):null===(i=e._session)||void 0===i||i.emit(p.INNER_ON_MEMBER_MODIFY,r,o,e._session)},onCallConnected:function(e){var t=e.getCallId();i[t]=!0},onCallTypeChanged:function(e,t){},onRemoteUserStateChanged:function(t,_,i,o){var a,E,s;return d(this,void 0,void 0,(function(){var c,I,R,O,L,C,N,d,S;return T(this,(function(T){return c={userId:_},I=[r.IDLE,r.DECLINED,r.MISSED,r.NO_ANSWER].includes(i),e._listener?(i===r.RINGING&&e._reportAppEventModule.onRinging(c,e._session),i===r.CONNECTING&&e._reportAppEventModule.onAccept(c,e._session),I&&e._reportAppEventModule.onHungup(c,g(o,e._isSelfHangup),e._session)):(i===r.RINGING&&(null===(a=e._session)||void 0===a||a.emit(p.INNER_ON_RINGING,c,e._session)),i===r.CONNECTING&&(null===(E=e._session)||void 0===E||E.emit(p.INNER_ON_ACCEPT,c,e._session)),I&&(null===(s=e._session)||void 0===s||s.emit(p.INNER_ON_HANGUP,c,g(o,e._isSelfHangup),e._session))),R=e._callPlusClient.getCurrentCallSession(),O=null==R?void 0:R.getCallType(),L=null==R?void 0:R.getUserList(),C=null==L?void 0:L.filter((function(t){return t.userId===e._context.getCurrentId()}))[0],N=null==L?void 0:L.filter((function(t){return t.userId!==e._context.getCurrentId()})),d=null==N?void 0:N.every((function(e){return e.state===r.IDLE})),S=(null==C?void 0:C.state)===r.ONCALL&&d,I&&O===u.MULTI&&S&&(e._callPlusClient.hangup(),n[t]=o===l.MISSED?l.NO_ANSWER:o,e._isSelfHangup=!1),[2]}))}))},onCallEnded:function(t,r){return d(this,void 0,void 0,(function(){var o,a,l;return T(this,(function(E){return o=+new Date-_,a=t.getCallId(),l={conversationType:e._session.getConversationType(),channelId:e._session.getChannelId(),targetId:e._session.getTargetId(),mediaType:e._session.getMediaType(),beginTimestamp:e._sessionStartTime,endTimestamp:o,duration:i[a]?Math.ceil((o-e._sessionStartTime)/1e3):0,endReason:n[a]?g(n[a],e._isSelfHangup):g(r,e._isSelfHangup)},e._options.onSessionClose(e._session,l),e._session=null,e._sessionStartTime=0,delete n[a],delete i[a],[2]}))}))},onUserMediaAvailable:function(t,_){var n;return d(this,void 0,void 0,(function(){var i;return T(this,(function(r){return i=_===E.AUDIO?c.AUDIO:c.AUDIO_VIDEO,e._listener?e._reportAppEventModule.onTrackReady(t,i,e._session):null===(n=e._session)||void 0===n||n.emit(p.INNER_ON_TRACK_READY,t,i,e._session),[2]}))}))},onFetchRemoteMediaError:function(t,_){var n,i,r;e._listener?null===(i=(n=e._reportAppEventModule).onTrackSubscribeFail)||void 0===i||i.call(n,_,e._session):null===(r=e._session)||void 0===r||r.emit(p.INNER_ON_TRACK_SUBSCRIBE_FAIL,_,e._session)},onRemoteCameraStateChanged:function(t,_,n){var i,r={userId:_,muted:n,kind:""};e._listener?e._reportAppEventModule.onVideoMuteChange(r,e._session):null===(i=e._session)||void 0===i||i.emit(p.INNER_ON_VIDEO_MUTE_CHANGE,r,e._session)},onRemoteMicrophoneStateChanged:function(t,_,n){var i,r={userId:_,muted:n,kind:""};e._listener?e._reportAppEventModule.onAudioMuteChange(r,e._session):null===(i=e._session)||void 0===i||i.emit(p.INNER_ON_AUDIO_MUTE_CHANGE,r,e._session)},onReceivedCallRecord:function(e){},onReceivedChangeMediaTypeRequest:function(t,_,n){e._callPlusClient.replyChangeMediaType(_,!0)},onReceivedChangeMediaTypeResult:function(t){var _;if(e._mediaType===c.AUDIO_VIDEO&&t.mediaType===E.AUDIO_VIDEO&&t.code===s.SERVER_ALLOW_MEDIA_TYPE){var n={userId:t.userId};e._mediaType=c.AUDIO,e._listener?e._reportAppEventModule.onMediaModify(n,e._mediaType,e._session):null===(_=e._session)||void 0===_||_.emit(p.INNER_ON_MEDIA_MODIFY,n,e._mediaType,e._session,t.transactionId)}},onReceivedCallStartTime:function(t){e._sessionStartTime=t.callStartTime,_=+new Date-t.callStartTime},onReceivedCallFirstFrameTime:function(e,t){},onUserAudioLevelChanged:function(e,t){}})}}),Object.defineProperty(e.prototype,"registerUserInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.warn(S.L_CALL_CLIENT_REGISTER_USER_INFO_O,"`RCCallClient.registerUserInfo` has been deprecated, use `https://doc.rongcloud.cn/imserver/server/v1/user/register` instead.")}}),Object.defineProperty(e.prototype,"startCrossCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e){e.targetId;var t=e.mediaType;return void 0===t&&c.AUDIO,e.listener,e.constraints,e.channelId,e.extra,e.bitrate,d(this,void 0,void 0,(function(){return T(this,(function(e){return this._logger.warn(S.L_CALL_CLIENT_START_CROSS_CALL_O,"`RCCallClient.startCrossCall` has been deprecated"),[2]}))}))}}),Object.defineProperty(e.prototype,"__startCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,_){var n=_.targetId,i=_.userIds,r=_.mediaType,o=void 0===r?c.AUDIO:r,l=_.listener,s=_.constraints,R=_.channelId,O=void 0===R?"":R,L=_.extra,C=void 0===L?"":L,N=_.bitrate;return d(this,void 0,void 0,(function(){var _,r,R,L,d,A,g,b,h,P,D,U,y,M,m=this;return T(this,(function(T){switch(T.label){case 0:return _=this._logger.createTraceId(),this._logger.info(S.L_CALL_CLIENT_CALL_T,JSON.stringify({targetId:n,userIds:i,mediaType:o,listener:Object.keys(l),constraints:s,channelId:O,extra:C,bitrate:N}),_),s&&(r=s.audio,R=s.video,(null==r?void 0:r.micphoneId)&&this._audioConfigBuilder.setDefaultMicrophoneId(r.micphoneId),(null==r?void 0:r.sampleRate)&&this._audioConfigBuilder.setSampleRate(r.sampleRate),(null==R?void 0:R.cameraId)&&this._videoConfigBuilder.setDefaultCameraId(R.cameraId),(null==R?void 0:R.frameRate)&&this._videoConfigBuilder.setFrameRate(R.frameRate),(null==R?void 0:R.resolution)&&this._videoConfigBuilder.setVideoResolution(R.resolution)),N&&(r=N.audio,R=N.video,r&&this._audioConfigBuilder.setBitrate(r,r),R&&this._videoConfigBuilder.setBitrate(R.min,R.max)),L=this._audioConfigBuilder.build(),d=this._videoConfigBuilder.build(),this._callPlusClient.setAudioConfig(L),this._callPlusClient.setVideoConfig(d),this._targetId=n,this._listener=l,this._reportAppEventModule.registerEventListener(l),this._mediaType=o,A=o===c.AUDIO?E.AUDIO:E.AUDIO_VIDEO,g=e?u.SINGLE:u.MULTI,b=e?[n]:i,h=e?this._context.getCurrentId():n,P=JSON.stringify({callLibExtra:C,channelId:O,targetId:h}),[4,this._callPlusClient.startCall(b,g,A,this._callPushConfig,P)];case 1:return D=T.sent(),U=D.code,y=D.callId,U!==a.SUCCESS?(this._logger.error(S.L_CALL_CLIENT_CALL_R,"errorCode: ".concat(f(U)),_),[2,{code:f(U)}]):(this._logger.info(S.L_CALL_CLIENT_CALL_R,"success",_),M=e?t.PRIVATE:t.GROUP,this._session=new v(y,this._callPlusClient,this._channelId,this._targetId,M,A,this._context,this._logger,{callPushConfig:this._callPushConfig,hangupPushConfig:this._hangupPushConfig}),this._session.on(p.INNER_ON_SELF_HANGUP,(function(){m._isSelfHangup=!0})),[2,{code:I.SUCCESS,session:this._session}])}}))}))}}),Object.defineProperty(e.prototype,"call",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.targetId,_=e.mediaType,n=void 0===_?c.AUDIO:_,i=e.listener,r=e.constraints,o=e.channelId,a=void 0===o?"":o,l=e.extra,E=void 0===l?"":l,s=e.bitrate;return d(this,void 0,void 0,(function(){return T(this,(function(e){return[2,this.__startCall(!0,{targetId:t,userIds:[],mediaType:n,listener:i,constraints:r,channelId:a,extra:E,bitrate:s})]}))}))}}),Object.defineProperty(e.prototype,"callInGroup",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.targetId,_=e.userIds,n=e.mediaType,i=void 0===n?c.AUDIO:n,r=e.listener,o=e.constraints,a=e.channelId,l=void 0===a?"":a,E=e.extra,s=void 0===E?"":E,u=e.bitrate;return d(this,void 0,void 0,(function(){return T(this,(function(e){return[2,this.__startCall(!1,{targetId:t,userIds:_,mediaType:i,listener:r,constraints:o,channelId:l,extra:s,bitrate:u})]}))}))}}),Object.defineProperty(e.prototype,"getJoinedRoomInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(){return d(this,void 0,void 0,(function(){var e,t,n;return T(this,(function(i){switch(i.label){case 0:return[4,this._context.getRTCJoinedUserInfo(this._context.getCurrentId())];case 1:return e=i.sent(),t=e.code,n=e.data,t!==_.SUCCESS?(this._logger.error(S.L_CALL_CLIENT_GET_JOINED_ROOM_INFO_E,t),[2,{code:I.QUERY_JOINED_USER_INFO_ERROR}]):[2,{code:I.SUCCESS,data:n}]}}))}))}}),Object.defineProperty(e.prototype,"setPushConfig",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===e&&(e={}),void 0===t&&(t={}),this._logger.info(S.L_CALL_CLIENT_SET_PUSH_CONFIG_O,JSON.stringify({callPushConfig:e,hangupPushConfig:t})),this._callPushConfig=e,this._hangupPushConfig=t,delete this._callPushConfig.pushContent,delete this._hangupPushConfig.pushContent}}),e}();!function(e){e.ZH="zh",e.EN="en"}(h||(h={}));var D={tag:"CallPlusWrapper",verify:function(e){return"browser"===e.tag},setup:function(e,t,_){var r=e.createLogger("CallPlusWrapper","RTC"),o=n(_.logOutputLevel)?i.WARN:_.logOutputLevel;return r.setOutputLevel(o),r.warn(S.L_CALL_PLUS_WRAPPER_INIT_O,"CallPlus Version: ".concat("2.1.2",", Commit: ").concat("d95e6815e07ae1c83b40409e2738c123b376f493")),new P(e,t,r,_)}};export{P as RCCallClient,C as RCCallEndReason,I as RCCallErrorCode,h as RCCallLanguage,c as RCCallMediaType,v as RCCallSession,O as RCCallSessionState,R as RCCallUserState,D as installer};
|
|
1
|
+
import{EventEmitter as e,ConversationType as t,ErrorCode as n,isUndefined as _,LogL as i}from"@rongcloud/engine";import{RCCallPlusSessionUserState as r,RCCallPlusCallState as o,RCCallPlusCode as a,RCCallPlusReason as l,RCCallPlusMediaType as E,RCCallPlusMediaTypeChangeResult as s,RCCallPlusType as u}from"@rongcloud/plugin-call-plus";var c,I,R,O,L,C,N=function(e,t){return N=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},N(e,t)};function d(e,t,n,_){return new(n||(n=Promise))((function(i,r){function o(e){try{l(_.next(e))}catch(e){r(e)}}function a(e){try{l(_.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((_=_.apply(e,t||[])).next())}))}function T(e,t){var n,_,i,r,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;r&&(r=0,a[0]&&(o=0)),o;)try{if(n=1,_&&(i=2&a[0]?_.return:a[0]?_.throw||((i=_.return)&&i.call(_),0):_.next)&&!(i=i.call(_,a[1])).done)return i;switch(_=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,_=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],_=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}function S(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var _,i,r=n.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(_=r.next()).done;)o.push(_.value)}catch(e){i={error:e}}finally{try{_&&!_.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return o}function A(e,t,n){if(n||2===arguments.length)for(var _,i=0,r=t.length;i<r;i++)!_&&i in t||(_||(_=Array.prototype.slice.call(t,0,i)),_[i]=t[i]);return e.concat(_||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError,function(e){e[e.AUDIO=1]="AUDIO",e[e.AUDIO_VIDEO=2]="AUDIO_VIDEO"}(c||(c={})),function(e){e[e.SUCCESS=1e4]="SUCCESS",e[e.STATE_MACHINE_EXIT=53200]="STATE_MACHINE_EXIT",e[e.SEND_MSG_ERROR=53201]="SEND_MSG_ERROR",e[e.REJECTED_BY_BLACKLIST=53202]="REJECTED_BY_BLACKLIST",e[e.NOT_IN_GROUP=53203]="NOT_IN_GROUP",e[e.GET_LOCAL_AUDIO_TRACK_ERROR=53301]="GET_LOCAL_AUDIO_TRACK_ERROR",e[e.GET_LOCAL_VIDEO_TRACK_ERROR=53302]="GET_LOCAL_VIDEO_TRACK_ERROR",e[e.GET_LOCAL_AUDIO_AND_VIDEO_TRACK_ERROR=53303]="GET_LOCAL_AUDIO_AND_VIDEO_TRACK_ERROR",e[e.JOIN_ROOM_ERROR=53304]="JOIN_ROOM_ERROR",e[e.AUDIO_PUBLISH_ERROR=53305]="AUDIO_PUBLISH_ERROR",e[e.VIDEO_PUBLISH_ERROR=53306]="VIDEO_PUBLISH_ERROR",e[e.AUDIO_AND_VIDEO_PUBLISH_ERROR=53307]="AUDIO_AND_VIDEO_PUBLISH_ERROR",e[e.QUERY_JOINED_USER_INFO_ERROR=53308]="QUERY_JOINED_USER_INFO_ERROR",e[e.MISSING_VIDEO_TRACK_ERROR=53309]="MISSING_VIDEO_TRACK_ERROR",e[e.UNPUBLISH_VIDEO_ERROR=53310]="UNPUBLISH_VIDEO_ERROR",e[e.CONVERSATION_NOT_GROUP_ERROR=53311]="CONVERSATION_NOT_GROUP_ERROR",e[e.NOT_IN_ROOM_ERROR=53312]="NOT_IN_ROOM_ERROR",e[e.PARAM_ERROR=53313]="PARAM_ERROR",e[e.NOT_IN_CALL=53314]="NOT_IN_CALL",e[e.MEDIATYPE_INVALID=53315]="MEDIATYPE_INVALID",e[e.NOT_VIDEO_CALL=53316]="NOT_VIDEO_CALL",e[e.RTC_SERVICE_UNAVAILABLE=53317]="RTC_SERVICE_UNAVAILABLE",e[e.USER_LIST_INVAILD=53318]="USER_LIST_INVAILD",e[e.CALL_ID_INVALID=53319]="CALL_ID_INVALID",e[e.TRANSACTION_ID_INVALID=53320]="TRANSACTION_ID_INVALID",e[e.USER_ID_INVALID=53321]="USER_ID_INVALID",e[e.SINGLE_CALL_NOT_SUPPORT_MULTI_PERSON=53322]="SINGLE_CALL_NOT_SUPPORT_MULTI_PERSON",e[e.MICROPHONE_CLOSED=53323]="MICROPHONE_CLOSED",e[e.MEDIA_RESOURCE_INVALIED=53324]="MEDIA_RESOURCE_INVALIED",e[e.NOT_INSTALL_RTC_PLUGIN=53325]="NOT_INSTALL_RTC_PLUGIN",e[e.PLAY_MEDIA_FAILED=53326]="PLAY_MEDIA_FAILED",e[e.VIDEO_VIEW_NOT_SET=53327]="VIDEO_VIEW_NOT_SET"}(I||(I={})),function(e){e[e.NONE=0]="NONE",e[e.WAITING=1]="WAITING",e[e.KEEPING=2]="KEEPING"}(R||(R={})),function(e){e[e.WAITING=0]="WAITING",e[e.KEEPING=1]="KEEPING",e[e.END=2]="END"}(O||(O={})),function(e){e[e.CANCEL=1]="CANCEL",e[e.REJECT=2]="REJECT",e[e.HANGUP=3]="HANGUP",e[e.BUSY_LINE=4]="BUSY_LINE",e[e.NO_RESPONSE=5]="NO_RESPONSE",e[e.ENGINE_UNSUPPORTED=6]="ENGINE_UNSUPPORTED",e[e.NETWORK_ERROR=7]="NETWORK_ERROR",e[e.GET_MEDIA_RESOURCES_ERROR=8]="GET_MEDIA_RESOURCES_ERROR",e[e.PUBLISH_ERROR=9]="PUBLISH_ERROR",e[e.SUBSCRIBE_ERROR=10]="SUBSCRIBE_ERROR",e[e.REMOTE_CANCEL=11]="REMOTE_CANCEL",e[e.REMOTE_REJECT=12]="REMOTE_REJECT",e[e.REMOTE_HANGUP=13]="REMOTE_HANGUP",e[e.REMOTE_BUSY_LINE=14]="REMOTE_BUSY_LINE",e[e.REMOTE_NO_RESPONSE=15]="REMOTE_NO_RESPONSE",e[e.REMOTE_ENGINE_UNSUPPORTED=16]="REMOTE_ENGINE_UNSUPPORTED",e[e.REMOTE_NETWORK_ERROR=17]="REMOTE_NETWORK_ERROR",e[e.REMOTE_GET_MEDIA_RESOURCE_ERROR=18]="REMOTE_GET_MEDIA_RESOURCE_ERROR",e[e.REMOTE_PUBLISH_ERROR=19]="REMOTE_PUBLISH_ERROR",e[e.REMOTE_SUBSCRIBE_ERROR=20]="REMOTE_SUBSCRIBE_ERROR",e[e.OTHER_CLIENT_JOINED_CALL=21]="OTHER_CLIENT_JOINED_CALL",e[e.OTHER_CLIENT_IN_CALL=22]="OTHER_CLIENT_IN_CALL",e[e.KICKED_BY_SERVER=23]="KICKED_BY_SERVER",e[e.ACCEPT_SYSTEM_CALL=24]="ACCEPT_SYSTEM_CALL",e[e.REMOTE_OTHER_CLIENT_JOINED_CALL=31]="REMOTE_OTHER_CLIENT_JOINED_CALL",e[e.REMOTE_OTHER_CLIENT_IN_CALL=32]="REMOTE_OTHER_CLIENT_IN_CALL",e[e.REMOTE_KICKED_BY_SERVER=33]="REMOTE_KICKED_BY_SERVER",e[e.REMOTE_ACCEPT_SYSTEM_CALL=34]="REMOTE_ACCEPT_SYSTEM_CALL",e[e.ACCEPT_BY_OTHER_CLIENT=101]="ACCEPT_BY_OTHER_CLIENT",e[e.HANGUP_BY_OTHER_CLIENT=102]="HANGUP_BY_OTHER_CLIENT",e[e.ADDED_TO_BLACKLIST=103]="ADDED_TO_BLACKLIST",e[e.SERVICE_NOT_OPENED=104]="SERVICE_NOT_OPENED"}(C||(C={})),(L={})[C.CANCEL]=C.REMOTE_CANCEL,L[C.REJECT]=C.REMOTE_REJECT,L[C.HANGUP]=C.REMOTE_HANGUP,L[C.BUSY_LINE]=C.REMOTE_BUSY_LINE,L[C.NO_RESPONSE]=C.REMOTE_NO_RESPONSE,L[C.ENGINE_UNSUPPORTED]=C.REMOTE_ENGINE_UNSUPPORTED,L[C.NETWORK_ERROR]=C.REMOTE_NETWORK_ERROR,L[C.GET_MEDIA_RESOURCES_ERROR]=C.REMOTE_GET_MEDIA_RESOURCE_ERROR,L[C.PUBLISH_ERROR]=C.REMOTE_PUBLISH_ERROR,L[C.SUBSCRIBE_ERROR]=C.REMOTE_SUBSCRIBE_ERROR,L[C.OTHER_CLIENT_JOINED_CALL]=C.REMOTE_OTHER_CLIENT_JOINED_CALL,L[C.OTHER_CLIENT_IN_CALL]=C.REMOTE_OTHER_CLIENT_IN_CALL,L[C.KICKED_BY_SERVER]=C.REMOTE_KICKED_BY_SERVER,L[C.REMOTE_NO_RESPONSE]=C.NO_RESPONSE,L[C.ACCEPT_SYSTEM_CALL]=C.REMOTE_ACCEPT_SYSTEM_CALL;var f,p=function(e){var t=null;switch(e){case r.IDLE:t=R.NONE;break;case r.CALLING:case r.INVITED:case r.RINGING:t=R.WAITING;break;case r.BUSYLINE_RINGING:case r.BUSYLINE_WAIT:t=R.NONE;break;case r.CONNECTING:t=R.WAITING;break;case r.ONCALL:t=R.KEEPING;break;case r.ONPHONE:t=R.WAITING;break;case r.ENDED:case r.NO_ANSWER:case r.MISSED:case r.CANCELLED:case r.DECLINED:case r.ERROR:default:t=R.NONE}return t},g=function(e){var t=null;switch(e){case a.SUCCESS:t=I.SUCCESS;break;case a.PARAM_ERROR:t=I.PARAM_ERROR;break;case a.SESSION_EXIST:t=I.STATE_MACHINE_EXIT;break;case a.NOT_IN_CALL:t=I.NOT_IN_CALL;break;case a.MEDIATYPE_INVALID:t=I.MEDIATYPE_INVALID;break;case a.NOT_VIDEO_CALL:t=I.NOT_VIDEO_CALL;break;case a.RTC_SERVICE_UNAVAILABLE:t=I.RTC_SERVICE_UNAVAILABLE;break;case a.USER_LIST_INVAILD:t=I.USER_LIST_INVAILD;break;case a.CALL_ID_INVALID:t=I.CALL_ID_INVALID;break;case a.TRANSACTION_ID_INVALID:t=I.TRANSACTION_ID_INVALID;break;case a.USER_ID_INVALID:t=I.USER_ID_INVALID;break;case a.SINGLE_CALL_NOT_SUPPORT_MULTI_PERSON:t=I.SINGLE_CALL_NOT_SUPPORT_MULTI_PERSON;break;case a.CAMERA_CLOSED:t=I.MISSING_VIDEO_TRACK_ERROR;break;case a.MICROPHONE_CLOSED:t=I.MICROPHONE_CLOSED;break;case a.MEDIA_RESOURCE_INVALIED:t=I.MEDIA_RESOURCE_INVALIED;break;case a.NOT_INSTALL_RTC_PLUGIN:t=I.NOT_INSTALL_RTC_PLUGIN;break;case a.PLAY_MEDIA_FAILED:t=I.PLAY_MEDIA_FAILED;break;case a.VIDEO_VIEW_NOT_SET:t=I.VIDEO_VIEW_NOT_SET;break;default:t=e}return t},b=function(e,t){var n=null;switch(e){case l.BUSYLINE_RINGING:n=t?C.BUSY_LINE:C.REMOTE_BUSY_LINE;break;case l.ON_DEVICE_DISABLE:n=C.REMOTE_GET_MEDIA_RESOURCE_ERROR;break;case l.ENDED:n=t?C.HANGUP:C.REMOTE_HANGUP;break;case l.NO_ANSWER:n=C.REMOTE_NO_RESPONSE;break;case l.MISSED:n=C.NO_RESPONSE;break;case l.CANCELLED:n=t?C.CANCEL:C.REMOTE_CANCEL;break;case l.DECLINED:n=t?C.REJECT:C.REMOTE_REJECT;break;case l.OTHER_CLIENT_ACCEPT:n=C.ACCEPT_BY_OTHER_CLIENT;break;case l.PUBLISH_ERR:n=C.PUBLISH_ERROR;break;case l.SUBSCRIBE_ERR:n=C.SUBSCRIBE_ERROR;break;case l.ACCEPT_CARRIER:n=t?C.ACCEPT_SYSTEM_CALL:C.REMOTE_ACCEPT_SYSTEM_CALL;break;case l.KICKED_BY_SERVER:n=C.KICKED_BY_SERVER;break;case l.CONNECTION_ERR:n=C.NETWORK_ERROR;break;case l.OTHER_CLIENT_JOINED:n=t?C.OTHER_CLIENT_JOINED_CALL:C.REMOTE_OTHER_CLIENT_JOINED_CALL;break;case l.OTHER_CLIENT_IN_ROOM:n=C.OTHER_CLIENT_IN_CALL;break;case l.OTHER_CLIENT_HANGUP:n=C.HANGUP_BY_OTHER_CLIENT;break;case l.REMOTE_PUBLISH_ERROR:n=C.REMOTE_PUBLISH_ERROR;break;case l.REMOTE_SUBSCRIBE_ERROR:n=C.REMOTE_SUBSCRIBE_ERROR;break;case l.REMOTE_KICKED_BY_SERVER:n=C.REMOTE_KICKED_BY_SERVER;break;case l.REMOTE_CONNECTION_ERROR:n=C.REMOTE_NETWORK_ERROR;break;case l.ABNORMAL_END:n=t?C.NETWORK_ERROR:C.REMOTE_NETWORK_ERROR;break;case l.OTHER_CLIENT_CALLING:n=C.REMOTE_OTHER_CLIENT_JOINED_CALL;break;case l.JOIN_ROOM_ERR:n=C.NETWORK_ERROR;break;case l.LOGOUT:n=C.HANGUP;break;case l.OTHER_CLIENT_LOGIN:n=C.NETWORK_ERROR;break;case l.REMOTE_JOIN_RTC_ERROR:n=C.REMOTE_NETWORK_ERROR;break;case l.REMOTE_LOGOUT:n=C.REMOTE_HANGUP;break;case l.REMOTE_OTHER_CLIENT_LOGIN:n=C.REMOTE_NETWORK_ERROR;break;case l.REMOTE_OTHER_JOINED_RTC:n=C.REMOTE_OTHER_CLIENT_JOINED_CALL;break;case l.REMOTE_OTHER_CLIENT_IN_RTC:n=C.REMOTE_OTHER_CLIENT_IN_CALL;break;default:n=C.NETWORK_ERROR}return n};!function(e){e.L_CALL_PLUS_WRAPPER_INIT_O="L-call_plus_wrapper_init-O",e.L_CALL_CLIENT_REGISTER_USER_INFO_O="L-call_client_register_user_info-O",e.L_CALL_CLIENT_START_CROSS_CALL_O="L-call_client_start_cross_call-O",e.L_CALL_CLIENT_CALL_T="L-call_client_call-T",e.L_CALL_CLIENT_CALL_R="L-call_client_call-R",e.L_CALL_CLIENT_CALL_IN_GROUP_T="L-call_client_call_in_group-T",e.L_CALL_CLIENT_CALL_IN_GROUP_R="L-call_client_call_in_group-R",e.L_CALL_CLIENT_SET_PUSH_CONFIG_O="L-call_client_set_push_config-O",e.L_CALL_SESSION_REGISTER_SESSION_LISTENER_O="L-call_session_register_session_listener-O",e.L_CALL_SESSION_CHANGE_AUDIO_DEVICE_T="L-call_session_change_audio_device-T",e.L_CALL_SESSION_CHANGE_AUDIO_DEVICE_R="L-call_session_change_audio_device-R",e.L_CALL_SESSION_INVITE_T="L-call_session_invite-T",e.L_CALL_SESSION_INVITE_R="L-call_session_invite-R",e.L_CALL_SESSION_ACCEPT_T="L-call_session_accept-T",e.L_CALL_SESSION_ACCEPT_R="L-call_session_accept-R",e.L_CALL_SESSION_HUNGUP_T="L-call_session_hungup-T",e.L_CALL_SESSION_HUNGUP_R="L-call_session_hungup-R",e.L_CALL_SESSION_DESCEND_ABILITY_T="L-call_session_descend_ability-T",e.L_CALL_SESSION_DESCEND_ABILITY_P="L-call_session_descend_ability-P",e.L_CALL_SESSION_DESCEND_ABILITY_R="L-call_session_descend_ability-R",e.L_CALL_SESSION_DISABLE_VIDEO_TRACK_T="L-call_session_disable_video_track-T",e.L_CALL_SESSION_DISABLE_VIDEO_TRACK_R="L-call_session_disable_video_track-R",e.L_CALL_SESSION_ENABLE_VIDEO_TRACK_T="L-call_session_enable_video_track-T",e.L_CALL_SESSION_ENABLE_VIDEO_TRACK_R="L-call_session_enable_video_track-R",e.L_CALL_SESSION_DISABLE_AUDIO_TRACK_T="L-call_session_disable_audio_track-T",e.L_CALL_SESSION_DISABLE_AUDIO_TRACK_R="L-call_session_disable_audio_track-R",e.L_CALL_SESSION_ENABLE_AUDIO_TRACK_T="L-call_session_enable_audio_track-T",e.L_CALL_SESSION_ENABLE_AUDIO_TRACK_R="L-call_session_enable_audio_track-R",e.L_CALL_EXECUTE_EVENT_LISTENER_O="L-call_execute_event_listener-O",e.L_CALL_CLIENT_GET_JOINED_ROOM_INFO_E="L-call_client_get_joined_room_info-E"}(f||(f={}));var h,v=function(){function e(e){Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_listener",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}return Object.defineProperty(e.prototype,"registerEventListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._listener=e}}),Object.defineProperty(e.prototype,"_callAppListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],_=1;_<arguments.length;_++)n[_-1]=arguments[_];return d(this,void 0,void 0,(function(){var _,i;return T(this,(function(r){switch(r.label){case 0:if(!(_=null===(t=this._listener)||void 0===t?void 0:t[e]))return[2];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,_.apply(void 0,A([],S(n),!1))];case 2:return r.sent(),[3,4];case 3:return i=r.sent(),this._logger.error(f.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventName:e,name:i.name,message:i.message})),[3,4];case 4:return[2]}}))}))}}),Object.defineProperty(e.prototype,"onRinging",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.info(f.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onRinging",sender:e,sessionId:t.getSessionId()})),this._callAppListener("onRinging",e,t)}}),Object.defineProperty(e.prototype,"onAccept",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.info(f.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onAccept",sender:e,sessionId:t.getSessionId()})),this._callAppListener("onAccept",e,t)}}),Object.defineProperty(e.prototype,"onHungup",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){this._logger.info(f.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onHungup",sender:e,reason:t,sessionId:n.getSessionId()})),this._callAppListener("onHungup",e,t,n)}}),Object.defineProperty(e.prototype,"onMemberModify",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){this._logger.info(f.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onMemberModify",sender:e,invitedUsers:t,sessionId:n.getSessionId()})),this._callAppListener("onMemberModify",e,t,n)}}),Object.defineProperty(e.prototype,"onMediaModify",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){this._logger.info(f.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onMediaModify",sender:e,mediaType:t,sessionId:n.getSessionId()})),this._callAppListener("onMediaModify",e,t,n)}}),Object.defineProperty(e.prototype,"onTrackReady",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){this._logger.info(f.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onTrackReady",userId:e,mediaType:t,sessionId:null==n?void 0:n.getSessionId()})),this._callAppListener("onTrackReady",e,t,n)}}),Object.defineProperty(e.prototype,"onAudioMuteChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.info(f.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onAudioMuteChange",muteUser:e,sessionId:t.getSessionId()})),this._callAppListener("onAudioMuteChange",e,t)}}),Object.defineProperty(e.prototype,"onVideoMuteChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.info(f.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onVideoMuteChange",muteUser:e,sessionId:t.getSessionId()})),this._callAppListener("onVideoMuteChange",e,t)}}),Object.defineProperty(e.prototype,"onTrackSubscribeFail",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.info(f.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onTrackSubscribeFail",code:e,sessionId:t.getSessionId()})),this._callAppListener("onTrackSubscribeFail",e,t)}}),Object.defineProperty(e.prototype,"onSendPacketLoss",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.debug(f.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onSendPacketLoss",packetLostRate:e,delay:t})),this._callAppListener("onSendPacketLoss",e,t)}}),Object.defineProperty(e.prototype,"onReceivePacketLoss",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(f.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onReceivePacketLoss",data:e})),this._callAppListener("onReceivePacketLoss",e)}}),e}();!function(e){e.INNER_ON_RINGING="inner-on-ringing",e.INNER_ON_ACCEPT="inner-on-accept",e.INNER_ON_HANGUP="inner-on-hangup",e.INNER_ON_TRACK_READY="inner-on-track-ready",e.INNER_ON_MEMBER_MODIFY="inner-on-member-modify",e.INNER_ON_MEDIA_MODIFY="inner-on-media-modify",e.INNER_ON_AUDIO_MUTE_CHANGE="inner-on-audio-mute-change",e.INNER_ON_VIDEO_MUTE_CHANGE="inner-on-video-mute-change",e.INNER_ON_TRACK_SUBSCRIBE_FAIL="inner-on-track-subscribe-fail",e.INNER_ON_SELF_HANGUP="inner-on-self-hangup"}(h||(h={}));var P,D=function(e){function t(t,n,_,i,r,o,a,l,E){var s=e.call(this)||this;return Object.defineProperty(s,"_callId",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(s,"_callPlusClient",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(s,"_channelId",{enumerable:!0,configurable:!0,writable:!0,value:_}),Object.defineProperty(s,"_targetId",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(s,"_callType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(s,"_mediaType",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(s,"_context",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(s,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:l}),Object.defineProperty(s,"_options",{enumerable:!0,configurable:!0,writable:!0,value:E}),Object.defineProperty(s,"_descendResolve",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(s,"_audioConfigBuilder",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(s,"_videoConfigBuilder",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(s,"_reportAppEventModule",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),s._audioConfigBuilder=s._callPlusClient.createAudioConfigBuilder(),s._videoConfigBuilder=s._callPlusClient.createVideoConfigBuilder(),s._reportAppEventModule=new v(l),s}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}N(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),Object.defineProperty(t.prototype,"registerSessionListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this._logger.info(f.L_CALL_SESSION_REGISTER_SESSION_LISTENER_O,Object.keys(e).join(",")),this._reportAppEventModule.registerEventListener(e),this.on(h.INNER_ON_RINGING,(function(e,n){t._reportAppEventModule.onRinging(e,n)})),this.on(h.INNER_ON_ACCEPT,(function(e,n){t._reportAppEventModule.onAccept(e,n)})),this.on(h.INNER_ON_HANGUP,(function(e,n,_){t._reportAppEventModule.onHungup(e,n,_)})),this.on(h.INNER_ON_TRACK_READY,(function(e,n,_){t._reportAppEventModule.onTrackReady(e,n,_)})),this.on(h.INNER_ON_MEMBER_MODIFY,(function(e,n,_){t._reportAppEventModule.onMemberModify(e,n,_)})),this.on(h.INNER_ON_MEDIA_MODIFY,(function(e,n,_,i){var r,o;t._descendResolve[i]?(t._logger.info(f.L_CALL_SESSION_DESCEND_ABILITY_R,"success, transactionId: ".concat(i)),null===(o=(r=t._descendResolve)[i])||void 0===o||o.call(r,{code:I.SUCCESS}),delete t._descendResolve[i]):t._reportAppEventModule.onMediaModify(e,n,_)})),this.on(h.INNER_ON_AUDIO_MUTE_CHANGE,(function(e,n){t._reportAppEventModule.onAudioMuteChange(e,n)})),this.on(h.INNER_ON_VIDEO_MUTE_CHANGE,(function(e,n){t._reportAppEventModule.onVideoMuteChange(e,n)})),this.on(h.INNER_ON_TRACK_SUBSCRIBE_FAIL,(function(e,n){var _,i;null===(i=(_=t._reportAppEventModule).onTrackSubscribeFail)||void 0===i||i.call(_,e,n)}))}}),Object.defineProperty(t.prototype,"changeAudioDevice",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return d(this,void 0,void 0,(function(){var t,n,_,i;return T(this,(function(r){switch(r.label){case 0:return t=this._logger.createTraceId(),this._logger.info(f.L_CALL_SESSION_CHANGE_AUDIO_DEVICE_T,JSON.stringify(e),t),e?(n=e.micphoneId,_=e.sampleRate,this._callPlusClient.setAudioConfig({microphoneId:n,sampleRate:_}),[4,this._callPlusClient.switchMicrophone(n)]):(this._logger.error(f.L_CALL_SESSION_CHANGE_AUDIO_DEVICE_R,"errorCode: ".concat(I.PARAM_ERROR),t),[2,{code:I.PARAM_ERROR}]);case 1:return(i=r.sent().code)!==a.SUCCESS?(this._logger.error(f.L_CALL_SESSION_CHANGE_AUDIO_DEVICE_R,"errorCode: ".concat(g(i)),t),[2,{code:g(i)}]):(this._logger.info(f.L_CALL_SESSION_CHANGE_AUDIO_DEVICE_R,"success",t),[2,{code:g(i)}])}}))}))}}),Object.defineProperty(t.prototype,"invite",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n;return void 0===t&&(t={}),d(this,void 0,void 0,(function(){var _,i;return T(this,(function(r){switch(r.label){case 0:return _=this._logger.createTraceId(),this._logger.info(f.L_CALL_SESSION_INVITE_T,JSON.stringify({userIds:e,options:t}),_),[4,this._callPlusClient.invite(e,null===(n=this._options)||void 0===n?void 0:n.callPushConfig,t.extra)];case 1:return(i=r.sent().code)!==a.SUCCESS?(this._logger.error(f.L_CALL_SESSION_INVITE_R,"errorCode: ".concat(g(i)),_),[2,{code:g(i)}]):(this._logger.info(f.L_CALL_SESSION_INVITE_R,"success",_),[2,{code:g(i)}])}}))}))}}),Object.defineProperty(t.prototype,"accept",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t;return d(this,void 0,void 0,(function(){var n,_,i,r,o,l;return T(this,(function(E){switch(E.label){case 0:return n=this._logger.createTraceId(),this._logger.info(f.L_CALL_SESSION_ACCEPT_T,JSON.stringify(e),n),e&&(_=e.audio,i=e.video,(null==_?void 0:_.micphoneId)&&this._audioConfigBuilder.setDefaultMicrophoneId(_.micphoneId),(null==_?void 0:_.sampleRate)&&this._audioConfigBuilder.setSampleRate(_.sampleRate),(null==i?void 0:i.cameraId)&&this._videoConfigBuilder.setDefaultCameraId(i.cameraId),(null==i?void 0:i.frameRate)&&this._videoConfigBuilder.setFrameRate(i.frameRate),(null==i?void 0:i.resolution)&&this._videoConfigBuilder.setVideoResolution(i.resolution)),r=this._audioConfigBuilder.build(),o=this._videoConfigBuilder.build(),this._callPlusClient.setAudioConfig(r),this._callPlusClient.setVideoConfig(o),[4,this._callPlusClient.accept(this._callId,null===(t=this._options)||void 0===t?void 0:t.callPushConfig)];case 1:return(l=E.sent().code)!==a.SUCCESS?(this._logger.error(f.L_CALL_SESSION_ACCEPT_R,"errorCode: ".concat(g(l)),n),[2,{code:g(l)}]):(this._logger.info(f.L_CALL_SESSION_ACCEPT_R,"success",n),[2,{code:g(l)}])}}))}))}}),Object.defineProperty(t.prototype,"hungup",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return d(this,void 0,void 0,(function(){var t,n;return T(this,(function(_){switch(_.label){case 0:return t=this._logger.createTraceId(),this._logger.info(f.L_CALL_SESSION_HUNGUP_T,"",t),this.emit(h.INNER_ON_SELF_HANGUP),[4,this._callPlusClient.hangup(this._callId,null===(e=this._options)||void 0===e?void 0:e.hangupPushConfig)];case 1:return(n=_.sent().code)!==a.SUCCESS&&this._logger.error(f.L_CALL_SESSION_HUNGUP_R,"errorCode: ".concat(g(n)),t),this._logger.info(f.L_CALL_SESSION_HUNGUP_R,"success",t),[2,{code:g(n)}]}}))}))}}),Object.defineProperty(t.prototype,"descendAbility",{enumerable:!1,configurable:!0,writable:!0,value:function(){return d(this,void 0,void 0,(function(){var e,t=this;return T(this,(function(n){return e=this._logger.createTraceId(),this._logger.info(f.L_CALL_SESSION_DESCEND_ABILITY_T,"",e),[2,new Promise((function(n){t._callPlusClient.requestChangeMediaType(E.AUDIO).then((function(_){var i=_.code,r=_.transactionId;if(i!==a.SUCCESS)return t._logger.error(f.L_CALL_SESSION_DESCEND_ABILITY_R,"errorCode: ".concat(g(i)),e),void n({code:g(i)});t._logger.info(f.L_CALL_SESSION_DESCEND_ABILITY_P,"transactionId: ".concat(r),e),t._descendResolve[r]=n}))}))]}))}))}}),Object.defineProperty(t.prototype,"disableVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return d(this,void 0,void 0,(function(){var e,t;return T(this,(function(n){switch(n.label){case 0:return e=this._logger.createTraceId(),this._logger.info(f.L_CALL_SESSION_DISABLE_VIDEO_TRACK_T,"",e),[4,this._callPlusClient.stopCamera()];case 1:return(t=n.sent().code)!==a.SUCCESS?(this._logger.error(f.L_CALL_SESSION_DISABLE_VIDEO_TRACK_R,"errorCode: ".concat(g(t)),e),[2,{code:g(t)}]):(this._logger.info(f.L_CALL_SESSION_DISABLE_VIDEO_TRACK_R,"success",e),[2,{code:g(t)}])}}))}))}}),Object.defineProperty(t.prototype,"enableVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return d(this,void 0,void 0,(function(){var e,t;return T(this,(function(n){switch(n.label){case 0:return e=this._logger.createTraceId(),this._logger.info(f.L_CALL_SESSION_ENABLE_VIDEO_TRACK_T,"",e),[4,this._callPlusClient.startCamera()];case 1:return(t=n.sent().code)!==a.SUCCESS?(this._logger.error(f.L_CALL_SESSION_ENABLE_VIDEO_TRACK_R,"errorCode: ".concat(g(t)),e),[2,{code:g(t)}]):(this._logger.info(f.L_CALL_SESSION_ENABLE_VIDEO_TRACK_R,"success",e),[2,{code:g(t)}])}}))}))}}),Object.defineProperty(t.prototype,"disableAudioTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return d(this,void 0,void 0,(function(){var e,t;return T(this,(function(n){switch(n.label){case 0:return e=this._logger.createTraceId(),this._logger.info(f.L_CALL_SESSION_DISABLE_AUDIO_TRACK_T,"",e),[4,this._callPlusClient.stopMicrophone()];case 1:return(t=n.sent().code)!==a.SUCCESS?(this._logger.error(f.L_CALL_SESSION_DISABLE_AUDIO_TRACK_R,"errorCode: ".concat(g(t)),e),[2,{code:g(t)}]):(this._logger.info(f.L_CALL_SESSION_DISABLE_AUDIO_TRACK_R,"success",e),[2,{code:g(t)}])}}))}))}}),Object.defineProperty(t.prototype,"enableAudioTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return d(this,void 0,void 0,(function(){var e,t;return T(this,(function(n){switch(n.label){case 0:return e=this._logger.createTraceId(),this._logger.info(f.L_CALL_SESSION_ENABLE_AUDIO_TRACK_T,"",e),[4,this._callPlusClient.startMicrophone()];case 1:return(t=n.sent().code)!==a.SUCCESS?(this._logger.error(f.L_CALL_SESSION_ENABLE_AUDIO_TRACK_R,"errorCode: ".concat(g(t)),e),[2,{code:g(t)}]):(this._logger.info(f.L_CALL_SESSION_ENABLE_AUDIO_TRACK_R,"success",e),[2,{code:g(t)}])}}))}))}}),Object.defineProperty(t.prototype,"getSessionId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._callId}}),Object.defineProperty(t.prototype,"getRTCSessionId",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._callPlusClient.getCurrentCallSession();return this._callId!==(null==e?void 0:e.getCallId())?null:this._callPlusClient.getRTCSessionId()}}),Object.defineProperty(t.prototype,"getTargetId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._targetId}}),Object.defineProperty(t.prototype,"getChannelId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._channelId}}),Object.defineProperty(t.prototype,"getConversationType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._callType}}),Object.defineProperty(t.prototype,"getRemoteUsers",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=this._callPlusClient.getCurrentCallSession();if(this._callId!==(null==t?void 0:t.getCallId()))return[];var n=(null==t?void 0:t.getUserList())||[];return null==n?void 0:n.map((function(t){var n=t.userId,_=t.state;return{userId:n,state:p(_),isCaller:n===e.getCallerId(),isRemote:n!==e._context.getCurrentId()}}))}}),Object.defineProperty(t.prototype,"getUserState",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this._callPlusClient.getCurrentCallSession();if(this._callId!==(null==t?void 0:t.getCallId()))return R.NONE;var n=null==t?void 0:t.getUserList().filter((function(t){return t.userId===e}))[0].state;return p(n)}}),Object.defineProperty(t.prototype,"getState",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._callPlusClient.getCurrentCallSession();return function(e){var t=null;switch(e){case o.IDLE:t=O.END;break;case o.CALLING:case o.INVITED:case o.RINGING:case o.BUSYLINE_RINGING:case o.BUSYLINE_WAIT:t=O.WAITING;break;case o.CONNECTING:case o.ONCALL:t=O.KEEPING;break;case o.ENDED:case o.NOANSWER:case o.MISSED:case o.CANCELED:case o.DECLINED:case o.ERROR:default:t=O.END}return t}(this._callId===(null==e?void 0:e.getCallId())?null==e?void 0:e.getState():o.ENDED)}}),Object.defineProperty(t.prototype,"getCallerId",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._callPlusClient.getCurrentCallSession();return this._callId!==(null==e?void 0:e.getCallId())?"":e.getCreatorUserId()}}),Object.defineProperty(t.prototype,"getMediaType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._mediaType===E.AUDIO?c.AUDIO:c.AUDIO_VIDEO}}),t}(e),U=function(){function e(e,t,n,_){Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_options",{enumerable:!0,configurable:!0,writable:!0,value:_}),Object.defineProperty(this,"_callPlusClient",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_targetId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_channelId",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_session",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_sessionStartTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_listener",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_mediaType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_audioConfigBuilder",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_videoConfigBuilder",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_callPushConfig",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_hangupPushConfig",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_isSelfHangup",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_reportAppEventModule",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._callPlusClient=_.callPlusClient,this._reportAppEventModule=new v(n),this._setCallPlusEventListener(),this._audioConfigBuilder=this._callPlusClient.createAudioConfigBuilder(),this._videoConfigBuilder=this._callPlusClient.createVideoConfigBuilder()}return Object.defineProperty(e.prototype,"_setCallPlusEventListener",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,n=0,_={},i={};this._callPlusClient.setCallPlusEventListener({onReceivedCall:function(n,_){return void 0===_&&(_="{}"),d(this,void 0,void 0,(function(){var i,r,o;return T(this,(function(a){return i=n.getCallId(),e._session?(e._callPlusClient.hangup(i,e._hangupPushConfig),[2]):(e._targetId=JSON.parse(_).targetId||"",e._channelId=JSON.parse(_).channelId||"",e._mediaType=n.getMediaType()===E.AUDIO?c.AUDIO:c.AUDIO_VIDEO,r=n.getCallType(),o=r===u.MULTI?t.GROUP:t.PRIVATE,e._session=new D(i,e._callPlusClient,e._channelId,e._targetId,o,n.getMediaType(),e._context,e._logger),e._session.on(h.INNER_ON_SELF_HANGUP,(function(){e._isSelfHangup=!0})),e._options.onSession(e._session,JSON.parse(_).callLibExtra||""),[2])}))}))},onRemoteUserInvited:function(t,n,_){var i,r={userId:n},o=t.map((function(e){return{userId:e}}));e._listener?e._reportAppEventModule.onMemberModify(r,o,e._session):null===(i=e._session)||void 0===i||i.emit(h.INNER_ON_MEMBER_MODIFY,r,o,e._session)},onCallConnected:function(e){var t=e.getCallId();i[t]=!0},onCallTypeChanged:function(e,t){},onRemoteUserStateChanged:function(t,n,i,o){var a,E,s;return d(this,void 0,void 0,(function(){var c,I,R,O,L,C,N,d,S;return T(this,(function(T){return c={userId:n},I=[r.IDLE,r.DECLINED,r.MISSED,r.NO_ANSWER].includes(i),e._listener?(i===r.RINGING&&e._reportAppEventModule.onRinging(c,e._session),i===r.CONNECTING&&e._reportAppEventModule.onAccept(c,e._session),I&&e._reportAppEventModule.onHungup(c,b(o,e._isSelfHangup),e._session)):(i===r.RINGING&&(null===(a=e._session)||void 0===a||a.emit(h.INNER_ON_RINGING,c,e._session)),i===r.CONNECTING&&(null===(E=e._session)||void 0===E||E.emit(h.INNER_ON_ACCEPT,c,e._session)),I&&(null===(s=e._session)||void 0===s||s.emit(h.INNER_ON_HANGUP,c,b(o,e._isSelfHangup),e._session))),R=e._callPlusClient.getCurrentCallSession(),O=null==R?void 0:R.getCallType(),L=null==R?void 0:R.getUserList(),C=null==L?void 0:L.filter((function(t){return t.userId===e._context.getCurrentId()}))[0],N=null==L?void 0:L.filter((function(t){return t.userId!==e._context.getCurrentId()})),d=null==N?void 0:N.every((function(e){return e.state===r.IDLE})),S=(null==C?void 0:C.state)===r.ONCALL&&d,I&&O===u.MULTI&&S&&(e._callPlusClient.hangup(),_[t]=o===l.MISSED?l.NO_ANSWER:o,e._isSelfHangup=!1),[2]}))}))},onCallEnded:function(t,r){return d(this,void 0,void 0,(function(){var o,a,l;return T(this,(function(E){return o=+new Date-n,a=t.getCallId(),l={conversationType:e._session.getConversationType(),channelId:e._session.getChannelId(),targetId:e._session.getTargetId(),mediaType:e._session.getMediaType(),beginTimestamp:e._sessionStartTime,endTimestamp:o,duration:i[a]?Math.ceil((o-e._sessionStartTime)/1e3):0,endReason:_[a]?b(_[a],e._isSelfHangup):b(r,e._isSelfHangup)},e._options.onSessionClose(e._session,l),e._session=null,e._sessionStartTime=0,delete _[a],delete i[a],[2]}))}))},onUserMediaAvailable:function(t,n){var _;return d(this,void 0,void 0,(function(){var i;return T(this,(function(r){return i=n===E.AUDIO?c.AUDIO:c.AUDIO_VIDEO,e._listener?e._reportAppEventModule.onTrackReady(t,i,e._session):null===(_=e._session)||void 0===_||_.emit(h.INNER_ON_TRACK_READY,t,i,e._session),[2]}))}))},onFetchRemoteMediaError:function(t,n){var _,i,r;e._listener?null===(i=(_=e._reportAppEventModule).onTrackSubscribeFail)||void 0===i||i.call(_,n,e._session):null===(r=e._session)||void 0===r||r.emit(h.INNER_ON_TRACK_SUBSCRIBE_FAIL,n,e._session)},onRemoteCameraStateChanged:function(t,n,_){var i,r={userId:n,muted:_,kind:""};e._listener?e._reportAppEventModule.onVideoMuteChange(r,e._session):null===(i=e._session)||void 0===i||i.emit(h.INNER_ON_VIDEO_MUTE_CHANGE,r,e._session)},onRemoteMicrophoneStateChanged:function(t,n,_){var i,r={userId:n,muted:_,kind:""};e._listener?e._reportAppEventModule.onAudioMuteChange(r,e._session):null===(i=e._session)||void 0===i||i.emit(h.INNER_ON_AUDIO_MUTE_CHANGE,r,e._session)},onReceivedCallRecord:function(e){},onReceivedChangeMediaTypeRequest:function(t,n,_){e._callPlusClient.replyChangeMediaType(n,!0)},onReceivedChangeMediaTypeResult:function(t){var n;if(e._mediaType===c.AUDIO_VIDEO&&t.mediaType===E.AUDIO_VIDEO&&t.code===s.SERVER_ALLOW_MEDIA_TYPE){var _={userId:t.userId};e._mediaType=c.AUDIO,e._listener?e._reportAppEventModule.onMediaModify(_,e._mediaType,e._session):null===(n=e._session)||void 0===n||n.emit(h.INNER_ON_MEDIA_MODIFY,_,e._mediaType,e._session,t.transactionId)}},onReceivedCallStartTime:function(t){e._sessionStartTime=t.callStartTime,n=+new Date-t.callStartTime},onReceivedCallFirstFrameTime:function(e,t){},onUserAudioLevelChanged:function(e,t){}})}}),Object.defineProperty(e.prototype,"registerUserInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.warn(f.L_CALL_CLIENT_REGISTER_USER_INFO_O,"`RCCallClient.registerUserInfo` has been deprecated, use `https://doc.rongcloud.cn/imserver/server/v1/user/register` instead.")}}),Object.defineProperty(e.prototype,"startCrossCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e){e.targetId;var t=e.mediaType;return void 0===t&&c.AUDIO,e.listener,e.constraints,e.channelId,e.extra,e.bitrate,d(this,void 0,void 0,(function(){return T(this,(function(e){return this._logger.warn(f.L_CALL_CLIENT_START_CROSS_CALL_O,"`RCCallClient.startCrossCall` has been deprecated"),[2]}))}))}}),Object.defineProperty(e.prototype,"__startCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n){var _=n.targetId,i=n.userIds,r=n.mediaType,o=void 0===r?c.AUDIO:r,l=n.listener,s=n.constraints,R=n.channelId,O=void 0===R?"":R,L=n.extra,C=void 0===L?"":L,N=n.bitrate;return d(this,void 0,void 0,(function(){var n,r,R,L,d,S,A,p,b,v,P,U,y,M,m=this;return T(this,(function(T){switch(T.label){case 0:return n=this._logger.createTraceId(),this._logger.info(f.L_CALL_CLIENT_CALL_T,JSON.stringify({targetId:_,userIds:i,mediaType:o,listener:Object.keys(l),constraints:s,channelId:O,extra:C,bitrate:N}),n),s&&(r=s.audio,R=s.video,(null==r?void 0:r.micphoneId)&&this._audioConfigBuilder.setDefaultMicrophoneId(r.micphoneId),(null==r?void 0:r.sampleRate)&&this._audioConfigBuilder.setSampleRate(r.sampleRate),(null==R?void 0:R.cameraId)&&this._videoConfigBuilder.setDefaultCameraId(R.cameraId),(null==R?void 0:R.frameRate)&&this._videoConfigBuilder.setFrameRate(R.frameRate),(null==R?void 0:R.resolution)&&this._videoConfigBuilder.setVideoResolution(R.resolution)),N&&(r=N.audio,R=N.video,r&&this._audioConfigBuilder.setBitrate(r,r),R&&this._videoConfigBuilder.setBitrate(R.min,R.max)),L=this._audioConfigBuilder.build(),d=this._videoConfigBuilder.build(),this._callPlusClient.setAudioConfig(L),this._callPlusClient.setVideoConfig(d),this._targetId=_,this._listener=l,this._reportAppEventModule.registerEventListener(l),this._mediaType=o,S=o===c.AUDIO?E.AUDIO:E.AUDIO_VIDEO,A=e?u.SINGLE:u.MULTI,p=e?[_]:i,b=e?this._context.getCurrentId():_,v=JSON.stringify({callLibExtra:C,channelId:O,targetId:b}),[4,this._callPlusClient.startCall(p,A,S,this._callPushConfig,v)];case 1:return P=T.sent(),U=P.code,y=P.callId,U!==a.SUCCESS?(this._logger.error(f.L_CALL_CLIENT_CALL_R,"errorCode: ".concat(g(U)),n),[2,{code:g(U)}]):(this._logger.info(f.L_CALL_CLIENT_CALL_R,"success",n),M=e?t.PRIVATE:t.GROUP,this._session=new D(y,this._callPlusClient,this._channelId,this._targetId,M,S,this._context,this._logger,{callPushConfig:this._callPushConfig,hangupPushConfig:this._hangupPushConfig}),this._session.on(h.INNER_ON_SELF_HANGUP,(function(){m._isSelfHangup=!0})),[2,{code:I.SUCCESS,session:this._session}])}}))}))}}),Object.defineProperty(e.prototype,"call",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.targetId,n=e.mediaType,_=void 0===n?c.AUDIO:n,i=e.listener,r=e.constraints,o=e.channelId,a=void 0===o?"":o,l=e.extra,E=void 0===l?"":l,s=e.bitrate;return d(this,void 0,void 0,(function(){return T(this,(function(e){return[2,this.__startCall(!0,{targetId:t,userIds:[],mediaType:_,listener:i,constraints:r,channelId:a,extra:E,bitrate:s})]}))}))}}),Object.defineProperty(e.prototype,"callInGroup",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.targetId,n=e.userIds,_=e.mediaType,i=void 0===_?c.AUDIO:_,r=e.listener,o=e.constraints,a=e.channelId,l=void 0===a?"":a,E=e.extra,s=void 0===E?"":E,u=e.bitrate;return d(this,void 0,void 0,(function(){return T(this,(function(e){return[2,this.__startCall(!1,{targetId:t,userIds:n,mediaType:i,listener:r,constraints:o,channelId:l,extra:s,bitrate:u})]}))}))}}),Object.defineProperty(e.prototype,"getJoinedRoomInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(){return d(this,void 0,void 0,(function(){var e,t,_;return T(this,(function(i){switch(i.label){case 0:return[4,this._context.getRTCJoinedUserInfo(this._context.getCurrentId())];case 1:return e=i.sent(),t=e.code,_=e.data,t!==n.SUCCESS?(this._logger.error(f.L_CALL_CLIENT_GET_JOINED_ROOM_INFO_E,t),[2,{code:I.QUERY_JOINED_USER_INFO_ERROR}]):[2,{code:I.SUCCESS,data:_}]}}))}))}}),Object.defineProperty(e.prototype,"setPushConfig",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===e&&(e={}),void 0===t&&(t={}),this._logger.info(f.L_CALL_CLIENT_SET_PUSH_CONFIG_O,JSON.stringify({callPushConfig:e,hangupPushConfig:t})),this._callPushConfig=e,this._hangupPushConfig=t,delete this._callPushConfig.pushContent,delete this._hangupPushConfig.pushContent}}),e}();!function(e){e.ZH="zh",e.EN="en"}(P||(P={}));var y={tag:"CallPlusWrapper",verify:function(e){return"browser"===e.tag},setup:function(e,t,n){var r=e.createLogger("CallPlusWrapper","RTC"),o=_(n.logOutputLevel)?i.WARN:n.logOutputLevel;return r.setOutputLevel(o),r.warn(f.L_CALL_PLUS_WRAPPER_INIT_O,"CallPlus Version: ".concat("2.1.3",", Commit: ").concat("510a1938845462199b33310feeef72fe5c29f328")),new U(e,t,r,n)}};export{U as RCCallClient,C as RCCallEndReason,I as RCCallErrorCode,P as RCCallLanguage,c as RCCallMediaType,D as RCCallSession,O as RCCallSessionState,R as RCCallUserState,y as installer};
|
package/wrapper/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t,l,n,r,o,a=require("@rongcloud/engine"),s=require("@rongcloud/plugin-call-plus"),i=function(e,t){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var l in t)Object.prototype.hasOwnProperty.call(t,l)&&(e[l]=t[l])},i(e,t)};function _(e,t,l,n){return new(l||(l=Promise))((function(r,o){function a(e){try{i(n.next(e))}catch(e){o(e)}}function s(e){try{i(n.throw(e))}catch(e){o(e)}}function i(e){var t;e.done?r(e.value):(t=e.value,t instanceof l?t:new l((function(e){e(t)}))).then(a,s)}i((n=n.apply(e,t||[])).next())}))}function C(e,t){var l,n,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(i){return function(s){if(l)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(l=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(r=a.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){a.label=s[1];break}if(6===s[0]&&a.label<r[1]){a.label=r[1],r=s;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(s);break}r[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{l=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,i])}}}"function"==typeof SuppressedError&&SuppressedError,exports.RCCallMediaType=void 0,(e=exports.RCCallMediaType||(exports.RCCallMediaType={}))[e.AUDIO=1]="AUDIO",e[e.AUDIO_VIDEO=2]="AUDIO_VIDEO",exports.RCCallErrorCode=void 0,(t=exports.RCCallErrorCode||(exports.RCCallErrorCode={}))[t.SUCCESS=1e4]="SUCCESS",t[t.STATE_MACHINE_EXIT=53200]="STATE_MACHINE_EXIT",t[t.SEND_MSG_ERROR=53201]="SEND_MSG_ERROR",t[t.REJECTED_BY_BLACKLIST=53202]="REJECTED_BY_BLACKLIST",t[t.NOT_IN_GROUP=53203]="NOT_IN_GROUP",t[t.GET_LOCAL_AUDIO_TRACK_ERROR=53301]="GET_LOCAL_AUDIO_TRACK_ERROR",t[t.GET_LOCAL_VIDEO_TRACK_ERROR=53302]="GET_LOCAL_VIDEO_TRACK_ERROR",t[t.GET_LOCAL_AUDIO_AND_VIDEO_TRACK_ERROR=53303]="GET_LOCAL_AUDIO_AND_VIDEO_TRACK_ERROR",t[t.JOIN_ROOM_ERROR=53304]="JOIN_ROOM_ERROR",t[t.AUDIO_PUBLISH_ERROR=53305]="AUDIO_PUBLISH_ERROR",t[t.VIDEO_PUBLISH_ERROR=53306]="VIDEO_PUBLISH_ERROR",t[t.AUDIO_AND_VIDEO_PUBLISH_ERROR=53307]="AUDIO_AND_VIDEO_PUBLISH_ERROR",t[t.QUERY_JOINED_USER_INFO_ERROR=53308]="QUERY_JOINED_USER_INFO_ERROR",t[t.MISSING_VIDEO_TRACK_ERROR=53309]="MISSING_VIDEO_TRACK_ERROR",t[t.UNPUBLISH_VIDEO_ERROR=53310]="UNPUBLISH_VIDEO_ERROR",t[t.CONVERSATION_NOT_GROUP_ERROR=53311]="CONVERSATION_NOT_GROUP_ERROR",t[t.NOT_IN_ROOM_ERROR=53312]="NOT_IN_ROOM_ERROR",t[t.PARAM_ERROR=53313]="PARAM_ERROR",t[t.NOT_IN_CALL=53314]="NOT_IN_CALL",t[t.MEDIATYPE_INVALID=53315]="MEDIATYPE_INVALID",t[t.NOT_VIDEO_CALL=53316]="NOT_VIDEO_CALL",t[t.RTC_SERVICE_UNAVAILABLE=53317]="RTC_SERVICE_UNAVAILABLE",t[t.USER_LIST_INVAILD=53318]="USER_LIST_INVAILD",t[t.CALL_ID_INVALID=53319]="CALL_ID_INVALID",t[t.TRANSACTION_ID_INVALID=53320]="TRANSACTION_ID_INVALID",t[t.USER_ID_INVALID=53321]="USER_ID_INVALID",t[t.SINGLE_CALL_NOT_SUPPORT_MULTI_PERSON=53322]="SINGLE_CALL_NOT_SUPPORT_MULTI_PERSON",t[t.MICROPHONE_CLOSED=53323]="MICROPHONE_CLOSED",t[t.MEDIA_RESOURCE_INVALIED=53324]="MEDIA_RESOURCE_INVALIED",t[t.NOT_INSTALL_RTC_PLUGIN=53325]="NOT_INSTALL_RTC_PLUGIN",t[t.PLAY_MEDIA_FAILED=53326]="PLAY_MEDIA_FAILED",t[t.VIDEO_VIEW_NOT_SET=53327]="VIDEO_VIEW_NOT_SET",exports.RCCallUserState=void 0,(l=exports.RCCallUserState||(exports.RCCallUserState={}))[l.NONE=0]="NONE",l[l.WAITING=1]="WAITING",l[l.KEEPING=2]="KEEPING",exports.RCCallSessionState=void 0,(n=exports.RCCallSessionState||(exports.RCCallSessionState={}))[n.WAITING=0]="WAITING",n[n.KEEPING=1]="KEEPING",n[n.END=2]="END",exports.RCCallEndReason=void 0,(o=exports.RCCallEndReason||(exports.RCCallEndReason={}))[o.CANCEL=1]="CANCEL",o[o.REJECT=2]="REJECT",o[o.HANGUP=3]="HANGUP",o[o.BUSY_LINE=4]="BUSY_LINE",o[o.NO_RESPONSE=5]="NO_RESPONSE",o[o.ENGINE_UNSUPPORTED=6]="ENGINE_UNSUPPORTED",o[o.NETWORK_ERROR=7]="NETWORK_ERROR",o[o.GET_MEDIA_RESOURCES_ERROR=8]="GET_MEDIA_RESOURCES_ERROR",o[o.PUBLISH_ERROR=9]="PUBLISH_ERROR",o[o.SUBSCRIBE_ERROR=10]="SUBSCRIBE_ERROR",o[o.REMOTE_CANCEL=11]="REMOTE_CANCEL",o[o.REMOTE_REJECT=12]="REMOTE_REJECT",o[o.REMOTE_HANGUP=13]="REMOTE_HANGUP",o[o.REMOTE_BUSY_LINE=14]="REMOTE_BUSY_LINE",o[o.REMOTE_NO_RESPONSE=15]="REMOTE_NO_RESPONSE",o[o.REMOTE_ENGINE_UNSUPPORTED=16]="REMOTE_ENGINE_UNSUPPORTED",o[o.REMOTE_NETWORK_ERROR=17]="REMOTE_NETWORK_ERROR",o[o.REMOTE_GET_MEDIA_RESOURCE_ERROR=18]="REMOTE_GET_MEDIA_RESOURCE_ERROR",o[o.REMOTE_PUBLISH_ERROR=19]="REMOTE_PUBLISH_ERROR",o[o.REMOTE_SUBSCRIBE_ERROR=20]="REMOTE_SUBSCRIBE_ERROR",o[o.OTHER_CLIENT_JOINED_CALL=21]="OTHER_CLIENT_JOINED_CALL",o[o.OTHER_CLIENT_IN_CALL=22]="OTHER_CLIENT_IN_CALL",o[o.KICKED_BY_SERVER=23]="KICKED_BY_SERVER",o[o.ACCEPT_SYSTEM_CALL=24]="ACCEPT_SYSTEM_CALL",o[o.REMOTE_OTHER_CLIENT_JOINED_CALL=31]="REMOTE_OTHER_CLIENT_JOINED_CALL",o[o.REMOTE_OTHER_CLIENT_IN_CALL=32]="REMOTE_OTHER_CLIENT_IN_CALL",o[o.REMOTE_KICKED_BY_SERVER=33]="REMOTE_KICKED_BY_SERVER",o[o.REMOTE_ACCEPT_SYSTEM_CALL=34]="REMOTE_ACCEPT_SYSTEM_CALL",o[o.ACCEPT_BY_OTHER_CLIENT=101]="ACCEPT_BY_OTHER_CLIENT",o[o.HANGUP_BY_OTHER_CLIENT=102]="HANGUP_BY_OTHER_CLIENT",o[o.ADDED_TO_BLACKLIST=103]="ADDED_TO_BLACKLIST",o[o.SERVICE_NOT_OPENED=104]="SERVICE_NOT_OPENED",(r={})[exports.RCCallEndReason.CANCEL]=exports.RCCallEndReason.REMOTE_CANCEL,r[exports.RCCallEndReason.REJECT]=exports.RCCallEndReason.REMOTE_REJECT,r[exports.RCCallEndReason.HANGUP]=exports.RCCallEndReason.REMOTE_HANGUP,r[exports.RCCallEndReason.BUSY_LINE]=exports.RCCallEndReason.REMOTE_BUSY_LINE,r[exports.RCCallEndReason.NO_RESPONSE]=exports.RCCallEndReason.REMOTE_NO_RESPONSE,r[exports.RCCallEndReason.ENGINE_UNSUPPORTED]=exports.RCCallEndReason.REMOTE_ENGINE_UNSUPPORTED,r[exports.RCCallEndReason.NETWORK_ERROR]=exports.RCCallEndReason.REMOTE_NETWORK_ERROR,r[exports.RCCallEndReason.GET_MEDIA_RESOURCES_ERROR]=exports.RCCallEndReason.REMOTE_GET_MEDIA_RESOURCE_ERROR,r[exports.RCCallEndReason.PUBLISH_ERROR]=exports.RCCallEndReason.REMOTE_PUBLISH_ERROR,r[exports.RCCallEndReason.SUBSCRIBE_ERROR]=exports.RCCallEndReason.REMOTE_SUBSCRIBE_ERROR,r[exports.RCCallEndReason.OTHER_CLIENT_JOINED_CALL]=exports.RCCallEndReason.REMOTE_OTHER_CLIENT_JOINED_CALL,r[exports.RCCallEndReason.OTHER_CLIENT_IN_CALL]=exports.RCCallEndReason.REMOTE_OTHER_CLIENT_IN_CALL,r[exports.RCCallEndReason.KICKED_BY_SERVER]=exports.RCCallEndReason.REMOTE_KICKED_BY_SERVER,r[exports.RCCallEndReason.REMOTE_NO_RESPONSE]=exports.RCCallEndReason.NO_RESPONSE,r[exports.RCCallEndReason.ACCEPT_SYSTEM_CALL]=exports.RCCallEndReason.REMOTE_ACCEPT_SYSTEM_CALL;var E,R=function(e){var t=null;switch(e){case s.RCCallPlusSessionUserState.IDLE:t=exports.RCCallUserState.NONE;break;case s.RCCallPlusSessionUserState.CALLING:case s.RCCallPlusSessionUserState.INVITED:case s.RCCallPlusSessionUserState.RINGING:t=exports.RCCallUserState.WAITING;break;case s.RCCallPlusSessionUserState.BUSYLINE_RINGING:case s.RCCallPlusSessionUserState.BUSYLINE_WAIT:t=exports.RCCallUserState.NONE;break;case s.RCCallPlusSessionUserState.CONNECTING:t=exports.RCCallUserState.WAITING;break;case s.RCCallPlusSessionUserState.ONCALL:t=exports.RCCallUserState.KEEPING;break;case s.RCCallPlusSessionUserState.ONPHONE:t=exports.RCCallUserState.WAITING;break;case s.RCCallPlusSessionUserState.ENDED:case s.RCCallPlusSessionUserState.NO_ANSWER:case s.RCCallPlusSessionUserState.MISSED:case s.RCCallPlusSessionUserState.CANCELLED:case s.RCCallPlusSessionUserState.DECLINED:case s.RCCallPlusSessionUserState.ERROR:default:t=exports.RCCallUserState.NONE}return t},u=function(e){var t=null;switch(e){case s.RCCallPlusCode.SUCCESS:t=exports.RCCallErrorCode.SUCCESS;break;case s.RCCallPlusCode.PARAM_ERROR:t=exports.RCCallErrorCode.PARAM_ERROR;break;case s.RCCallPlusCode.SESSION_EXIST:t=exports.RCCallErrorCode.STATE_MACHINE_EXIT;break;case s.RCCallPlusCode.NOT_IN_CALL:t=exports.RCCallErrorCode.NOT_IN_CALL;break;case s.RCCallPlusCode.MEDIATYPE_INVALID:t=exports.RCCallErrorCode.MEDIATYPE_INVALID;break;case s.RCCallPlusCode.NOT_VIDEO_CALL:t=exports.RCCallErrorCode.NOT_VIDEO_CALL;break;case s.RCCallPlusCode.RTC_SERVICE_UNAVAILABLE:t=exports.RCCallErrorCode.RTC_SERVICE_UNAVAILABLE;break;case s.RCCallPlusCode.USER_LIST_INVAILD:t=exports.RCCallErrorCode.USER_LIST_INVAILD;break;case s.RCCallPlusCode.CALL_ID_INVALID:t=exports.RCCallErrorCode.CALL_ID_INVALID;break;case s.RCCallPlusCode.TRANSACTION_ID_INVALID:t=exports.RCCallErrorCode.TRANSACTION_ID_INVALID;break;case s.RCCallPlusCode.USER_ID_INVALID:t=exports.RCCallErrorCode.USER_ID_INVALID;break;case s.RCCallPlusCode.SINGLE_CALL_NOT_SUPPORT_MULTI_PERSON:t=exports.RCCallErrorCode.SINGLE_CALL_NOT_SUPPORT_MULTI_PERSON;break;case s.RCCallPlusCode.CAMERA_CLOSED:t=exports.RCCallErrorCode.MISSING_VIDEO_TRACK_ERROR;break;case s.RCCallPlusCode.MICROPHONE_CLOSED:t=exports.RCCallErrorCode.MICROPHONE_CLOSED;break;case s.RCCallPlusCode.MEDIA_RESOURCE_INVALIED:t=exports.RCCallErrorCode.MEDIA_RESOURCE_INVALIED;break;case s.RCCallPlusCode.NOT_INSTALL_RTC_PLUGIN:t=exports.RCCallErrorCode.NOT_INSTALL_RTC_PLUGIN;break;case s.RCCallPlusCode.PLAY_MEDIA_FAILED:t=exports.RCCallErrorCode.PLAY_MEDIA_FAILED;break;case s.RCCallPlusCode.VIDEO_VIEW_NOT_SET:t=exports.RCCallErrorCode.VIDEO_VIEW_NOT_SET;break;default:t=e}return t},c=function(e,t){var l=null;switch(e){case s.RCCallPlusReason.BUSYLINE_RINGING:l=t?exports.RCCallEndReason.BUSY_LINE:exports.RCCallEndReason.REMOTE_BUSY_LINE;break;case s.RCCallPlusReason.ON_DEVICE_DISABLE:l=exports.RCCallEndReason.REMOTE_GET_MEDIA_RESOURCE_ERROR;break;case s.RCCallPlusReason.ENDED:l=t?exports.RCCallEndReason.HANGUP:exports.RCCallEndReason.REMOTE_HANGUP;break;case s.RCCallPlusReason.NO_ANSWER:l=exports.RCCallEndReason.REMOTE_NO_RESPONSE;break;case s.RCCallPlusReason.MISSED:l=exports.RCCallEndReason.NO_RESPONSE;break;case s.RCCallPlusReason.CANCELLED:l=t?exports.RCCallEndReason.CANCEL:exports.RCCallEndReason.REMOTE_CANCEL;break;case s.RCCallPlusReason.DECLINED:l=t?exports.RCCallEndReason.REJECT:exports.RCCallEndReason.REMOTE_REJECT;break;case s.RCCallPlusReason.OTHER_CLIENT_ACCEPT:l=exports.RCCallEndReason.ACCEPT_BY_OTHER_CLIENT;break;case s.RCCallPlusReason.PUBLISH_ERR:l=exports.RCCallEndReason.PUBLISH_ERROR;break;case s.RCCallPlusReason.SUBSCRIBE_ERR:l=exports.RCCallEndReason.SUBSCRIBE_ERROR;break;case s.RCCallPlusReason.ACCEPT_CARRIER:l=t?exports.RCCallEndReason.ACCEPT_SYSTEM_CALL:exports.RCCallEndReason.REMOTE_ACCEPT_SYSTEM_CALL;break;case s.RCCallPlusReason.KICKED_BY_SERVER:l=exports.RCCallEndReason.KICKED_BY_SERVER;break;case s.RCCallPlusReason.CONNECTION_ERR:l=exports.RCCallEndReason.NETWORK_ERROR;break;case s.RCCallPlusReason.OTHER_CLIENT_JOINED:l=t?exports.RCCallEndReason.OTHER_CLIENT_JOINED_CALL:exports.RCCallEndReason.REMOTE_OTHER_CLIENT_JOINED_CALL;break;case s.RCCallPlusReason.OTHER_CLIENT_IN_ROOM:l=exports.RCCallEndReason.OTHER_CLIENT_IN_CALL;break;case s.RCCallPlusReason.OTHER_CLIENT_HANGUP:l=exports.RCCallEndReason.HANGUP_BY_OTHER_CLIENT;break;case s.RCCallPlusReason.REMOTE_PUBLISH_ERROR:l=exports.RCCallEndReason.REMOTE_PUBLISH_ERROR;break;case s.RCCallPlusReason.REMOTE_SUBSCRIBE_ERROR:l=exports.RCCallEndReason.REMOTE_SUBSCRIBE_ERROR;break;case s.RCCallPlusReason.REMOTE_KICKED_BY_SERVER:l=exports.RCCallEndReason.REMOTE_KICKED_BY_SERVER;break;case s.RCCallPlusReason.REMOTE_CONNECTION_ERROR:l=exports.RCCallEndReason.REMOTE_NETWORK_ERROR;break;case s.RCCallPlusReason.ABNORMAL_END:l=t?exports.RCCallEndReason.NETWORK_ERROR:exports.RCCallEndReason.REMOTE_NETWORK_ERROR;break;case s.RCCallPlusReason.OTHER_CLIENT_CALLING:l=exports.RCCallEndReason.REMOTE_OTHER_CLIENT_JOINED_CALL;break;case s.RCCallPlusReason.JOIN_ROOM_ERR:l=exports.RCCallEndReason.NETWORK_ERROR;break;case s.RCCallPlusReason.LOGOUT:l=exports.RCCallEndReason.HANGUP;break;case s.RCCallPlusReason.OTHER_CLIENT_LOGIN:l=exports.RCCallEndReason.NETWORK_ERROR;break;case s.RCCallPlusReason.REMOTE_JOIN_RTC_ERROR:l=exports.RCCallEndReason.REMOTE_NETWORK_ERROR;break;case s.RCCallPlusReason.REMOTE_LOGOUT:l=exports.RCCallEndReason.REMOTE_HANGUP;break;case s.RCCallPlusReason.REMOTE_OTHER_CLIENT_LOGIN:l=exports.RCCallEndReason.REMOTE_NETWORK_ERROR;break;case s.RCCallPlusReason.REMOTE_OTHER_JOINED_RTC:l=exports.RCCallEndReason.REMOTE_OTHER_CLIENT_JOINED_CALL;break;case s.RCCallPlusReason.REMOTE_OTHER_CLIENT_IN_RTC:l=exports.RCCallEndReason.REMOTE_OTHER_CLIENT_IN_CALL;break;default:l=exports.RCCallEndReason.NETWORK_ERROR}return l};!function(e){e.L_CALL_PLUS_WRAPPER_INIT_O="L-call_plus_wrapper_init-O",e.L_CALL_CLIENT_REGISTER_USER_INFO_O="L-call_client_register_user_info-O",e.L_CALL_CLIENT_START_CROSS_CALL_O="L-call_client_start_cross_call-O",e.L_CALL_CLIENT_CALL_T="L-call_client_call-T",e.L_CALL_CLIENT_CALL_R="L-call_client_call-R",e.L_CALL_CLIENT_CALL_IN_GROUP_T="L-call_client_call_in_group-T",e.L_CALL_CLIENT_CALL_IN_GROUP_R="L-call_client_call_in_group-R",e.L_CALL_CLIENT_SET_PUSH_CONFIG_O="L-call_client_set_push_config-O",e.L_CALL_SESSION_REGISTER_SESSION_LISTENER_O="L-call_session_register_session_listener-O",e.L_CALL_SESSION_CHANGE_AUDIO_DEVICE_T="L-call_session_change_audio_device-T",e.L_CALL_SESSION_CHANGE_AUDIO_DEVICE_R="L-call_session_change_audio_device-R",e.L_CALL_SESSION_INVITE_T="L-call_session_invite-T",e.L_CALL_SESSION_INVITE_R="L-call_session_invite-R",e.L_CALL_SESSION_ACCEPT_T="L-call_session_accept-T",e.L_CALL_SESSION_ACCEPT_R="L-call_session_accept-R",e.L_CALL_SESSION_HUNGUP_T="L-call_session_hungup-T",e.L_CALL_SESSION_HUNGUP_R="L-call_session_hungup-R",e.L_CALL_SESSION_DESCEND_ABILITY_T="L-call_session_descend_ability-T",e.L_CALL_SESSION_DESCEND_ABILITY_P="L-call_session_descend_ability-P",e.L_CALL_SESSION_DESCEND_ABILITY_R="L-call_session_descend_ability-R",e.L_CALL_SESSION_DISABLE_VIDEO_TRACK_T="L-call_session_disable_video_track-T",e.L_CALL_SESSION_DISABLE_VIDEO_TRACK_R="L-call_session_disable_video_track-R",e.L_CALL_SESSION_ENABLE_VIDEO_TRACK_T="L-call_session_enable_video_track-T",e.L_CALL_SESSION_ENABLE_VIDEO_TRACK_R="L-call_session_enable_video_track-R",e.L_CALL_SESSION_DISABLE_AUDIO_TRACK_T="L-call_session_disable_audio_track-T",e.L_CALL_SESSION_DISABLE_AUDIO_TRACK_R="L-call_session_disable_audio_track-R",e.L_CALL_SESSION_ENABLE_AUDIO_TRACK_T="L-call_session_enable_audio_track-T",e.L_CALL_SESSION_ENABLE_AUDIO_TRACK_R="L-call_session_enable_audio_track-R",e.L_CALL_EXECUTE_EVENT_LISTENER_O="L-call_execute_event_listener-O",e.L_CALL_CLIENT_GET_JOINED_ROOM_INFO_E="L-call_client_get_joined_room_info-E"}(E||(E={}));var d,I=function(){function e(e){Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_listener",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}return Object.defineProperty(e.prototype,"registerEventListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._listener=e}}),Object.defineProperty(e.prototype,"_callAppListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,l=[],n=1;n<arguments.length;n++)l[n-1]=arguments[n];return _(this,void 0,void 0,(function(){var n,r;return C(this,(function(o){switch(o.label){case 0:if(!(n=null===(t=this._listener)||void 0===t?void 0:t[e]))return[2];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,n.apply(void 0,l)];case 2:return o.sent(),[3,4];case 3:return r=o.sent(),this._logger.error(E.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventName:e,name:r.name,message:r.message})),[3,4];case 4:return[2]}}))}))}}),Object.defineProperty(e.prototype,"onRinging",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.info(E.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onRinging",sender:e,sessionId:t.getSessionId()})),this._callAppListener("onRinging",e,t)}}),Object.defineProperty(e.prototype,"onAccept",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.info(E.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onAccept",sender:e,sessionId:t.getSessionId()})),this._callAppListener("onAccept",e,t)}}),Object.defineProperty(e.prototype,"onHungup",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,l){this._logger.info(E.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onHungup",sender:e,reason:t,sessionId:l.getSessionId()})),this._callAppListener("onHungup",e,t,l)}}),Object.defineProperty(e.prototype,"onMemberModify",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,l){this._logger.info(E.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onMemberModify",sender:e,invitedUsers:t,sessionId:l.getSessionId()})),this._callAppListener("onMemberModify",e,t,l)}}),Object.defineProperty(e.prototype,"onMediaModify",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,l){this._logger.info(E.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onMediaModify",sender:e,mediaType:t,sessionId:l.getSessionId()})),this._callAppListener("onMediaModify",e,t,l)}}),Object.defineProperty(e.prototype,"onTrackReady",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,l){this._logger.info(E.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onTrackReady",userId:e,mediaType:t,sessionId:null==l?void 0:l.getSessionId()})),this._callAppListener("onTrackReady",e,t,l)}}),Object.defineProperty(e.prototype,"onAudioMuteChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.info(E.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onAudioMuteChange",muteUser:e,sessionId:t.getSessionId()})),this._callAppListener("onAudioMuteChange",e,t)}}),Object.defineProperty(e.prototype,"onVideoMuteChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.info(E.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onVideoMuteChange",muteUser:e,sessionId:t.getSessionId()})),this._callAppListener("onVideoMuteChange",e,t)}}),Object.defineProperty(e.prototype,"onTrackSubscribeFail",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.info(E.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onTrackSubscribeFail",code:e,sessionId:t.getSessionId()})),this._callAppListener("onTrackSubscribeFail",e,t)}}),Object.defineProperty(e.prototype,"onSendPacketLoss",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.debug(E.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onSendPacketLoss",packetLostRate:e,delay:t})),this._callAppListener("onSendPacketLoss",e,t)}}),Object.defineProperty(e.prototype,"onReceivePacketLoss",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(E.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onReceivePacketLoss",data:e})),this._callAppListener("onReceivePacketLoss",e)}}),e}();!function(e){e.INNER_ON_RINGING="inner-on-ringing",e.INNER_ON_ACCEPT="inner-on-accept",e.INNER_ON_HANGUP="inner-on-hangup",e.INNER_ON_TRACK_READY="inner-on-track-ready",e.INNER_ON_MEMBER_MODIFY="inner-on-member-modify",e.INNER_ON_MEDIA_MODIFY="inner-on-media-modify",e.INNER_ON_AUDIO_MUTE_CHANGE="inner-on-audio-mute-change",e.INNER_ON_VIDEO_MUTE_CHANGE="inner-on-video-mute-change",e.INNER_ON_TRACK_SUBSCRIBE_FAIL="inner-on-track-subscribe-fail",e.INNER_ON_SELF_HANGUP="inner-on-self-hangup"}(d||(d={}));var O,L=function(e){function t(t,l,n,r,o,a,s,i,_){var C=e.call(this)||this;return Object.defineProperty(C,"_callId",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(C,"_callPlusClient",{enumerable:!0,configurable:!0,writable:!0,value:l}),Object.defineProperty(C,"_channelId",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(C,"_targetId",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(C,"_callType",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(C,"_mediaType",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(C,"_context",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(C,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(C,"_options",{enumerable:!0,configurable:!0,writable:!0,value:_}),Object.defineProperty(C,"_descendResolve",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(C,"_audioConfigBuilder",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(C,"_videoConfigBuilder",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(C,"_reportAppEventModule",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),C._audioConfigBuilder=C._callPlusClient.createAudioConfigBuilder(),C._videoConfigBuilder=C._callPlusClient.createVideoConfigBuilder(),C._reportAppEventModule=new I(i),C}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function l(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(l.prototype=t.prototype,new l)}(t,e),Object.defineProperty(t.prototype,"registerSessionListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this._logger.info(E.L_CALL_SESSION_REGISTER_SESSION_LISTENER_O,Object.keys(e).join(",")),this._reportAppEventModule.registerEventListener(e),this.on(d.INNER_ON_RINGING,(function(e,l){t._reportAppEventModule.onRinging(e,l)})),this.on(d.INNER_ON_ACCEPT,(function(e,l){t._reportAppEventModule.onAccept(e,l)})),this.on(d.INNER_ON_HANGUP,(function(e,l,n){t._reportAppEventModule.onHungup(e,l,n)})),this.on(d.INNER_ON_TRACK_READY,(function(e,l,n){t._reportAppEventModule.onTrackReady(e,l,n)})),this.on(d.INNER_ON_MEMBER_MODIFY,(function(e,l,n){t._reportAppEventModule.onMemberModify(e,l,n)})),this.on(d.INNER_ON_MEDIA_MODIFY,(function(e,l,n,r){var o,a;t._descendResolve[r]?(t._logger.info(E.L_CALL_SESSION_DESCEND_ABILITY_R,"success, transactionId: ".concat(r)),null===(a=(o=t._descendResolve)[r])||void 0===a||a.call(o,{code:exports.RCCallErrorCode.SUCCESS}),delete t._descendResolve[r]):t._reportAppEventModule.onMediaModify(e,l,n)})),this.on(d.INNER_ON_AUDIO_MUTE_CHANGE,(function(e,l){t._reportAppEventModule.onAudioMuteChange(e,l)})),this.on(d.INNER_ON_VIDEO_MUTE_CHANGE,(function(e,l){t._reportAppEventModule.onVideoMuteChange(e,l)})),this.on(d.INNER_ON_TRACK_SUBSCRIBE_FAIL,(function(e,l){var n,r;null===(r=(n=t._reportAppEventModule).onTrackSubscribeFail)||void 0===r||r.call(n,e,l)}))}}),Object.defineProperty(t.prototype,"changeAudioDevice",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return _(this,void 0,void 0,(function(){var t,l,n,r;return C(this,(function(o){switch(o.label){case 0:return t=this._logger.createTraceId(),this._logger.info(E.L_CALL_SESSION_CHANGE_AUDIO_DEVICE_T,JSON.stringify(e),t),e?(l=e.micphoneId,n=e.sampleRate,this._callPlusClient.setAudioConfig({microphoneId:l,sampleRate:n}),[4,this._callPlusClient.switchMicrophone(l)]):(this._logger.error(E.L_CALL_SESSION_CHANGE_AUDIO_DEVICE_R,"errorCode: ".concat(exports.RCCallErrorCode.PARAM_ERROR),t),[2,{code:exports.RCCallErrorCode.PARAM_ERROR}]);case 1:return(r=o.sent().code)!==s.RCCallPlusCode.SUCCESS?(this._logger.error(E.L_CALL_SESSION_CHANGE_AUDIO_DEVICE_R,"errorCode: ".concat(u(r)),t),[2,{code:u(r)}]):(this._logger.info(E.L_CALL_SESSION_CHANGE_AUDIO_DEVICE_R,"success",t),[2,{code:u(r)}])}}))}))}}),Object.defineProperty(t.prototype,"invite",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var l;return void 0===t&&(t={}),_(this,void 0,void 0,(function(){var n,r;return C(this,(function(o){switch(o.label){case 0:return n=this._logger.createTraceId(),this._logger.info(E.L_CALL_SESSION_INVITE_T,JSON.stringify({userIds:e,options:t}),n),[4,this._callPlusClient.invite(e,null===(l=this._options)||void 0===l?void 0:l.callPushConfig,t.extra)];case 1:return(r=o.sent().code)!==s.RCCallPlusCode.SUCCESS?(this._logger.error(E.L_CALL_SESSION_INVITE_R,"errorCode: ".concat(u(r)),n),[2,{code:u(r)}]):(this._logger.info(E.L_CALL_SESSION_INVITE_R,"success",n),[2,{code:u(r)}])}}))}))}}),Object.defineProperty(t.prototype,"accept",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t;return _(this,void 0,void 0,(function(){var l,n,r,o,a,i;return C(this,(function(_){switch(_.label){case 0:return l=this._logger.createTraceId(),this._logger.info(E.L_CALL_SESSION_ACCEPT_T,JSON.stringify(e),l),e&&(n=e.audio,r=e.video,(null==n?void 0:n.micphoneId)&&this._audioConfigBuilder.setDefaultMicrophoneId(n.micphoneId),(null==n?void 0:n.sampleRate)&&this._audioConfigBuilder.setSampleRate(n.sampleRate),(null==r?void 0:r.cameraId)&&this._videoConfigBuilder.setDefaultCameraId(r.cameraId),(null==r?void 0:r.frameRate)&&this._videoConfigBuilder.setFrameRate(r.frameRate),(null==r?void 0:r.resolution)&&this._videoConfigBuilder.setVideoResolution(r.resolution)),o=this._audioConfigBuilder.build(),a=this._videoConfigBuilder.build(),this._callPlusClient.setAudioConfig(o),this._callPlusClient.setVideoConfig(a),[4,this._callPlusClient.accept(this._callId,null===(t=this._options)||void 0===t?void 0:t.callPushConfig)];case 1:return(i=_.sent().code)!==s.RCCallPlusCode.SUCCESS?(this._logger.error(E.L_CALL_SESSION_ACCEPT_R,"errorCode: ".concat(u(i)),l),[2,{code:u(i)}]):(this._logger.info(E.L_CALL_SESSION_ACCEPT_R,"success",l),[2,{code:u(i)}])}}))}))}}),Object.defineProperty(t.prototype,"hungup",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return _(this,void 0,void 0,(function(){var t,l;return C(this,(function(n){switch(n.label){case 0:return t=this._logger.createTraceId(),this._logger.info(E.L_CALL_SESSION_HUNGUP_T,"",t),this.emit(d.INNER_ON_SELF_HANGUP),[4,this._callPlusClient.hangup(this._callId,null===(e=this._options)||void 0===e?void 0:e.hangupPushConfig)];case 1:return(l=n.sent().code)!==s.RCCallPlusCode.SUCCESS&&this._logger.error(E.L_CALL_SESSION_HUNGUP_R,"errorCode: ".concat(u(l)),t),this._logger.info(E.L_CALL_SESSION_HUNGUP_R,"success",t),[2,{code:u(l)}]}}))}))}}),Object.defineProperty(t.prototype,"descendAbility",{enumerable:!1,configurable:!0,writable:!0,value:function(){return _(this,void 0,void 0,(function(){var e,t=this;return C(this,(function(l){return e=this._logger.createTraceId(),this._logger.info(E.L_CALL_SESSION_DESCEND_ABILITY_T,"",e),[2,new Promise((function(l){t._callPlusClient.requestChangeMediaType(s.RCCallPlusMediaType.AUDIO).then((function(n){var r=n.code,o=n.transactionId;if(r!==s.RCCallPlusCode.SUCCESS)return t._logger.error(E.L_CALL_SESSION_DESCEND_ABILITY_R,"errorCode: ".concat(u(r)),e),void l({code:u(r)});t._logger.info(E.L_CALL_SESSION_DESCEND_ABILITY_P,"transactionId: ".concat(o),e),t._descendResolve[o]=l}))}))]}))}))}}),Object.defineProperty(t.prototype,"disableVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return _(this,void 0,void 0,(function(){var e,t;return C(this,(function(l){switch(l.label){case 0:return e=this._logger.createTraceId(),this._logger.info(E.L_CALL_SESSION_DISABLE_VIDEO_TRACK_T,"",e),[4,this._callPlusClient.stopCamera()];case 1:return(t=l.sent().code)!==s.RCCallPlusCode.SUCCESS?(this._logger.error(E.L_CALL_SESSION_DISABLE_VIDEO_TRACK_R,"errorCode: ".concat(u(t)),e),[2,{code:u(t)}]):(this._logger.info(E.L_CALL_SESSION_DISABLE_VIDEO_TRACK_R,"success",e),[2,{code:u(t)}])}}))}))}}),Object.defineProperty(t.prototype,"enableVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return _(this,void 0,void 0,(function(){var e,t;return C(this,(function(l){switch(l.label){case 0:return e=this._logger.createTraceId(),this._logger.info(E.L_CALL_SESSION_ENABLE_VIDEO_TRACK_T,"",e),[4,this._callPlusClient.startCamera()];case 1:return(t=l.sent().code)!==s.RCCallPlusCode.SUCCESS?(this._logger.error(E.L_CALL_SESSION_ENABLE_VIDEO_TRACK_R,"errorCode: ".concat(u(t)),e),[2,{code:u(t)}]):(this._logger.info(E.L_CALL_SESSION_ENABLE_VIDEO_TRACK_R,"success",e),[2,{code:u(t)}])}}))}))}}),Object.defineProperty(t.prototype,"disableAudioTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return _(this,void 0,void 0,(function(){var e,t;return C(this,(function(l){switch(l.label){case 0:return e=this._logger.createTraceId(),this._logger.info(E.L_CALL_SESSION_DISABLE_AUDIO_TRACK_T,"",e),[4,this._callPlusClient.stopMicrophone()];case 1:return(t=l.sent().code)!==s.RCCallPlusCode.SUCCESS?(this._logger.error(E.L_CALL_SESSION_DISABLE_AUDIO_TRACK_R,"errorCode: ".concat(u(t)),e),[2,{code:u(t)}]):(this._logger.info(E.L_CALL_SESSION_DISABLE_AUDIO_TRACK_R,"success",e),[2,{code:u(t)}])}}))}))}}),Object.defineProperty(t.prototype,"enableAudioTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return _(this,void 0,void 0,(function(){var e,t;return C(this,(function(l){switch(l.label){case 0:return e=this._logger.createTraceId(),this._logger.info(E.L_CALL_SESSION_ENABLE_AUDIO_TRACK_T,"",e),[4,this._callPlusClient.startMicrophone()];case 1:return(t=l.sent().code)!==s.RCCallPlusCode.SUCCESS?(this._logger.error(E.L_CALL_SESSION_ENABLE_AUDIO_TRACK_R,"errorCode: ".concat(u(t)),e),[2,{code:u(t)}]):(this._logger.info(E.L_CALL_SESSION_ENABLE_AUDIO_TRACK_R,"success",e),[2,{code:u(t)}])}}))}))}}),Object.defineProperty(t.prototype,"getSessionId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._callId}}),Object.defineProperty(t.prototype,"getRTCSessionId",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._callPlusClient.getCurrentCallSession();return this._callId!==(null==e?void 0:e.getCallId())?null:this._callPlusClient.getRTCSessionId()}}),Object.defineProperty(t.prototype,"getTargetId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._targetId}}),Object.defineProperty(t.prototype,"getChannelId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._channelId}}),Object.defineProperty(t.prototype,"getConversationType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._callType}}),Object.defineProperty(t.prototype,"getRemoteUsers",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=this._callPlusClient.getCurrentCallSession();if(this._callId!==(null==t?void 0:t.getCallId()))return[];var l=(null==t?void 0:t.getUserList())||[];return null==l?void 0:l.map((function(t){var l=t.userId,n=t.state;return{userId:l,state:R(n),isCaller:l===e.getCallerId(),isRemote:l!==e._context.getCurrentId()}}))}}),Object.defineProperty(t.prototype,"getUserState",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this._callPlusClient.getCurrentCallSession();if(this._callId!==(null==t?void 0:t.getCallId()))return exports.RCCallUserState.NONE;var l=null==t?void 0:t.getUserList().filter((function(t){return t.userId===e}))[0].state;return R(l)}}),Object.defineProperty(t.prototype,"getState",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._callPlusClient.getCurrentCallSession();return function(e){var t=null;switch(e){case s.RCCallPlusCallState.IDLE:t=exports.RCCallSessionState.END;break;case s.RCCallPlusCallState.CALLING:case s.RCCallPlusCallState.INVITED:case s.RCCallPlusCallState.RINGING:case s.RCCallPlusCallState.BUSYLINE_RINGING:case s.RCCallPlusCallState.BUSYLINE_WAIT:t=exports.RCCallSessionState.WAITING;break;case s.RCCallPlusCallState.CONNECTING:case s.RCCallPlusCallState.ONCALL:t=exports.RCCallSessionState.KEEPING;break;case s.RCCallPlusCallState.ENDED:case s.RCCallPlusCallState.NOANSWER:case s.RCCallPlusCallState.MISSED:case s.RCCallPlusCallState.CANCELED:case s.RCCallPlusCallState.DECLINED:case s.RCCallPlusCallState.ERROR:default:t=exports.RCCallSessionState.END}return t}(this._callId===(null==e?void 0:e.getCallId())?null==e?void 0:e.getState():s.RCCallPlusCallState.ENDED)}}),Object.defineProperty(t.prototype,"getCallerId",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._callPlusClient.getCurrentCallSession();return this._callId!==(null==e?void 0:e.getCallId())?"":e.getCreatorUserId()}}),Object.defineProperty(t.prototype,"getMediaType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._mediaType===s.RCCallPlusMediaType.AUDIO?exports.RCCallMediaType.AUDIO:exports.RCCallMediaType.AUDIO_VIDEO}}),t}(a.EventEmitter),S=function(){function e(e,t,l,n){Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:l}),Object.defineProperty(this,"_options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_callPlusClient",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_targetId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_channelId",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_session",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_sessionStartTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_listener",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_mediaType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_audioConfigBuilder",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_videoConfigBuilder",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_callPushConfig",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_hangupPushConfig",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_isSelfHangup",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_reportAppEventModule",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._callPlusClient=n.callPlusClient,this._reportAppEventModule=new I(l),this._setCallPlusEventListener(),this._audioConfigBuilder=this._callPlusClient.createAudioConfigBuilder(),this._videoConfigBuilder=this._callPlusClient.createVideoConfigBuilder()}return Object.defineProperty(e.prototype,"_setCallPlusEventListener",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=0,l={},n={};this._callPlusClient.setCallPlusEventListener({onReceivedCall:function(t,l){return void 0===l&&(l="{}"),_(this,void 0,void 0,(function(){var n,r,o;return C(this,(function(i){return n=t.getCallId(),e._session?(e._callPlusClient.hangup(n,e._hangupPushConfig),[2]):(e._targetId=JSON.parse(l).targetId||"",e._channelId=JSON.parse(l).channelId||"",e._mediaType=t.getMediaType()===s.RCCallPlusMediaType.AUDIO?exports.RCCallMediaType.AUDIO:exports.RCCallMediaType.AUDIO_VIDEO,r=t.getCallType(),o=r===s.RCCallPlusType.MULTI?a.ConversationType.GROUP:a.ConversationType.PRIVATE,e._session=new L(n,e._callPlusClient,e._channelId,e._targetId,o,t.getMediaType(),e._context,e._logger),e._session.on(d.INNER_ON_SELF_HANGUP,(function(){e._isSelfHangup=!0})),e._options.onSession(e._session,JSON.parse(l).callLibExtra||""),[2])}))}))},onRemoteUserInvited:function(t,l,n){var r,o={userId:l},a=t.map((function(e){return{userId:e}}));e._listener?e._reportAppEventModule.onMemberModify(o,a,e._session):null===(r=e._session)||void 0===r||r.emit(d.INNER_ON_MEMBER_MODIFY,o,a,e._session)},onCallConnected:function(e){var t=e.getCallId();n[t]=!0},onCallTypeChanged:function(e,t){},onRemoteUserStateChanged:function(t,n,r,o){var a,i,E;return _(this,void 0,void 0,(function(){var _,R,u,I,O,L,S,N,p;return C(this,(function(C){return _={userId:n},R=[s.RCCallPlusSessionUserState.IDLE,s.RCCallPlusSessionUserState.DECLINED,s.RCCallPlusSessionUserState.MISSED,s.RCCallPlusSessionUserState.NO_ANSWER].includes(r),e._listener?(r===s.RCCallPlusSessionUserState.RINGING&&e._reportAppEventModule.onRinging(_,e._session),r===s.RCCallPlusSessionUserState.CONNECTING&&e._reportAppEventModule.onAccept(_,e._session),R&&e._reportAppEventModule.onHungup(_,c(o,e._isSelfHangup),e._session)):(r===s.RCCallPlusSessionUserState.RINGING&&(null===(a=e._session)||void 0===a||a.emit(d.INNER_ON_RINGING,_,e._session)),r===s.RCCallPlusSessionUserState.CONNECTING&&(null===(i=e._session)||void 0===i||i.emit(d.INNER_ON_ACCEPT,_,e._session)),R&&(null===(E=e._session)||void 0===E||E.emit(d.INNER_ON_HANGUP,_,c(o,e._isSelfHangup),e._session))),u=e._callPlusClient.getCurrentCallSession(),I=null==u?void 0:u.getCallType(),O=null==u?void 0:u.getUserList(),L=null==O?void 0:O.filter((function(t){return t.userId===e._context.getCurrentId()}))[0],S=null==O?void 0:O.filter((function(t){return t.userId!==e._context.getCurrentId()})),N=null==S?void 0:S.every((function(e){return e.state===s.RCCallPlusSessionUserState.IDLE})),p=(null==L?void 0:L.state)===s.RCCallPlusSessionUserState.ONCALL&&N,R&&I===s.RCCallPlusType.MULTI&&p&&(e._callPlusClient.hangup(),l[t]=o===s.RCCallPlusReason.MISSED?s.RCCallPlusReason.NO_ANSWER:o,e._isSelfHangup=!1),[2]}))}))},onCallEnded:function(r,o){return _(this,void 0,void 0,(function(){var a,s,i;return C(this,(function(_){return a=+new Date-t,s=r.getCallId(),i={conversationType:e._session.getConversationType(),channelId:e._session.getChannelId(),targetId:e._session.getTargetId(),mediaType:e._session.getMediaType(),beginTimestamp:e._sessionStartTime,endTimestamp:a,duration:n[s]?Math.ceil((a-e._sessionStartTime)/1e3):0,endReason:l[s]?c(l[s],e._isSelfHangup):c(o,e._isSelfHangup)},e._options.onSessionClose(e._session,i),e._session=null,e._sessionStartTime=0,delete l[s],delete n[s],[2]}))}))},onUserMediaAvailable:function(t,l){var n;return _(this,void 0,void 0,(function(){var r;return C(this,(function(o){return r=l===s.RCCallPlusMediaType.AUDIO?exports.RCCallMediaType.AUDIO:exports.RCCallMediaType.AUDIO_VIDEO,e._listener?e._reportAppEventModule.onTrackReady(t,r,e._session):null===(n=e._session)||void 0===n||n.emit(d.INNER_ON_TRACK_READY,t,r,e._session),[2]}))}))},onFetchRemoteMediaError:function(t,l){var n,r,o;e._listener?null===(r=(n=e._reportAppEventModule).onTrackSubscribeFail)||void 0===r||r.call(n,l,e._session):null===(o=e._session)||void 0===o||o.emit(d.INNER_ON_TRACK_SUBSCRIBE_FAIL,l,e._session)},onRemoteCameraStateChanged:function(t,l,n){var r,o={userId:l,muted:n,kind:""};e._listener?e._reportAppEventModule.onVideoMuteChange(o,e._session):null===(r=e._session)||void 0===r||r.emit(d.INNER_ON_VIDEO_MUTE_CHANGE,o,e._session)},onRemoteMicrophoneStateChanged:function(t,l,n){var r,o={userId:l,muted:n,kind:""};e._listener?e._reportAppEventModule.onAudioMuteChange(o,e._session):null===(r=e._session)||void 0===r||r.emit(d.INNER_ON_AUDIO_MUTE_CHANGE,o,e._session)},onReceivedCallRecord:function(e){},onReceivedChangeMediaTypeRequest:function(t,l,n){e._callPlusClient.replyChangeMediaType(l,!0)},onReceivedChangeMediaTypeResult:function(t){var l;if(e._mediaType===exports.RCCallMediaType.AUDIO_VIDEO&&t.mediaType===s.RCCallPlusMediaType.AUDIO_VIDEO&&t.code===s.RCCallPlusMediaTypeChangeResult.SERVER_ALLOW_MEDIA_TYPE){var n={userId:t.userId};e._mediaType=exports.RCCallMediaType.AUDIO,e._listener?e._reportAppEventModule.onMediaModify(n,e._mediaType,e._session):null===(l=e._session)||void 0===l||l.emit(d.INNER_ON_MEDIA_MODIFY,n,e._mediaType,e._session,t.transactionId)}},onReceivedCallStartTime:function(l){e._sessionStartTime=l.callStartTime,t=+new Date-l.callStartTime},onReceivedCallFirstFrameTime:function(e,t){},onUserAudioLevelChanged:function(e,t){}})}}),Object.defineProperty(e.prototype,"registerUserInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.warn(E.L_CALL_CLIENT_REGISTER_USER_INFO_O,"`RCCallClient.registerUserInfo` has been deprecated, use `https://doc.rongcloud.cn/imserver/server/v1/user/register` instead.")}}),Object.defineProperty(e.prototype,"startCrossCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e){e.targetId;var t=e.mediaType;return void 0===t&&exports.RCCallMediaType.AUDIO,e.listener,e.constraints,e.channelId,e.extra,e.bitrate,_(this,void 0,void 0,(function(){return C(this,(function(e){return this._logger.warn(E.L_CALL_CLIENT_START_CROSS_CALL_O,"`RCCallClient.startCrossCall` has been deprecated"),[2]}))}))}}),Object.defineProperty(e.prototype,"__startCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var l=t.targetId,n=t.userIds,r=t.mediaType,o=void 0===r?exports.RCCallMediaType.AUDIO:r,i=t.listener,R=t.constraints,c=t.channelId,I=void 0===c?"":c,O=t.extra,S=void 0===O?"":O,N=t.bitrate;return _(this,void 0,void 0,(function(){var t,r,_,c,O,p,T,A,f,g,b,P,h,v,D=this;return C(this,(function(C){switch(C.label){case 0:return t=this._logger.createTraceId(),this._logger.info(E.L_CALL_CLIENT_CALL_T,JSON.stringify({targetId:l,userIds:n,mediaType:o,listener:Object.keys(i),constraints:R,channelId:I,extra:S,bitrate:N}),t),R&&(r=R.audio,_=R.video,(null==r?void 0:r.micphoneId)&&this._audioConfigBuilder.setDefaultMicrophoneId(r.micphoneId),(null==r?void 0:r.sampleRate)&&this._audioConfigBuilder.setSampleRate(r.sampleRate),(null==_?void 0:_.cameraId)&&this._videoConfigBuilder.setDefaultCameraId(_.cameraId),(null==_?void 0:_.frameRate)&&this._videoConfigBuilder.setFrameRate(_.frameRate),(null==_?void 0:_.resolution)&&this._videoConfigBuilder.setVideoResolution(_.resolution)),N&&(r=N.audio,_=N.video,r&&this._audioConfigBuilder.setBitrate(r,r),_&&this._videoConfigBuilder.setBitrate(_.min,_.max)),c=this._audioConfigBuilder.build(),O=this._videoConfigBuilder.build(),this._callPlusClient.setAudioConfig(c),this._callPlusClient.setVideoConfig(O),this._targetId=l,this._listener=i,this._reportAppEventModule.registerEventListener(i),this._mediaType=o,p=o===exports.RCCallMediaType.AUDIO?s.RCCallPlusMediaType.AUDIO:s.RCCallPlusMediaType.AUDIO_VIDEO,T=e?s.RCCallPlusType.SINGLE:s.RCCallPlusType.MULTI,A=e?[l]:n,f=e?this._context.getCurrentId():l,g=JSON.stringify({callLibExtra:S,channelId:I,targetId:f}),[4,this._callPlusClient.startCall(A,T,p,this._callPushConfig,g)];case 1:return b=C.sent(),P=b.code,h=b.callId,P!==s.RCCallPlusCode.SUCCESS?(this._logger.error(E.L_CALL_CLIENT_CALL_R,"errorCode: ".concat(u(P)),t),[2,{code:u(P)}]):(this._logger.info(E.L_CALL_CLIENT_CALL_R,"success",t),v=e?a.ConversationType.PRIVATE:a.ConversationType.GROUP,this._session=new L(h,this._callPlusClient,this._channelId,this._targetId,v,p,this._context,this._logger,{callPushConfig:this._callPushConfig,hangupPushConfig:this._hangupPushConfig}),this._session.on(d.INNER_ON_SELF_HANGUP,(function(){D._isSelfHangup=!0})),[2,{code:exports.RCCallErrorCode.SUCCESS,session:this._session}])}}))}))}}),Object.defineProperty(e.prototype,"call",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.targetId,l=e.mediaType,n=void 0===l?exports.RCCallMediaType.AUDIO:l,r=e.listener,o=e.constraints,a=e.channelId,s=void 0===a?"":a,i=e.extra,E=void 0===i?"":i,R=e.bitrate;return _(this,void 0,void 0,(function(){return C(this,(function(e){return[2,this.__startCall(!0,{targetId:t,userIds:[],mediaType:n,listener:r,constraints:o,channelId:s,extra:E,bitrate:R})]}))}))}}),Object.defineProperty(e.prototype,"callInGroup",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.targetId,l=e.userIds,n=e.mediaType,r=void 0===n?exports.RCCallMediaType.AUDIO:n,o=e.listener,a=e.constraints,s=e.channelId,i=void 0===s?"":s,E=e.extra,R=void 0===E?"":E,u=e.bitrate;return _(this,void 0,void 0,(function(){return C(this,(function(e){return[2,this.__startCall(!1,{targetId:t,userIds:l,mediaType:r,listener:o,constraints:a,channelId:i,extra:R,bitrate:u})]}))}))}}),Object.defineProperty(e.prototype,"getJoinedRoomInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(){return _(this,void 0,void 0,(function(){var e,t,l;return C(this,(function(n){switch(n.label){case 0:return[4,this._context.getRTCJoinedUserInfo(this._context.getCurrentId())];case 1:return e=n.sent(),t=e.code,l=e.data,t!==a.ErrorCode.SUCCESS?(this._logger.error(E.L_CALL_CLIENT_GET_JOINED_ROOM_INFO_E,t),[2,{code:exports.RCCallErrorCode.QUERY_JOINED_USER_INFO_ERROR}]):[2,{code:exports.RCCallErrorCode.SUCCESS,data:l}]}}))}))}}),Object.defineProperty(e.prototype,"setPushConfig",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===e&&(e={}),void 0===t&&(t={}),this._logger.info(E.L_CALL_CLIENT_SET_PUSH_CONFIG_O,JSON.stringify({callPushConfig:e,hangupPushConfig:t})),this._callPushConfig=e,this._hangupPushConfig=t,delete this._callPushConfig.pushContent,delete this._hangupPushConfig.pushContent}}),e}();exports.RCCallLanguage=void 0,(O=exports.RCCallLanguage||(exports.RCCallLanguage={})).ZH="zh",O.EN="en";var N={tag:"CallPlusWrapper",verify:function(e){return"browser"===e.tag},setup:function(e,t,l){var n=e.createLogger("CallPlusWrapper","RTC"),r=a.isUndefined(l.logOutputLevel)?a.LogL.WARN:l.logOutputLevel;return n.setOutputLevel(r),n.warn(E.L_CALL_PLUS_WRAPPER_INIT_O,"CallPlus Version: ".concat("2.1.2",", Commit: ").concat("d95e6815e07ae1c83b40409e2738c123b376f493")),new S(e,t,n,l)}};exports.RCCallClient=S,exports.RCCallSession=L,exports.installer=N;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t,l,n,r,o,a=require("@rongcloud/engine"),s=require("@rongcloud/plugin-call-plus"),i=function(e,t){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var l in t)Object.prototype.hasOwnProperty.call(t,l)&&(e[l]=t[l])},i(e,t)};function _(e,t,l,n){return new(l||(l=Promise))((function(r,o){function a(e){try{i(n.next(e))}catch(e){o(e)}}function s(e){try{i(n.throw(e))}catch(e){o(e)}}function i(e){var t;e.done?r(e.value):(t=e.value,t instanceof l?t:new l((function(e){e(t)}))).then(a,s)}i((n=n.apply(e,t||[])).next())}))}function C(e,t){var l,n,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(i){return function(s){if(l)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(l=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(r=a.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){a.label=s[1];break}if(6===s[0]&&a.label<r[1]){a.label=r[1],r=s;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(s);break}r[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{l=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,i])}}}function E(e,t){var l="function"==typeof Symbol&&e[Symbol.iterator];if(!l)return e;var n,r,o=l.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){r={error:e}}finally{try{n&&!n.done&&(l=o.return)&&l.call(o)}finally{if(r)throw r.error}}return a}function R(e,t,l){if(l||2===arguments.length)for(var n,r=0,o=t.length;r<o;r++)!n&&r in t||(n||(n=Array.prototype.slice.call(t,0,r)),n[r]=t[r]);return e.concat(n||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError,exports.RCCallMediaType=void 0,(e=exports.RCCallMediaType||(exports.RCCallMediaType={}))[e.AUDIO=1]="AUDIO",e[e.AUDIO_VIDEO=2]="AUDIO_VIDEO",exports.RCCallErrorCode=void 0,(t=exports.RCCallErrorCode||(exports.RCCallErrorCode={}))[t.SUCCESS=1e4]="SUCCESS",t[t.STATE_MACHINE_EXIT=53200]="STATE_MACHINE_EXIT",t[t.SEND_MSG_ERROR=53201]="SEND_MSG_ERROR",t[t.REJECTED_BY_BLACKLIST=53202]="REJECTED_BY_BLACKLIST",t[t.NOT_IN_GROUP=53203]="NOT_IN_GROUP",t[t.GET_LOCAL_AUDIO_TRACK_ERROR=53301]="GET_LOCAL_AUDIO_TRACK_ERROR",t[t.GET_LOCAL_VIDEO_TRACK_ERROR=53302]="GET_LOCAL_VIDEO_TRACK_ERROR",t[t.GET_LOCAL_AUDIO_AND_VIDEO_TRACK_ERROR=53303]="GET_LOCAL_AUDIO_AND_VIDEO_TRACK_ERROR",t[t.JOIN_ROOM_ERROR=53304]="JOIN_ROOM_ERROR",t[t.AUDIO_PUBLISH_ERROR=53305]="AUDIO_PUBLISH_ERROR",t[t.VIDEO_PUBLISH_ERROR=53306]="VIDEO_PUBLISH_ERROR",t[t.AUDIO_AND_VIDEO_PUBLISH_ERROR=53307]="AUDIO_AND_VIDEO_PUBLISH_ERROR",t[t.QUERY_JOINED_USER_INFO_ERROR=53308]="QUERY_JOINED_USER_INFO_ERROR",t[t.MISSING_VIDEO_TRACK_ERROR=53309]="MISSING_VIDEO_TRACK_ERROR",t[t.UNPUBLISH_VIDEO_ERROR=53310]="UNPUBLISH_VIDEO_ERROR",t[t.CONVERSATION_NOT_GROUP_ERROR=53311]="CONVERSATION_NOT_GROUP_ERROR",t[t.NOT_IN_ROOM_ERROR=53312]="NOT_IN_ROOM_ERROR",t[t.PARAM_ERROR=53313]="PARAM_ERROR",t[t.NOT_IN_CALL=53314]="NOT_IN_CALL",t[t.MEDIATYPE_INVALID=53315]="MEDIATYPE_INVALID",t[t.NOT_VIDEO_CALL=53316]="NOT_VIDEO_CALL",t[t.RTC_SERVICE_UNAVAILABLE=53317]="RTC_SERVICE_UNAVAILABLE",t[t.USER_LIST_INVAILD=53318]="USER_LIST_INVAILD",t[t.CALL_ID_INVALID=53319]="CALL_ID_INVALID",t[t.TRANSACTION_ID_INVALID=53320]="TRANSACTION_ID_INVALID",t[t.USER_ID_INVALID=53321]="USER_ID_INVALID",t[t.SINGLE_CALL_NOT_SUPPORT_MULTI_PERSON=53322]="SINGLE_CALL_NOT_SUPPORT_MULTI_PERSON",t[t.MICROPHONE_CLOSED=53323]="MICROPHONE_CLOSED",t[t.MEDIA_RESOURCE_INVALIED=53324]="MEDIA_RESOURCE_INVALIED",t[t.NOT_INSTALL_RTC_PLUGIN=53325]="NOT_INSTALL_RTC_PLUGIN",t[t.PLAY_MEDIA_FAILED=53326]="PLAY_MEDIA_FAILED",t[t.VIDEO_VIEW_NOT_SET=53327]="VIDEO_VIEW_NOT_SET",exports.RCCallUserState=void 0,(l=exports.RCCallUserState||(exports.RCCallUserState={}))[l.NONE=0]="NONE",l[l.WAITING=1]="WAITING",l[l.KEEPING=2]="KEEPING",exports.RCCallSessionState=void 0,(n=exports.RCCallSessionState||(exports.RCCallSessionState={}))[n.WAITING=0]="WAITING",n[n.KEEPING=1]="KEEPING",n[n.END=2]="END",exports.RCCallEndReason=void 0,(o=exports.RCCallEndReason||(exports.RCCallEndReason={}))[o.CANCEL=1]="CANCEL",o[o.REJECT=2]="REJECT",o[o.HANGUP=3]="HANGUP",o[o.BUSY_LINE=4]="BUSY_LINE",o[o.NO_RESPONSE=5]="NO_RESPONSE",o[o.ENGINE_UNSUPPORTED=6]="ENGINE_UNSUPPORTED",o[o.NETWORK_ERROR=7]="NETWORK_ERROR",o[o.GET_MEDIA_RESOURCES_ERROR=8]="GET_MEDIA_RESOURCES_ERROR",o[o.PUBLISH_ERROR=9]="PUBLISH_ERROR",o[o.SUBSCRIBE_ERROR=10]="SUBSCRIBE_ERROR",o[o.REMOTE_CANCEL=11]="REMOTE_CANCEL",o[o.REMOTE_REJECT=12]="REMOTE_REJECT",o[o.REMOTE_HANGUP=13]="REMOTE_HANGUP",o[o.REMOTE_BUSY_LINE=14]="REMOTE_BUSY_LINE",o[o.REMOTE_NO_RESPONSE=15]="REMOTE_NO_RESPONSE",o[o.REMOTE_ENGINE_UNSUPPORTED=16]="REMOTE_ENGINE_UNSUPPORTED",o[o.REMOTE_NETWORK_ERROR=17]="REMOTE_NETWORK_ERROR",o[o.REMOTE_GET_MEDIA_RESOURCE_ERROR=18]="REMOTE_GET_MEDIA_RESOURCE_ERROR",o[o.REMOTE_PUBLISH_ERROR=19]="REMOTE_PUBLISH_ERROR",o[o.REMOTE_SUBSCRIBE_ERROR=20]="REMOTE_SUBSCRIBE_ERROR",o[o.OTHER_CLIENT_JOINED_CALL=21]="OTHER_CLIENT_JOINED_CALL",o[o.OTHER_CLIENT_IN_CALL=22]="OTHER_CLIENT_IN_CALL",o[o.KICKED_BY_SERVER=23]="KICKED_BY_SERVER",o[o.ACCEPT_SYSTEM_CALL=24]="ACCEPT_SYSTEM_CALL",o[o.REMOTE_OTHER_CLIENT_JOINED_CALL=31]="REMOTE_OTHER_CLIENT_JOINED_CALL",o[o.REMOTE_OTHER_CLIENT_IN_CALL=32]="REMOTE_OTHER_CLIENT_IN_CALL",o[o.REMOTE_KICKED_BY_SERVER=33]="REMOTE_KICKED_BY_SERVER",o[o.REMOTE_ACCEPT_SYSTEM_CALL=34]="REMOTE_ACCEPT_SYSTEM_CALL",o[o.ACCEPT_BY_OTHER_CLIENT=101]="ACCEPT_BY_OTHER_CLIENT",o[o.HANGUP_BY_OTHER_CLIENT=102]="HANGUP_BY_OTHER_CLIENT",o[o.ADDED_TO_BLACKLIST=103]="ADDED_TO_BLACKLIST",o[o.SERVICE_NOT_OPENED=104]="SERVICE_NOT_OPENED",(r={})[exports.RCCallEndReason.CANCEL]=exports.RCCallEndReason.REMOTE_CANCEL,r[exports.RCCallEndReason.REJECT]=exports.RCCallEndReason.REMOTE_REJECT,r[exports.RCCallEndReason.HANGUP]=exports.RCCallEndReason.REMOTE_HANGUP,r[exports.RCCallEndReason.BUSY_LINE]=exports.RCCallEndReason.REMOTE_BUSY_LINE,r[exports.RCCallEndReason.NO_RESPONSE]=exports.RCCallEndReason.REMOTE_NO_RESPONSE,r[exports.RCCallEndReason.ENGINE_UNSUPPORTED]=exports.RCCallEndReason.REMOTE_ENGINE_UNSUPPORTED,r[exports.RCCallEndReason.NETWORK_ERROR]=exports.RCCallEndReason.REMOTE_NETWORK_ERROR,r[exports.RCCallEndReason.GET_MEDIA_RESOURCES_ERROR]=exports.RCCallEndReason.REMOTE_GET_MEDIA_RESOURCE_ERROR,r[exports.RCCallEndReason.PUBLISH_ERROR]=exports.RCCallEndReason.REMOTE_PUBLISH_ERROR,r[exports.RCCallEndReason.SUBSCRIBE_ERROR]=exports.RCCallEndReason.REMOTE_SUBSCRIBE_ERROR,r[exports.RCCallEndReason.OTHER_CLIENT_JOINED_CALL]=exports.RCCallEndReason.REMOTE_OTHER_CLIENT_JOINED_CALL,r[exports.RCCallEndReason.OTHER_CLIENT_IN_CALL]=exports.RCCallEndReason.REMOTE_OTHER_CLIENT_IN_CALL,r[exports.RCCallEndReason.KICKED_BY_SERVER]=exports.RCCallEndReason.REMOTE_KICKED_BY_SERVER,r[exports.RCCallEndReason.REMOTE_NO_RESPONSE]=exports.RCCallEndReason.NO_RESPONSE,r[exports.RCCallEndReason.ACCEPT_SYSTEM_CALL]=exports.RCCallEndReason.REMOTE_ACCEPT_SYSTEM_CALL;var u,c=function(e){var t=null;switch(e){case s.RCCallPlusSessionUserState.IDLE:t=exports.RCCallUserState.NONE;break;case s.RCCallPlusSessionUserState.CALLING:case s.RCCallPlusSessionUserState.INVITED:case s.RCCallPlusSessionUserState.RINGING:t=exports.RCCallUserState.WAITING;break;case s.RCCallPlusSessionUserState.BUSYLINE_RINGING:case s.RCCallPlusSessionUserState.BUSYLINE_WAIT:t=exports.RCCallUserState.NONE;break;case s.RCCallPlusSessionUserState.CONNECTING:t=exports.RCCallUserState.WAITING;break;case s.RCCallPlusSessionUserState.ONCALL:t=exports.RCCallUserState.KEEPING;break;case s.RCCallPlusSessionUserState.ONPHONE:t=exports.RCCallUserState.WAITING;break;case s.RCCallPlusSessionUserState.ENDED:case s.RCCallPlusSessionUserState.NO_ANSWER:case s.RCCallPlusSessionUserState.MISSED:case s.RCCallPlusSessionUserState.CANCELLED:case s.RCCallPlusSessionUserState.DECLINED:case s.RCCallPlusSessionUserState.ERROR:default:t=exports.RCCallUserState.NONE}return t},d=function(e){var t=null;switch(e){case s.RCCallPlusCode.SUCCESS:t=exports.RCCallErrorCode.SUCCESS;break;case s.RCCallPlusCode.PARAM_ERROR:t=exports.RCCallErrorCode.PARAM_ERROR;break;case s.RCCallPlusCode.SESSION_EXIST:t=exports.RCCallErrorCode.STATE_MACHINE_EXIT;break;case s.RCCallPlusCode.NOT_IN_CALL:t=exports.RCCallErrorCode.NOT_IN_CALL;break;case s.RCCallPlusCode.MEDIATYPE_INVALID:t=exports.RCCallErrorCode.MEDIATYPE_INVALID;break;case s.RCCallPlusCode.NOT_VIDEO_CALL:t=exports.RCCallErrorCode.NOT_VIDEO_CALL;break;case s.RCCallPlusCode.RTC_SERVICE_UNAVAILABLE:t=exports.RCCallErrorCode.RTC_SERVICE_UNAVAILABLE;break;case s.RCCallPlusCode.USER_LIST_INVAILD:t=exports.RCCallErrorCode.USER_LIST_INVAILD;break;case s.RCCallPlusCode.CALL_ID_INVALID:t=exports.RCCallErrorCode.CALL_ID_INVALID;break;case s.RCCallPlusCode.TRANSACTION_ID_INVALID:t=exports.RCCallErrorCode.TRANSACTION_ID_INVALID;break;case s.RCCallPlusCode.USER_ID_INVALID:t=exports.RCCallErrorCode.USER_ID_INVALID;break;case s.RCCallPlusCode.SINGLE_CALL_NOT_SUPPORT_MULTI_PERSON:t=exports.RCCallErrorCode.SINGLE_CALL_NOT_SUPPORT_MULTI_PERSON;break;case s.RCCallPlusCode.CAMERA_CLOSED:t=exports.RCCallErrorCode.MISSING_VIDEO_TRACK_ERROR;break;case s.RCCallPlusCode.MICROPHONE_CLOSED:t=exports.RCCallErrorCode.MICROPHONE_CLOSED;break;case s.RCCallPlusCode.MEDIA_RESOURCE_INVALIED:t=exports.RCCallErrorCode.MEDIA_RESOURCE_INVALIED;break;case s.RCCallPlusCode.NOT_INSTALL_RTC_PLUGIN:t=exports.RCCallErrorCode.NOT_INSTALL_RTC_PLUGIN;break;case s.RCCallPlusCode.PLAY_MEDIA_FAILED:t=exports.RCCallErrorCode.PLAY_MEDIA_FAILED;break;case s.RCCallPlusCode.VIDEO_VIEW_NOT_SET:t=exports.RCCallErrorCode.VIDEO_VIEW_NOT_SET;break;default:t=e}return t},I=function(e,t){var l=null;switch(e){case s.RCCallPlusReason.BUSYLINE_RINGING:l=t?exports.RCCallEndReason.BUSY_LINE:exports.RCCallEndReason.REMOTE_BUSY_LINE;break;case s.RCCallPlusReason.ON_DEVICE_DISABLE:l=exports.RCCallEndReason.REMOTE_GET_MEDIA_RESOURCE_ERROR;break;case s.RCCallPlusReason.ENDED:l=t?exports.RCCallEndReason.HANGUP:exports.RCCallEndReason.REMOTE_HANGUP;break;case s.RCCallPlusReason.NO_ANSWER:l=exports.RCCallEndReason.REMOTE_NO_RESPONSE;break;case s.RCCallPlusReason.MISSED:l=exports.RCCallEndReason.NO_RESPONSE;break;case s.RCCallPlusReason.CANCELLED:l=t?exports.RCCallEndReason.CANCEL:exports.RCCallEndReason.REMOTE_CANCEL;break;case s.RCCallPlusReason.DECLINED:l=t?exports.RCCallEndReason.REJECT:exports.RCCallEndReason.REMOTE_REJECT;break;case s.RCCallPlusReason.OTHER_CLIENT_ACCEPT:l=exports.RCCallEndReason.ACCEPT_BY_OTHER_CLIENT;break;case s.RCCallPlusReason.PUBLISH_ERR:l=exports.RCCallEndReason.PUBLISH_ERROR;break;case s.RCCallPlusReason.SUBSCRIBE_ERR:l=exports.RCCallEndReason.SUBSCRIBE_ERROR;break;case s.RCCallPlusReason.ACCEPT_CARRIER:l=t?exports.RCCallEndReason.ACCEPT_SYSTEM_CALL:exports.RCCallEndReason.REMOTE_ACCEPT_SYSTEM_CALL;break;case s.RCCallPlusReason.KICKED_BY_SERVER:l=exports.RCCallEndReason.KICKED_BY_SERVER;break;case s.RCCallPlusReason.CONNECTION_ERR:l=exports.RCCallEndReason.NETWORK_ERROR;break;case s.RCCallPlusReason.OTHER_CLIENT_JOINED:l=t?exports.RCCallEndReason.OTHER_CLIENT_JOINED_CALL:exports.RCCallEndReason.REMOTE_OTHER_CLIENT_JOINED_CALL;break;case s.RCCallPlusReason.OTHER_CLIENT_IN_ROOM:l=exports.RCCallEndReason.OTHER_CLIENT_IN_CALL;break;case s.RCCallPlusReason.OTHER_CLIENT_HANGUP:l=exports.RCCallEndReason.HANGUP_BY_OTHER_CLIENT;break;case s.RCCallPlusReason.REMOTE_PUBLISH_ERROR:l=exports.RCCallEndReason.REMOTE_PUBLISH_ERROR;break;case s.RCCallPlusReason.REMOTE_SUBSCRIBE_ERROR:l=exports.RCCallEndReason.REMOTE_SUBSCRIBE_ERROR;break;case s.RCCallPlusReason.REMOTE_KICKED_BY_SERVER:l=exports.RCCallEndReason.REMOTE_KICKED_BY_SERVER;break;case s.RCCallPlusReason.REMOTE_CONNECTION_ERROR:l=exports.RCCallEndReason.REMOTE_NETWORK_ERROR;break;case s.RCCallPlusReason.ABNORMAL_END:l=t?exports.RCCallEndReason.NETWORK_ERROR:exports.RCCallEndReason.REMOTE_NETWORK_ERROR;break;case s.RCCallPlusReason.OTHER_CLIENT_CALLING:l=exports.RCCallEndReason.REMOTE_OTHER_CLIENT_JOINED_CALL;break;case s.RCCallPlusReason.JOIN_ROOM_ERR:l=exports.RCCallEndReason.NETWORK_ERROR;break;case s.RCCallPlusReason.LOGOUT:l=exports.RCCallEndReason.HANGUP;break;case s.RCCallPlusReason.OTHER_CLIENT_LOGIN:l=exports.RCCallEndReason.NETWORK_ERROR;break;case s.RCCallPlusReason.REMOTE_JOIN_RTC_ERROR:l=exports.RCCallEndReason.REMOTE_NETWORK_ERROR;break;case s.RCCallPlusReason.REMOTE_LOGOUT:l=exports.RCCallEndReason.REMOTE_HANGUP;break;case s.RCCallPlusReason.REMOTE_OTHER_CLIENT_LOGIN:l=exports.RCCallEndReason.REMOTE_NETWORK_ERROR;break;case s.RCCallPlusReason.REMOTE_OTHER_JOINED_RTC:l=exports.RCCallEndReason.REMOTE_OTHER_CLIENT_JOINED_CALL;break;case s.RCCallPlusReason.REMOTE_OTHER_CLIENT_IN_RTC:l=exports.RCCallEndReason.REMOTE_OTHER_CLIENT_IN_CALL;break;default:l=exports.RCCallEndReason.NETWORK_ERROR}return l};!function(e){e.L_CALL_PLUS_WRAPPER_INIT_O="L-call_plus_wrapper_init-O",e.L_CALL_CLIENT_REGISTER_USER_INFO_O="L-call_client_register_user_info-O",e.L_CALL_CLIENT_START_CROSS_CALL_O="L-call_client_start_cross_call-O",e.L_CALL_CLIENT_CALL_T="L-call_client_call-T",e.L_CALL_CLIENT_CALL_R="L-call_client_call-R",e.L_CALL_CLIENT_CALL_IN_GROUP_T="L-call_client_call_in_group-T",e.L_CALL_CLIENT_CALL_IN_GROUP_R="L-call_client_call_in_group-R",e.L_CALL_CLIENT_SET_PUSH_CONFIG_O="L-call_client_set_push_config-O",e.L_CALL_SESSION_REGISTER_SESSION_LISTENER_O="L-call_session_register_session_listener-O",e.L_CALL_SESSION_CHANGE_AUDIO_DEVICE_T="L-call_session_change_audio_device-T",e.L_CALL_SESSION_CHANGE_AUDIO_DEVICE_R="L-call_session_change_audio_device-R",e.L_CALL_SESSION_INVITE_T="L-call_session_invite-T",e.L_CALL_SESSION_INVITE_R="L-call_session_invite-R",e.L_CALL_SESSION_ACCEPT_T="L-call_session_accept-T",e.L_CALL_SESSION_ACCEPT_R="L-call_session_accept-R",e.L_CALL_SESSION_HUNGUP_T="L-call_session_hungup-T",e.L_CALL_SESSION_HUNGUP_R="L-call_session_hungup-R",e.L_CALL_SESSION_DESCEND_ABILITY_T="L-call_session_descend_ability-T",e.L_CALL_SESSION_DESCEND_ABILITY_P="L-call_session_descend_ability-P",e.L_CALL_SESSION_DESCEND_ABILITY_R="L-call_session_descend_ability-R",e.L_CALL_SESSION_DISABLE_VIDEO_TRACK_T="L-call_session_disable_video_track-T",e.L_CALL_SESSION_DISABLE_VIDEO_TRACK_R="L-call_session_disable_video_track-R",e.L_CALL_SESSION_ENABLE_VIDEO_TRACK_T="L-call_session_enable_video_track-T",e.L_CALL_SESSION_ENABLE_VIDEO_TRACK_R="L-call_session_enable_video_track-R",e.L_CALL_SESSION_DISABLE_AUDIO_TRACK_T="L-call_session_disable_audio_track-T",e.L_CALL_SESSION_DISABLE_AUDIO_TRACK_R="L-call_session_disable_audio_track-R",e.L_CALL_SESSION_ENABLE_AUDIO_TRACK_T="L-call_session_enable_audio_track-T",e.L_CALL_SESSION_ENABLE_AUDIO_TRACK_R="L-call_session_enable_audio_track-R",e.L_CALL_EXECUTE_EVENT_LISTENER_O="L-call_execute_event_listener-O",e.L_CALL_CLIENT_GET_JOINED_ROOM_INFO_E="L-call_client_get_joined_room_info-E"}(u||(u={}));var O,L=function(){function e(e){Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_listener",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}return Object.defineProperty(e.prototype,"registerEventListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._listener=e}}),Object.defineProperty(e.prototype,"_callAppListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,l=[],n=1;n<arguments.length;n++)l[n-1]=arguments[n];return _(this,void 0,void 0,(function(){var n,r;return C(this,(function(o){switch(o.label){case 0:if(!(n=null===(t=this._listener)||void 0===t?void 0:t[e]))return[2];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,n.apply(void 0,R([],E(l),!1))];case 2:return o.sent(),[3,4];case 3:return r=o.sent(),this._logger.error(u.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventName:e,name:r.name,message:r.message})),[3,4];case 4:return[2]}}))}))}}),Object.defineProperty(e.prototype,"onRinging",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.info(u.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onRinging",sender:e,sessionId:t.getSessionId()})),this._callAppListener("onRinging",e,t)}}),Object.defineProperty(e.prototype,"onAccept",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.info(u.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onAccept",sender:e,sessionId:t.getSessionId()})),this._callAppListener("onAccept",e,t)}}),Object.defineProperty(e.prototype,"onHungup",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,l){this._logger.info(u.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onHungup",sender:e,reason:t,sessionId:l.getSessionId()})),this._callAppListener("onHungup",e,t,l)}}),Object.defineProperty(e.prototype,"onMemberModify",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,l){this._logger.info(u.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onMemberModify",sender:e,invitedUsers:t,sessionId:l.getSessionId()})),this._callAppListener("onMemberModify",e,t,l)}}),Object.defineProperty(e.prototype,"onMediaModify",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,l){this._logger.info(u.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onMediaModify",sender:e,mediaType:t,sessionId:l.getSessionId()})),this._callAppListener("onMediaModify",e,t,l)}}),Object.defineProperty(e.prototype,"onTrackReady",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,l){this._logger.info(u.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onTrackReady",userId:e,mediaType:t,sessionId:null==l?void 0:l.getSessionId()})),this._callAppListener("onTrackReady",e,t,l)}}),Object.defineProperty(e.prototype,"onAudioMuteChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.info(u.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onAudioMuteChange",muteUser:e,sessionId:t.getSessionId()})),this._callAppListener("onAudioMuteChange",e,t)}}),Object.defineProperty(e.prototype,"onVideoMuteChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.info(u.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onVideoMuteChange",muteUser:e,sessionId:t.getSessionId()})),this._callAppListener("onVideoMuteChange",e,t)}}),Object.defineProperty(e.prototype,"onTrackSubscribeFail",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.info(u.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onTrackSubscribeFail",code:e,sessionId:t.getSessionId()})),this._callAppListener("onTrackSubscribeFail",e,t)}}),Object.defineProperty(e.prototype,"onSendPacketLoss",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.debug(u.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onSendPacketLoss",packetLostRate:e,delay:t})),this._callAppListener("onSendPacketLoss",e,t)}}),Object.defineProperty(e.prototype,"onReceivePacketLoss",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(u.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onReceivePacketLoss",data:e})),this._callAppListener("onReceivePacketLoss",e)}}),e}();!function(e){e.INNER_ON_RINGING="inner-on-ringing",e.INNER_ON_ACCEPT="inner-on-accept",e.INNER_ON_HANGUP="inner-on-hangup",e.INNER_ON_TRACK_READY="inner-on-track-ready",e.INNER_ON_MEMBER_MODIFY="inner-on-member-modify",e.INNER_ON_MEDIA_MODIFY="inner-on-media-modify",e.INNER_ON_AUDIO_MUTE_CHANGE="inner-on-audio-mute-change",e.INNER_ON_VIDEO_MUTE_CHANGE="inner-on-video-mute-change",e.INNER_ON_TRACK_SUBSCRIBE_FAIL="inner-on-track-subscribe-fail",e.INNER_ON_SELF_HANGUP="inner-on-self-hangup"}(O||(O={}));var S,N=function(e){function t(t,l,n,r,o,a,s,i,_){var C=e.call(this)||this;return Object.defineProperty(C,"_callId",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(C,"_callPlusClient",{enumerable:!0,configurable:!0,writable:!0,value:l}),Object.defineProperty(C,"_channelId",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(C,"_targetId",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(C,"_callType",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(C,"_mediaType",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(C,"_context",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(C,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(C,"_options",{enumerable:!0,configurable:!0,writable:!0,value:_}),Object.defineProperty(C,"_descendResolve",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(C,"_audioConfigBuilder",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(C,"_videoConfigBuilder",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(C,"_reportAppEventModule",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),C._audioConfigBuilder=C._callPlusClient.createAudioConfigBuilder(),C._videoConfigBuilder=C._callPlusClient.createVideoConfigBuilder(),C._reportAppEventModule=new L(i),C}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function l(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(l.prototype=t.prototype,new l)}(t,e),Object.defineProperty(t.prototype,"registerSessionListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this._logger.info(u.L_CALL_SESSION_REGISTER_SESSION_LISTENER_O,Object.keys(e).join(",")),this._reportAppEventModule.registerEventListener(e),this.on(O.INNER_ON_RINGING,(function(e,l){t._reportAppEventModule.onRinging(e,l)})),this.on(O.INNER_ON_ACCEPT,(function(e,l){t._reportAppEventModule.onAccept(e,l)})),this.on(O.INNER_ON_HANGUP,(function(e,l,n){t._reportAppEventModule.onHungup(e,l,n)})),this.on(O.INNER_ON_TRACK_READY,(function(e,l,n){t._reportAppEventModule.onTrackReady(e,l,n)})),this.on(O.INNER_ON_MEMBER_MODIFY,(function(e,l,n){t._reportAppEventModule.onMemberModify(e,l,n)})),this.on(O.INNER_ON_MEDIA_MODIFY,(function(e,l,n,r){var o,a;t._descendResolve[r]?(t._logger.info(u.L_CALL_SESSION_DESCEND_ABILITY_R,"success, transactionId: ".concat(r)),null===(a=(o=t._descendResolve)[r])||void 0===a||a.call(o,{code:exports.RCCallErrorCode.SUCCESS}),delete t._descendResolve[r]):t._reportAppEventModule.onMediaModify(e,l,n)})),this.on(O.INNER_ON_AUDIO_MUTE_CHANGE,(function(e,l){t._reportAppEventModule.onAudioMuteChange(e,l)})),this.on(O.INNER_ON_VIDEO_MUTE_CHANGE,(function(e,l){t._reportAppEventModule.onVideoMuteChange(e,l)})),this.on(O.INNER_ON_TRACK_SUBSCRIBE_FAIL,(function(e,l){var n,r;null===(r=(n=t._reportAppEventModule).onTrackSubscribeFail)||void 0===r||r.call(n,e,l)}))}}),Object.defineProperty(t.prototype,"changeAudioDevice",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return _(this,void 0,void 0,(function(){var t,l,n,r;return C(this,(function(o){switch(o.label){case 0:return t=this._logger.createTraceId(),this._logger.info(u.L_CALL_SESSION_CHANGE_AUDIO_DEVICE_T,JSON.stringify(e),t),e?(l=e.micphoneId,n=e.sampleRate,this._callPlusClient.setAudioConfig({microphoneId:l,sampleRate:n}),[4,this._callPlusClient.switchMicrophone(l)]):(this._logger.error(u.L_CALL_SESSION_CHANGE_AUDIO_DEVICE_R,"errorCode: ".concat(exports.RCCallErrorCode.PARAM_ERROR),t),[2,{code:exports.RCCallErrorCode.PARAM_ERROR}]);case 1:return(r=o.sent().code)!==s.RCCallPlusCode.SUCCESS?(this._logger.error(u.L_CALL_SESSION_CHANGE_AUDIO_DEVICE_R,"errorCode: ".concat(d(r)),t),[2,{code:d(r)}]):(this._logger.info(u.L_CALL_SESSION_CHANGE_AUDIO_DEVICE_R,"success",t),[2,{code:d(r)}])}}))}))}}),Object.defineProperty(t.prototype,"invite",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var l;return void 0===t&&(t={}),_(this,void 0,void 0,(function(){var n,r;return C(this,(function(o){switch(o.label){case 0:return n=this._logger.createTraceId(),this._logger.info(u.L_CALL_SESSION_INVITE_T,JSON.stringify({userIds:e,options:t}),n),[4,this._callPlusClient.invite(e,null===(l=this._options)||void 0===l?void 0:l.callPushConfig,t.extra)];case 1:return(r=o.sent().code)!==s.RCCallPlusCode.SUCCESS?(this._logger.error(u.L_CALL_SESSION_INVITE_R,"errorCode: ".concat(d(r)),n),[2,{code:d(r)}]):(this._logger.info(u.L_CALL_SESSION_INVITE_R,"success",n),[2,{code:d(r)}])}}))}))}}),Object.defineProperty(t.prototype,"accept",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t;return _(this,void 0,void 0,(function(){var l,n,r,o,a,i;return C(this,(function(_){switch(_.label){case 0:return l=this._logger.createTraceId(),this._logger.info(u.L_CALL_SESSION_ACCEPT_T,JSON.stringify(e),l),e&&(n=e.audio,r=e.video,(null==n?void 0:n.micphoneId)&&this._audioConfigBuilder.setDefaultMicrophoneId(n.micphoneId),(null==n?void 0:n.sampleRate)&&this._audioConfigBuilder.setSampleRate(n.sampleRate),(null==r?void 0:r.cameraId)&&this._videoConfigBuilder.setDefaultCameraId(r.cameraId),(null==r?void 0:r.frameRate)&&this._videoConfigBuilder.setFrameRate(r.frameRate),(null==r?void 0:r.resolution)&&this._videoConfigBuilder.setVideoResolution(r.resolution)),o=this._audioConfigBuilder.build(),a=this._videoConfigBuilder.build(),this._callPlusClient.setAudioConfig(o),this._callPlusClient.setVideoConfig(a),[4,this._callPlusClient.accept(this._callId,null===(t=this._options)||void 0===t?void 0:t.callPushConfig)];case 1:return(i=_.sent().code)!==s.RCCallPlusCode.SUCCESS?(this._logger.error(u.L_CALL_SESSION_ACCEPT_R,"errorCode: ".concat(d(i)),l),[2,{code:d(i)}]):(this._logger.info(u.L_CALL_SESSION_ACCEPT_R,"success",l),[2,{code:d(i)}])}}))}))}}),Object.defineProperty(t.prototype,"hungup",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return _(this,void 0,void 0,(function(){var t,l;return C(this,(function(n){switch(n.label){case 0:return t=this._logger.createTraceId(),this._logger.info(u.L_CALL_SESSION_HUNGUP_T,"",t),this.emit(O.INNER_ON_SELF_HANGUP),[4,this._callPlusClient.hangup(this._callId,null===(e=this._options)||void 0===e?void 0:e.hangupPushConfig)];case 1:return(l=n.sent().code)!==s.RCCallPlusCode.SUCCESS&&this._logger.error(u.L_CALL_SESSION_HUNGUP_R,"errorCode: ".concat(d(l)),t),this._logger.info(u.L_CALL_SESSION_HUNGUP_R,"success",t),[2,{code:d(l)}]}}))}))}}),Object.defineProperty(t.prototype,"descendAbility",{enumerable:!1,configurable:!0,writable:!0,value:function(){return _(this,void 0,void 0,(function(){var e,t=this;return C(this,(function(l){return e=this._logger.createTraceId(),this._logger.info(u.L_CALL_SESSION_DESCEND_ABILITY_T,"",e),[2,new Promise((function(l){t._callPlusClient.requestChangeMediaType(s.RCCallPlusMediaType.AUDIO).then((function(n){var r=n.code,o=n.transactionId;if(r!==s.RCCallPlusCode.SUCCESS)return t._logger.error(u.L_CALL_SESSION_DESCEND_ABILITY_R,"errorCode: ".concat(d(r)),e),void l({code:d(r)});t._logger.info(u.L_CALL_SESSION_DESCEND_ABILITY_P,"transactionId: ".concat(o),e),t._descendResolve[o]=l}))}))]}))}))}}),Object.defineProperty(t.prototype,"disableVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return _(this,void 0,void 0,(function(){var e,t;return C(this,(function(l){switch(l.label){case 0:return e=this._logger.createTraceId(),this._logger.info(u.L_CALL_SESSION_DISABLE_VIDEO_TRACK_T,"",e),[4,this._callPlusClient.stopCamera()];case 1:return(t=l.sent().code)!==s.RCCallPlusCode.SUCCESS?(this._logger.error(u.L_CALL_SESSION_DISABLE_VIDEO_TRACK_R,"errorCode: ".concat(d(t)),e),[2,{code:d(t)}]):(this._logger.info(u.L_CALL_SESSION_DISABLE_VIDEO_TRACK_R,"success",e),[2,{code:d(t)}])}}))}))}}),Object.defineProperty(t.prototype,"enableVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return _(this,void 0,void 0,(function(){var e,t;return C(this,(function(l){switch(l.label){case 0:return e=this._logger.createTraceId(),this._logger.info(u.L_CALL_SESSION_ENABLE_VIDEO_TRACK_T,"",e),[4,this._callPlusClient.startCamera()];case 1:return(t=l.sent().code)!==s.RCCallPlusCode.SUCCESS?(this._logger.error(u.L_CALL_SESSION_ENABLE_VIDEO_TRACK_R,"errorCode: ".concat(d(t)),e),[2,{code:d(t)}]):(this._logger.info(u.L_CALL_SESSION_ENABLE_VIDEO_TRACK_R,"success",e),[2,{code:d(t)}])}}))}))}}),Object.defineProperty(t.prototype,"disableAudioTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return _(this,void 0,void 0,(function(){var e,t;return C(this,(function(l){switch(l.label){case 0:return e=this._logger.createTraceId(),this._logger.info(u.L_CALL_SESSION_DISABLE_AUDIO_TRACK_T,"",e),[4,this._callPlusClient.stopMicrophone()];case 1:return(t=l.sent().code)!==s.RCCallPlusCode.SUCCESS?(this._logger.error(u.L_CALL_SESSION_DISABLE_AUDIO_TRACK_R,"errorCode: ".concat(d(t)),e),[2,{code:d(t)}]):(this._logger.info(u.L_CALL_SESSION_DISABLE_AUDIO_TRACK_R,"success",e),[2,{code:d(t)}])}}))}))}}),Object.defineProperty(t.prototype,"enableAudioTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return _(this,void 0,void 0,(function(){var e,t;return C(this,(function(l){switch(l.label){case 0:return e=this._logger.createTraceId(),this._logger.info(u.L_CALL_SESSION_ENABLE_AUDIO_TRACK_T,"",e),[4,this._callPlusClient.startMicrophone()];case 1:return(t=l.sent().code)!==s.RCCallPlusCode.SUCCESS?(this._logger.error(u.L_CALL_SESSION_ENABLE_AUDIO_TRACK_R,"errorCode: ".concat(d(t)),e),[2,{code:d(t)}]):(this._logger.info(u.L_CALL_SESSION_ENABLE_AUDIO_TRACK_R,"success",e),[2,{code:d(t)}])}}))}))}}),Object.defineProperty(t.prototype,"getSessionId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._callId}}),Object.defineProperty(t.prototype,"getRTCSessionId",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._callPlusClient.getCurrentCallSession();return this._callId!==(null==e?void 0:e.getCallId())?null:this._callPlusClient.getRTCSessionId()}}),Object.defineProperty(t.prototype,"getTargetId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._targetId}}),Object.defineProperty(t.prototype,"getChannelId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._channelId}}),Object.defineProperty(t.prototype,"getConversationType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._callType}}),Object.defineProperty(t.prototype,"getRemoteUsers",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=this._callPlusClient.getCurrentCallSession();if(this._callId!==(null==t?void 0:t.getCallId()))return[];var l=(null==t?void 0:t.getUserList())||[];return null==l?void 0:l.map((function(t){var l=t.userId,n=t.state;return{userId:l,state:c(n),isCaller:l===e.getCallerId(),isRemote:l!==e._context.getCurrentId()}}))}}),Object.defineProperty(t.prototype,"getUserState",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this._callPlusClient.getCurrentCallSession();if(this._callId!==(null==t?void 0:t.getCallId()))return exports.RCCallUserState.NONE;var l=null==t?void 0:t.getUserList().filter((function(t){return t.userId===e}))[0].state;return c(l)}}),Object.defineProperty(t.prototype,"getState",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._callPlusClient.getCurrentCallSession();return function(e){var t=null;switch(e){case s.RCCallPlusCallState.IDLE:t=exports.RCCallSessionState.END;break;case s.RCCallPlusCallState.CALLING:case s.RCCallPlusCallState.INVITED:case s.RCCallPlusCallState.RINGING:case s.RCCallPlusCallState.BUSYLINE_RINGING:case s.RCCallPlusCallState.BUSYLINE_WAIT:t=exports.RCCallSessionState.WAITING;break;case s.RCCallPlusCallState.CONNECTING:case s.RCCallPlusCallState.ONCALL:t=exports.RCCallSessionState.KEEPING;break;case s.RCCallPlusCallState.ENDED:case s.RCCallPlusCallState.NOANSWER:case s.RCCallPlusCallState.MISSED:case s.RCCallPlusCallState.CANCELED:case s.RCCallPlusCallState.DECLINED:case s.RCCallPlusCallState.ERROR:default:t=exports.RCCallSessionState.END}return t}(this._callId===(null==e?void 0:e.getCallId())?null==e?void 0:e.getState():s.RCCallPlusCallState.ENDED)}}),Object.defineProperty(t.prototype,"getCallerId",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._callPlusClient.getCurrentCallSession();return this._callId!==(null==e?void 0:e.getCallId())?"":e.getCreatorUserId()}}),Object.defineProperty(t.prototype,"getMediaType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._mediaType===s.RCCallPlusMediaType.AUDIO?exports.RCCallMediaType.AUDIO:exports.RCCallMediaType.AUDIO_VIDEO}}),t}(a.EventEmitter),p=function(){function e(e,t,l,n){Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:l}),Object.defineProperty(this,"_options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_callPlusClient",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_targetId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_channelId",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_session",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_sessionStartTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_listener",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_mediaType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_audioConfigBuilder",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_videoConfigBuilder",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_callPushConfig",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_hangupPushConfig",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_isSelfHangup",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_reportAppEventModule",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._callPlusClient=n.callPlusClient,this._reportAppEventModule=new L(l),this._setCallPlusEventListener(),this._audioConfigBuilder=this._callPlusClient.createAudioConfigBuilder(),this._videoConfigBuilder=this._callPlusClient.createVideoConfigBuilder()}return Object.defineProperty(e.prototype,"_setCallPlusEventListener",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=0,l={},n={};this._callPlusClient.setCallPlusEventListener({onReceivedCall:function(t,l){return void 0===l&&(l="{}"),_(this,void 0,void 0,(function(){var n,r,o;return C(this,(function(i){return n=t.getCallId(),e._session?(e._callPlusClient.hangup(n,e._hangupPushConfig),[2]):(e._targetId=JSON.parse(l).targetId||"",e._channelId=JSON.parse(l).channelId||"",e._mediaType=t.getMediaType()===s.RCCallPlusMediaType.AUDIO?exports.RCCallMediaType.AUDIO:exports.RCCallMediaType.AUDIO_VIDEO,r=t.getCallType(),o=r===s.RCCallPlusType.MULTI?a.ConversationType.GROUP:a.ConversationType.PRIVATE,e._session=new N(n,e._callPlusClient,e._channelId,e._targetId,o,t.getMediaType(),e._context,e._logger),e._session.on(O.INNER_ON_SELF_HANGUP,(function(){e._isSelfHangup=!0})),e._options.onSession(e._session,JSON.parse(l).callLibExtra||""),[2])}))}))},onRemoteUserInvited:function(t,l,n){var r,o={userId:l},a=t.map((function(e){return{userId:e}}));e._listener?e._reportAppEventModule.onMemberModify(o,a,e._session):null===(r=e._session)||void 0===r||r.emit(O.INNER_ON_MEMBER_MODIFY,o,a,e._session)},onCallConnected:function(e){var t=e.getCallId();n[t]=!0},onCallTypeChanged:function(e,t){},onRemoteUserStateChanged:function(t,n,r,o){var a,i,E;return _(this,void 0,void 0,(function(){var _,R,u,c,d,L,S,N,p;return C(this,(function(C){return _={userId:n},R=[s.RCCallPlusSessionUserState.IDLE,s.RCCallPlusSessionUserState.DECLINED,s.RCCallPlusSessionUserState.MISSED,s.RCCallPlusSessionUserState.NO_ANSWER].includes(r),e._listener?(r===s.RCCallPlusSessionUserState.RINGING&&e._reportAppEventModule.onRinging(_,e._session),r===s.RCCallPlusSessionUserState.CONNECTING&&e._reportAppEventModule.onAccept(_,e._session),R&&e._reportAppEventModule.onHungup(_,I(o,e._isSelfHangup),e._session)):(r===s.RCCallPlusSessionUserState.RINGING&&(null===(a=e._session)||void 0===a||a.emit(O.INNER_ON_RINGING,_,e._session)),r===s.RCCallPlusSessionUserState.CONNECTING&&(null===(i=e._session)||void 0===i||i.emit(O.INNER_ON_ACCEPT,_,e._session)),R&&(null===(E=e._session)||void 0===E||E.emit(O.INNER_ON_HANGUP,_,I(o,e._isSelfHangup),e._session))),u=e._callPlusClient.getCurrentCallSession(),c=null==u?void 0:u.getCallType(),d=null==u?void 0:u.getUserList(),L=null==d?void 0:d.filter((function(t){return t.userId===e._context.getCurrentId()}))[0],S=null==d?void 0:d.filter((function(t){return t.userId!==e._context.getCurrentId()})),N=null==S?void 0:S.every((function(e){return e.state===s.RCCallPlusSessionUserState.IDLE})),p=(null==L?void 0:L.state)===s.RCCallPlusSessionUserState.ONCALL&&N,R&&c===s.RCCallPlusType.MULTI&&p&&(e._callPlusClient.hangup(),l[t]=o===s.RCCallPlusReason.MISSED?s.RCCallPlusReason.NO_ANSWER:o,e._isSelfHangup=!1),[2]}))}))},onCallEnded:function(r,o){return _(this,void 0,void 0,(function(){var a,s,i;return C(this,(function(_){return a=+new Date-t,s=r.getCallId(),i={conversationType:e._session.getConversationType(),channelId:e._session.getChannelId(),targetId:e._session.getTargetId(),mediaType:e._session.getMediaType(),beginTimestamp:e._sessionStartTime,endTimestamp:a,duration:n[s]?Math.ceil((a-e._sessionStartTime)/1e3):0,endReason:l[s]?I(l[s],e._isSelfHangup):I(o,e._isSelfHangup)},e._options.onSessionClose(e._session,i),e._session=null,e._sessionStartTime=0,delete l[s],delete n[s],[2]}))}))},onUserMediaAvailable:function(t,l){var n;return _(this,void 0,void 0,(function(){var r;return C(this,(function(o){return r=l===s.RCCallPlusMediaType.AUDIO?exports.RCCallMediaType.AUDIO:exports.RCCallMediaType.AUDIO_VIDEO,e._listener?e._reportAppEventModule.onTrackReady(t,r,e._session):null===(n=e._session)||void 0===n||n.emit(O.INNER_ON_TRACK_READY,t,r,e._session),[2]}))}))},onFetchRemoteMediaError:function(t,l){var n,r,o;e._listener?null===(r=(n=e._reportAppEventModule).onTrackSubscribeFail)||void 0===r||r.call(n,l,e._session):null===(o=e._session)||void 0===o||o.emit(O.INNER_ON_TRACK_SUBSCRIBE_FAIL,l,e._session)},onRemoteCameraStateChanged:function(t,l,n){var r,o={userId:l,muted:n,kind:""};e._listener?e._reportAppEventModule.onVideoMuteChange(o,e._session):null===(r=e._session)||void 0===r||r.emit(O.INNER_ON_VIDEO_MUTE_CHANGE,o,e._session)},onRemoteMicrophoneStateChanged:function(t,l,n){var r,o={userId:l,muted:n,kind:""};e._listener?e._reportAppEventModule.onAudioMuteChange(o,e._session):null===(r=e._session)||void 0===r||r.emit(O.INNER_ON_AUDIO_MUTE_CHANGE,o,e._session)},onReceivedCallRecord:function(e){},onReceivedChangeMediaTypeRequest:function(t,l,n){e._callPlusClient.replyChangeMediaType(l,!0)},onReceivedChangeMediaTypeResult:function(t){var l;if(e._mediaType===exports.RCCallMediaType.AUDIO_VIDEO&&t.mediaType===s.RCCallPlusMediaType.AUDIO_VIDEO&&t.code===s.RCCallPlusMediaTypeChangeResult.SERVER_ALLOW_MEDIA_TYPE){var n={userId:t.userId};e._mediaType=exports.RCCallMediaType.AUDIO,e._listener?e._reportAppEventModule.onMediaModify(n,e._mediaType,e._session):null===(l=e._session)||void 0===l||l.emit(O.INNER_ON_MEDIA_MODIFY,n,e._mediaType,e._session,t.transactionId)}},onReceivedCallStartTime:function(l){e._sessionStartTime=l.callStartTime,t=+new Date-l.callStartTime},onReceivedCallFirstFrameTime:function(e,t){},onUserAudioLevelChanged:function(e,t){}})}}),Object.defineProperty(e.prototype,"registerUserInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.warn(u.L_CALL_CLIENT_REGISTER_USER_INFO_O,"`RCCallClient.registerUserInfo` has been deprecated, use `https://doc.rongcloud.cn/imserver/server/v1/user/register` instead.")}}),Object.defineProperty(e.prototype,"startCrossCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e){e.targetId;var t=e.mediaType;return void 0===t&&exports.RCCallMediaType.AUDIO,e.listener,e.constraints,e.channelId,e.extra,e.bitrate,_(this,void 0,void 0,(function(){return C(this,(function(e){return this._logger.warn(u.L_CALL_CLIENT_START_CROSS_CALL_O,"`RCCallClient.startCrossCall` has been deprecated"),[2]}))}))}}),Object.defineProperty(e.prototype,"__startCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var l=t.targetId,n=t.userIds,r=t.mediaType,o=void 0===r?exports.RCCallMediaType.AUDIO:r,i=t.listener,E=t.constraints,R=t.channelId,c=void 0===R?"":R,I=t.extra,L=void 0===I?"":I,S=t.bitrate;return _(this,void 0,void 0,(function(){var t,r,_,R,I,p,T,A,f,g,b,P,h,v,D=this;return C(this,(function(C){switch(C.label){case 0:return t=this._logger.createTraceId(),this._logger.info(u.L_CALL_CLIENT_CALL_T,JSON.stringify({targetId:l,userIds:n,mediaType:o,listener:Object.keys(i),constraints:E,channelId:c,extra:L,bitrate:S}),t),E&&(r=E.audio,_=E.video,(null==r?void 0:r.micphoneId)&&this._audioConfigBuilder.setDefaultMicrophoneId(r.micphoneId),(null==r?void 0:r.sampleRate)&&this._audioConfigBuilder.setSampleRate(r.sampleRate),(null==_?void 0:_.cameraId)&&this._videoConfigBuilder.setDefaultCameraId(_.cameraId),(null==_?void 0:_.frameRate)&&this._videoConfigBuilder.setFrameRate(_.frameRate),(null==_?void 0:_.resolution)&&this._videoConfigBuilder.setVideoResolution(_.resolution)),S&&(r=S.audio,_=S.video,r&&this._audioConfigBuilder.setBitrate(r,r),_&&this._videoConfigBuilder.setBitrate(_.min,_.max)),R=this._audioConfigBuilder.build(),I=this._videoConfigBuilder.build(),this._callPlusClient.setAudioConfig(R),this._callPlusClient.setVideoConfig(I),this._targetId=l,this._listener=i,this._reportAppEventModule.registerEventListener(i),this._mediaType=o,p=o===exports.RCCallMediaType.AUDIO?s.RCCallPlusMediaType.AUDIO:s.RCCallPlusMediaType.AUDIO_VIDEO,T=e?s.RCCallPlusType.SINGLE:s.RCCallPlusType.MULTI,A=e?[l]:n,f=e?this._context.getCurrentId():l,g=JSON.stringify({callLibExtra:L,channelId:c,targetId:f}),[4,this._callPlusClient.startCall(A,T,p,this._callPushConfig,g)];case 1:return b=C.sent(),P=b.code,h=b.callId,P!==s.RCCallPlusCode.SUCCESS?(this._logger.error(u.L_CALL_CLIENT_CALL_R,"errorCode: ".concat(d(P)),t),[2,{code:d(P)}]):(this._logger.info(u.L_CALL_CLIENT_CALL_R,"success",t),v=e?a.ConversationType.PRIVATE:a.ConversationType.GROUP,this._session=new N(h,this._callPlusClient,this._channelId,this._targetId,v,p,this._context,this._logger,{callPushConfig:this._callPushConfig,hangupPushConfig:this._hangupPushConfig}),this._session.on(O.INNER_ON_SELF_HANGUP,(function(){D._isSelfHangup=!0})),[2,{code:exports.RCCallErrorCode.SUCCESS,session:this._session}])}}))}))}}),Object.defineProperty(e.prototype,"call",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.targetId,l=e.mediaType,n=void 0===l?exports.RCCallMediaType.AUDIO:l,r=e.listener,o=e.constraints,a=e.channelId,s=void 0===a?"":a,i=e.extra,E=void 0===i?"":i,R=e.bitrate;return _(this,void 0,void 0,(function(){return C(this,(function(e){return[2,this.__startCall(!0,{targetId:t,userIds:[],mediaType:n,listener:r,constraints:o,channelId:s,extra:E,bitrate:R})]}))}))}}),Object.defineProperty(e.prototype,"callInGroup",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.targetId,l=e.userIds,n=e.mediaType,r=void 0===n?exports.RCCallMediaType.AUDIO:n,o=e.listener,a=e.constraints,s=e.channelId,i=void 0===s?"":s,E=e.extra,R=void 0===E?"":E,u=e.bitrate;return _(this,void 0,void 0,(function(){return C(this,(function(e){return[2,this.__startCall(!1,{targetId:t,userIds:l,mediaType:r,listener:o,constraints:a,channelId:i,extra:R,bitrate:u})]}))}))}}),Object.defineProperty(e.prototype,"getJoinedRoomInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(){return _(this,void 0,void 0,(function(){var e,t,l;return C(this,(function(n){switch(n.label){case 0:return[4,this._context.getRTCJoinedUserInfo(this._context.getCurrentId())];case 1:return e=n.sent(),t=e.code,l=e.data,t!==a.ErrorCode.SUCCESS?(this._logger.error(u.L_CALL_CLIENT_GET_JOINED_ROOM_INFO_E,t),[2,{code:exports.RCCallErrorCode.QUERY_JOINED_USER_INFO_ERROR}]):[2,{code:exports.RCCallErrorCode.SUCCESS,data:l}]}}))}))}}),Object.defineProperty(e.prototype,"setPushConfig",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===e&&(e={}),void 0===t&&(t={}),this._logger.info(u.L_CALL_CLIENT_SET_PUSH_CONFIG_O,JSON.stringify({callPushConfig:e,hangupPushConfig:t})),this._callPushConfig=e,this._hangupPushConfig=t,delete this._callPushConfig.pushContent,delete this._hangupPushConfig.pushContent}}),e}();exports.RCCallLanguage=void 0,(S=exports.RCCallLanguage||(exports.RCCallLanguage={})).ZH="zh",S.EN="en";var T={tag:"CallPlusWrapper",verify:function(e){return"browser"===e.tag},setup:function(e,t,l){var n=e.createLogger("CallPlusWrapper","RTC"),r=a.isUndefined(l.logOutputLevel)?a.LogL.WARN:l.logOutputLevel;return n.setOutputLevel(r),n.warn(u.L_CALL_PLUS_WRAPPER_INIT_O,"CallPlus Version: ".concat("2.1.3",", Commit: ").concat("510a1938845462199b33310feeef72fe5c29f328")),new p(e,t,n,l)}};exports.RCCallClient=p,exports.RCCallSession=N,exports.installer=T;
|