Agora provides an open-source Basic-Video-Broadcasting sample project on GitHub. This document introduces how to run this project and experience live video streaming implemented by the Agora SDK.
You can also use this online demo and try live video streaming 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:
cdcommand in the terminal.
npm installto install the dependencies and integrate the Agora Web SDK.
Run the sample project to start a live video streaming, as follows:
Rename the extension of the
.env.example file to
.env in the sample project folder.
.env.examplefile is a hidden file, and you may need to change the system settings to show this file.
Open the .
env file, replace
<#YOUR Agora.io APP ID#> with the App ID of your Agora project, and replace
<#YOUR Agora.io APP TOKEN#> with the temporary token generated in Agora Console.
Change the directory to OpenLive-Web with the
cd command in the terminal, and then run
npm run dev to run the sample app.
The sample app opens in your default browser.
http://localhost:3000in your browser to open it manually.
Enter the channel name that you used to generate the temporary token, and then click Start Live Streaming to start the live video streaming as a host. You need to 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.
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.