Integrate the SDK
This article shows how to integrate the Server Gateway C++ SDK and run the sample project.
Set up the development environment
Make sure your server meets the following requirements.
Hardware environment
Operating system
- Ubuntu (14.04 or higher)
- CentOS (6.6 or higher)
CPU architecture
- arm64
- x86-64
If you need to run the SDK on other architectures, submit a ticket to contact technical support.
Performance
- CPU:8-core, 1.8 GHz or higher.
- 2 GB of RAM or higher. 4 GB or higher is recommended.
Network
- The server is connected to the internet and has an internet IP.
- The server can access
*.agora.io
and*.agoralab.co
.
Software environment
- glibc 2.18 or later
- gcc 4.8 or later
If you are using Ubuntu, taking Ubuntu 20.04.3 LTS as an example, install the following dependencies in your server:
If you are using CentOS, taking CentOS 7.9.2009 as an example, install the following dependencies in your server:
Get an Agora App ID and an RTC Temporary Token
See Get Started with Agora to learn how to get an Agora App ID and an RTC temporary token.
Get the SDK
Run the following command to get the latest x86-64 SDK package and decompress the file. If you need to get the SDK build on other architectures, submit a ticket to contact technical support.
Compile the sample project
Run the following commands to compile the sample project:
Run the project that sends media streams from the server
This section uses the sample_send_h264_pcm project to demonstrate sending media streams from the server.
Steps to run
Run the sample_send_h264_pcm sample project. Replace YOUR_RTC_TOKEN
, the parameter value of --token
, with your RTC temporary token. Replace the parameter value of --channelId
with the value of your RTC channel ID. In this page, the value of --channelId
is set to demo_channel
.
Use the client to receive streams sent from the server
-
Use a PC or mobile device to open the Agora RTC Web SDK sample project and specify the following fields:
- APP ID:Specify your Agora app ID, which must be the same as the app ID used in the server; otherwise, the server cannot communicate with the client.
- Channel Name:Specify your channel name, which must be the same as the channel ID used in the server; otherwise, the server cannot communicate with the client. In this page, we set the value to
demo_channel
. - Token: Specify your RTC temporary token, which is the same as the temporary token used in the server.
-
Click Join to receive media streams from the server.
Run the project that receives media streams from the client
This section uses the sample_send_h264_pcm project to demonstrate receiving media streams from the client.
Steps to run
Run the sample_receive_h264_pcm project. Replace YOUR_RTC_TOKEN
, the parameter value of --token
, with your RTC temporary token. Replace the parameter value of --channelId
with the value of your RTC channel ID. In this page, the value of --channelId
is set to demo_channel
.
When the sample project is running, the console prints the following information:
Use the client to send media streams to the server
- Use a PC or mobile device to open the Agora RTC Web SDK sample project and specify the following fields:
- APP ID:Specify your Agora app ID, which must be the same as the app ID used in the server; otherwise, the server cannot communicate with the client.
- Channel Name:Specify your channel name, which must be the same as the channel ID used in the server; otherwise, the server cannot communicate with the client. In this page, the value is set to
demo_channel
. - Token: Specify your RTC temporary token, which is the same as the temporary token used in the server.
-
Click Join to receive media streams to the server.
When the sample project is running, the console prints the following information:
The received video and audio are saved in the received_video.h264
file and the received_audio.pcm
file, respectively.