Mute the local user
The Vivox Unity Package has two ways to mute a local user's audio input:
- Muting the VivoxInputDevice.
- Setting the Transmission.
VivoxInputDevice mute
Use VivoxService.Instance.MuteInputDevice()
and VivoxService.Instance.UnmuteInputDevice()
to control whether or not the local input device is muted. This will mute the user for all channel sessions that they are in.
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 TransmissionMode.All
to transmit the user's input to all channels they are in. Refer to the following code as an example:
void SetChannelTransmissionAll()
{
VivoxService.Instance.SetChannelTransmissionModeAsync(TransmissionMode.All);
}
Set TransmissionMode to TransmissionMode.Single
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:
void TransmitToChannel(string channelName)
{
VivoxService.Instance.SetChannelTransmissionModeAsync(TransmissionMode.Single, channelName);
}
Set TransmissionMode to TransmissionMode.None
to mute the user's input in all channels. The best practice is to use VivoxInputDevice
to handle this situation; however, TransmissionMode.None
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.None
:
void TransmitToNone()
{
VivoxService.Instance.SetChannelTransmissionModeAsync(TransmissionMode.None);
}