@rongcloud/plugin-call-plus 2.1.5-alpha.2 → 2.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.esm.js +1 -1
- package/index.js +1 -1
- package/package.json +1 -1
- package/wrapper/index.esm.js +1 -1
- package/wrapper/index.js +1 -1
package/package.json
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"license": "LGPL 2.1",
|
|
30
30
|
"description": "@rongcloud/plugin-call-plus",
|
|
31
31
|
"homepage": "https://www.rongcloud.cn",
|
|
32
|
-
"version": "2.1.5
|
|
32
|
+
"version": "2.1.5",
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@rongcloud/engine": "^5.8.2",
|
|
35
35
|
"@rongcloud/plugin-rtc": "^5.7.0"
|
package/wrapper/index.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{EventEmitter as e,ConversationType as t,ErrorCode as n,VersionManage as _,isUndefined as i,LogL as r}from"@rongcloud/engine";import{RCCallPlusSessionUserState as o,RCCallPlusCallState as a,RCCallPlusCode as l,RCCallPlusReason as E,RCCallPlusMediaType as s,RCCallPlusMediaTypeChangeResult as u,RCCallPlusType as c}from"@rongcloud/plugin-call-plus";var I,R,O,C,L,N,d=function(e,t){return d=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])},d(e,t)};function T(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 S(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 A(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 f(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"}(I||(I={})),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"}(R||(R={})),function(e){e[e.NONE=0]="NONE",e[e.WAITING=1]="WAITING",e[e.KEEPING=2]="KEEPING"}(O||(O={})),function(e){e[e.WAITING=0]="WAITING",e[e.KEEPING=1]="KEEPING",e[e.END=2]="END"}(C||(C={})),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"}(N||(N={})),(L={})[N.CANCEL]=N.REMOTE_CANCEL,L[N.REJECT]=N.REMOTE_REJECT,L[N.HANGUP]=N.REMOTE_HANGUP,L[N.BUSY_LINE]=N.REMOTE_BUSY_LINE,L[N.NO_RESPONSE]=N.REMOTE_NO_RESPONSE,L[N.ENGINE_UNSUPPORTED]=N.REMOTE_ENGINE_UNSUPPORTED,L[N.NETWORK_ERROR]=N.REMOTE_NETWORK_ERROR,L[N.GET_MEDIA_RESOURCES_ERROR]=N.REMOTE_GET_MEDIA_RESOURCE_ERROR,L[N.PUBLISH_ERROR]=N.REMOTE_PUBLISH_ERROR,L[N.SUBSCRIBE_ERROR]=N.REMOTE_SUBSCRIBE_ERROR,L[N.OTHER_CLIENT_JOINED_CALL]=N.REMOTE_OTHER_CLIENT_JOINED_CALL,L[N.OTHER_CLIENT_IN_CALL]=N.REMOTE_OTHER_CLIENT_IN_CALL,L[N.KICKED_BY_SERVER]=N.REMOTE_KICKED_BY_SERVER,L[N.REMOTE_NO_RESPONSE]=N.NO_RESPONSE,L[N.ACCEPT_SYSTEM_CALL]=N.REMOTE_ACCEPT_SYSTEM_CALL;var p,g=function(e){var t=null;switch(e){case o.IDLE:t=O.NONE;break;case o.CALLING:case o.INVITED:case o.RINGING:t=O.WAITING;break;case o.BUSYLINE_RINGING:case o.BUSYLINE_WAIT:t=O.NONE;break;case o.CONNECTING:t=O.WAITING;break;case o.ONCALL:t=O.KEEPING;break;case o.ONPHONE:t=O.WAITING;break;case o.ENDED:case o.NO_ANSWER:case o.MISSED:case o.CANCELLED:case o.DECLINED:case o.ERROR:default:t=O.NONE}return t},b=function(e){var t=null;switch(e){case l.SUCCESS:t=R.SUCCESS;break;case l.PARAM_ERROR:t=R.PARAM_ERROR;break;case l.SESSION_EXIST:t=R.STATE_MACHINE_EXIT;break;case l.NOT_IN_CALL:t=R.NOT_IN_CALL;break;case l.MEDIATYPE_INVALID:t=R.MEDIATYPE_INVALID;break;case l.NOT_VIDEO_CALL:t=R.NOT_VIDEO_CALL;break;case l.RTC_SERVICE_UNAVAILABLE:t=R.RTC_SERVICE_UNAVAILABLE;break;case l.USER_LIST_INVAILD:t=R.USER_LIST_INVAILD;break;case l.CALL_ID_INVALID:t=R.CALL_ID_INVALID;break;case l.TRANSACTION_ID_INVALID:t=R.TRANSACTION_ID_INVALID;break;case l.USER_ID_INVALID:t=R.USER_ID_INVALID;break;case l.SINGLE_CALL_NOT_SUPPORT_MULTI_PERSON:t=R.SINGLE_CALL_NOT_SUPPORT_MULTI_PERSON;break;case l.CAMERA_CLOSED:t=R.MISSING_VIDEO_TRACK_ERROR;break;case l.MICROPHONE_CLOSED:t=R.MICROPHONE_CLOSED;break;case l.MEDIA_RESOURCE_INVALIED:t=R.MEDIA_RESOURCE_INVALIED;break;case l.NOT_INSTALL_RTC_PLUGIN:t=R.NOT_INSTALL_RTC_PLUGIN;break;case l.PLAY_MEDIA_FAILED:t=R.PLAY_MEDIA_FAILED;break;case l.VIDEO_VIEW_NOT_SET:t=R.VIDEO_VIEW_NOT_SET;break;default:t=e}return t},h=function(e,t){var n=null;switch(e){case E.BUSYLINE_RINGING:n=t?N.BUSY_LINE:N.REMOTE_BUSY_LINE;break;case E.ON_DEVICE_DISABLE:n=N.REMOTE_GET_MEDIA_RESOURCE_ERROR;break;case E.ENDED:n=t?N.HANGUP:N.REMOTE_HANGUP;break;case E.NO_ANSWER:n=N.REMOTE_NO_RESPONSE;break;case E.MISSED:n=N.NO_RESPONSE;break;case E.CANCELLED:n=t?N.CANCEL:N.REMOTE_CANCEL;break;case E.DECLINED:n=t?N.REJECT:N.REMOTE_REJECT;break;case E.OTHER_CLIENT_ACCEPT:n=N.ACCEPT_BY_OTHER_CLIENT;break;case E.PUBLISH_ERR:n=N.PUBLISH_ERROR;break;case E.SUBSCRIBE_ERR:n=N.SUBSCRIBE_ERROR;break;case E.ACCEPT_CARRIER:n=t?N.ACCEPT_SYSTEM_CALL:N.REMOTE_ACCEPT_SYSTEM_CALL;break;case E.KICKED_BY_SERVER:n=N.KICKED_BY_SERVER;break;case E.CONNECTION_ERR:n=N.NETWORK_ERROR;break;case E.OTHER_CLIENT_JOINED:n=t?N.OTHER_CLIENT_JOINED_CALL:N.REMOTE_OTHER_CLIENT_JOINED_CALL;break;case E.OTHER_CLIENT_IN_ROOM:n=N.OTHER_CLIENT_IN_CALL;break;case E.OTHER_CLIENT_HANGUP:n=N.HANGUP_BY_OTHER_CLIENT;break;case E.REMOTE_PUBLISH_ERROR:n=N.REMOTE_PUBLISH_ERROR;break;case E.REMOTE_SUBSCRIBE_ERROR:n=N.REMOTE_SUBSCRIBE_ERROR;break;case E.REMOTE_KICKED_BY_SERVER:n=N.REMOTE_KICKED_BY_SERVER;break;case E.REMOTE_CONNECTION_ERROR:n=N.REMOTE_NETWORK_ERROR;break;case E.ABNORMAL_END:n=t?N.NETWORK_ERROR:N.REMOTE_NETWORK_ERROR;break;case E.OTHER_CLIENT_CALLING:n=N.REMOTE_OTHER_CLIENT_JOINED_CALL;break;case E.JOIN_ROOM_ERR:n=N.NETWORK_ERROR;break;case E.LOGOUT:n=N.HANGUP;break;case E.OTHER_CLIENT_LOGIN:n=N.NETWORK_ERROR;break;case E.REMOTE_JOIN_RTC_ERROR:n=N.REMOTE_NETWORK_ERROR;break;case E.REMOTE_LOGOUT:n=N.REMOTE_HANGUP;break;case E.REMOTE_OTHER_CLIENT_LOGIN:n=N.REMOTE_NETWORK_ERROR;break;case E.REMOTE_OTHER_JOINED_RTC:n=N.REMOTE_OTHER_CLIENT_JOINED_CALL;break;case E.REMOTE_OTHER_CLIENT_IN_RTC:n=N.REMOTE_OTHER_CLIENT_IN_CALL;break;default:n=N.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_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"}(p||(p={}));var v,D=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 T(this,void 0,void 0,(function(){var _,i;return S(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,f([],A(n),!1))];case 2:return r.sent(),[3,4];case 3:return i=r.sent(),this._logger.error(p.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(p.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(p.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(p.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(p.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(p.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(p.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(p.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(p.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(p.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onTrackSubscribeFail",code:e,sessionId:t.getSessionId()})),this._callAppListener("onTrackSubscribeFail",e,t)}}),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"}(v||(v={}));var P,U=function(e){function n(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 D(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}d(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(n,e),Object.defineProperty(n.prototype,"registerSessionListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this._logger.info(p.L_CALL_SESSION_REGISTER_SESSION_LISTENER_O,Object.keys(e).join(",")),this._reportAppEventModule.registerEventListener(e),this.on(v.INNER_ON_RINGING,(function(e,n){t._reportAppEventModule.onRinging(e,n)})),this.on(v.INNER_ON_ACCEPT,(function(e,n){t._reportAppEventModule.onAccept(e,n)})),this.on(v.INNER_ON_HANGUP,(function(e,n,_){t._reportAppEventModule.onHungup(e,n,_)})),this.on(v.INNER_ON_TRACK_READY,(function(e,n,_){t._reportAppEventModule.onTrackReady(e,n,_)})),this.on(v.INNER_ON_MEMBER_MODIFY,(function(e,n,_){t._reportAppEventModule.onMemberModify(e,n,_)})),this.on(v.INNER_ON_MEDIA_MODIFY,(function(e,n,_,i){t._reportAppEventModule.onMediaModify(e,n,_)})),this.on(v.INNER_ON_AUDIO_MUTE_CHANGE,(function(e,n){t._reportAppEventModule.onAudioMuteChange(e,n)})),this.on(v.INNER_ON_VIDEO_MUTE_CHANGE,(function(e,n){t._reportAppEventModule.onVideoMuteChange(e,n)})),this.on(v.INNER_ON_TRACK_SUBSCRIBE_FAIL,(function(e,n){var _,i;null===(i=(_=t._reportAppEventModule).onTrackSubscribeFail)||void 0===i||i.call(_,e,n)}))}}),Object.defineProperty(n.prototype,"changeAudioDevice",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return T(this,void 0,void 0,(function(){var t,n,_,i;return S(this,(function(r){switch(r.label){case 0:return t=this._logger.createTraceId(),this._logger.info(p.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(p.L_CALL_SESSION_CHANGE_AUDIO_DEVICE_R,"errorCode: ".concat(R.PARAM_ERROR),t),[2,{code:R.PARAM_ERROR}]);case 1:return(i=r.sent().code)!==l.SUCCESS?(this._logger.error(p.L_CALL_SESSION_CHANGE_AUDIO_DEVICE_R,"errorCode: ".concat(b(i)),t),[2,{code:b(i)}]):(this._logger.info(p.L_CALL_SESSION_CHANGE_AUDIO_DEVICE_R,"success",t),[2,{code:b(i)}])}}))}))}}),Object.defineProperty(n.prototype,"invite",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n){return void 0===n&&(n={}),T(this,void 0,void 0,(function(){var _,i,r,o,a;return S(this,(function(E){switch(E.label){case 0:return _=this._logger.createTraceId(),this._logger.info(p.L_CALL_SESSION_INVITE_T,JSON.stringify({userIds:e,options:n}),_),i=n.extra,r=JSON.stringify({callLibExtra:i,targetId:this._targetId,channelId:this._channelId,conversationType:t.GROUP}),o=this._options.callPushConfig||n.pushConfig,[4,this._callPlusClient.invite(e,o,r)];case 1:return(a=E.sent().code)!==l.SUCCESS?(this._logger.error(p.L_CALL_SESSION_INVITE_R,"errorCode: ".concat(b(a)),_),[2,{code:b(a)}]):(this._logger.info(p.L_CALL_SESSION_INVITE_R,"success",_),[2,{code:b(a)}])}}))}))}}),Object.defineProperty(n.prototype,"accept",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return T(this,void 0,void 0,(function(){var t,n,_,i,r,o;return S(this,(function(a){switch(a.label){case 0:return t=this._logger.createTraceId(),this._logger.info(p.L_CALL_SESSION_ACCEPT_T,JSON.stringify(e),t),e&&(n=e.audio,_=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==_?void 0:_.cameraId)&&this._videoConfigBuilder.setDefaultCameraId(_.cameraId),(null==_?void 0:_.frameRate)&&this._videoConfigBuilder.setFrameRate(_.frameRate),(null==_?void 0:_.resolution)&&this._videoConfigBuilder.setVideoResolution(_.resolution)),i=this._audioConfigBuilder.build(),r=this._videoConfigBuilder.build(),this._callPlusClient.setAudioConfig(i),this._callPlusClient.setVideoConfig(r),[4,this._callPlusClient.accept(this._callId,this._options.callPushConfig)];case 1:return(o=a.sent().code)!==l.SUCCESS?(this._logger.error(p.L_CALL_SESSION_ACCEPT_R,"errorCode: ".concat(b(o)),t),[2,{code:b(o)}]):(this._logger.info(p.L_CALL_SESSION_ACCEPT_R,"success",t),[2,{code:b(o)}])}}))}))}}),Object.defineProperty(n.prototype,"hungup",{enumerable:!1,configurable:!0,writable:!0,value:function(){return T(this,void 0,void 0,(function(){var e,t;return S(this,(function(n){switch(n.label){case 0:return e=this._logger.createTraceId(),this._logger.info(p.L_CALL_SESSION_HUNGUP_T,"",e),this.emit(v.INNER_ON_SELF_HANGUP),[4,this._callPlusClient.hangup(this._callId,this._options.hangupPushConfig)];case 1:return(t=n.sent().code)!==l.SUCCESS?this._logger.error(p.L_CALL_SESSION_HUNGUP_R,"errorCode: ".concat(b(t)),e):this._logger.info(p.L_CALL_SESSION_HUNGUP_R,"success",e),[2,{code:b(t)}]}}))}))}}),Object.defineProperty(n.prototype,"descendAbility",{enumerable:!1,configurable:!0,writable:!0,value:function(){return T(this,void 0,void 0,(function(){var e,t,n,_,i,r=this;return S(this,(function(o){switch(o.label){case 0:return e=this._logger.createTraceId(),this._logger.info(p.L_CALL_SESSION_DESCEND_ABILITY_T,"",e),[4,this._callPlusClient.requestChangeMediaType(s.AUDIO)];case 1:return t=o.sent(),n=t.code,_=t.transactionId,n!==l.SUCCESS?(this._logger.error(p.L_CALL_SESSION_DESCEND_ABILITY_R,"errorCode: ".concat(b(n)),e),[2,{code:b(n)}]):[4,new Promise((function(e){r._descendResolve[_]=e}))];case 2:return i=o.sent(),this._logger.info(p.L_CALL_SESSION_DESCEND_ABILITY_R,"transactionId: ".concat(_),e),[2,{code:i.code}]}}))}))}}),Object.defineProperty(n.prototype,"disableVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return T(this,void 0,void 0,(function(){var e,t;return S(this,(function(n){switch(n.label){case 0:return e=this._logger.createTraceId(),this._logger.info(p.L_CALL_SESSION_DISABLE_VIDEO_TRACK_T,"",e),[4,this._callPlusClient.stopCamera()];case 1:return(t=n.sent().code)!==l.SUCCESS?(this._logger.error(p.L_CALL_SESSION_DISABLE_VIDEO_TRACK_R,"errorCode: ".concat(b(t)),e),[2,{code:b(t)}]):(this._logger.info(p.L_CALL_SESSION_DISABLE_VIDEO_TRACK_R,"success",e),[2,{code:b(t)}])}}))}))}}),Object.defineProperty(n.prototype,"enableVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return T(this,void 0,void 0,(function(){var e,t;return S(this,(function(n){switch(n.label){case 0:return e=this._logger.createTraceId(),this._logger.info(p.L_CALL_SESSION_ENABLE_VIDEO_TRACK_T,"",e),[4,this._callPlusClient.startCamera()];case 1:return(t=n.sent().code)!==l.SUCCESS?(this._logger.error(p.L_CALL_SESSION_ENABLE_VIDEO_TRACK_R,"errorCode: ".concat(b(t)),e),[2,{code:b(t)}]):(this._logger.info(p.L_CALL_SESSION_ENABLE_VIDEO_TRACK_R,"success",e),[2,{code:b(t)}])}}))}))}}),Object.defineProperty(n.prototype,"disableAudioTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return T(this,void 0,void 0,(function(){var e,t;return S(this,(function(n){switch(n.label){case 0:return e=this._logger.createTraceId(),this._logger.info(p.L_CALL_SESSION_DISABLE_AUDIO_TRACK_T,"",e),[4,this._callPlusClient.stopMicrophone()];case 1:return(t=n.sent().code)!==l.SUCCESS?(this._logger.error(p.L_CALL_SESSION_DISABLE_AUDIO_TRACK_R,"errorCode: ".concat(b(t)),e),[2,{code:b(t)}]):(this._logger.info(p.L_CALL_SESSION_DISABLE_AUDIO_TRACK_R,"success",e),[2,{code:b(t)}])}}))}))}}),Object.defineProperty(n.prototype,"enableAudioTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return T(this,void 0,void 0,(function(){var e,t;return S(this,(function(n){switch(n.label){case 0:return e=this._logger.createTraceId(),this._logger.info(p.L_CALL_SESSION_ENABLE_AUDIO_TRACK_T,"",e),[4,this._callPlusClient.startMicrophone()];case 1:return(t=n.sent().code)!==l.SUCCESS?(this._logger.error(p.L_CALL_SESSION_ENABLE_AUDIO_TRACK_R,"errorCode: ".concat(b(t)),e),[2,{code:b(t)}]):(this._logger.info(p.L_CALL_SESSION_ENABLE_AUDIO_TRACK_R,"success",e),[2,{code:b(t)}])}}))}))}}),Object.defineProperty(n.prototype,"getSessionId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._callId}}),Object.defineProperty(n.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(n.prototype,"getTargetId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._targetId}}),Object.defineProperty(n.prototype,"getChannelId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._channelId}}),Object.defineProperty(n.prototype,"getConversationType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._callType}}),Object.defineProperty(n.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:g(_),isCaller:n===e.getCallerId(),isRemote:n!==e._context.getCurrentId()}}))}}),Object.defineProperty(n.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 O.NONE;var n=null==t?void 0:t.getUserList().filter((function(t){return t.userId===e}))[0].state;return g(n)}}),Object.defineProperty(n.prototype,"getState",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._callPlusClient.getCurrentCallSession();return function(e){var t=null;switch(e){case a.IDLE:t=C.END;break;case a.CALLING:case a.INVITED:case a.RINGING:case a.BUSYLINE_RINGING:case a.BUSYLINE_WAIT:t=C.WAITING;break;case a.CONNECTING:case a.ONCALL:t=C.KEEPING;break;case a.ENDED:case a.NOANSWER:case a.MISSED:case a.CANCELED:case a.DECLINED:case a.ERROR:default:t=C.END}return t}(this._callId===(null==e?void 0:e.getCallId())?null==e?void 0:e.getState():a.ENDED)}}),Object.defineProperty(n.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(n.prototype,"getMediaType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._mediaType===s.AUDIO?I.AUDIO:I.AUDIO_VIDEO}}),Object.defineProperty(n.prototype,"__innerEndTranction",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._mediaType=e,this._descendResolve[t]&&(this._descendResolve[t]({code:R.SUCCESS}),delete this._descendResolve[t])}}),n}(e),y=function(){function e(e,t,n){Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:t}),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 D(t),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===_&&(_="{}"),T(this,void 0,void 0,(function(){var i,r,o;return S(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()===s.AUDIO?I.AUDIO:I.AUDIO_VIDEO,r=n.getCallType(),o=r===c.MULTI?t.GROUP:t.PRIVATE,e._session=new U(i,e._callPlusClient,e._channelId,e._targetId,o,n.getMediaType(),e._context,e._logger,{callPushConfig:e._callPushConfig,hangupPushConfig:e._hangupPushConfig}),e._session.on(v.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(v.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,r){var a,l,s;return T(this,void 0,void 0,(function(){var u,I,R,O,C,L,N,d,T;return S(this,(function(S){return u={userId:n},I=[o.IDLE,o.DECLINED,o.MISSED,o.NO_ANSWER].includes(i),e._listener?(i===o.RINGING&&e._reportAppEventModule.onRinging(u,e._session),i===o.CONNECTING&&e._reportAppEventModule.onAccept(u,e._session),I&&e._reportAppEventModule.onHungup(u,h(r,e._isSelfHangup),e._session)):(i===o.RINGING&&(null===(a=e._session)||void 0===a||a.emit(v.INNER_ON_RINGING,u,e._session)),i===o.CONNECTING&&(null===(l=e._session)||void 0===l||l.emit(v.INNER_ON_ACCEPT,u,e._session)),I&&(null===(s=e._session)||void 0===s||s.emit(v.INNER_ON_HANGUP,u,h(r,e._isSelfHangup),e._session))),R=e._callPlusClient.getCurrentCallSession(),O=null==R?void 0:R.getCallType(),C=null==R?void 0:R.getUserList(),L=null==C?void 0:C.filter((function(t){return t.userId===e._context.getCurrentId()}))[0],N=null==C?void 0:C.filter((function(t){return t.userId!==e._context.getCurrentId()})),d=null==N?void 0:N.every((function(e){return e.state===o.IDLE})),T=(null==L?void 0:L.state)===o.ONCALL&&d,I&&O===c.MULTI&&T&&(e._callPlusClient.hangup(),_[t]=r===E.MISSED?E.NO_ANSWER:r,e._isSelfHangup=!1),[2]}))}))},onCallEnded:function(t,r){return T(this,void 0,void 0,(function(){var o,a,l;return S(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]?h(_[a],e._isSelfHangup):h(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 T(this,void 0,void 0,(function(){var i;return S(this,(function(r){return i=n===s.AUDIO?I.AUDIO:I.AUDIO_VIDEO,e._listener?e._reportAppEventModule.onTrackReady(t,i,e._session):null===(_=e._session)||void 0===_||_.emit(v.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(v.INNER_ON_TRACK_SUBSCRIBE_FAIL,n,e._session)},onRemoteCameraStateChanged:function(t,n,_){var i,r={userId:n,muted:_,kind:"video",trackId:"".concat(n,"_RongCloudRTC_1")};e._listener?e._reportAppEventModule.onVideoMuteChange(r,e._session):null===(i=e._session)||void 0===i||i.emit(v.INNER_ON_VIDEO_MUTE_CHANGE,r,e._session)},onRemoteMicrophoneStateChanged:function(t,n,_){var i,r={userId:n,muted:_,kind:"audio",trackId:"".concat(n,"_RongCloudRTC_0")};e._listener?e._reportAppEventModule.onAudioMuteChange(r,e._session):null===(i=e._session)||void 0===i||i.emit(v.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===I.AUDIO_VIDEO&&t.mediaType===s.AUDIO&&t.code===u.SERVER_ALLOW_MEDIA_TYPE){var i={userId:t.userId};e._mediaType=I.AUDIO,null===(n=e._session)||void 0===n||n.__innerEndTranction(s.AUDIO,t.transactionId),e._listener?e._reportAppEventModule.onMediaModify(i,e._mediaType,e._session):null===(_=e._session)||void 0===_||_.emit(v.INNER_ON_MEDIA_MODIFY,i,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.error(p.L_CALL_CLIENT_REGISTER_USER_INFO_O,"`RCCallClient.registerUserInfo` has been deprecated.")}}),Object.defineProperty(e.prototype,"startCrossCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return T(this,void 0,void 0,(function(){return S(this,(function(e){return this._logger.error(p.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?I.AUDIO:r,a=n.listener,E=n.constraints,u=n.channelId,O=void 0===u?"":u,C=n.extra,L=void 0===C?"":C,N=n.bitrate;return T(this,void 0,void 0,(function(){var n,r,u,C,d,T,A,f,g,h,D,P,y,M,m=this;return S(this,(function(S){switch(S.label){case 0:return n=this._logger.createTraceId(),this._logger.info(p.L_CALL_CLIENT_CALL_T,JSON.stringify({targetId:_,userIds:i,mediaType:o,listener:Object.keys(a),constraints:E,channelId:O,extra:L,bitrate:N}),n),E&&(r=E.audio,u=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==u?void 0:u.cameraId)&&this._videoConfigBuilder.setDefaultCameraId(u.cameraId),(null==u?void 0:u.frameRate)&&this._videoConfigBuilder.setFrameRate(u.frameRate),(null==u?void 0:u.resolution)&&this._videoConfigBuilder.setVideoResolution(u.resolution)),N&&(r=N.audio,u=N.video,r&&this._audioConfigBuilder.setBitrate(r,r),u&&this._videoConfigBuilder.setBitrate(u.min,u.max)),C=this._audioConfigBuilder.build(),d=this._videoConfigBuilder.build(),this._callPlusClient.setAudioConfig(C),this._callPlusClient.setVideoConfig(d),this._targetId=_,this._listener=a,this._reportAppEventModule.registerEventListener(a),this._mediaType=o,T=o===I.AUDIO?s.AUDIO:s.AUDIO_VIDEO,A=e?c.SINGLE:c.MULTI,f=e?[_]:i,g=e?t.PRIVATE:t.GROUP,h=e?this._context.getCurrentId():_,D=JSON.stringify({callLibExtra:L,channelId:O,targetId:h,conversationType:g}),[4,this._callPlusClient.startCall(f,A,T,this._callPushConfig,D)];case 1:return P=S.sent(),y=P.code,M=P.callId,y!==l.SUCCESS?(this._logger.error(p.L_CALL_CLIENT_CALL_R,"errorCode: ".concat(b(y)),n),[2,{code:b(y)}]):(this._logger.info(p.L_CALL_CLIENT_CALL_R,"success",n),this._session=new U(M,this._callPlusClient,this._channelId,this._targetId,g,T,this._context,this._logger,{callPushConfig:this._callPushConfig,hangupPushConfig:this._hangupPushConfig}),this._session.on(v.INNER_ON_SELF_HANGUP,(function(){m._isSelfHangup=!0})),[2,{code:R.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?I.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 T(this,void 0,void 0,(function(){return S(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===_?I.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 T(this,void 0,void 0,(function(){return S(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 T(this,void 0,void 0,(function(){var e,t,_;return S(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(p.L_CALL_CLIENT_GET_JOINED_ROOM_INFO_E,t),[2,{code:R.QUERY_JOINED_USER_INFO_ERROR}]):[2,{code:R.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(p.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={})),_.add("callpluswrapper","2.1.5-alpha.2");var M={tag:"CallPlusWrapper",verify:function(e){return"browser"===e.tag},setup:function(e,t,n){var _=e.createLogger("CWrapper","RTC"),o=i(n.logOutputLevel)?r.WARN:n.logOutputLevel;return _.setOutputLevel(o),_.warn(p.L_CALL_PLUS_WRAPPER_INIT_O,"CallPlus Version: ".concat("2.1.5-alpha.2",", Commit: ").concat("c8e5a05b524058da963f8ba30cb0f23015ae64cb")),new y(e,_,n)}};export{y as RCCallClient,N as RCCallEndReason,R as RCCallErrorCode,P as RCCallLanguage,I as RCCallMediaType,U as RCCallSession,C as RCCallSessionState,O as RCCallUserState,M as installer};
|
|
1
|
+
import{EventEmitter as e,ConversationType as t,ErrorCode as n,VersionManage as _,isUndefined as i,LogL as r}from"@rongcloud/engine";import{RCCallPlusSessionUserState as o,RCCallPlusCallState as a,RCCallPlusCode as l,RCCallPlusReason as E,RCCallPlusMediaType as s,RCCallPlusMediaTypeChangeResult as u,RCCallPlusType as c}from"@rongcloud/plugin-call-plus";var I,R,O,C,L,d,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 T(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 S(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 A(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 f(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"}(I||(I={})),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"}(R||(R={})),function(e){e[e.NONE=0]="NONE",e[e.WAITING=1]="WAITING",e[e.KEEPING=2]="KEEPING"}(O||(O={})),function(e){e[e.WAITING=0]="WAITING",e[e.KEEPING=1]="KEEPING",e[e.END=2]="END"}(C||(C={})),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"}(d||(d={})),(L={})[d.CANCEL]=d.REMOTE_CANCEL,L[d.REJECT]=d.REMOTE_REJECT,L[d.HANGUP]=d.REMOTE_HANGUP,L[d.BUSY_LINE]=d.REMOTE_BUSY_LINE,L[d.NO_RESPONSE]=d.REMOTE_NO_RESPONSE,L[d.ENGINE_UNSUPPORTED]=d.REMOTE_ENGINE_UNSUPPORTED,L[d.NETWORK_ERROR]=d.REMOTE_NETWORK_ERROR,L[d.GET_MEDIA_RESOURCES_ERROR]=d.REMOTE_GET_MEDIA_RESOURCE_ERROR,L[d.PUBLISH_ERROR]=d.REMOTE_PUBLISH_ERROR,L[d.SUBSCRIBE_ERROR]=d.REMOTE_SUBSCRIBE_ERROR,L[d.OTHER_CLIENT_JOINED_CALL]=d.REMOTE_OTHER_CLIENT_JOINED_CALL,L[d.OTHER_CLIENT_IN_CALL]=d.REMOTE_OTHER_CLIENT_IN_CALL,L[d.KICKED_BY_SERVER]=d.REMOTE_KICKED_BY_SERVER,L[d.REMOTE_NO_RESPONSE]=d.NO_RESPONSE,L[d.ACCEPT_SYSTEM_CALL]=d.REMOTE_ACCEPT_SYSTEM_CALL;var g,p=function(e){var t=null;switch(e){case o.IDLE:t=O.NONE;break;case o.CALLING:case o.INVITED:case o.RINGING:t=O.WAITING;break;case o.BUSYLINE_RINGING:case o.BUSYLINE_WAIT:t=O.NONE;break;case o.CONNECTING:t=O.WAITING;break;case o.ONCALL:t=O.KEEPING;break;case o.ONPHONE:t=O.WAITING;break;case o.ENDED:case o.NO_ANSWER:case o.MISSED:case o.CANCELLED:case o.DECLINED:case o.ERROR:default:t=O.NONE}return t},b=function(e){var t=null;switch(e){case l.SUCCESS:t=R.SUCCESS;break;case l.PARAM_ERROR:t=R.PARAM_ERROR;break;case l.SESSION_EXIST:t=R.STATE_MACHINE_EXIT;break;case l.NOT_IN_CALL:t=R.NOT_IN_CALL;break;case l.MEDIATYPE_INVALID:t=R.MEDIATYPE_INVALID;break;case l.NOT_VIDEO_CALL:t=R.NOT_VIDEO_CALL;break;case l.RTC_SERVICE_UNAVAILABLE:t=R.RTC_SERVICE_UNAVAILABLE;break;case l.USER_LIST_INVAILD:t=R.USER_LIST_INVAILD;break;case l.CALL_ID_INVALID:t=R.CALL_ID_INVALID;break;case l.TRANSACTION_ID_INVALID:t=R.TRANSACTION_ID_INVALID;break;case l.USER_ID_INVALID:t=R.USER_ID_INVALID;break;case l.SINGLE_CALL_NOT_SUPPORT_MULTI_PERSON:t=R.SINGLE_CALL_NOT_SUPPORT_MULTI_PERSON;break;case l.CAMERA_CLOSED:t=R.MISSING_VIDEO_TRACK_ERROR;break;case l.MICROPHONE_CLOSED:t=R.MICROPHONE_CLOSED;break;case l.MEDIA_RESOURCE_INVALIED:t=R.MEDIA_RESOURCE_INVALIED;break;case l.NOT_INSTALL_RTC_PLUGIN:t=R.NOT_INSTALL_RTC_PLUGIN;break;case l.PLAY_MEDIA_FAILED:t=R.PLAY_MEDIA_FAILED;break;case l.VIDEO_VIEW_NOT_SET:t=R.VIDEO_VIEW_NOT_SET;break;default:t=e}return t},h=function(e,t){var n=null;switch(e){case E.BUSYLINE_RINGING:n=t?d.BUSY_LINE:d.REMOTE_BUSY_LINE;break;case E.ON_DEVICE_DISABLE:n=d.REMOTE_GET_MEDIA_RESOURCE_ERROR;break;case E.ENDED:n=t?d.HANGUP:d.REMOTE_HANGUP;break;case E.NO_ANSWER:n=d.REMOTE_NO_RESPONSE;break;case E.MISSED:n=d.NO_RESPONSE;break;case E.CANCELLED:n=t?d.CANCEL:d.REMOTE_CANCEL;break;case E.DECLINED:n=t?d.REJECT:d.REMOTE_REJECT;break;case E.OTHER_CLIENT_ACCEPT:n=d.ACCEPT_BY_OTHER_CLIENT;break;case E.PUBLISH_ERR:n=d.PUBLISH_ERROR;break;case E.SUBSCRIBE_ERR:n=d.SUBSCRIBE_ERROR;break;case E.ACCEPT_CARRIER:n=t?d.ACCEPT_SYSTEM_CALL:d.REMOTE_ACCEPT_SYSTEM_CALL;break;case E.KICKED_BY_SERVER:n=d.KICKED_BY_SERVER;break;case E.CONNECTION_ERR:n=d.NETWORK_ERROR;break;case E.OTHER_CLIENT_JOINED:n=t?d.OTHER_CLIENT_JOINED_CALL:d.REMOTE_OTHER_CLIENT_JOINED_CALL;break;case E.OTHER_CLIENT_IN_ROOM:n=d.OTHER_CLIENT_IN_CALL;break;case E.OTHER_CLIENT_HANGUP:n=d.HANGUP_BY_OTHER_CLIENT;break;case E.REMOTE_PUBLISH_ERROR:n=d.REMOTE_PUBLISH_ERROR;break;case E.REMOTE_SUBSCRIBE_ERROR:n=d.REMOTE_SUBSCRIBE_ERROR;break;case E.REMOTE_KICKED_BY_SERVER:n=d.REMOTE_KICKED_BY_SERVER;break;case E.REMOTE_CONNECTION_ERROR:n=d.REMOTE_NETWORK_ERROR;break;case E.ABNORMAL_END:n=t?d.NETWORK_ERROR:d.REMOTE_NETWORK_ERROR;break;case E.OTHER_CLIENT_CALLING:n=d.REMOTE_OTHER_CLIENT_JOINED_CALL;break;case E.JOIN_ROOM_ERR:n=d.NETWORK_ERROR;break;case E.LOGOUT:n=d.HANGUP;break;case E.OTHER_CLIENT_LOGIN:n=d.NETWORK_ERROR;break;case E.REMOTE_JOIN_RTC_ERROR:n=d.REMOTE_NETWORK_ERROR;break;case E.REMOTE_LOGOUT:n=d.REMOTE_HANGUP;break;case E.REMOTE_OTHER_CLIENT_LOGIN:n=d.REMOTE_NETWORK_ERROR;break;case E.REMOTE_OTHER_JOINED_RTC:n=d.REMOTE_OTHER_CLIENT_JOINED_CALL;break;case E.REMOTE_OTHER_CLIENT_IN_RTC:n=d.REMOTE_OTHER_CLIENT_IN_CALL;break;default:n=d.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_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"}(g||(g={}));var v,D=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 T(this,void 0,void 0,(function(){var _,i;return S(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,f([],A(n),!1))];case 2:return r.sent(),[3,4];case 3:return i=r.sent(),this._logger.error(g.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(g.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(g.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(g.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(g.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(g.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(g.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(g.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(g.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(g.L_CALL_EXECUTE_EVENT_LISTENER_O,JSON.stringify({eventType:"onTrackSubscribeFail",code:e,sessionId:t.getSessionId()})),this._callAppListener("onTrackSubscribeFail",e,t)}}),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"}(v||(v={}));var P,U=function(e){function n(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 D(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)}(n,e),Object.defineProperty(n.prototype,"registerSessionListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this._logger.info(g.L_CALL_SESSION_REGISTER_SESSION_LISTENER_O,Object.keys(e).join(",")),this._reportAppEventModule.registerEventListener(e),this.on(v.INNER_ON_RINGING,(function(e,n){t._reportAppEventModule.onRinging(e,n)})),this.on(v.INNER_ON_ACCEPT,(function(e,n){t._reportAppEventModule.onAccept(e,n)})),this.on(v.INNER_ON_HANGUP,(function(e,n,_){t._reportAppEventModule.onHungup(e,n,_)})),this.on(v.INNER_ON_TRACK_READY,(function(e,n,_){t._reportAppEventModule.onTrackReady(e,n,_)})),this.on(v.INNER_ON_MEMBER_MODIFY,(function(e,n,_){t._reportAppEventModule.onMemberModify(e,n,_)})),this.on(v.INNER_ON_MEDIA_MODIFY,(function(e,n,_,i){t._reportAppEventModule.onMediaModify(e,n,_)})),this.on(v.INNER_ON_AUDIO_MUTE_CHANGE,(function(e,n){t._reportAppEventModule.onAudioMuteChange(e,n)})),this.on(v.INNER_ON_VIDEO_MUTE_CHANGE,(function(e,n){t._reportAppEventModule.onVideoMuteChange(e,n)})),this.on(v.INNER_ON_TRACK_SUBSCRIBE_FAIL,(function(e,n){var _,i;null===(i=(_=t._reportAppEventModule).onTrackSubscribeFail)||void 0===i||i.call(_,e,n)}))}}),Object.defineProperty(n.prototype,"changeAudioDevice",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return T(this,void 0,void 0,(function(){var t,n,_,i;return S(this,(function(r){switch(r.label){case 0:return t=this._logger.createTraceId(),this._logger.info(g.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(g.L_CALL_SESSION_CHANGE_AUDIO_DEVICE_R,"errorCode: ".concat(R.PARAM_ERROR),t),[2,{code:R.PARAM_ERROR}]);case 1:return(i=r.sent().code)!==l.SUCCESS?(this._logger.error(g.L_CALL_SESSION_CHANGE_AUDIO_DEVICE_R,"errorCode: ".concat(b(i)),t),[2,{code:b(i)}]):(this._logger.info(g.L_CALL_SESSION_CHANGE_AUDIO_DEVICE_R,"success",t),[2,{code:b(i)}])}}))}))}}),Object.defineProperty(n.prototype,"invite",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n){return void 0===n&&(n={}),T(this,void 0,void 0,(function(){var _,i,r,o,a;return S(this,(function(E){switch(E.label){case 0:return _=this._logger.createTraceId(),this._logger.info(g.L_CALL_SESSION_INVITE_T,JSON.stringify({userIds:e,options:n}),_),i=n.extra,r=JSON.stringify({callLibExtra:i,targetId:this._targetId,channelId:this._channelId,conversationType:t.GROUP}),o=this._options.callPushConfig||n.pushConfig,[4,this._callPlusClient.invite(e,o,r)];case 1:return(a=E.sent().code)!==l.SUCCESS?(this._logger.error(g.L_CALL_SESSION_INVITE_R,"errorCode: ".concat(b(a)),_),[2,{code:b(a)}]):(this._logger.info(g.L_CALL_SESSION_INVITE_R,"success",_),[2,{code:b(a)}])}}))}))}}),Object.defineProperty(n.prototype,"accept",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return T(this,void 0,void 0,(function(){var t,n,_,i,r,o;return S(this,(function(a){switch(a.label){case 0:return t=this._logger.createTraceId(),this._logger.info(g.L_CALL_SESSION_ACCEPT_T,JSON.stringify(e),t),e&&(n=e.audio,_=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==_?void 0:_.cameraId)&&this._videoConfigBuilder.setDefaultCameraId(_.cameraId),(null==_?void 0:_.frameRate)&&this._videoConfigBuilder.setFrameRate(_.frameRate),(null==_?void 0:_.resolution)&&this._videoConfigBuilder.setVideoResolution(_.resolution)),i=this._audioConfigBuilder.build(),r=this._videoConfigBuilder.build(),this._callPlusClient.setAudioConfig(i),this._callPlusClient.setVideoConfig(r),[4,this._callPlusClient.accept(this._callId,this._options.callPushConfig)];case 1:return(o=a.sent().code)!==l.SUCCESS?(this._logger.error(g.L_CALL_SESSION_ACCEPT_R,"errorCode: ".concat(b(o)),t),[2,{code:b(o)}]):(this._logger.info(g.L_CALL_SESSION_ACCEPT_R,"success",t),[2,{code:b(o)}])}}))}))}}),Object.defineProperty(n.prototype,"hungup",{enumerable:!1,configurable:!0,writable:!0,value:function(){return T(this,void 0,void 0,(function(){var e,t;return S(this,(function(n){switch(n.label){case 0:return e=this._logger.createTraceId(),this._logger.info(g.L_CALL_SESSION_HUNGUP_T,"",e),this.emit(v.INNER_ON_SELF_HANGUP),[4,this._callPlusClient.hangup(this._callId,this._options.hangupPushConfig)];case 1:return(t=n.sent().code)!==l.SUCCESS?this._logger.error(g.L_CALL_SESSION_HUNGUP_R,"errorCode: ".concat(b(t)),e):this._logger.info(g.L_CALL_SESSION_HUNGUP_R,"success",e),[2,{code:b(t)}]}}))}))}}),Object.defineProperty(n.prototype,"descendAbility",{enumerable:!1,configurable:!0,writable:!0,value:function(){return T(this,void 0,void 0,(function(){var e,t,n,_,i,r=this;return S(this,(function(o){switch(o.label){case 0:return e=this._logger.createTraceId(),this._logger.info(g.L_CALL_SESSION_DESCEND_ABILITY_T,"",e),[4,this._callPlusClient.requestChangeMediaType(s.AUDIO)];case 1:return t=o.sent(),n=t.code,_=t.transactionId,n!==l.SUCCESS?(this._logger.error(g.L_CALL_SESSION_DESCEND_ABILITY_R,"errorCode: ".concat(b(n)),e),[2,{code:b(n)}]):[4,new Promise((function(e){r._descendResolve[_]=e}))];case 2:return i=o.sent(),this._logger.info(g.L_CALL_SESSION_DESCEND_ABILITY_R,"transactionId: ".concat(_),e),[2,{code:i.code}]}}))}))}}),Object.defineProperty(n.prototype,"disableVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return T(this,void 0,void 0,(function(){var e,t;return S(this,(function(n){switch(n.label){case 0:return e=this._logger.createTraceId(),this._logger.info(g.L_CALL_SESSION_DISABLE_VIDEO_TRACK_T,"",e),[4,this._callPlusClient.stopCamera()];case 1:return(t=n.sent().code)!==l.SUCCESS?(this._logger.error(g.L_CALL_SESSION_DISABLE_VIDEO_TRACK_R,"errorCode: ".concat(b(t)),e),[2,{code:b(t)}]):(this._logger.info(g.L_CALL_SESSION_DISABLE_VIDEO_TRACK_R,"success",e),[2,{code:b(t)}])}}))}))}}),Object.defineProperty(n.prototype,"enableVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return T(this,void 0,void 0,(function(){var e,t;return S(this,(function(n){switch(n.label){case 0:return e=this._logger.createTraceId(),this._logger.info(g.L_CALL_SESSION_ENABLE_VIDEO_TRACK_T,"",e),[4,this._callPlusClient.startCamera()];case 1:return(t=n.sent().code)!==l.SUCCESS?(this._logger.error(g.L_CALL_SESSION_ENABLE_VIDEO_TRACK_R,"errorCode: ".concat(b(t)),e),[2,{code:b(t)}]):(this._logger.info(g.L_CALL_SESSION_ENABLE_VIDEO_TRACK_R,"success",e),[2,{code:b(t)}])}}))}))}}),Object.defineProperty(n.prototype,"disableAudioTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return T(this,void 0,void 0,(function(){var e,t;return S(this,(function(n){switch(n.label){case 0:return e=this._logger.createTraceId(),this._logger.info(g.L_CALL_SESSION_DISABLE_AUDIO_TRACK_T,"",e),[4,this._callPlusClient.stopMicrophone()];case 1:return(t=n.sent().code)!==l.SUCCESS?(this._logger.error(g.L_CALL_SESSION_DISABLE_AUDIO_TRACK_R,"errorCode: ".concat(b(t)),e),[2,{code:b(t)}]):(this._logger.info(g.L_CALL_SESSION_DISABLE_AUDIO_TRACK_R,"success",e),[2,{code:b(t)}])}}))}))}}),Object.defineProperty(n.prototype,"enableAudioTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return T(this,void 0,void 0,(function(){var e,t;return S(this,(function(n){switch(n.label){case 0:return e=this._logger.createTraceId(),this._logger.info(g.L_CALL_SESSION_ENABLE_AUDIO_TRACK_T,"",e),[4,this._callPlusClient.startMicrophone()];case 1:return(t=n.sent().code)!==l.SUCCESS?(this._logger.error(g.L_CALL_SESSION_ENABLE_AUDIO_TRACK_R,"errorCode: ".concat(b(t)),e),[2,{code:b(t)}]):(this._logger.info(g.L_CALL_SESSION_ENABLE_AUDIO_TRACK_R,"success",e),[2,{code:b(t)}])}}))}))}}),Object.defineProperty(n.prototype,"getSessionId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._callId}}),Object.defineProperty(n.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(n.prototype,"getTargetId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._targetId}}),Object.defineProperty(n.prototype,"getChannelId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._channelId}}),Object.defineProperty(n.prototype,"getConversationType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._callType}}),Object.defineProperty(n.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(n.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 O.NONE;var n=null==t?void 0:t.getUserList().filter((function(t){return t.userId===e}))[0].state;return p(n)}}),Object.defineProperty(n.prototype,"getState",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._callPlusClient.getCurrentCallSession();return function(e){var t=null;switch(e){case a.IDLE:t=C.END;break;case a.CALLING:case a.INVITED:case a.RINGING:case a.BUSYLINE_RINGING:case a.BUSYLINE_WAIT:t=C.WAITING;break;case a.CONNECTING:case a.ONCALL:t=C.KEEPING;break;case a.ENDED:case a.NOANSWER:case a.MISSED:case a.CANCELED:case a.DECLINED:case a.ERROR:default:t=C.END}return t}(this._callId===(null==e?void 0:e.getCallId())?null==e?void 0:e.getState():a.ENDED)}}),Object.defineProperty(n.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(n.prototype,"getMediaType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._mediaType===s.AUDIO?I.AUDIO:I.AUDIO_VIDEO}}),Object.defineProperty(n.prototype,"__innerEndTranction",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._mediaType=e,this._descendResolve[t]&&(this._descendResolve[t]({code:R.SUCCESS}),delete this._descendResolve[t])}}),n}(e),y=function(){function e(e,t,n){Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:t}),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 D(t),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===_&&(_="{}"),T(this,void 0,void 0,(function(){var i,r,o;return S(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()===s.AUDIO?I.AUDIO:I.AUDIO_VIDEO,r=n.getCallType(),o=r===c.MULTI?t.GROUP:t.PRIVATE,e._session=new U(i,e._callPlusClient,e._channelId,e._targetId,o,n.getMediaType(),e._context,e._logger,{callPushConfig:e._callPushConfig,hangupPushConfig:e._hangupPushConfig}),e._session.on(v.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(v.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,r){var a,l,s;return T(this,void 0,void 0,(function(){var u,I,R,O,C,L,d,N,T;return S(this,(function(S){return u={userId:n},I=[o.IDLE,o.DECLINED,o.MISSED,o.NO_ANSWER].includes(i),e._listener?(i===o.RINGING&&e._reportAppEventModule.onRinging(u,e._session),i===o.CONNECTING&&e._reportAppEventModule.onAccept(u,e._session),I&&e._reportAppEventModule.onHungup(u,h(r,e._isSelfHangup),e._session)):(i===o.RINGING&&(null===(a=e._session)||void 0===a||a.emit(v.INNER_ON_RINGING,u,e._session)),i===o.CONNECTING&&(null===(l=e._session)||void 0===l||l.emit(v.INNER_ON_ACCEPT,u,e._session)),I&&(null===(s=e._session)||void 0===s||s.emit(v.INNER_ON_HANGUP,u,h(r,e._isSelfHangup),e._session))),R=e._callPlusClient.getCurrentCallSession(),O=null==R?void 0:R.getCallType(),C=null==R?void 0:R.getUserList(),L=null==C?void 0:C.filter((function(t){return t.userId===e._context.getCurrentId()}))[0],d=null==C?void 0:C.filter((function(t){return t.userId!==e._context.getCurrentId()})),N=null==d?void 0:d.every((function(e){return e.state===o.IDLE})),T=(null==L?void 0:L.state)===o.ONCALL&&N,I&&O===c.MULTI&&T&&(e._callPlusClient.hangup(),_[t]=r===E.MISSED?E.NO_ANSWER:r,e._isSelfHangup=!1),[2]}))}))},onCallEnded:function(t,r){return T(this,void 0,void 0,(function(){var o,a,l;return S(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]?h(_[a],e._isSelfHangup):h(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 T(this,void 0,void 0,(function(){var i;return S(this,(function(r){return i=n===s.AUDIO?I.AUDIO:I.AUDIO_VIDEO,e._listener?e._reportAppEventModule.onTrackReady(t,i,e._session):null===(_=e._session)||void 0===_||_.emit(v.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(v.INNER_ON_TRACK_SUBSCRIBE_FAIL,n,e._session)},onRemoteCameraStateChanged:function(t,n,_){var i,r={userId:n,muted:_,kind:"video",trackId:"".concat(n,"_RongCloudRTC_1")};e._listener?e._reportAppEventModule.onVideoMuteChange(r,e._session):null===(i=e._session)||void 0===i||i.emit(v.INNER_ON_VIDEO_MUTE_CHANGE,r,e._session)},onRemoteMicrophoneStateChanged:function(t,n,_){var i,r={userId:n,muted:_,kind:"audio",trackId:"".concat(n,"_RongCloudRTC_0")};e._listener?e._reportAppEventModule.onAudioMuteChange(r,e._session):null===(i=e._session)||void 0===i||i.emit(v.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===I.AUDIO_VIDEO&&t.mediaType===s.AUDIO&&t.code===u.SERVER_ALLOW_MEDIA_TYPE){var i={userId:t.userId};e._mediaType=I.AUDIO,null===(n=e._session)||void 0===n||n.__innerEndTranction(s.AUDIO,t.transactionId),e._listener?e._reportAppEventModule.onMediaModify(i,e._mediaType,e._session):null===(_=e._session)||void 0===_||_.emit(v.INNER_ON_MEDIA_MODIFY,i,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.error(g.L_CALL_CLIENT_REGISTER_USER_INFO_O,"`RCCallClient.registerUserInfo` has been deprecated.")}}),Object.defineProperty(e.prototype,"startCrossCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return T(this,void 0,void 0,(function(){return S(this,(function(e){return this._logger.error(g.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?I.AUDIO:r,a=n.listener,E=n.constraints,u=n.channelId,O=void 0===u?"":u,C=n.extra,L=void 0===C?"":C,d=n.bitrate;return T(this,void 0,void 0,(function(){var n,r,u,C,N,T,A,f,p,h,D,P,y,M,m=this;return S(this,(function(S){switch(S.label){case 0:return n=this._logger.createTraceId(),this._logger.info(g.L_CALL_CLIENT_CALL_T,JSON.stringify({targetId:_,userIds:i,mediaType:o,listener:Object.keys(a),constraints:E,channelId:O,extra:L,bitrate:d}),n),E&&(r=E.audio,u=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==u?void 0:u.cameraId)&&this._videoConfigBuilder.setDefaultCameraId(u.cameraId),(null==u?void 0:u.frameRate)&&this._videoConfigBuilder.setFrameRate(u.frameRate),(null==u?void 0:u.resolution)&&this._videoConfigBuilder.setVideoResolution(u.resolution)),d&&(r=d.audio,u=d.video,r&&this._audioConfigBuilder.setBitrate(r,r),u&&this._videoConfigBuilder.setBitrate(u.min,u.max)),C=this._audioConfigBuilder.build(),N=this._videoConfigBuilder.build(),this._callPlusClient.setAudioConfig(C),this._callPlusClient.setVideoConfig(N),this._targetId=_,this._listener=a,this._reportAppEventModule.registerEventListener(a),this._mediaType=o,T=o===I.AUDIO?s.AUDIO:s.AUDIO_VIDEO,A=e?c.SINGLE:c.MULTI,f=e?[_]:i,p=e?t.PRIVATE:t.GROUP,h=e?this._context.getCurrentId():_,D=JSON.stringify({callLibExtra:L,channelId:O,targetId:h,conversationType:p}),[4,this._callPlusClient.startCall(f,A,T,this._callPushConfig,D)];case 1:return P=S.sent(),y=P.code,M=P.callId,y!==l.SUCCESS?(this._logger.error(g.L_CALL_CLIENT_CALL_R,"errorCode: ".concat(b(y)),n),[2,{code:b(y)}]):(this._logger.info(g.L_CALL_CLIENT_CALL_R,"success",n),this._session=new U(M,this._callPlusClient,this._channelId,this._targetId,p,T,this._context,this._logger,{callPushConfig:this._callPushConfig,hangupPushConfig:this._hangupPushConfig}),this._session.on(v.INNER_ON_SELF_HANGUP,(function(){m._isSelfHangup=!0})),[2,{code:R.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?I.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 T(this,void 0,void 0,(function(){return S(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===_?I.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 T(this,void 0,void 0,(function(){return S(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 T(this,void 0,void 0,(function(){var e,t,_;return S(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(g.L_CALL_CLIENT_GET_JOINED_ROOM_INFO_E,t),[2,{code:R.QUERY_JOINED_USER_INFO_ERROR}]):[2,{code:R.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(g.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={})),_.add("callpluswrapper","2.1.5");var M={tag:"CallPlusWrapper",verify:function(e){return"browser"===e.tag},setup:function(e,t,n){var _=e.createLogger("CWrapper","RTC"),o=i(n.logOutputLevel)?r.WARN:n.logOutputLevel;return _.setOutputLevel(o),_.warn(g.L_CALL_PLUS_WRAPPER_INIT_O,"CallPlus Version: ".concat("2.1.5",", Commit: ").concat("0a419bc9f0f5a38e552a794bb4799310bd46cbd8")),new y(e,_,n)}};export{y as RCCallClient,d as RCCallEndReason,R as RCCallErrorCode,P as RCCallLanguage,I as RCCallMediaType,U as RCCallSession,C as RCCallSessionState,O as RCCallUserState,M 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 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_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)}}),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){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){return void 0===t&&(t={}),_(this,void 0,void 0,(function(){var l,n,r,o,i;return C(this,(function(_){switch(_.label){case 0:return l=this._logger.createTraceId(),this._logger.info(u.L_CALL_SESSION_INVITE_T,JSON.stringify({userIds:e,options:t}),l),n=t.extra,r=JSON.stringify({callLibExtra:n,targetId:this._targetId,channelId:this._channelId,conversationType:a.ConversationType.GROUP}),o=this._options.callPushConfig||t.pushConfig,[4,this._callPlusClient.invite(e,o,r)];case 1:return(i=_.sent().code)!==s.RCCallPlusCode.SUCCESS?(this._logger.error(u.L_CALL_SESSION_INVITE_R,"errorCode: ".concat(d(i)),l),[2,{code:d(i)}]):(this._logger.info(u.L_CALL_SESSION_INVITE_R,"success",l),[2,{code:d(i)}])}}))}))}}),Object.defineProperty(t.prototype,"accept",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return _(this,void 0,void 0,(function(){var t,l,n,r,o,a;return C(this,(function(i){switch(i.label){case 0:return t=this._logger.createTraceId(),this._logger.info(u.L_CALL_SESSION_ACCEPT_T,JSON.stringify(e),t),e&&(l=e.audio,n=e.video,(null==l?void 0:l.micphoneId)&&this._audioConfigBuilder.setDefaultMicrophoneId(l.micphoneId),(null==l?void 0:l.sampleRate)&&this._audioConfigBuilder.setSampleRate(l.sampleRate),(null==n?void 0:n.cameraId)&&this._videoConfigBuilder.setDefaultCameraId(n.cameraId),(null==n?void 0:n.frameRate)&&this._videoConfigBuilder.setFrameRate(n.frameRate),(null==n?void 0:n.resolution)&&this._videoConfigBuilder.setVideoResolution(n.resolution)),r=this._audioConfigBuilder.build(),o=this._videoConfigBuilder.build(),this._callPlusClient.setAudioConfig(r),this._callPlusClient.setVideoConfig(o),[4,this._callPlusClient.accept(this._callId,this._options.callPushConfig)];case 1:return(a=i.sent().code)!==s.RCCallPlusCode.SUCCESS?(this._logger.error(u.L_CALL_SESSION_ACCEPT_R,"errorCode: ".concat(d(a)),t),[2,{code:d(a)}]):(this._logger.info(u.L_CALL_SESSION_ACCEPT_R,"success",t),[2,{code:d(a)}])}}))}))}}),Object.defineProperty(t.prototype,"hungup",{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_HUNGUP_T,"",e),this.emit(O.INNER_ON_SELF_HANGUP),[4,this._callPlusClient.hangup(this._callId,this._options.hangupPushConfig)];case 1:return(t=l.sent().code)!==s.RCCallPlusCode.SUCCESS?this._logger.error(u.L_CALL_SESSION_HUNGUP_R,"errorCode: ".concat(d(t)),e):this._logger.info(u.L_CALL_SESSION_HUNGUP_R,"success",e),[2,{code:d(t)}]}}))}))}}),Object.defineProperty(t.prototype,"descendAbility",{enumerable:!1,configurable:!0,writable:!0,value:function(){return _(this,void 0,void 0,(function(){var e,t,l,n,r,o=this;return C(this,(function(a){switch(a.label){case 0:return e=this._logger.createTraceId(),this._logger.info(u.L_CALL_SESSION_DESCEND_ABILITY_T,"",e),[4,this._callPlusClient.requestChangeMediaType(s.RCCallPlusMediaType.AUDIO)];case 1:return t=a.sent(),l=t.code,n=t.transactionId,l!==s.RCCallPlusCode.SUCCESS?(this._logger.error(u.L_CALL_SESSION_DESCEND_ABILITY_R,"errorCode: ".concat(d(l)),e),[2,{code:d(l)}]):[4,new Promise((function(e){o._descendResolve[n]=e}))];case 2:return r=a.sent(),this._logger.info(u.L_CALL_SESSION_DESCEND_ABILITY_R,"transactionId: ".concat(n),e),[2,{code:r.code}]}}))}))}}),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}}),Object.defineProperty(t.prototype,"__innerEndTranction",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._mediaType=e,this._descendResolve[t]&&(this._descendResolve[t]({code:exports.RCCallErrorCode.SUCCESS}),delete this._descendResolve[t])}}),t}(a.EventEmitter),p=function(){function e(e,t,l){Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_options",{enumerable:!0,configurable:!0,writable:!0,value:l}),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=l.callPlusClient,this._reportAppEventModule=new L(t),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,{callPushConfig:e._callPushConfig,hangupPushConfig:e._hangupPushConfig}),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:"video",trackId:"".concat(l,"_RongCloudRTC_1")};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:"audio",trackId:"".concat(l,"_RongCloudRTC_0")};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,n;if(e._mediaType===exports.RCCallMediaType.AUDIO_VIDEO&&t.mediaType===s.RCCallPlusMediaType.AUDIO&&t.code===s.RCCallPlusMediaTypeChangeResult.SERVER_ALLOW_MEDIA_TYPE){var r={userId:t.userId};e._mediaType=exports.RCCallMediaType.AUDIO,null===(l=e._session)||void 0===l||l.__innerEndTranction(s.RCCallPlusMediaType.AUDIO,t.transactionId),e._listener?e._reportAppEventModule.onMediaModify(r,e._mediaType,e._session):null===(n=e._session)||void 0===n||n.emit(O.INNER_ON_MEDIA_MODIFY,r,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.error(u.L_CALL_CLIENT_REGISTER_USER_INFO_O,"`RCCallClient.registerUserInfo` has been deprecated.")}}),Object.defineProperty(e.prototype,"startCrossCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return _(this,void 0,void 0,(function(){return C(this,(function(e){return this._logger.error(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,U=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?a.ConversationType.PRIVATE:a.ConversationType.GROUP,g=e?this._context.getCurrentId():l,b=JSON.stringify({callLibExtra:L,channelId:c,targetId:g,conversationType:f}),[4,this._callPlusClient.startCall(A,T,p,this._callPushConfig,b)];case 1:return P=C.sent(),h=P.code,v=P.callId,h!==s.RCCallPlusCode.SUCCESS?(this._logger.error(u.L_CALL_CLIENT_CALL_R,"errorCode: ".concat(d(h)),t),[2,{code:d(h)}]):(this._logger.info(u.L_CALL_CLIENT_CALL_R,"success",t),this._session=new N(v,this._callPlusClient,this._channelId,this._targetId,f,p,this._context,this._logger,{callPushConfig:this._callPushConfig,hangupPushConfig:this._hangupPushConfig}),this._session.on(O.INNER_ON_SELF_HANGUP,(function(){U._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",a.VersionManage.add("callpluswrapper","2.1.5-alpha.2");var T={tag:"CallPlusWrapper",verify:function(e){return"browser"===e.tag},setup:function(e,t,l){var n=e.createLogger("CWrapper","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.5-alpha.2",", Commit: ").concat("c8e5a05b524058da963f8ba30cb0f23015ae64cb")),new p(e,n,l)}};exports.RCCallClient=p,exports.RCCallSession=N,exports.installer=T;
|
|
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_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)}}),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){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){return void 0===t&&(t={}),_(this,void 0,void 0,(function(){var l,n,r,o,i;return C(this,(function(_){switch(_.label){case 0:return l=this._logger.createTraceId(),this._logger.info(u.L_CALL_SESSION_INVITE_T,JSON.stringify({userIds:e,options:t}),l),n=t.extra,r=JSON.stringify({callLibExtra:n,targetId:this._targetId,channelId:this._channelId,conversationType:a.ConversationType.GROUP}),o=this._options.callPushConfig||t.pushConfig,[4,this._callPlusClient.invite(e,o,r)];case 1:return(i=_.sent().code)!==s.RCCallPlusCode.SUCCESS?(this._logger.error(u.L_CALL_SESSION_INVITE_R,"errorCode: ".concat(d(i)),l),[2,{code:d(i)}]):(this._logger.info(u.L_CALL_SESSION_INVITE_R,"success",l),[2,{code:d(i)}])}}))}))}}),Object.defineProperty(t.prototype,"accept",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return _(this,void 0,void 0,(function(){var t,l,n,r,o,a;return C(this,(function(i){switch(i.label){case 0:return t=this._logger.createTraceId(),this._logger.info(u.L_CALL_SESSION_ACCEPT_T,JSON.stringify(e),t),e&&(l=e.audio,n=e.video,(null==l?void 0:l.micphoneId)&&this._audioConfigBuilder.setDefaultMicrophoneId(l.micphoneId),(null==l?void 0:l.sampleRate)&&this._audioConfigBuilder.setSampleRate(l.sampleRate),(null==n?void 0:n.cameraId)&&this._videoConfigBuilder.setDefaultCameraId(n.cameraId),(null==n?void 0:n.frameRate)&&this._videoConfigBuilder.setFrameRate(n.frameRate),(null==n?void 0:n.resolution)&&this._videoConfigBuilder.setVideoResolution(n.resolution)),r=this._audioConfigBuilder.build(),o=this._videoConfigBuilder.build(),this._callPlusClient.setAudioConfig(r),this._callPlusClient.setVideoConfig(o),[4,this._callPlusClient.accept(this._callId,this._options.callPushConfig)];case 1:return(a=i.sent().code)!==s.RCCallPlusCode.SUCCESS?(this._logger.error(u.L_CALL_SESSION_ACCEPT_R,"errorCode: ".concat(d(a)),t),[2,{code:d(a)}]):(this._logger.info(u.L_CALL_SESSION_ACCEPT_R,"success",t),[2,{code:d(a)}])}}))}))}}),Object.defineProperty(t.prototype,"hungup",{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_HUNGUP_T,"",e),this.emit(O.INNER_ON_SELF_HANGUP),[4,this._callPlusClient.hangup(this._callId,this._options.hangupPushConfig)];case 1:return(t=l.sent().code)!==s.RCCallPlusCode.SUCCESS?this._logger.error(u.L_CALL_SESSION_HUNGUP_R,"errorCode: ".concat(d(t)),e):this._logger.info(u.L_CALL_SESSION_HUNGUP_R,"success",e),[2,{code:d(t)}]}}))}))}}),Object.defineProperty(t.prototype,"descendAbility",{enumerable:!1,configurable:!0,writable:!0,value:function(){return _(this,void 0,void 0,(function(){var e,t,l,n,r,o=this;return C(this,(function(a){switch(a.label){case 0:return e=this._logger.createTraceId(),this._logger.info(u.L_CALL_SESSION_DESCEND_ABILITY_T,"",e),[4,this._callPlusClient.requestChangeMediaType(s.RCCallPlusMediaType.AUDIO)];case 1:return t=a.sent(),l=t.code,n=t.transactionId,l!==s.RCCallPlusCode.SUCCESS?(this._logger.error(u.L_CALL_SESSION_DESCEND_ABILITY_R,"errorCode: ".concat(d(l)),e),[2,{code:d(l)}]):[4,new Promise((function(e){o._descendResolve[n]=e}))];case 2:return r=a.sent(),this._logger.info(u.L_CALL_SESSION_DESCEND_ABILITY_R,"transactionId: ".concat(n),e),[2,{code:r.code}]}}))}))}}),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}}),Object.defineProperty(t.prototype,"__innerEndTranction",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._mediaType=e,this._descendResolve[t]&&(this._descendResolve[t]({code:exports.RCCallErrorCode.SUCCESS}),delete this._descendResolve[t])}}),t}(a.EventEmitter),p=function(){function e(e,t,l){Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_options",{enumerable:!0,configurable:!0,writable:!0,value:l}),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=l.callPlusClient,this._reportAppEventModule=new L(t),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,{callPushConfig:e._callPushConfig,hangupPushConfig:e._hangupPushConfig}),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:"video",trackId:"".concat(l,"_RongCloudRTC_1")};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:"audio",trackId:"".concat(l,"_RongCloudRTC_0")};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,n;if(e._mediaType===exports.RCCallMediaType.AUDIO_VIDEO&&t.mediaType===s.RCCallPlusMediaType.AUDIO&&t.code===s.RCCallPlusMediaTypeChangeResult.SERVER_ALLOW_MEDIA_TYPE){var r={userId:t.userId};e._mediaType=exports.RCCallMediaType.AUDIO,null===(l=e._session)||void 0===l||l.__innerEndTranction(s.RCCallPlusMediaType.AUDIO,t.transactionId),e._listener?e._reportAppEventModule.onMediaModify(r,e._mediaType,e._session):null===(n=e._session)||void 0===n||n.emit(O.INNER_ON_MEDIA_MODIFY,r,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.error(u.L_CALL_CLIENT_REGISTER_USER_INFO_O,"`RCCallClient.registerUserInfo` has been deprecated.")}}),Object.defineProperty(e.prototype,"startCrossCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return _(this,void 0,void 0,(function(){return C(this,(function(e){return this._logger.error(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,U=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?a.ConversationType.PRIVATE:a.ConversationType.GROUP,g=e?this._context.getCurrentId():l,b=JSON.stringify({callLibExtra:L,channelId:c,targetId:g,conversationType:f}),[4,this._callPlusClient.startCall(A,T,p,this._callPushConfig,b)];case 1:return P=C.sent(),h=P.code,v=P.callId,h!==s.RCCallPlusCode.SUCCESS?(this._logger.error(u.L_CALL_CLIENT_CALL_R,"errorCode: ".concat(d(h)),t),[2,{code:d(h)}]):(this._logger.info(u.L_CALL_CLIENT_CALL_R,"success",t),this._session=new N(v,this._callPlusClient,this._channelId,this._targetId,f,p,this._context,this._logger,{callPushConfig:this._callPushConfig,hangupPushConfig:this._hangupPushConfig}),this._session.on(O.INNER_ON_SELF_HANGUP,(function(){U._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",a.VersionManage.add("callpluswrapper","2.1.5");var T={tag:"CallPlusWrapper",verify:function(e){return"browser"===e.tag},setup:function(e,t,l){var n=e.createLogger("CWrapper","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.5",", Commit: ").concat("0a419bc9f0f5a38e552a794bb4799310bd46cbd8")),new p(e,n,l)}};exports.RCCallClient=p,exports.RCCallSession=N,exports.installer=T;
|