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 Video SDK features.

This page shows how to compile, configure, and run the Video SDK Web sample project.

Prerequisites

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 Video 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:

DescriptionPath
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

  1. Install dependencies

In the project root folder, run the following command to install the dependencies:

npm install
  1. To launch the project, run the following command in the project root folder:

    npm run dev

After execution is complete, the terminal displays the URL to launch the demo.

  1. Set App ID and temporary Token

Open http://localhost:3001/index.html in 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.

If you have enabled joining with only the App ID for your project, leave the App certificate field blank.

Run the sample project

  1. From the menu, choose the feature or use-case you want to experience.

  2. 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.