This article describes how to implement the basic features of Single Host.


Refer to the flowcharts for the following functions:

  • Joins and leaves the room.

Integrate the SDK

Refer to the following table to integrate the SDKs into your project:

Product SDK downloads Integration guide
Agora RTC (Real-time Communication) SDK Agora SDK for Android Start Live Interactive Video Streaming
Agora RTM (Real-time Messaging) SDK Real-time messaging SDK Peer-to-peer or Channel Messaging
Third-party Image Enhancement SDK N/A Android SDK Integration Guide

Core API call sequence

The following diagrams show the core APIs that the Agora Live Demo app uses to implement a Single Host scenario. Refer to them to implement the various functions in your project.

The Cloud Service in the demo app is implemented by Agora, and you need to deploy your own cloud service for the same purposes.
  • The host joins the room and starts the interactive streaming.

Core API reference

  • Agora RTM SDK
API Function
createInstance Creates an RTM Client object.
login Logs into the Agora RTM system.
createChannel Creates an Agora RTM channel.
join Joins the RTM channel.
sendMessage Sends a channel message, which can be received by all users in the channel.
leave Leaves the RTM channel.
logout Logs out of the Agora RTM system.
  • Agora RTC SDK
API Function
create Creates an RtcEngine object.
setChannelProfile Sets the channel profile. In a Single Host scenario, the channel profile is set as BROADCASTING.
setClientRole Sets the user role in interactive streaming.
enableVideo Enables video.
setupLocalVideo Sets the local video view. Call this method on the host's client to configure the view of the host on the local device.
joinChannel Joins the RTC channel.
leaveChannel Leaves the channel. Use this method to quick switch to another live-broadcast channel.

Additional functions

Image enhancement

The Agora Live Demo app uses a third-party SDK for image enhancement. You can refer to the source code in the faceunity file to implement the function.

Network quality detection

Use the onRtcStats callback to detect and report the network quality in real-time. Triggered once every two seconds during a live broadcast, this callback reports statistics, including the sending and receiving bitrate and packet loss rate.

Mute the local audio and video

Call muteLocalAudioStream or muteLocalVideoStream to stop sending local audio or video streams.

In-ear monitoring

Call enableInEarMonitoring to enable the in-ear monitor function on the host's client.

Audio mixing

After joining the channel, call startAudioMixing on the host's client to play background music.

Open-source sample project

Agora provides an open-source sample project for Single Host on GitHub for you to download as a source code reference.