Compile and run a sample project
Updated
Compile and run a project using Agora SDK
Agora provides Open-source sample projects on GitHub to demonstrate the implementation of basic and advanced RTC SDK features.
This page shows how to compile, configure, and run the RTC SDK Web sample project.
Prerequisites
- A supported browser. Agora strongly recommends using the latest stable version of Google Chrome.
- Node.js and npm
-
A camera and a microphone
-
A valid Agora account and project. Please refer to Agora account management for details.
-
Installed Git
Project setup
Get the sample project
Obtain the sample project using one of the following methods:
-
Go to the SDKs page, download the latest version of RTC SDK, and unzip it.
-
Run the following commands to clone the GitHub repository locally:
git clone https://github.com/AgoraIO/API-Examples-Web cd API-Examples-Web git checkout new
The API-Examples-Web repository provides the following examples:
| Description | Path |
|---|---|
| Basic examples | /src/example/basic |
| Advanced examples | /src/example/advanced |
| Plug-in examples | /src/example/plugin |
| Other examples | /src/example/others |
| Vue framework example | /src/example/framework/vue |
| React framework example | /src/example/framework/react |
Configure the sample project
-
Install dependencies
In the project root folder, run the following command to install the dependencies:
npm install -
To launch the project, run the following command in the project root folder:
npm run devAfter execution is complete, the terminal displays the URL to launch the demo.
-
Set App ID and temporary Token
Open
http://localhost:3001/index.htmlin your browser , fill in the App ID and App certificate you obtained from the Agora console, and then click Set. Both primary and secondary certificates are acceptable.
Information
If you have enabled joining with only the App ID for your project, leave the App certificate field blank.
Run the sample project
-
From the menu, choose the feature or use-case you want to experience.
-
As an example, try the screen sharing demo, click Join as host to join a channel as the host. Ask a friend to run the sample project on another device and Join as audience, using the same app ID, app certificate, and channel name. Now you can share the screen with your friend.
