TUICalling
is an open-source class based on two closed-source SDKs: Tencent Cloud Real-Time Communication (TRTC) and Instant Messaging (IM). It supports one-to-one and group audio calls. For detailed instructions how to implement it, see Real-Time Audio Call (iOS).
TUICalling
API OverviewAPI | Description |
---|---|
sharedInstance | Gets a singleton. |
call | Sends call invitations by user ID. |
receiveAPNSCalled | Answers a call. |
setCallingListener | Sets the listener. |
setCallingBell | Sets the ringtone (preferably shorter than 30s). |
enableMuteMode | Enables/Disables the mute mode. |
enableCustomViewRoute | Enables/Disables custom views. |
TUICallingListener
API OverviewAPI | Description |
---|---|
shouldShowOnCallView | Callback of whether the answering view is displayed when there is an incoming call |
onCallStart | Callback for starting calling. This callback is triggered for both callers and callees. |
onCallEnd | Callback for ending a call. This callback is triggered for both callers and callees. |
onCallEvent | Call event callback |
Enumerated Type | Description |
---|---|
TUICallingTypeAudio | Audio call |
TUICallingTypeVideo | Video call |
Enumerated Type | Description |
---|---|
TUICallingRoleCall | Caller |
TTUICallingRoleCalled | Callee |
Enumerated Type | Description |
---|---|
TUICallingEventCallStart | The call started. |
TUICallingEventCallSucceed | The call was connected successfully. |
TUICallingEventCallEnd | The call ended. |
TUICallingEventCallFailed | The call failed. |
This API is used to get a singleton of the TUICallingManager
component.
+ (instancetype)shareInstance;
This API is used to send call invitations by user ID.
- (void)call:(NSArray<NSString *> *)userIDs type:(TUICallingType)type;
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
userIDs | NSArray | List of the user IDs of call participants |
type | TUICallingType | Call type: audio/video |
This API is used to answer a call.
- (void)receiveAPNSCalled:(NSArray<NSString *> *)userIDs type:(TUICallingType)type;
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
userIDs | NSArray | List of the user IDs of call participants |
type | TUICallingType | Call type: audio/video |
This API is used to set the listener.
- (void)setCallingListener:(id<TUICallingListerner>)listener;
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
listener | TUICallingListener | Listener of the TUIcalling component |
This API is used to set the ringtone (preferably shorter than 30s).
- (void)setCallingBell:(NSString *)filePath;
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
filePath | NSString | Path of the ringtone file |
This API is used to enable/disable the mute mode.
- (void)enableMuteMode:(BOOL)enable;
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
enable | BOOL | Whether to enable the mute mode |
This API is used to enable/disable custom views.
After enabling custom views, you will receive a CallingViewController
instance in the callback for calling/being called, and can decide how to display the view by yourself.
Note:The view must be displayed full screen; otherwise, an error may occur.
- (void)enableCustomViewRoute:(BOOL)enable;
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
enable | BOOL | Whether to enable custom views |
TUICallingListener
Callback APIsCallback of whether the answering view is displayed when there is an incoming call.
- (BOOL)shouldShowOnCallView;
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
Return value | BOOL | Whether the answering view is displayed |
Callback for starting calling, which is triggered for both callers and callees.
- (void)callStart:(NSArray<NSString *> *)userIDs type:(TUICallingType)type role:(TUICallingRole)role viewController:(UIViewController * _Nullable)viewController;
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
userIDs | NSArray | List of the user IDs of call participants |
type | TUICallingType | Call type: audio/video |
role | TUICallingRole | Role type: caller/callee |
viewController | UIViewController | Calling view controller |
Callback for ending a call, which is triggered for both callers and callees. If enableCustomViewRoute
is set to NO
, this callback will not be triggered.
- (void)callEnd:(NSArray<NSString *> *)userIDs type:(TUICallingType)type role:(TUICallingRole)role totalTime:(CGFloat)totalTime;
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
userIDs | NSArray | List of the user IDs of call participants |
type | TUICallingType | Call type: audio/video |
role | TUICallingRole | Role type: caller/callee |
totalTime | CGFloat | Call duration (s) |
Call event callback, which is triggered for both callers and callees. If enableCustomViewRoute
is set to NO
, this callback will not be triggered.
- (void)onCallEvent:(TUICallingEvent)event type:(TUICallingType)type role:(TUICallingRole)role message:(NSString *)message;
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
event | TUICallingEvent | Call event type |
type | TUICallingType | Call type: audio/video |
role | TUICallingRole | Role type: caller/callee |
message | NSString | Event description |
Was this page helpful?