이 페이지는 현재 영어로만 제공되며 한국어 버전은 곧 제공될 예정입니다. 기다려 주셔서 감사드립니다.

TUICallEvent

You can listen to TUICallKit's corresponding events for prompts and other interactions.

Event Overview

API
Description
onError
A call occurred during the call.
A call invitation was received.
The call was canceled.
The call was connected.
onCallEnd
The call ended.
The call type changed.
A user declined the call.
A user didn't respond.
A user was busy.
A user joined the call.
A user left the call.
Whether a user had a video stream.
Whether a user had an audio stream.
The volume levels of all users.
The network quality of all users.
The current user was kicked offline.
The user sig is expired.

Details

Listen to events thrown by the native plugin via globalEvent.
const TUICallEngine = uni.requireNativePlugin('TencentCloud-TUICallKit-TUICallEngine');

onError

An error occurred.
Note
This callback indicates that the SDK encountered an unrecoverable error. Such errors must be listened for, and UI reminders should be sent to users if necessary.
TUICallEngine.addEventListener('onError', (res) => {
console.log('onError', JSON.stringify(res));
});
The parameters are described below:
Parameter
Type
Description
res
Object
callback parameter
res.code
Number
The error code.
res.msg
String
The error message.

onCallReceived

A call invitation was received. This callback is received by an invitee. You can listen for this event to determine whether to display the incoming call view.
TUICallEngine.addEventListener('onCallReceived', (res) => {
console.log('onCallReceived', JSON.stringify(res));
});
The parameters are described below:
Parameter
Type
Description
res
Object
callback parameter
res.callerId
String
The user ID of the inviter.
res.calleeIdList
Array<String>
The invitee list.
res.groupId
String
The group ID.
res.callMediaType
Number
Media type of the call, e.g., voice call (callMediaType = 1), video call (callMediaType = 2)
res.userData
String
User-added extended fields.

onCallCancelled

The call was canceled by the inviter or timed out. This callback is received by an invitee. You can listen for this event to determine whether to show a missed call message.
This indicates that the call was canceled by the caller, timed out by the callee, rejected by the callee, or the callee was busy. There are multiple scenarios involved. You can listen to this event to achieve UI logic such as missed calls and resetting UI status.
Call cancellation by the caller: The caller receives the callback (userId is himself); the callee receives the callback (userId is the ID of the caller)
Callee timeout: the caller will simultaneously receive the onUserNoResponse and onCallCancelled callbacks (userId is his own ID); the callee receives the onCallCancelled callback (userId is his own ID)
Callee rejection: The caller will simultaneously receive the onUserReject and onCallCancelled callbacks (userId is his own ID); the callee receives the onCallCancelled callback (userId is his own ID)
Callee busy: The caller will simultaneously receive the onUserLineBusy and onCallCancelled callbacks (userId is his own ID);
Abnormal interruption: The callee failed to receive the call ,he receives this callback (userId is his own ID).
TUICallEngine.addEventListener('onCallCancelled', (res) => {
console.log('onCallCancelled', res);
});
The parameters are described below:
Parameter
Type
Description
res
Object
callback parameter
res.userId
String
The user ID of the inviter.

onCallBegin

The call was connected. This callback is received by both the inviter and invitees. You can listen for this event to determine whether to start on-cloud recording, content moderation, or other tasks.
TUICallEngine.addEventListener('onCallBegin', (res) => {
console.log('onCallBegin', JSON.stringify(res));
});
The parameters are described below:
Parameter
Type
Description
res
Object
callback parameter
res.roomID
Number
The room ID.
res.callMediaType
Number
Media type of the call, e.g., voice call (callMediaType = 1), video call (callMediaType = 2)
res.callRole
Number
The role, which can be caller or callee.

onCallEnd

The call ended. This callback is received by both the inviter and invitees. You can listen for this event to determine when to display call information such as call duration and call type, or stop on-cloud recording.
TUICallEngine.addEventListener('onCallEnd', (res) => {
console.log('onCallEnd', JSON.stringify(res));
});
The parameters are described below:
Parameter
Type
Description
res
Object
callback parameter
res.roomID
Number
The room ID.
res.callMediaType
Number
Media type of the call, e.g., voice call (callMediaType = 1), video call (callMediaType = 2)
res.callRole
Number
The role, which can be caller or callee.
res.totalTime
Number
The call duration. unit: second
Note
Client-side callbacks are often lost when errors occur, for example, when the process is closed. If you need to measure the duration of a call for billing or other purposes, we recommend you use the RESTful API.

onCallMediaTypeChanged

The call type changed.
TUICallEngine.addEventListener('onCallMediaTypeChanged', (res) => {
console.log('onCallMediaTypeChanged', JSON.stringify(res));
});
The parameters are described below:
Parameter
Type
Description
res
Object
callback parameter
res.oldCallMediaType
Number
The call type before the change. eg. audio call(callMediaType = 1), video call(callMediaType = 2)
res.newCallMediaType
Number
The call type after the change. eg. audio call(callMediaType = 1), video call(callMediaType = 2)

onUserReject

The call was rejected. In a one-to-one call, only the inviter will receive this callback. In a group call, all invitees will receive this callback.
TUICallEngine.addEventListener('onUserReject', (res) => {
console.log('onUserReject', JSON.stringify(res));
});
The parameters are described below:
Parameter
Type
Description
res
Object
callback parameter
res.userId
String
The user ID of the invitee who rejected the call.

onUserNoResponse

A user did not respond.
TUICallEngine.addEventListener('onUserNoResponse', (res) => {
console.log('onUserNoResponse', JSON.stringify(res));
});
The parameters are described below:
Parameter
Type
Description
res
Object
callback parameter
res.userId
String
The user ID of the invitee who did not answer.

onUserLineBusy

A user is busy.
TUICallEngine.addEventListener('onUserLineBusy', (res) => {
console.log('onUserLineBusy', JSON.stringify(res));
});
The parameters are described below:
Parameter
Type
Description
res
Object
callback parameter
res.userId
String
The user ID of the invitee who is busy.

onUserJoin

A user joined the call.
TUICallEngine.addEventListener('onUserJoin', (res) => {
console.log('onUserJoin', JSON.stringify(res));
});
The parameters are described below:
Parameter
Type
Description
res
Object
callback parameter
res.userId
String
The ID of the user who joined the call.

onUserLeave

A user left the call.
TUICallEngine.addEventListener('onUserLeave', (res) => {
console.log('onUserLeave', JSON.stringify(res));
});
The parameters are described below:
Parameter
Type
Description
res
Object
callback parameter
res.userId
String
The ID of the user who left the call.

onUserVideoAvailable

Whether a user is sending video.
TUICallEngine.addEventListener('onUserVideoAvailable', (res) => {
console.log('onUserVideoAvailable', JSON.stringify(res));
});
The parameters are described below:
Parameter
Type
Description
res
Object
callback parameter
res.userId
String
The user ID.
res.isVideoAvailable
boolean
Whether the user has video.

onUserAudioAvailable

Whether a user is sending audio.
TUICallEngine.addEventListener('onUserAudioAvailable', (res) => {
console.log('onUserAudioAvailable', JSON.stringify(res));
});
The parameters are described below:
Parameter
Type
Description
res
Object
callback parameter
res.userId
String
The user ID.
res.isAudioAvailable
boolean
Whether the user has audio.

onUserVoiceVolumeChanged

The volumes of all users.
TUICallEngine.addEventListener('onUserVoiceVolumeChanged', (res) => {
console.log('onUserVoiceVolumeChanged', JSON.stringify(res));
});
The parameters are described below:
Parameter
Type
Description
res
Object
callback parameter
res.volumeMap
Map<String, Integer>
The volume table, which includes the volume of each user (userId). Value range: 0-100.

onUserNetworkQualityChanged

The network quality of all users.
TUICallEngine.addEventListener('onUserNetworkQualityChanged', (res) => {
console.log('onUserNetworkQualityChanged', JSON.stringify(res));
});
The parameters are described below:
Parameter
Type
Description
res
Object
callback parameter
res.networkQualityList
List
The current network conditions for all users (userId).

onKickedOffline

The current user was kicked offline:At this time, you can prompt the user with a UI message and then invoke login again.
TUICallEngine.addEventListener('onKickedOffline', (res) => {
console.log('onKickedOffline', JSON.stringify(res));
});

onUserSigExpired

The user sig is expired:At this time, you need to generate a new userSig, and then invoke loginagain.
TUICallEngine.addEventListener('onUserSigExpired', (res) => {
console.log('onUserSigExpired', JSON.stringify(res));
});