tencent cloud


Real-Time Interactive Teaching (Electron)

Last updated: 2022-04-02 16:27:03

    Free Demo


    You can install our demo app to experiment with our real-time interactive teaching solution. It offers not only basic capabilities such as audio/video call, screen sharing, whiteboard, and chat, but also advanced features such as mute all, raise hand to speak, invite users to speak, roll call, and sign-in.

    Using the Source Code for Real-Time Interactive Teaching

    Step 1. Create an application and get the SDKAppID and key

    If you already have a TRTC application, you can skip this step and use your application’s SDKAppID and key.

    1. Log in to the TRTC console, click Development Assistance > Demo Quick Run, enter your application name, such as TestTRTC, and click Create.

    2. Click Next. In the Modify Configuration step, note the SDKAppID and key.

    Step 2. Configure the IM application


    The real-time interactive teaching solution is based on 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. For its billing details, see Pricing.

    1. Click Relevant Cloud Services in the left sidebar and then click IM Console > Application List.

    2. Click the application you created.

    3. Click Feature Configuration > Login and Message. Under Login Settings, click Edit, and set the Max Login Instances per User per Platform for web to 2 or larger (the demo app requires login to only 2 IM instances, but you can set this value higher in case you need more in the future).

    Step 3. Set up the environment

    Node.js and Yarn are required for the source code to run.

    1. Install Node.js:
      Install Node.js (preferably a version higher than 14.16.0). Run the terminal command below to check the version.

      node --version
    2. Install Yarn:

    • If the Node.js version is lower than 14.16.0, run the terminal command below to install Yarn.

      npm i -g corepack
    • If the Node.js version is higher than 14.16.0, run the terminal command below to install Yarn.

      corepack enable

    On Windows 10 or 11, if an error occurs because of insufficient permissions, try running the commands as administrator in the Command Prompt.

    Step 4. Clone the code

    Download a ZIP file of the code. After decompressing the file, you can find the code in trtc-education-electron. If you use git to clone the code, run the following terminal command:

    git clone https://github.com/TencentCloud/trtc-education-electron.git
    cd trtc-education-electron

    Step 5. Obtain the SDKAppID and key

    1. Find and open src/main/config/generateUserSig.js.
    2. Set the parameters required to generate UserSig:
      • SDKAPPID: 0 by default. Set it to the SDKAppID obtained in Step 1.
      • SECRETKEY: an empty string by default. Set it to the key obtained in Step 1.

    • In this document, the method to obtain UserSig is to configure a SECRETKEY in the client code. In this method, the SECRETKEY is vulnerable to decompilation and reverse engineering. Once your SECRETKEY is disclosed, attackers can steal your Tencent Cloud traffic. Therefore, this method is only suitable for locally running a demo project and feature debugging.
    • 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 6. Run the code

    Open trtc-education-electron in a terminal and run the following command:

    yarn start

    • On Windows 10 or 11, when you run the Yarn command for the first time to install dependencies, if an error occurs because of insufficient permissions, run the command as administrator in the Command Prompt first. After that, you can run the command as an ordinary user in the Command Prompt or a terminal of your code editor such as Visual Studio Code or WebStorm.
    • If your download of the Electron code is slow or stuck, you can contact us for help.

    Step 7. Create an installer and run it

    Open trtc-education-electron in a terminal and run the command below to create an installer. After it is created, find the installer in trtc-education-electron/build/release, and then run it.

    yarn package

    You need macOS to create a macOS installer and Windows to create a Windows installer.

    Technical Support

    If you have other questions, you can fill out a contact form or email colleenyu@tencent.com.

    Learn More

    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support