Enabling Interactive Broadcast

Enabling Interactive Broadcast

This page demonstrates the following interactive broadcast functions with the Agora sample code Open Live on Android:

  • Create/Join a channel
  • Enable a voice or video live broadcast
  • Set the video resolution
  • Switch the camera
  • Mute/unmute

Step 1: Download the Sample Code

Download the latest Full SDK.

./libs The required libraries
./samples Open Live Sample Code

Step 2: Prepare the Environments

Prepare the following environments:

  • Android SDK API 16 or later
  • Android Studio 2.0 or later
  • Android 4.1 or later devices with audio and video functionalities
  • Get an App ID

Step 3: Enable a Live Broadcast

Agora.io provides sample code called Open Live.

Compile the Sample Code

  1. Select Import project (Eclipse ADT, Gradle, etc.) in Android Studio.
  2. Import OpenLive_Android/build.gradle using the import function of Android Studio.
../_images/android_live_import.png
  1. Enter your App ID in OpenLive_Android/app/src/main/res/values/strings_config.xml. For example,
../_images/android_live_app_id.png
  1. Click Run to compile the sample code with Android devices connected.

Run the Sample Code

You need two Android devices to run the sample code.

  1. Open the Open Live application on the Android device, and the following screen appears:

    ../_images/android-demo-live-1.png
  2. Enter a channel name in Input Name of Live.

  3. Click the Settings icon on the top right to select the resolution.

    ../_images/android-demo-live-2.png
  4. Set the user mode.

    • Join the channel as a host by clicking JOIN ROOM and selecting BROADCASTER.

      ../_images/android-demo-live-3.png
    • Join the channel as an audience by clicking JOIN ROOM and selecting AUDIENCE.