Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
2 contributors

Users who have contributed to this file

@PRWrl @guohai
85 lines (53 sloc) 6.95 KB

Online PK

Other Languages: 中文

Agora PK Hosting

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

Co-hosting in Standard 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.

Co-hosting in PK Mode

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.

Architectural Design

ArchitectureDesign.png

You can find the Agora implementation code for Android on Github. You can also download the APK file.

API methods

PK 连麦架构设计

The API methods related to the Agora Online PK:

iOS Android
sharedEngineWithAppId:delegate: create
setChannelProfile setChannelProfile
setClientRole setClientRole
enableVideo enableVideo
joinChannel joinChannel
setLiveTranscoding setLiveTranscoding
addPublishStreamUrl addPublishStreamUrl
removePublishStreamUrl removePublishStreamUrl
leaveChannel leaveChannel

Implementation

  • 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:

  1. 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.
  2. The hosts need to ensure that the CDN Live push stream URL address will not change after switching from the Standard mode.
  3. 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:
  1. Each host needs to remove the previous CDN Live push stream URL address using the removePublishStreamUrl API method.
  2. Each host needs to push the stream to the original CDN URL address.

Integration Guide

Integration SDK

Switching Between the Co-hosting Standard Mode and Co-hosting PK Mode

Android:

  1. Video broadcasting realization
  2. Stream pushing to CDN Live
  3. Call the removePublishStreamUrl API method to remove the stream URL address.

IOS:

  1. Video broadcasting realization

  2. Stream pushing to CDN Live

  3. Call the removePublishStreamUrl API method to remove the stream URL address.

Ijkplayer Realization (Optional)

Android: See 'Integration of ijkplayer framework for Android development'.

You can’t perform that action at this time.