TUICallKit
TUICallKit APIs
TUICallKit is an audio/video call component that includes UI elements. You can use its APIs to quickly implement an audio/video call application similar to WeChat. For directions on integration, see Integrating TUICallKit.Overview
API | Description |
Create a TUICallKit instance (singleton mode). | |
Set the user's profile picture and nickname. | |
Initiate a one-to-one or multi-person call | |
Proactively join a call | |
Set the ringtone. | |
Set whether to turn on the mute mode. | |
Set whether to enable floating windows. | |
Set a blurred background. | |
Set whether to display incoming banner. | |
Set the screen orientation. |
Details
createInstance
This API is used to create a
TUICallKit singleton.public static func createInstance() -> TUICallKit
setSelfInfo
This API is used to set the user's profile picture and nickname. The nickname cannot exceed 500 bytes, and the profile picture is specified by a URL.
public func setSelfInfo(nickname: String, avatar: String, completion: CompletionClosure?)
Parameter | Type | Description |
nickname | String | The nickname. |
avatar | String | The profile picture. |
completion | CompletionClosure | The result callback of the asynchronous operation. |
calls
Initiate a call.
public func calls(userIdList: [String], callMediaType: CallMediaType, params: CallParams?, completion: CompletionClosure?)
The parameters are described below:
Parameter | Type | Meaning |
userIdList | [String] | Target user ID list |
mediaType | Media type of the call, such as video call, voice call | |
params | Call extension parameters, such as room number, call invitation timeout | |
completion | CompletionClosure | Callback for the result of an asynchronous operation |
join
Proactively join a call.
public func join(callId: String, completion: CompletionClosure?)
The parameters are described below:
Parameter | Type | Meaning |
callId | String | The unique ID for this call |
completion | CompletionClosure | The result callback of the asynchronous operation. |
setCallingBell
This API is used to set the ringtone.
filePath must be an accessible local file URL.The ringtone set is associated with the device and does not change with user.
To reset the ringtone, pass in an empty string for
filePath.public func setCallingBell(filePath: String)
enableMuteMode
This API is used to turn silent mode on/off.
The default value is
false, This API is used to set whether to play the music when user received a call.public func enableMuteMode(enable: Bool)
enableFloatWindow
This API is used to set whether to enable floating windows.
The default value is
false, and the floating window button in the top left corner of the call view is hidden. If it is set to true, the button will become visible.public func enableFloatWindow(enable: Bool)
enableVirtualBackground
This API is used to set a blurred background.
The default value is
false.public func enableVirtualBackground(enable: Bool)
enableIncomingBanner
The API is used to set whether show incoming banner when user received a new call invitation.
The default value is
false, The callee will pop up a full-screen call view by default when receiving the invitation. If it is set to true, the callee will display a banner first.public func enableIncomingBanner(enable: Bool)
setScreenOrientation
Set the screen orientation.
The default is portrait mode; orientation: 0-Portrait, 1-Landscape, 2-Auto.
public func setScreenOrientation(orientation: Int, completion: CompletionClosure?)
Deprecated Interface
call
This API is used to make a (one-to-one) call.
Note:
public func call(userId: String, callMediaType: TUICallMediaType)
Parameter | Type | Description |
userId | String | The target user ID. |
callMediaType | The call type, which can be video or audio. |
call
This API is used to make a (one-to-one) call, support for custom room ID, call timeout, offline push content, etc.
Note:
public func call(userId: String, callMediaType: TUICallMediaType, params: TUICallParams,succ: @escaping TUICallSucc, fail: @escaping TUICallFail)
Parameter | Type | Description |
userId | String | The target user ID. |
callMediaType | The call type, which can be video or audio. | |
params | Call extension parameters, such as roomID, call timeout, offline push info,etc. |
groupCall
This API is used to make a group call.
Note:
It is recommended to use the calls API
Before making a group call, you need to create a Chat group first.
For details about how to create a group, see Chat Group Management, or you can use Chat UIKit to integrate chat, call and other scenarios.
public func groupCall(groupId: String, userIdList: [String], callMediaType: TUICallMediaType)
Parameter | Type | Description |
groupId | String | The group ID. |
userIdList | Array | The target user IDs. |
callMediaType | The call type, which can be video or audio. |
groupCall
This API is used to make a group call, support for custom room ID, call timeout, offline push content, etc.
Note:
It is recommended to use the calls API.
Before making a group call, you need to create a Chat group first.
For details about how to create a group, see Chat Group Management, or you can use Chat UIKit to integrate chat, call and other scenarios.
public func groupCall(groupId: String, userIdList: [String], callMediaType: TUICallMediaType, params: TUICallParams,succ: @escaping TUICallSucc, fail: @escaping TUICallFail)
Parameter | Type | Description |
groupId | String | The group ID. |
userIdList | Array | The target user IDs. |
callMediaType | The call type, which can be video or audio. | |
params | Call extension parameters, such as roomID, call timeout, offline push info, etc. |
joinInGroupCall
This API is used to join a group call.
Note:
It is recommended to use the join API.
Before joining a group call, you need to create or join a Chat group in advance, and there are already users in the group who are in the call.
For details about how to create a group, see Chat Group Management, or you can use Chat UIKit to integrate chat, call and other scenarios.
public func joinInGroupCall(roomId: TUIRoomId, groupId: String, callMediaType: TUICallMediaType)
Parameter | Type | Description |
roomId | The room ID. | |
groupId | String | The group ID. |
callMediaType | The call type, which can be video or audio. |