TUICallObserver
TUICallObserver APIs
TUICallObserver
is the callback class of TUICallEngine
. You can use it to listen for events.Overview
API | Description |
An error occurred during the call. | |
A call was received. | |
The call was canceled. | |
The call was connected. | |
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
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.
- (void)onError:(int)code message:(NSString * _Nullable)message;
The parameters are described below:
Parameter | Type | Description |
code | int | The error code. |
message | NSString | 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.
- (void)onCallReceived:(NSString *)callerId calleeIdList:(NSArray<NSString *> *)calleeIdList groupId:(NSString * _Nullable)groupId callMediaType:(TUICallMediaType)callMediaType userData:(NSString * _Nullable)userData
The parameters are described below:
Parameter | Type | Description |
callerId | NSString | The user ID of the inviter. |
calleeIdList | NSArray | The invitee list. |
groupId | NSString | The group ID. |
callMediaType | The call type, which can be video or audio. | |
userData | NSString | User-added extended fields.,Please refer to: |
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).
- (void)onCallCancelled:(NSString *)callerId;
The parameters are described below:
Parameter | Type | Description |
callerId | NSString | 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.
- (void)onCallBegin:(TUIRoomId *)roomId callMediaType:(TUICallMediaType)callMediaType callRole:(TUICallRole)callRole;
The parameters are described below:
Parameter | Type | Description |
roomId | The room ID. | |
callMediaType | The call type, which can be video or audio. | |
callRole | 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.
- (void)onCallEnd:(TUIRoomId *)roomId callMediaType:(TUICallMediaType)callMediaType callRole:(TUICallRole)callRole totalTime:(float)totalTime;
The parameters are described below:
Parameter | Type | Description |
roomId | The room ID. | |
callMediaType | The call type, which can be video or audio. | |
callRole | The role, which can be caller or callee. | |
totalTime | float | The call duration. |
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.
- (void)onCallMediaTypeChanged:(TUICallMediaType)oldCallMediaType newCallMediaType:(TUICallMediaType)newCallMediaType;
The parameters are described below:
Parameter | Type | Description |
oldCallMediaType | The call type before the change. | |
newCallMediaType | The call type after the change. |
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.
- (void)onUserReject:(NSString *)userId;
The parameters are described below:
Parameter | Type | Description |
userId | NSString | The user ID of the invitee who rejected the call. |
onUserNoResponse
A user did not respond.
- (void)onUserNoResponse:(NSString *)userId;
The parameters are described below:
Parameter | Type | Description |
userId | NSString | The user ID of the invitee who did not answer. |
onUserLineBusy
A user is busy.
- (void)onUserLineBusy:(NSString *)userId;
The parameters are described below:
Parameter | Type | Description |
userId | NSString | The user ID of the invitee who is busy. |
onUserJoin
A user joined the call.
- (void)onUserJoin:(NSString *)userId;
The parameters are described below:
Parameter | Type | Description |
userId | NSString | The ID of the user who joined the call. |
onUserLeave
A user left the call.
- (void)onUserLeave:(NSString *)userId;
The parameters are described below:
Parameter | Type | Description |
userId | NSString | The ID of the user who left the call. |
onUserAudioAvailable
Whether a user is sending audio.
- (void)onUserAudioAvailable:(NSString *)userId isAudioAvailable:(BOOL)isAudioAvailable;
The parameters are described below:
Parameter | Type | Description |
userId | NSString | The user ID. |
isAudioAvailable | BOOL | Whether the user has audio. |
onUserVideoAvailable
Whether a user is sending video.
- (void)onUserVideoAvailable:(NSString *)userId isVideoAvailable:(BOOL)isVideoAvailable;
The parameters are described below:
Parameter | Type | Description |
userId | NSString | The user ID. |
isVideoAvailable | BOOL | Whether the user has video. |
onUserVoiceVolumeChanged
The volumes of all users.
- (void)onUserVoiceVolumeChanged:(NSDictionary <NSString *, NSNumber *> *)volumeMap;
The parameters are described below:
Parameter | Type | Description |
volumeMap | NSDictionary | The volume table, which includes the volume of each user ( userId ). Value range: 0-100. |
onUserNetworkQualityChanged
The network quality of all users.
- (void)onUserNetworkQualityChanged:(NSArray<TUINetworkQualityInfo *> *)networkQualityList;
The parameters are described below:
Parameter | Type | Description |
networkQualityList | NSArray | 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
init
again.- (void)onKickedOffline;
onUserSigExpired
The user sig is expired:At this time, you need to generate a new
userSig
, and then invoke init
again.- (void)onUserSigExpired;