This article will introduce how to complete the integration of the TUIRoomKit Component in the shortest time. By following this document, you will complete the following key steps within an hour and ultimately obtain an audio/video conference function with a complete UI interface.
Environment preparation
iOS 13.0 and higher.
Xcode 12.0 and higher.
Swift 4.2 and higher.
Step 1: Activate the service
Before initiating a meeting with TUIRoomKit, you need to activate the exclusive multi-person audio and video interaction service for TUIRoomKit on the console. For specific steps, please refer to Activate Service.
Step 2: Integrate the TUIRoomKit Component
1. Add the following dependencies to your Podfile file.
pod 'TUIRoomKit'
2. Execute the following command to install the Component.
pod install
Note:
If you cannot install the latest version of TUIRoomKit, execute the following command to update the local CocoaPods repository list.
pod repo update
Step 3: Project Configuration
To use the audio and video functions, you need to authorize the use of microphone, camera and photo album. Add the following items to the App's Info.plist, corresponding to the prompt messages for the microphone, camera, and photo album when the system pops up the authorization dialog box.
<key>NSCameraUsageDescription</key>
<string>TUIRoom needs access to your Camera permission</string>
<key>NSMicrophoneUsageDescription</key>
<string>TUIRoom needs access to your Mic permission</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>TUIRoom needs access to your Photo Library</string>
Step 4: Log in
Add the following code to your project. Its function is to complete the initialization of TUI components by calling the relevant interfaces in TUICore. This step is very critical, because all functions of TUIRoomKit can only be used normally after successful login, so please be patient and check whether the relevant parameters are configured correctly:
Swift
OC
importTUICore
TUILogin.login(1400000001,// Please replace with the SDKAppID obtained in step 1
userID:"998",// Please replace with your UserID
userSig:"xxxxxxxxxx"){// You can calculate a UserSig in the Console and fill it in this position
[TUILogin login:1400000001// Please replace with the SDKAppID obtained in step 1
userID:@"998"// Please replace with your UserID
userSig:@"xxxxxxxxxx" succ:^{// You can calculate a UserSig in the Console and fill it in this position
NSLog(@"login,success");
} fail:^(int code, NSString * _Nullable msg){
NSLog(@"login,failed,code:%d,msg:%@",code,msg);
}];
Parameter Description
Here is a detailed introduction to the key parameters used in the login function:
SDKAppID:You have already obtained it in Activate the service, so it will not be repeated here.
UserID:The ID of the current user, string type, only allows to contain English letters (a-z and A-Z), numbers (0-9), hyphens (-), and underscores (_).
UserSig:Encrypt the SDKAppID, UserID, etc. with the SDKSecretKey obtained in Activate the service to get the UserSig, which is a ticket for authorization and is used for Tencent Cloud to recognize whether the current user can use the TRTC service. You can create a temporarily available UserSig through the UserSig Tools through the project sidebar in the console.
The main conference page is ConferenceMainViewController. After logging in, you only need to create and navigate to ConferenceMainViewController according to the following example to initiate a quick conference.
Swift
OC
importTUIRoomKit
// CreateConferenceViewController is your own ViewController