Start an Audio Broadcast

Start an Audio Broadcast

Scenario 1: Start an Audio Live Broadcast

  1. Integrate the package. Agora provides two packages for Android to enable the audio call function: audio package and full package. It is recommended that you integrate the full package due to:
    • If you only need the audio function currently, just disable the video function.
    • If you only need the audio function currently, but later video function is also required, you can still use the full package.
    • If you only need the audio function now and later, use the audio package which is cropped based on the full package. The audio package and full package share one set of APIs, and you can switch to the full package later when video function is required with the same set of APIs.

Integrate either of the following packages according to your actual needs:

Audio Package Integrate Audio Package - Android
Full Package Integrate Full Package - Android
  1. Create an RtcEngine object, see live_android_create_en .
  2. Set the channel as live broadcast mode, see Set Channel Profile (setChannelProfile) .
  3. Set the user role, see Set User Role(setClientRole) .
  4. Create and join a channel, see live_android_joinchannel .

Sample code:

//create an RtcEngine object
RtcEngine rtcEngine = RtcEngine.create(ctx, "74******************************a", myRtcEventHandler);

//set the channel as live broadcast mode

//set the user role as host
rtcEngine.setClientRole(Constants.CLIENT_ROLE_BROADCASTER, myPermissionKey)

//create and join a channel
rtcEngine.joinChannel(null, "channelName", null, myUid)

You can now start the audio live broadcast!

Scenario 2: Implement other functions

Agora will provide the API calling workflow and detailed sample code for the following scenarios later. Before that, refer to Interactive Broadcast API :

  • How to host in
  • Capture the audio raw data by yourself
  • Werewolf

Meanwhile, you may need the following functions when starting an audio live broadcast:

  • ../Tutorial/recording
  • ../Tutorial/encryption_android_agora
  • ../Tutorial/encryption_android_customize
  • ../Tutorial/rawdata_android