TUIVoiceRoom is an open-source audio/video UI component. After integrating it into your project, you can make your application support the group audio chat scenario simply by writing a few lines of code. It also supports the Android platform. Its basic features are as shown below:
Note
All TUIKit components are based on two 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 billing details of Chat, see Pricing.
Integration
Step 1. Download and import the TUIVoiceRoom component
Open the project's Podfile and import TUIVocieRoom.podspec as follows:
# `path` is the path of `TXAppBasic.podspec` relative to the `Podfile`
pod 'TXAppBasic', :path =>"TUIVoiceRoom/TXAppBasic/"
# `path` is the path of `TUIVoiceRoom.podspec` relative to the `Podfile`
pod 'TUIVoiceRoom', :path =>"TUIVoiceRoom/", :subspecs =>["TRTC"]
Open Terminal, enter the directory of Podfile, and run pod install.
pod install
Step 2. Configure permission requests and obfuscation rules
In info.plist, add Privacy > Microphone Usage Description to request mic access.
<key>NSMicrophoneUsageDescription</key>
<string>`VoiceRoomApp` needs to access your mic to be able to shoot videos with audio.</string>
Step 3. Initialize and log in to the component
// Initialize TUIKit
let mTRTCVoiceRoom = TRTCVoiceRoom.shared()
// Log in
mTRTCVoiceRoom.login(sdkAppID: SDKAppID, userId: userId, userSig: userSig) { code, message in
if code == 0 {
// Logged in
}
}
Parameter description:
SDKAppID: The 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: The TRTC application key. Each secret key corresponds to a SDKAppID. You can view your application’s secret key on the Application Management page of the TRTC console.
userId: The ID of the current user, which is a string that can contain only letters (a-z and A-Z), digits (0-9), hyphens (-), and underscores (_). We recommend that you keep it consistent with your user account system.
UserSig: The security signature calculated based on SDKAppID, userId, and Secretkey. You can click here to quickly generate a UserSig for testing. For more information, see UserSig.