Last updated: 2021-07-01 17:50:06


    You can download and install the demo we provide to try out TRTC’s video conferencing features, including screen sharing, beauty filters, and low-latency conferencing.

    To quickly enable the video conferencing feature, you can modify the demo we provide and adapt it to your needs. You can also use the TRTCMeeting component and customize your own UI.

    Using the Demo UI

    Step 1. Create an application.

    1. Log in to the TRTC console and select Development Assistance > Demo Quick Run.
    2. Enter an application name, e.g., TestMeetingRoom, and click Create.

    The video conferencing feature uses two basic PaaS services of Tencent Cloud, namely TRTC and IM. When you activate TRTC, IM will be activated automatically. IM is a value-added service. See Value-added Service Pricing for its billing details.

    Step 2. Download the SDK and demo source code.

    1. Download the SDK and demo source code for your platform.
    2. Click Next.

    Step 3. Configure demo project files.

    1. In the Modify Configuration step, select the platform in line with the source package downloaded.

    2. Find and open the Android/TRTCScenesDemo/debug/src/main/java/com/tencent/liteav/debug/ file.

    3. Set parameters in as follows.

      • SDKAPPID: 0 by default. Set it to the actual `SDKAppID`.
      • SECRETKEY: left empty by default. Set it to the actual key.
    4. Click Next to complete the creation.

    5. After compilation, click Return to Overview Page.


    The method for generating UserSig described in this document involves configuring SECRETKEY in client code. In this method, SECRETKEY may be easily decompiled and reversed, and if your key is leaked, attackers can steal your Tencent Cloud traffic. Therefore, this method is only suitable for the local execution and debugging of the demo.
    The correct UserSig distribution method is to integrate the calculation code of UserSig into your server and provide an application-oriented API. When UserSig is needed, your application can send a request to the business server for a dynamic UserSig. For more information, see How do I calculate UserSig on the server?.

    Step 4. Run the demo.

    Open the TRTCScenesDemo project with Android Studio (version 3.5 or above) and click Run.

    Step 5. Modify the demo source code.

    The trtcmeetingdemo folder in the source code contains two subfolders: ui and model. The ui folder contains the UI code. The table below lists the files (folders) and UI views they represent. You can refer to it when making UI changes.

    File or Folder Use
    remote The remote user list view
    widget Common UI component The meeting creation view The main view for video conferencing Include TXCloudVideoView, which displays the video data of the local user and remote users User data at the UI layer Adapter for the main video conferencing view

    Implementing A Custom UI

    The trtcmeetingdemo folder in the [source code] contains two subfolders: ui and model. The model folder contains the reusable open-source component TRTCMeeting. You can find the component’s API functions in and use them to customize your own UI.

    Step 1. Integrate the SDKs.

    The video conferencing component TRTCMeeting depends on the TRTC SDK and IM SDK. Follow the steps below to integrate the two SDKs into your project.

    Method 1: adding dependencies via Maven

    1. Add the TRTC SDK and IM SDK dependencies to dependencies.
      dependencies {
         compile "com.tencent.liteav:LiteAVSDK_TRTC:latest.release"
         compile 'com.tencent.imsdk:imsdk:latest.release'

      You can view the latest version numbers of the two SDKs by visiting their GitHub pages at TRTC and IM.

    2. In defaultConfig, specify the CPU architecture to be used by the app.
      defaultConfig {
        ndk {
            abiFilters "armeabi-v7a"
    3. Click Sync Now to have the SDKs downloaded and integrated into your project automatically.

    Method 2: adding dependencies through local AAR files
    If your access to the Maven repository is slow, you can download the ZIP packages of the SDKs and manually and integrate them into your project as instructed in the documents below.

    SDK Download Page Integration Guide
    TRTC SDK Download Integration document
    IM SDK Download Integration document

    Step 2. Configure permission requests and obfuscation rules.

    Configure permission requests for your app in AndroidManifest.xml. The SDKs need the following permissions (on Android 6.0 and above, the camera and read storage permissions must be requested at runtime.)

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-feature android:name=""/>
    <uses-feature android:name="" />

    In the file, add the SDK classes to the "do not obfuscate" list.

    -keep class com.tencent.** { *; }

    Step 3. Import the TRTCMeeting component.

    Copy all files in the following directory to your project:


    Step 4. Create a component instance and log in.

    1. Call the sharedInstance API to create an instance of the TRTCMeeting component.
    2. Call the setDelegate function to register event callbacks of the component.
    3. Call the login function to log in to the component. Set the key parameters as described below.
      Parameter Note
      SDKAPPID You can view the `SDKAPPID` of your application in the TRTC console.
      userId ID of the current user, which is a string that can contain letters (a-z and A-Z), digits (0-9), hyphens (-), and underscores (_).
      userSig Tencent Cloud's proprietary security signature. To obtain one, see UserSig.
      callback Login callback. The code is 0 if login is successful.