Mute other users for a specific user
How to mute other users for a specific player.
Read time 1 minuteLast updated 8 months ago
You can mute other users for a specific user by using a local mute. The function prevents a user from hearing a muted user, but other users in the channel continue to hear the muted user. can be used to allow the user to hear the muted user again.
VivoxParticipant.MutePlayerLocallyVivoxParticipant.UnmutePlayerLocallyFor 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 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:
VivoxServices.Instance.ActiveChannelsvoid 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();}