Agora provides two open-source sample projects: OpenVideoCall-Windows (based on QT) and OpenVideoCall-Windows-MFC (based on MFC). This article describes how to run the sample projects.
Get App ID and Token
1. Create an Agora project
To create an Agora project, do the following:
- Enter the Project Management page.
- Click Create.
- Follow the on-screen instructions to enter a project name and use case, and check Secured mode: APP ID + Token (Recommended) as the authentication mechanism.
- Click Submit. You can now see the project on the Project Management page.
2. Get an App ID
Agora automatically assigns each project an App ID as a unique identifier.
To copy this App ID, find your project on the Project Management page in Agora Console, and click the icon in the App ID column.
You must specify the App ID when running the project.
3. Generate a temporary token
To ensure communication security, Agora recommends using tokens to authenticate users joining a channel.
For testing purposes, Agora Console supports generating RTC temporary tokens. To generate an RTC temporary token:
- On the Project Management page, find your project and click Config.
- Click Generate temp RTC token under Primary Certificate.
- Enter the name of the channel that you want to join, and click Generate. When joining the channel later, ensure that the channel name is the same with the one you enter here.
- Click the copy icon to copy the temporary token.
Temporary tokens are for demonstration and testing purposes only, and remain valid for 24 hours. In a production environment, you need to deploy your own server for generating tokens. For details, see
Authenticate Your Users with Tokens.
You must specify the Token when running the project.
Run the sample project based on Qt
Prerequisites
- Operating system: Windows 7 or higher
- IDE: Qt Creator based on Qt 5.6 or higher
Integrate the SDK
Clone the Basic-Video-Call repository. Navigate to the Group-Video\OpenVideoCall-Windows
folder.
Download the latest version of Video SDK. Decompress the file and perform the following operations:
- Create a
sdk
folder in OpenVideoCall-Windows
. In sdk
, create two folders: include
and lib
.
- Copy all
.h
files from libs\include
to OpenVideoCall-Windows\sdk\include
.
- Copy
libs\x86
or libs\x86_64
to OpenVideoCall-Windows\sdk\lib
.
Precedure
- Navigate to the
OpenVideoCall-Windows
folder and open OpenVideoCall.pro
with Qt Creator.
- Click Projects and select the build tool in Build&Run, such as x86-windows-msvc0217-pe-64bit or x86-windows-msvc0217-pe-32bit.
- Click Edit, open
Headers/agoraobject.h
, and replace APP_ID
and APP_TOKEN
with your App ID and Token.
- Select Release as the build option and click to build the project.
- When the build is successful, click to run the project. Enter the channel name and select your role. Click joinChannel to join the channel.
You must use the channel name that is used to generate the token.
Project structure
The following table shows the structure of the sample project. You can adjust the code per your requirements.
Folder / file |
Description |
OpenVideoCall.pro |
Qt project file |
Headers ,Sources |
All .h files and .cpp filesmain.h/cpp :Main app class openvideocall.h/cpp : Main app logic, including the connection between the UI and low-level logicagoraobject.h/cpp : Main logic implemented by the RTC SDKagoraconfig.h/cpp : Read and write the SDK settings in AgoraConfigOpenVideoCall.ini avdevice.h/cpp :Select the capture device and configure video/audio settingsnettesting.h/cpp ,nettestresult.h/cpp ,nettestdetail.h/cpp : Device network testinroom.h/cpp , enterroom.h/cpp :SDK callbacks and UI changes when and after the user joins the channel
|
Forms |
All .ui files of the project to define user interface |
Resources |
UI resource file |
Other files |
openvideocall.rc : App icon file |
Run the project based on MFC
Prerequisites
- Operating system: Windows 7 or higher
- IDE: Visual Studio 2017 or higher
Integrate the SDK
Clone the Basic-Video-Call repository. Navigate to the Group-Video\OpenVideoCall-Windows-MFC
folder.
Download the latest version of Video SDK. Unzip the file and perform the following operations:
- Create a
sdk
folder in OpenVideoCall-Windows-MFC
. In sdk, create three folders: include
, dll
, and lib
.
- Copy all
.h
files from libs\include
to OpenVideoCall-Windows-MFC\sdk\include
.
- Copy
libs\x86\agora_rtc_sdk.dll
or libs\x86_64\agora_rtc_sdk.dll
to OpenVideoCall-Windows-MFC\sdk\dll
.
- Copy
libs\x86\agora_rtc_sdk.lib
or libs\x86_64\agora_rtc_sdk.lib
to OpenVideoCall-Windows-MFC\sdk\lib
.
If you select files from the x86
folder, you must choose Win32 platform when running the project; If you select files from the x86_64
folder, you must choose x64 platform when running the project.
Procedure
- Navigate to the
OpenVideoCall-Windows-MFC
folder and open OpenVideoCall.sln
with Visual Studio.
- In the solution manager, select OpenVideoCall >> AgoraObject >> AgoraObject.h.
- In the solution manager, right-click the solution and select generate solution.
- After compilation, press <F5> to run the project. Enter the channel name and select your role. Click Join to join the channel.
You must use the channel name that is used to generate the token.
Project structure
The following table shows the structure of the sample project. You can adjust the code per your requirements.
Folder |
Description |
AgoraObject |
Main app logic, includes:AgoraObject.h/cpp : Main app logic with basic functionsAgoraAudInputManager.h/cpp ,AgoraCameraManager.h/cpp : Select capture device and set parametersAgoraPlayoutManager.h/cpp : Select playout device and set parametersAGEngineEventHandler.h/cpp : Event handler logicAGResourceVisitor.h/cpp : Resource management
|
App |
OpenVideoCall main app class |
Headers |
Standard header files to include for MFC |
Resources |
Resource file |
UI |
User interface, including definitions for dialogs, windows, and controls |