Run Sample Code

This document describes how to quickly run the demo for the TRTC Windows SDK.

Prerequisites

Install Visual Studio 2017 or later (v2019 is recommended).
Install Qt 5.14.x.
Find the right version of Qt Add-in for your Visual Studio on the Qt website. Download and install it.
Open Visual Studio, in the menu bar, select Extension > QT VS Tools > Qt Options > Qt Versions, and add a MSVC compiler.
Copy all the DLL files in SDK/CPlusPlus/Win64/lib (for 64-bit Windows) to the debug/release folder of the project directory.
Note:
debug/release is auto-generated after environment configuration in Visual Studio. For 32-bit Windows, copy all the DLL files in SDK/CPlusPlus/Win32/lib to the debug/release folder of the project directory.

Steps To Run Demo

Step 1. Download the Demo

Download the TRTC_Windows-C++ sample demo code on github which SDK has been imported into, or run the following command in a terminal:

Step 2. Configure the Demo

1. Log in to the TRTC Console and click Create Application. If you have already done so, you may skip this step.
2. And then, your own SDKAppID and SDKSecretKey of your created application can be obtained in the Basic Information section.



3. Replace the values of SDKAPPID and SDKSECRETKEY in defs.h file under TRTC-API-Example-C++/TRTC-API-Example-Qt/src/Util directory with the information obtained in Step 2 .



Note:
In the demo above, we used SDKSecretKey to generate UserSig locally in order to help you go through the demo easier. However, in the production environment, you are not supposed to generate userSig in this way, which may lead to SDKSecretKey leakage, thereby creating a chance for attackers to steal your TRTC traffic. The correct way to generate UserSig is to integrate Server-Side Generation of UserSig on your server. When an user enters the room:
Send a http request to your server.
Generate a UserSig on your server.
Return it to the user to enter the room.
When you deploy your page to a production environment, you need to have your page accessed through the HTTPS(e.g. https://domain/xxx). For the reason, please refer to the document Page Access Protocol Restriction Description.

Step 3. Run the Demo

Open QTDemo.sln in the TRTC-API-Example-Qt directory with Microsoft Visual Studio (v2019 is recommended), set up the Qt environment (Qt 5.14 is recommended), and run the project.

FAQs

If you encounter any problems with access and use, please refer to FAQs.
If you have any requirements or feedback, you can contact: info_rtc@tencent.com.