Mute / Unmute

Inherit from EasyManager.cs

using EasyCodeForVivox;

public class VivoxManager : EasyManager
{

}

Inject EasyUsers

using EasyCodeForVivox;
using UnityEngine;
using Zenject;

public class VivoxMute : MonoBehaviour
{
    EasyMute _mute;

    [Inject]
    private void Initialize(EasyMute mute)
    {
        _mute = mute;
    }
}

Local Mute/Unmute Self

Toggle (turn on/off) Local Player Voice/audio in a channel. A channel must be connected and have active Audio/Voice in that channel.

  • Mute/Unmute the local players audio on or off. This will stop/prevent Vivox from transmitting any audio to any/all channels the user is connected to.

EasyManager

public void MuteLocalPlayer()
{
    MuteSelf();
}

public void UnmuteLocalPlayer()
{
    UnmuteSelf();
}

EasyMute

private void LocalMuteSelf()
{
    _mute.LocalMuteSelf(EasySession.Client);
}

private void LocalUnmuteSelf()
{
    _mute.LocalUnmuteSelf(EasySession.Client);
}

Local Mute/Unmute Remote Player

  • Mute/Unmute any remote players audio on or off in the channel called "chat". This will block any audio that the muted player is speaking in the channel in which they were blocked. Only mutes them for the local user, not everyone in the channel.

EasyManager

public void MuteRemotePlayer()
{
    LocalMuteRemoteUser("remotePlayer", "chat");
}

public void UnmuteRemotePlayer()
{
    LocalUnmuteRemoteUser("remotePlayer", "chat");
}

EasyMute

public void MuteRemoteUser()
{
    _mute.LocalMuteRemoteUser("userName", EasySession.ChannelSessions["chat"], true);
}

public void UnmuteRemoteUser()
{
    _mute.LocalMuteRemoteUser("userName", EasySession.ChannelSessions["chat"], false);
}

Local Mute/Unmute All Players

  • Toggle any remote players audio on or off in the channel called "chat". This will block any audio from all muted players that are speaking in the channel in which they were blocked. Only mutes them for the local user, not everyone in the channel.

EasyManager

public void MuteAllPlayers()
{
    LocalMuteAllPlayers("chat");
}

public void UnmuteAllPlayers()
{
    LocalUnmuteAllPlayers("chat");
}

EasyMute

  • Checks if channel exists before attempting to mute all players

public void MuteAllPlayers()
{
    if (EasySession.ChannelSessions.ContainsKey("chat"))
    {
        _mute.LocalMuteAllUsers(EasySession.ChannelSessions["chat"]);
    }
    else
    {
        Debug.Log("Channel Does not exist. Cannot Mute player");
    }
}

public void UnmuteAllPlayers()
{
    if (EasySession.ChannelSessions.ContainsKey("chat"))
    {
        _mute.LocalUnmuteAllUsers(EasySession.ChannelSessions["chat"]);
    }
    else
    {
        Debug.Log("Channel Does not exist. Cannot Unmute player");
    }
}

Cross Mute/Unmute a Player

  • Prevents a player from sending text/chat messages or audio/voice in the channel that is specified. In this case the player's name is "userNameToMute" and channel name is "channelName"

EasyManager

public void CrossMuteUser()
{
    CrossMuteUser("userName", "channelName", "usernameToMute", true);
}

public void CrossUnmuteUser()
{
    CrossMuteUser("userName", "channelName", "usernameToMute", false);
}

EasyMute

public void CrossMuteUser()
{
    _mute.CrossMuteUser("userName", "channelName", "usernameToMute", true);
}

public void CrossUnmuteUser()
{
    _mute.CrossMuteUser("userName", "channelName", "usernameToMute", true);
}

Cross Mute/Unmute multiple Players

  • Prevents selected players from sending text/chat messages or audio/voice in the channel that is specified. In this case the players' names are "player1", "player2" and channel name is "channelName"

EasyManager

public void CrossMuteUsers()
{
    List<string> usersToMute = new List<string>() {"player1", "player2" };
    CrossMuteUsers("userName", "channelName", usersToMute, true);
}

public void CrossUnmuteUsers()
{
    List<string> usersToMute = new List<string>() { "player1", "player2" };
    CrossMuteUsers("userName", "channelName", usersToMute, false);
}

EasyMute

public void CrossMuteUsers()
{
    List<string> usersToMute = new List<string>() { "player1", "player2" };
    _mute.CrossMuteUsers("userName", "channelName", usersToMute, true);
}

public void CrossUnmuteUsers()
{
    List<string> usersToMute = new List<string>() { "player1", "player2" };
    _mute.CrossMuteUsers("userName", "channelName", usersToMute, false);
}

Clear Cross Muted Users for Login Session

  • Unmutes all players for the current login session (player currently signed in), in this case the current logged in player is "userName". Unless locally muted, all players will now be able to talk and send text messages to the current logged in player ("userName")

EasyManager

public void ClearCrossMutedUsersForLoginSession()
{
    ClearCrossMutedUsersForLoginSession("userName");
}

EasyMute

public void ClearCrossMutedUsersForLoginSession()
{
    _mute.ClearAllCurrentCrossMutedAccounts("userName");
}

Last updated