Start Interactive Live Streaming using UI Kit
Agora provides an open-source API-Examples sample project on GitHub. This page describes how to run this project and experience interactive live audio or video streaming.
Prerequisites
- Development environment requirements:
- Java Development Kit
- Android Studio 3.0 or later
- If your network has a firewall, follow the instructions in Firewall Requirements to access Agora services.
- A real Android device. Agora recommends you run this sample project on a physical mobile device, as some simulators may not support the full features of this project.
- A valid Agora account.
Procedure
1. Create an Agora project
To create an Agora project, do the following:
- Enter the Project Management page.
- Click Create.
- Follow the on-screen instructions to enter a project name and use case, and check Secured mode: APP ID + Token (Recommended) as the authentication mechanism.
- Click Submit. You can now see the project on the Project Management page.
2. Get an App ID
To copy this App ID, find your project on the Project Management page in Agora Console, and click the copy icon in the App ID column.
3. Generate a temporary token
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:
- On the Project Management page, find your project and click Config.
2. Click Generate temp RTC token under Primary Certificate.
3. Enter the name of the channel that you want to join, and click Generate. When joining the channel later, ensure that the channel name is the same with the one you enter here.
-
Click the copy icon to copy the temporary token.
4. Configure the sample project
-
Download the API-Examples repository, and find the
API-Examples-master/Android/APIExample
sample project. Agora recommends that you move theAPIExample
folder to the root directory of your working disk; otherwise, the project build can fail because the project path is too long. -
Fill in the
APIExample/app/src/main/res/values/string_config.xml
file with the App ID and temporary token generated in Agora Console.
5. Build and run the sample project
-
Enable Developer options and USB Debugging on your Android device, and then connect it to your computer using a USB cable.
-
Open the
APIExample
sample project with Android Studio. Android Studio automatically starts the sync with Grade files. -
After the sync is successful, click
Run 'app'
on your Android Studio to install the Agora API Example app on your device. -
Open the app, select Live Interactive Audio Streaming or Live Interactive Video Streaming, read the prompt, and click Next to join the channel.
-
Ask a friend to join the live streaming with you using the Agora Web demo app. Ensure that your friend enters the same App ID, channel name, and temporary token. You can then hear or see each other.