please select
Live
  • Overview
  • Android
    • Run Sample Demo
    • Integration
    • API Documentation
    • Interactive Barrage
    • Interactive Gift
    • Release Notes
    • FAQs
  • iOS
    • Run Sample Demo
    • Integration
    • API Documentation
    • Interactive Barrage
    • Interactive Gift
    • Release Notes
    • FAQs
  • Overview
    • Overview
  • Activate the Service
  • Pricing
    • Free Minutes
    • Live Monthly Packages
    • Billing Explanation for Subscription Package Duration
    • Pay-as-you-go
      • Billing of Audio and Video Duration
      • Billing of On-Cloud Recording and Recording Delivery
      • Billing of MixTranscoding and Relay to CDN
  • ErrorCode
Live

Run Sample Demo

This article will show you how to quickly run the video live streaming demo. Following this document, you can run the demo in 10 minutes and finally experience a video live streaming function with a complete UI interface.
Anchor
Audience









Environment Preparations

Xcode 15 or later.
iOS 13.0 or later.
CocoaPods environment installation, click to view.
If you encounter problems with access and use, 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 on the command line:
cd TUILiveKit/iOS/Example
3. Load dependent library:
pod install
Note:
If you do not already have CocoaPods installed, you can learn how to install it here.

Step 2: Configure Demo

1. Activate the TRTC service, obtain the SDKAppID and SDKSecretKey.



2. Open the/iOS/Example/Debug/GenerateTestUserSig.swiftDocument,file, and enter the SDKAppID and SDKSecretKey obtained when Activate the service:




Step 3: Run the Demo

1. Select the device on which you want to run the Demo in XCode as shown below:



2. Once the selection is complete, click Run to run our Demo on the target device.
3. After Demo runs successfully on the device, you can perform the following steps to initiate and watch live broadcasts.

Start Live Broadcast

Note:
In order to allow you to experience the complete video live broadcast process, please log in two users on two devices to use the Demo, one as the host and the other as the audience.
1. Log in & Signup
Please enter your UserId in the User ID field. If your current User ID has not been used before, you will be taken to the Registration page where you can set an avatar and nickname for yourself.



Note:
Try to avoid setting your User ID to simple strings like "1", "123", "111", as TRTC does not support the same User ID being logged into from multiple devices. Such User IDs like "1", "123", "111" are easily occupied by your colleagues during collaborative development, leading to login failures. Therefore, we recommend setting highly recognizable User IDs while debugging.
2. The anchor starts the live broadcast.
Click the Start Broadcast button in the middle of the bottom of the homepage to enter the broadcast preview page, and then click "Start Live" to start the live broadcast.
Anchor: Before entering
Anchor: Preview
Anchor: Live









3. Viewers join the live broadcast room.
Click on any room in the live broadcast list to enter the live broadcast room.
Audience: Before entering
Audience: After entering