Start an Audio Broadcast¶
Scenario 1: Start an Audio Live Broadcast¶
- 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.
- Create an RtcEngine object, see live_android_create_en .
- Set the channel as live broadcast mode, see Set Channel Profile (setChannelProfile) .
- Set the user role, see Set User Role(setClientRole) .
- Create and join a channel, see live_android_joinchannel .
//create an RtcEngine object RtcEngine rtcEngine = RtcEngine.create(ctx, "74******************************a", myRtcEventHandler); //set the channel as live broadcast mode rtcEngine.setChannelProfile(Constants.CHANNEL_PROFILE_LIVE_BROADCASTING); //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
Meanwhile, you may need the following functions when starting an audio live broadcast: