Host Prepare Page | Host Streaming Page | Live Stream List | Audience Viewing Page |
![]() | ![]() | ![]() | ![]() |
sudo gem install cocoapods command in the terminal to install.sudo gem install cocoapods installation process, you may be prompted to enter your computer's password. Enter the administrator password as prompted.pod 'TUILiveKit' dependency in your project's Podfile file. For example:target 'YourProjectTarget' do# Other existing Pod dependencies...# Addpod 'TUILiveKit'dependencypod 'TUILiveKit'end
cd command in the terminal, then execute pod init to create the Podfile. After creation, add the pod 'TUILiveKit' dependency to your Podfile. For example:# If your project directory is /Users/yourusername/Projects/YourProject# 1. cd to your.xcodeprojproject directorycd /Users/yourusername/Projects/YourProject# 2. Execute pod init. This command will generate a Podfile in your project directory.pod init# 3. Addpod 'TUILiveKit'dependency in the generatedPodfilefiletarget 'YourProjectTarget' do# Addpod 'TUILiveKit'dependencypod 'TUILiveKit'end
cd to the directory containing the Podfile in the terminal, then execute the following command to install the component.pod install
Info.plist file, and provide corresponding usage descriptions. These descriptions will be displayed to the user when the system requests permission:<key>NSCameraUsageDescription</key><string>TUILiveKit needs camera access to enable video recording with picture</string><key>NSMicrophoneUsageDescription</key><string>TUILiveKit needs microphone permission to enable sound in recorded videos</string>

//// AppDelegate.swift//// 1. Import TUICoreimport TUICore// 2. The example code completes login in didFinishLaunchingWithOptions. Recommendation for you: call the login service after completing your own login service.func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {// 3. Call the login APITUILogin.login(1400000001, // replace with the SDKAppID from the service consoleuserID: "denny", // replace with your UserIDuserSig: "xxxxxxxxxxx") { // You can calculate a UserSig in the console and fill it in this locationprint("login success")} fail: { (code, message) inprint("login failed, code: \\(code), error: \\(message ?? "nil")")}return true}
//// AppDelegate.m//// 1. Import TUICore#import <TUICore/TUILogin.h>// 2. The example code completes login in didFinishLaunchingWithOptions. Recommendation for you: call the login service after completing your own login service.- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {// 3. Call the login API[TUILogin login:1400000001 // replace with the SDKAppID from the service consoleuserID:@"denny" // replace with your UserIDuserSig:@"xxxxxxxxxxx" // You can calculate a UserSig in the console and fill it in this locationsucc:^{NSLog(@"login success");} fail:^(int code, NSString * _Nullable msg) {NSLog(@"login failed, code: %d, error: %@", code, msg);}];return YES;}
Parameter | Type | Description |
SDKAppID | Int | |
UserID | String | The unique ID for the current user. Must contain only English letters, numbers, hyphens, and underscores. |
userSig | String | A ticket for Tencent Cloud authentication. Please note: Development Environment: You can use the local GenerateTestUserSig.genTestSig function to generate a UserSig or generate a temporary UserSig via the UserSig Generation Tool.Production Environment: To prevent key leakage, you must use a server-side method to generate UserSig. For details, see Generating UserSig on the Server. |
onKickedOffline callback. At this point, you can display a UI prompt to the user and call TUILogin.login to login again.onUserSigExpired callback while online, it means the userSig previously issued for that user has expired. If the user's login session on your backend is still valid, you can have your app request a new userSig from your backend and call TUILogin.login to renew the login session.// YourLoginService represents the business module responsible for loginclass YourLoginService: NSObject {// Listen to login status callbackfunc addLoginListener() {TUILogin.add(self)}// Cancel listening to login status callbackfunc removeLoginListener() {TUILogin.remove(self)}}// Implement login callback TUILoginListenerextension YourLoginService: TUILoginListener {// User kicked offline callbackfunc onKickedOffline() {// Your business code: UI prompt user, then log in again}// User signature expired callbackfunc onUserSigExpired() {// Your business code: If the current user is still logged in on your backend, you can have your app request a new userSig from your backend and call TUILogin.login to renew the login status.}}
@interface YourLoginService() <TUILoginListener>// Listen to login status callback- (void)addLoginListener;// Cancel listening to login status callback- (void)removeLoginListener;@end@implementation YourLoginService// Listen to login status callback- (void)addLoginListener {[TUILogin add:self];}// Cancel listening to login status callback- (void)removeLoginListener {[TUILogin remove:self];}#pragma mark - TUILoginListener// User kicked offline callback- (void)onKickedOffline {// Your business code: UI interaction prompts user, then log in again}// User signature expired callback- (void)onUserSigExpired {// Your business code: UI interaction prompts user, then log in again}@end
Feature | Description | Integration Guide |
Host Streaming | The complete workflow for a host to start a stream, including pre-stream setup and various in-stream interactions. | |
Audience Viewing | Audience can watch live streaming after entering the anchor's live streaming room, with features like audience mic connection, live room information, online audience, and bullet screen display. | |
Live Stream List | Display the live stream list interface and features, including the live stream list and room information display. |
Podfile.lock and Pods. You can choose to delete them manually or execute the following command in the terminal:// cd to the directory where Podfile is locatedrm -rf Pods/rmPodfile.lock
pod install --repo-update// cd to the directory where Podfile is locatedpod install --repo-update
TUILogin.login call. We recommend associating TUILogin.loginand TUILogin.logout with your own application's login business logic.Feedback