Run Sample Demo
This article will show you how to quickly build the video live streaming or voice room demo. By following this guide, you can build a video live streaming or voice room project complete with UI within 10 minutes.
Anchor(video live) | Audience(video live) | Audience(voice room) | Audience(voice room) |
| | | |
Environment Preparations
Xcode 15 or later.
iOS 13.0 or later.
CocoaPods environment installation.
If you encounter problems, see Q&A.
Step 1: Download the Demo
1. Download the TUILiveKit Demo source code from GitHub, or directly run the following command in the command line:
git clone https://github.com/Tencent-RTC/TUILiveKit.git
2. Go to the iOS project directory in the command line:
cd TUILiveKit/iOS/Example
3. Load dependent library:
pod install
Note:
Step 2: Configure the Demo
1. Activate the TRTC service and obtain the SDKAppID and SDKSecretKey.
2. Open the
/iOS/Example/Debug/GenerateTestUserSig.swift
file and enter the SDKAppID and SDKSecretKey obtained when activate the service:
Step 3: Run the Demo
1. Open the file (TUILiveKit/iOS/Example/TUILiveKitApp.xcworkspace), select the device on which you want to run the demo in Xcode as shown below:
2. Once the selection is complete, click the run button to run the demo on the target device.
3. After the demo runs successfully on the device, you can perform the following steps to start and watch live broadcasts.
Step 4: Start a Live Broadcast
Note:
To try out the live broadcast feature, you need to log in to the demo with two different user IDs on two devices, one as the anchor and the other as an audience member.
1. Log in & Signup
Enter a User ID and tap LOG IN. If the ID is not already taken, you will be taken to the Register page, where you can set your avatar and nickname.
Anchor(mike) | | Audiece(vince) | |
| | | |
Note:
Avoid setting your User ID to a simple string like "1", "123", "111". TRTC does not support multi-device login using the same User ID. During collaborative development, User IDs like "1", "123", "111" are likely already used by your colleagues, leading to login failures. Therefore, we recommend setting more distinguishable User IDs for debugging.
2. The anchor starts the live broadcast.
On the homepage, tap the middle button in the bottom bar to enter the broadcast preview page and then tap "Go Live" to start a live broadcast.
Live room:
Anchor (Before entering) | Anchor (Preview) | Anchor (Live) |
| | |
Voice room:
Anchor (Before entering) | Anchor (Preview) | Anchor (Live) |
| | |
3. Viewers join the live broadcast room.
Tap to enter any room in the live broadcast list.
Audience (Before entering) | Audience (After entering live room) | Audience (After entering voice room) |
| | |