Run Sample Code
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
Platform | Version |
Flutter | Flutter 3.22.0 or later.。 Dart version 3.4.0 or higher. |
Android | Android Studio 3.5 or later. Android devices 5.0 or later. |
iOS | Xcode 13.0 or later. Please ensure that your project has a valid developer signature set. |
Step 1: Download the Demo
1. Download the TUILiveKit Demo source code from GitHub, or directly run the following command in the command line:
2. Open the TUILiveKit Flutter project through Android Studio:
Step 2: Configure the Demo
1. Activate the TRTC service, obtain the SDKAppID and SDKSecretKey.
2. Open the Flutter/example/lib/debug/generate_test_user_sig.dart file and fill in the corresponding SDKAppID and SDKSecretKey obtained when Activate the service:
Step 3: Running the Demo
1. In the top right corner of Android Studio, select the device you want to run the Demo on as shown below:
2. After selecting, click Run to execute the TUILiveKit Flutter Demo on the target device.
3. After the demo is successfully run on the device, you can start and watch live broadcasts by following the steps below:
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 Go 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 |
| |