Skip to main content

You are viewing Agora Docs forBetaproducts and features. Switch to Docs

You are looking at Interactive Live Streaming v3.x Docs. The newest version is  Interactive Live Streaming 4.x

Android
iOS
macOS
Windows C++
Windows C#
Unity
Flutter
React Native
Electron
Cocos Creator
Cocos2d-x

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

  1. Enter the Project Management page.
  2. Click Create.
  3. 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.
  4. 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:

  1. On the Project Management page, find your project and click Config.

1641971834422 2. Click Generate temp Video SDK token under Primary Certificate.

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

  1. Click the copy icon to copy the temporary token.

Temporary tokens are for demonstration and testing purposes only, and remain valid for 24 hours. In a production environment, you need to deploy your own server for generating tokens. For details, see Authenticate Your Users with Tokens.

4. Configure the sample project

  1. Download the API-Examples repository, and find the API-Examples-master/Android/APIExample sample project. Agora recommends that you move the APIExample folder to the root directory of your working disk; otherwise, the project build can fail because the project path is too long.

  2. Fill in the APIExample/app/src/main/res/values/string_config.xml file with the App ID and temporary token generated in Agora Console.


    _4
    // Replace YOUR APP ID with your App ID in the string format.
    _4
    <string name="agora_app_id" translatable="false">YOUR APP ID</string>
    _4
    // Replace YOUR ACCESS TOKEN with your temporary token in the string format.
    _4
    <string name="agora_access_token" translatable="false">YOUR ACCESS TOKEN</string>

5. Build and run the sample project

  1. Enable Developer options and USB Debugging on your Android device, and then connect it to your computer using a USB cable.

  2. Open the APIExample sample project with Android Studio. Android Studio automatically starts the sync with Grade files.

  3. After the sync is successful, click Run 'app' on your Android Studio to install the Agora API Example app on your device.

  4. Open the app, select Live Interactive Audio Streaming or Live Interactive Video Streaming, read the prompt, and click Next to join the channel.

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

Interactive Live Streaming