接入侧需要监听处理的事件列表,详细如下:
Members
(static) ERROR
sdk内部发生了错误
Example
let onError = function(error) {
console.log(error)
};
tuiCallEngine.on(TUICallEvent.ERROR, onError);
(static) SDK_READY
SDK 进入 ready 状态时收到该回调
Example
let onSDKReady = function(event) {
console.log(event)
};
tuiCallEngine.on(TUICallEvent.SDK_READY, onSDKReady);
(static) ON_CALL_BEGIN
表示通话接通,主叫和被叫都可以收到,您可以通过监听这个事件来开启云端录制、内容审核等流程。
- 注意:支持 v1.4.6+ 版本。
Example
let handleOnCallBegin = function(event) {
console.log(event)
};
tuiCallEngine.on(TUICallEvent.ON_CALL_BEGIN, handleOnCallBegin);
(static) INVITED
被邀请进行通话
- 注意:后续计划废弃, 建议使用 ON_CALL_RECEIVED 事件。
Example
let handleNewInvitationReceived = function(event) {
console.log(event)
};
tuiCallEngine.on(TUICallEvent.INVITED, handleNewInvitationReceived);
(static) ON_CALL_RECEIVED
收到一个新的来电请求事件,被叫会收到,您可以通过监听这个事件,来决定是否显示通话接听界面。
- 注意:支持 v1.4.6+ 版本。
Example
let handleOnCallReceived = function(event) {
console.log(event)
};
tuiCallEngine.on(TUICallEvent.ON_CALL_RECEIVED, handleOnCallReceived);
(static) USER_ACCEPT
如果有用户接听,那么会收到此回调
Example
let handleUserAccept = function(event) {
console.log(event)
};
tuiCallEngine.on(TUICallEvent.USER_ACCEPT, handleUserAccept);
(static) USER_ENTER
如果有用户同意进入通话,那么会收到此回调
Example
let handleUserEnter = function(event) {
console.log(event)
};
tuiCallEngine.on(TUICallEvent.USER_ENTER, handleUserEnter);
(static) USER_LEAVE
如果有用户同意离开通话,那么会收到此回调
Example
let handleUserLeave = function(event) {
console.log(event)
};
tuiCallEngine.on(TUICallEvent.USER_LEAVE, handleUserLeave);
(static) REJECT
用户拒绝通话
- 在C2C通话中,只有发起方会收到拒绝回调 例如 A 邀请 B、C 进入通话,B拒绝,A可以收到该回调,但C不行
- 在IM群组通话中,所有被邀请人均能收到该回调 例如 A 邀请 B、C 进入通话,B拒绝,A、C均能收到该回调
Example
let handleInviteeReject = function(event) {
console.log(event)
};
tuiCallEngine.on(TUICallEvent.REJECT, handleInviteeReject);
(static) NO_RESP
邀请用户无应答
- 在C2C通话中,只有发起方会收到无人应答的回调 例如 A 邀请 B、C 进入通话,B不应答,A可以收到该回调,但C不行
- 在IM群组通话中,所有被邀请人均能收到该回调 例如 A 邀请 B、C 进入通话,B不应答,A、C均能收到该回调
Example
let handleNoResponse = function(event) {
console.log(event)
};
tuiCallEngine.on(TUICallEvent.NO_RESP, handleNoResponse);
(static) LINE_BUSY
邀请方忙线
Example
let handleLineBusy = function(event) {
console.log(event)
};
tuiCallEngine.on(TUICallEvent.LINE_BUSY, handleLineBusy);
(static) CALLING_CANCEL
作为被邀请方会收到,收到该回调说明本次通话被取消了
- 注意:后续计划废弃, 建议使用 ON_CALL_CANCELED 事件。
Example
let handleCallingCancel = function(event) {
console.log(event)
};
tuiCallEngine.on(TUICallEvent.CALLING_CANCEL, handleCallingCancel);
(static) ON_CALL_CANCELED
如果通话未建立,都会抛出该事件。您可以通过监听该事件来实现类似未接来电、重置 UI 状态等显示逻辑。
- 注意:支持 v1.4.6+ 版本。
Example
let handleOnCallCanceled = function(event) {
console.log(event)
};
tuiCallEngine.on(TUICallEvent.ON_CALL_CANCELED, handleOnCallCanceled);
(static) KICKED_OUT
重复登陆,收到该回调说明被踢出房间
Example
let handleOnKickedOut = function(event) {
console.log(event)
};
tuiCallEngine.on(TUICallEvent.KICKED_OUT, handleOnKickedOut);
(static) CALLING_TIMEOUT
作为被邀请方会收到,收到该回调说明本次通话超时未应答
Example
let handleCallingTimeout = function(event) {
console.log(event)
};
tuiCallEngine.on(TUICallEvent.CALLING_TIMEOUT, handleCallingTimeout);
(static) CALLING_END
收到该回调说明本次通话结束了
Example
let handleCallingEnd = function(event) {
console.log(event)
};
tuiCallEngine.on(TUICallEvent.CALLING_END, handleCallingEnd);
(static) USER_VIDEO_AVAILABLE
远端用户开启/关闭了摄像头, 会收到该回调
Example
let handleUserVideoChange = function(event) {
console.log(event)
};
tuiCallEngine.on(TUICallEvent.USER_VIDEO_AVAILABLE, handleUserVideoChange);
(static) USER_AUDIO_AVAILABLE
远端用户开启/关闭了麦克风, 会收到该回调
Example
let handleUserAudioChange = function(event) {
console.log(event)
};
tuiCallEngine.on(TUICallEvent.USER_AUDIO_AVAILABLE, handleUserAudioChange);
(static) USER_VOICE_VOLUME
远端用户说话音量调整, 会收到该回调
Example
let handleUserVoiceVolumeChange = function(event) {
console.log(event)
};
tuiCallEngine.on(TUICallEvent.USER_VOICE_VOLUME, handleUserVoiceVolumeChange);
(static) GROUP_CALL_INVITEE_LIST_UPDATE
群聊更新邀请列表收到该回调
Example
let handleGroupInviteeListUpdate = function(event) {
console.log(event)
};
tuiCallEngine.on(TUICallEvent.GROUP_CALL_INVITEE_LIST_UPDATE, handleGroupInviteeListUpdate);
(static) CALL_TYPE_CHANGED
通话类型切换收到该回调
Example
let handleCallTypeChanged = function({oldCallType, newCallType}) {
console.log(oldCallType, newCallType)
};
tuiCallEngine.on(TUICallEvent.CALL_TYPE_CHANGED, handleCallTypeChanged);
(static) DEVICED_UPDATED
设备列表更新
Example
let handleDeviceUpdated = function({ microphoneList, cameraList, currentMicrophone, currentCamera}) {
console.log(microphoneList, cameraList, currentMicrophone, currentCamera)
};
tuiCallEngine.on(TUICallEvent.DEVICED_UPDATED, handleDeviceUpdated);
(static) ON_USER_NETWORK_QUALITY_CHANGED
用户网络质量
Example
let handleOnUserNetworkQualityChanged = function(event) {
console.log(event.networkQualityList);
};
tuiCallEngine.on(TUICallEvent.ON_USER_NETWORK_QUALITY_CHANGED, handleOnUserNetworkQualityChanged);
(static) MESSAGE_SENT_BY_ME
用户本人消息发送
Example
let handleMessageSentByMe = function(event:any) {
console.log(event);
};
tuiCallEngine.on(TUICallEvent.MESSAGE_SENT_BY_ME, handleMessageSentByMe);