Agora provides an open-source One-to-One-Video sample project on GitHub. This document introduces how to run this project and experience a video call implemented by the Agora SDK.
To create an Agora project, do the following:
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.
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:
Integrate the Agora SDK into the sample project, as follows:
.js
file starting with AgoraRTCSDK
to the assets
folder in the Agora-Web-Tutorial-1to1 project, and rename the file to AgoraRTCSDK.js
.Run the sample project to join a video call, as follows:
Open the index.html
file in Chrome. You will see the Basic Communication page:
Enter the App ID and temporary token, as well as the channel name that you use to generate the temporary token.
Click JOIN, and allow the browser to access your camera and microphone in the pop-up window.
You should see a video stream of yourself on the page.
To try a one-to-one video call, duplicate the browser tab, enter the same App ID, channel name, and temporary token, and then click JOIN.
You should see two video streams in each browser window.
If the sample project does not work properly, open the browser console and check for errors. The following are the most likely errors:
INVALID_VENDOR_KEY
: Incorrect App ID or token. Ensure that you enter the correct App ID and token.DYNAMIC_USE_STATIC_KEY
: Token missing. Because your Agora project enables App Certificate, you need a token to join the channel.Media access:NotFoundError
: Camera/microphone error. Check that your camera and microphone are working properly.The following table lists the code structure of the sample project for your reference:
File/Folder | Description |
---|---|
index.html |
The code of the web page and the main functions. |
assets/common.css |
The code for the front-end style. |
vendor |
Third-party libraries for the front-end style and layout. |
Agora provides the following additional video call sample projects on GitHub: