Mute other users for a specific user

You can mute other users for a specific user by using a local mute. The VivoxParticipant.MutePlayerLocally function prevents a user from hearing a muted user, but other users in the channel continue to hear the muted user. VivoxParticipant.UnmutePlayerLocally can be used to allow the user to hear the muted user again.

For example, Cynthia, Fernando, and Wang are in a channel. Fernando does not want to hear Wang’s audio. By using a local mute, you can allow Fernando to stop hearing Wang’s audio. However, Cynthia continues to hear Wang, and Wang continues to hear Cynthia and Fernando.

Because this is a VivoxParticipant function, it is best to have some way to handle individual UI representations for each VivoxParticipant, so that everyone has their own mute buttons (as shown in the Chat Channel Sample and the Participant Management page).

Alternatively, the following example showcases using the VivoxServices.Instance.ActiveChannels dictionary to find and mute/unmute a specific participant in a particular channel by using the PlayerId of the participant and the ChannelName of the channel:

void MutePlayerLocally(string PlayerId, string ChannelName)
{
    VivoxService.Instance.ActiveChannels[ChannelName].Where(participant => participant.PlayerId == PlayerId).First().MutePlayerLocally();
}

void UnmutePlayerLocally(string PlayerId, string ChannelName)
{
    VivoxService.Instance.ActiveChannels[ChannelName].Where(participant => participant.PlayerId == PlayerId).First().UnmutePlayerLocally();
}

Note: To update a UI element to indicate which users a user has muted, you need to wait until you receive an event from the Vivox SDK to confirm that the other users have been muted. You can find examples of handling this event and implementing it into a UI in the Chat Channel Sample and on the Participants management page.