TUILiveRoom is an open-source video live streaming scenario UI component. After integrating it into your project, you can enable your application to support interactive video live streaming simply by writing a few lines of code. It provides source code for Android, iOS, and mini program platforms. Its basic features are as shown below:
Note
All TUIKit components are based on two basic PaaS services of Tencent Cloud, namely TRTC and Chat. When you activate TRTC, the Chat SDK trial edition (which supports up to 100 DAUs) will be activated automatically. For Chat billing details, see Pricing.
Integration
Step 1. Import the TUILiveRoom component
To import the component using CocoaPods, follow the steps below:
1. Create a TUILiveRoom folder in the same directory as Podfile in your project.
2. Go to the component's GitHub page, clone or download the code, and copy the Source, Resources, TUIBeauty, TUIAudioEffect, TUIBarrage, TUIGift, and TUIKitCommon folders and the TUILiveRoom.podspec file in TUILiveRoom/iOS/ to the TUILiveRoom folder in your project.
3. Add the following dependencies to your Podfile and run pod install to import the component.
# :path => "The relative path of `TUILiveRoom.podspec`"
pod 'TUILiveRoom', :path =>"./TUILiveRoom/TUILiveRoom.podspec", :subspecs =>["TRTC"]
# :path => "The relative path of `TUIKitCommon.podspec`"
pod 'TUIKitCommon', :path =>"./TUILiveRoom/TUIKitCommon/"
# :path => "The relative path of `TUIBeauty.podspec`"
pod 'TUIBeauty', :path =>"./TUILiveRoom/TUIBeauty/"
# :path => "The relative path of `TUIAudioEffect.podspec`"
pod 'TUIAudioEffect', :path =>"./TUILiveRoom/TUIAudioEffect/"
# :path => "The relative path of `TUIBarrage.podspec`"
pod 'TUIBarrage', :path =>"./TUILiveRoom/TUIBarrage/"
# :path => "The relative path of `TUIGift.podspec`"
pod 'TUIGift', :path =>"./TUILiveRoom/TUIGift/"
Note
The Source and Resources folders and the TUILiveRoom.podspec file must be in the same directory.
TUIKitCommon.podspec is in the TUIKitCommon folder.
Step 2. Configure permissions
Your app needs mic and camera permissions to implement audio/video communication. Add the two items below to Info.plist of your app. Their content is what users see in the mic and camera access pop-up windows.
<key>NSCameraUsageDescription</key>
<string>RoomApp needs to access your camera to capture video.</string>
<key>NSMicrophoneUsageDescription</key>
<string>RoomApp needs to access your mic to capture audio.</string>
SDKAppID: TRTC application ID. If you haven't activated TRTC, log in to the TRTC console, create a TRTC application, click Application Info, and select the Quick Start tab to view its SDKAppID.
Secretkey: TRTC application key. Each secret key corresponds to an SDKAppID. You can view your application’s secret key on the Application Management page of the TRTC console.
UserId: Current user ID, which is a custom string that can contain up to 32 bytes of letters and digits (special characters are not supported).
UserSig: Security signature calculated based on SDKAppID, userId, and Secretkey. You can click here to quickly generate a UserSig for testing or calculate it on your own by referring to our TUILiveRoom demo project. For more information, see UserSig.