Get only 2 people to enable video call at a time using agora?

Viewed 366

Is their anyway to have only have two people who can go on a video call at a time from a room on agora. For example their are 20 speakers, and only 2 people at a time can have their video on, and if one closes their video someone else can turn it on. Is their an API for this, or a method to do it?

1 Answers

The concept you are asking about is achievable using the Agora RTC and RTM SDKs. The Agora RTC (Voice/Video) SDK supports up to 17 active broadcasters/host (for 128 hosts see FAQ) but does not have any methods to limit the number below that. This is where Agora RTM can help, it is a signaling layer that enables client side devices to communicate with string and JSON msgs.

I would recommend you take a look at this guide on "Dynamic Channels". It explains how to use RTM to create a lobby where users can see existing channels and either join a channel or create a new one. With some slight modifications you could add limitations to the number of participants.

Specifically in this section, currently there is a check before joining the call, you can change the 4 to 2 it will say the channel is full and not allow others to join. The onTap should look like this:

onTap: () {
  // limit channel to 2 people
  if (_channelList.values.toList()[index] <= 2) {
    joinCall(_channelList.keys.toList()[index], _channelList.values.toList()[index]);
  } else {
    print('Channel is full');
  }
},
Related