Mute the local user
How to mute the local player microphone.
Read time 1 minuteLast updated 7 months ago
The Vivox Unity Package has two ways to mute a local user's audio input:
- Muting the VivoxInputDevice.
- Setting the Transmission.
VivoxInputDevice mute
Use and to control whether or not the local input device is muted. This will mute the user for all channel sessions that they are in.
VivoxService.Instance.MuteInputDevice()VivoxService.Instance.UnmuteInputDevice()VivoxInputDevice mute is the recommended mute method for consistency unless you must manage which individual channels a user can speak into.
TransmissionMode
For more control over where a user's input is transmitted, use .
VivoxService.Instance.SetChannelTransmissionModeAsync(TransmissionMode transmissionMode, string channelName = null)TransmissionMode allows a user's input to be transmitted into all channels they are in, a single channel or no channels at all.
Set TransmissionMode to to transmit the user's input to all channels they are in. Refer to the following code as an example:
TransmissionMode.Allvoid SetChannelTransmissionAll(){ VivoxService.Instance.SetChannelTransmissionModeAsync(TransmissionMode.All);}
Set TransmissionMode to to transmit the user's input into a single channel. Set the specified channel name in the channelName field. Refer to the following code as an example:
TransmissionMode.Singlevoid TransmitToChannel(string channelName){ VivoxService.Instance.SetChannelTransmissionModeAsync(TransmissionMode.Single, channelName);}
Set TransmissionMode to to mute the user's input in all channels. The best practice is to use to handle this situation; however, can have its use cases, mainly when used with the other two transmission mode settings to unify the input settings. Refer to the following code as an example of :
TransmissionMode.NoneVivoxInputDeviceTransmissionMode.NoneTransmissionMode.Nonevoid TransmitToNone(){ VivoxService.Instance.SetChannelTransmissionModeAsync(TransmissionMode.None);}