Agora Media Accelerator (MA) provides a sample project, including hello_rtsa.c
and hello_rtm.c
, to demonstrate basic functionalities of the SDK.
You can compile and run the sample project to learn the functionalities and understand how to call the APIs.
A host for development, such as a PC or embedded device. See Product Overview for supported environments. Here we use a PC with Ubuntu 18.04 as an example.
See Get Started with Agora to get the following information:
demo_channel
.user1
and user2
. Here we refer to the acquired RTM tokens as RTM_TOKEN_1 and RTM_TOKEN_2, respectively.See Get Started with Agora to get the following information:
Skip this step if you use the attached free license to try the SDK.
Here we use the x86_64 SDK as an example. See the download page to get SDKs for other platforms.
# Get the SDK
wget https://download.agora.io/rtsasdk/release/Agora-RTSALite-LRmAcAjCP-x86_64-linux-gnu-v1.8.0.tgz
# Decompress the SDK
tar xvf Agora-RTSALite-LRmAcAjCP-x86_64-linux-gnu-v1.8.0.tgz
Run the following command to compile the sample project.
# Navigate to the sample folder
cd agora_rtc_sdk/example
# Build the sample project
./build-86_64.sh
If you need to run
hello_rtsa
in a device (such as ARM Linux), seePORTING.md
in the SDK package to learn how to port the code to your device.
After compilation, the following executable files are generated:
hello_rtsa
hello_rtm
license_query
: Run ./license_query
to check the license information.license_activator
: See Activate License.Skip this step if you use the attached free license to try the SDK.
If you have already purchased a commercial license, use license_query to query your license keys.
$ ./license_query --appId YOUR_APPID --customerKey YOUR_KEY --customerSecret YOUR_SECRET
YOUR_APPID
with your Agora App ID.YOUR_KEY
with the customer ID.YOUR_SECRET
with the customer key.Run the following command to active the license and generate a credential.
$ ./license_activator --appId YOUR_APPID --customerKey YOUR_KEY --customerSecret YOUR_SECRET --deviceId YOUR_DEVICE_ID --certOutputDir .
YOUR_APPID
with your Agora App ID.YOUR_KEY
with the customer ID.YOUR_SECRET
with the customer key.YOUR_DEVICE_ID
with the unique ID of the device, such as IMEI. The length must not exceed 128 bytes. Each successful activation costs you a commercial license.After a successful activation, a certificate.bin file is generated in the current folder by default. The file is the license bind with the device. hello_rtsa and hello_rtm loads this file and use agora_rtc_license_verify
to check the validity of the license before running the SDK.
The device needs to call agora_rtc_license_verify
to validate the license each time before initializing the SDK.
Replace YOUR_APP_ID
and MY_RTC_TOKEN
with your App ID and RTC temporary token. Run the following command to join the RTC channel named as demo_channel
and send H.264 video and PCM audio with default parameters. The media source comes from the send_audio_16k_1ch.pcm
file and the send_video.h264
in the SDK package.
cd out/x86_64
./hello_rtsa -i YOUR_APP_ID -c demo_channel --token MY_RTC_TOKEN
After running the sample project, open RTC SDK Webdemo, enter your Agora App ID, channel name demo_channel
, and RTC temporary token. After joining the RTC channel, you can receive real-time audio and video.
Open two terminals and enter the following commands to send and receive messages.
YOUR_APP_ID
with your Agora app ID.RTM_TOKEN_1
with the RTM_TOKEN_1 you have acquired.RTM_TOKEN_2
with the RTM_TOKEN_2 you have acquired.# Terminal 1
cd out/x86_64
./hello_rtm --appId YOUR_APPID --rtmUid user1 --peerUid user2 --token RTM_TOKEN_1
# Terminal 2
cd out/x86_64
./hello_rtm --appId YOUR_APPID --rtmUid user2 --peerUid user1 --token RTM_TOKEN_2