Search code examples
unity-game-engineagora.io

Mute a remote user only on the local device. Everyone should be able to hear the muted person except the one that muted him


I am making a Live teaching platform with unity, using agora for the audio/video module. My requirement is to build a 'One-to-many' and 'Many-to-one' communication channel. For example, let's say that there are 4 students and 1 teacher in the channel. When the teacher speaks, everyone should be able to hear. And when a student speaks, only the teacher should be able to hear. How can I achieve this with unity and agora?


Solution

  • There are a couple of ways you can achieve this. One where you manage multiple channels, and there other where each student individually unsubscribes from the other students' audio.

    For the multiple channel scenario, there is an overview of how that works here: https://docs.agora.io/en/Voice/multiple_channel_unity?platform=Unity

    • Each student would broadcast, but subscribe into a channel, let's call it "students"
    • Each student would subscribe to another channel, let's call "teacher"
    • The teacher would do the opposite (subscribe to "students" and stream into "teacher"

    In the one channel scenario, whenever a student joins the stream, the other students can call muteRemoteAudioStream.