Other Languages: 中文
The Agora PK Hosting solution is designed for CDN Live push-and-pull stream scenarios that involve switching between the following scenarios:
- Co-hosting in Standard mode
- Co-hosting in PK mode
The hosts can use third-party applications such as ijkplayer to push streams to CDN Live. The push stream address for the hosts are independent and the audience can only see the corresponding host.
The hosts need to quit the CDN Live push stream process, join the same Agora channel, and set the co-hosting composite mode on the Agora server using the setLiveTranscoding API method; then push the composite stream to the original CDN address using the push stream addPublishStreamUrl API method.
The CDN Live audience can then participate in the PK between the hosts. The CDN Live audience does not need to change the CDN Live URL address as the hosts will still use the previous CDN Live push stream URL address. When either one of the hosts quit the Agora channel, the other host will switch to the Standard mode.
You can find the Agora implementation code for Android on Github. You can also download the APK file.
The API methods related to the Agora Online PK:
-
The Agora PK Hosting solution uses the Agora Video SDK in the communication mode.
-
When switching to the PK mode from the Standard mode, each host needs to quit the original CDN Live stream and join the same Agora channel through the application logic.
-
Under the PK mode:
- Each host needs to set the composite configuration using the _setLiveTranscoding API method a_nd add the CDN Live push stream URL address, using the addPublishStreamUrl API method, in the Agora channel.
- The hosts need to ensure that the CDN Live push stream URL address will not change after switching from the Standard mode.
- When either one of the hosts quit the Agora channel, the other host will quit the channel and switch to the Standard mode through the application.
- Before switching to the Standard mode from the PK mode:
- Each host needs to remove the previous CDN Live push stream URL address using the removePublishStreamUrl API method.
- Each host needs to push the stream to the original CDN URL address.
- For Android, see Configuring the DEV runtime.
- For IOS, see Configuring the DEV runtime.
Android:
- Video broadcasting realization
- Stream pushing to CDN Live
- Call the removePublishStreamUrl API method to remove the stream URL address.
IOS:
-
Call the removePublishStreamUrl API method to remove the stream URL address.
Ijkplayer Realization (Optional)
Android: See 'Integration of ijkplayer framework for Android development'.