TUIRoomKit
Last updated: 2023-10-20 10:13:38Download PDF
Introduction
TUIRoomKit is an open source UI layer suite for conference SDK, currently only supports Swift language on the iOS platform. The conference UI can be called up through simple API calls.
TUIRoomKit Interface
API | Description |
Initialize the TUIRoomKit singleton object | |
Initialization of user information interface, you need to initialize user information before entering the room and performing a series of operations | |
Log out interface, there will be active leave room operation, destroy resources | |
Set user information (avatar, nickname) to enter the preparation page (optional) | |
Enter the preparation page (optional) | |
Create a room | |
Enter the room | |
Add TUIRoomKit event callback |
sharedInstance
Initialize the TUIRoomKit singleton object.
static let sharedInstance: TUIRoomKit
login(sdkAppId:,userId:,userSig:)
Initialize the user information interface, set the required parameters for the SDK, SDKAPPID, user ID, and UserSig. You need to initialize user information before entering the room and performing a series of operations.
public func login(sdkAppId: Int, userId: String, userSig: String) -> Void
The parameters are as follows:
Parameter | Type | Meaning |
sdkAppId | Int | |
userId | String | The current user's ID, string type, only allows English letters (a-z and A-Z), numbers (0-9), hyphens (-) and underscores (_) |
userSig | String | A security protection signature designed by Tencent Cloud, please refer to How to Calculate and Use UserSig for acquisition method |
logout
Log out interface, there will be active leave room operation, destroy resources.
public func logout()
setSelfInfo
Set user information (avatar, nickname).
public func setSelfInfo(userName: String, avatarURL: String) -> Void
Parameter | Type | Meaning |
userName | String | Username |
avatarURL | String | User avatar URL |
enterPrepareView
Enter the preparation page (optional).
public func enterPrepareView(enablePreview: Bool) -> Void
Parameter | Type | Meaning |
enablePreview | Bool | Whether to enable the video preview screen, true means enabled |
createRoom(roomInfo:,scene:)
Create a room.
public func createRoom(roomInfo: RoomInfo, scene: RoomScene) -> Void
The parameters are as follows:
Parameter | Type | Meaning |
roomInfo | RoomInfo | Room data |
roomInfo.roomId | String | Room string |
roomInfo.name | String | Room name |
roomInfo.isOpenCamera | Bool | Set whether to open the camera before entering the room |
roomInfo.isOpenMicrophone | Bool | Set whether to open the mic before entering the room |
roomInfo.isUseSpeaker | Bool | Set whether to open the speaker before entering the room |
roomInfo.speechMode | TUISpeechMode | Microphone control mode (free speech mode, request speech mode, go live mode) |
scene | RoomScene | Room type (conference, live broadcast) |
enterRoom(roomInfo:, scene:)
Enter the room.
public func enterRoom(roomInfo: RoomInfo) -> Void
The parameters are as follows:
Parameter | Type | Meaning |
roomInfo | RoomInfo | Room data |
roomInfo.roomId | String | Room string |
roomInfo.isOpenCamera | Bool | Set whether to open the camera before entering the room |
roomInfo.isOpenMicrophone | Bool | Set whether to open the mic before entering the room |
roomInfo.isUseSpeaker | Bool | Set whether to open the speaker before entering the room |
addListener(listener:)
Add TUIRoomKit event callback.
public func addListener(listener: TUIRoomKitListener) -> Void
Parameter | Type | Meaning |
listener | TUIRoomKitListener | TUIRoomKit callback event |
TUIRoomKit event callback TUIRoomKitListener
Callback | Meaning |
User login callback | |
Create room callback | |
Entered room callback | |
Destroy room callback | |
Exit room callback |
onLogin
Login callback.
Parameter | Type | Meaning |
code | Int | Error code, 0 when successful |
message | String | Callback information |
onRoomCreate
Create room callback.
Parameter | Type | Meaning |
code | Int | Error code, 0 when successful |
message | String | Callback information |
onRoomEnter
Entered room callback.
Parameter | Type | Meaning |
code | Int | Error code, 0 when successful |
message | String | Callback information |
onDestroyRoom
Destroy room callback.
onExitRoom
Exit room callback.