Agora Video SDK for ReactJS reference app
This repository holds the code examples used for the Agora Video SDK for ReactJS documentation. Clone the repo, run and test the samples, and use the code in your own project. Enjoy.
Samples
The runnable code examples are:
-
SDK quickstart - The minimum code you need to integrate high-quality, low-latency Video Calling features into your app using Video SDK.
-
Authentication Workflow - Authenticate the current user and channel with a token retrieved from a token server.
-
Connect through restricted networks with Cloud Proxy - Connect from an environment with a restricted network.
-
Stream media to a channel - Use the media player classes in Video SDK to enable your users to publish media files to a channel.
-
Call quality best practice - use Video SDK features to ensure optimal audio and video quality in your app.
-
Audio and voice effects - Modify the captured audio to add sound effects, mix in a pre-recorded audio, or change the voice quality.
-
Geofencing - Control and customize data routing in your app by specifying the Agora SD-RTN™ region users connect to.
Run this project
To run the sample projects in this folder, take the following steps:
-
Clone the Git repository by executing the following command in a terminal window:
git clone https://github.com/AgoraIO/video-sdk-samples-reactjs
-
Install the dependencies:
In Terminal, navigate to
video-sdk-samples-reactjs
, and execute the following command.npm install
-
In the
video-sdk-samples-reactjs
reference app, opensrc/agora-manager/config.json
and setappId
to the AppID of your project. -
Set the authentication token:
- Temporary token:
- Set
rtcToken
with the value of your temporary token
- Set
- Authentication server:
-
Setup an Authentication server
-
In
config.json
:- Set
rtcToken
to an empty string. - Set
serverUrl
to the base URL of your authentication server. For example,https://agora-token-service-production-1234.up.railway.app
.
- Set
-
Start a proxy server so this web app can make HTTP calls to fetch a token. In a Terminal instance in the reference app root, run the following command:
node ./utils/proxy.js
-
- Temporary token:
-
Start this reference app.
In Terminal, run the following command:
yarn dev
-
Open the project in your browser. The default URL is http://localhost:5173/.
-
In the dropdown, select this document and test .