Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

EasyEvents.cs

Subscribe To Vivox Events

Subscribe to relevant Vivox events in Awake() or Start() methods. Check out the Login Events page to see examples on how to use EasyEvents

Audio Device Events

#region Audio Device Events

public event Action<IAudioDevice> AudioInputDeviceAdded;
public event Action<IAudioDevice> AudioInputDeviceRemoved;
public event Action<IAudioDevice> AudioInputDeviceUpdated;

public event Action<IAudioDevice> AudioOutputDeviceAdded;
public event Action<IAudioDevice> AudioOutputDeviceRemoved;
public event Action<IAudioDevice> AudioOutputDeviceUpdated;

#endregion

Uses EasyEvents.cs to access Login events

You can also access EasyEvents by injecting it into your class using Zenject dependency injection. Read more about it here.

AudioInputDeviceAdded

Called when a new Audio device is detected (Mic)

AudioInputDeviceRemoved

Called when an Audio device is removed (Mic)

AudioInputDeviceUpdated

Called after the 2 previous events and is called when a device is added, removed, or changed

AudioOutputDeviceAdded

Called when a new Audio device is detected (Speaker / Headphones)

AudioOutputDeviceRemoved

Called when an Audio device is removed (Speaker / Headphones)

AudioOutputDeviceUpdated

Called after the 2 previous events and is called when a device is added, removed, or changed

OnAudioInputDeviceAdded

requires (IAudioDevice audioDevice)

OnAudioInputDeviceRemoved

requires (IAudioDevice audioDevice)

OnAudioInputDeviceUpdated

requires (IAudioDevice audioDevice)

OnAudioOutputDeviceAdded

requires (IAudioDevice audioDevice)

OnAudioOutputDeviceRemoved

requires (IAudioDevice audioDevice)

OnAudioOutputDeviceUpdated

requires (IAudioDevice audioDevice)

Subscribe to Audio Device events if you want to allow users to change their Mic / Headphone / Speaker device settings in game instead of having to exit the game and adjust audio device settings

Login Events

Uses EasyEvents.cs to access Login events

You can also access EasyEvents by injecting it into your class using Zenject dependency injection. Read more about it here.

Event

Purpose

LoggingIn

Called when Vivox begins logging in a user

LoggedIn

Called when Vivox successfully logs in a user

LoggingOut

Called locally and immediately when the LogoutOfVivox() method is called

LoggedOut

Called locally and fires after the LogoutOfVivox() method is called

LoginAdded

Called when a new LoginSession is added to Vivox Client - User Logged In

LoginRemoved

Called when a new LoginSession is removed to Vivox Client - User Logged out

LoginUpdated

Called when a new LoginSession values are updated in Vivox Client - User Changed Name

Callback Method

Parameters

OnLoggingIn

requires (ILoginSession loginSession)

OnLoggedIn

requires (ILoginSession loginSession)

OnLoggedInSetup

requires (ILoginSession loginSession)

OnLoggingOut

requires (ILoginSession loginSession)

OnLoggedOut

requires (ILoginSession loginSession)

OnLoginAdded

requires (AccountId accountId)

OnLoginRemoved

requires (AccountId accountId)

OnLoginUpdated

requires (ILoginSession loginSession)

Subscribe to Login events if you want to perform actions based on each level of logging in or out, you want to offer users the ability to have multiple login sessions at 1 time and keep track of them, or simply want to implement a Debug.Log statement to ensure the player is logged in successfully.

Channel Events

Uses EasyEvents.cs to access Channel events

You can also access EasyEvents by injecting it into your class using Zenject dependency injection. Read more about it here.

Event

Purpose

ChannelConnecting

Called when Vivox starts connecting a user to a channel. If the channel doesn't exists one is created

ChannelConnected

Called when Vivox successfully connects a user to a channel.

ChannelDisconnecting

Called when Vivox starts disconnecting a user from a channel.

ChannelDisconnected

Called when Vivox successfully disconnects a user from a channel.

Callback Method

Parameters

OnChannelConnecting

requires (IChannelSession channelSession)

OnChannelConnected

requires (IChannelSession channelSession)

OnChannelDisconnecting

requires (IChannelSession channelSession)

OnChannelDisconnected

requires (IChannelSession channelSession)

Subscribe to Channel events if you want to perform actions based on each level of connecting/disconnecting or simply want to implement a Debug.Log statement to ensure the player is connected to a channel

Audio Channel Events

Uses EasyEvents.cs to access Audio Channel events

You can also access EasyEvents by injecting it into your class using Zenject dependency injection. Read more about it here.

Event

Purpose

AudioChannelConnecting

Called when Vivox starts connecting a user to a voice channel. Channel must exist for voice to connect

AudioChannelConnected

Called when Vivox successfully connects a user to voice a channel.

AudioChannelDisconnecting

Called when Vivox starts disconnecting a user from a voice channel.

AudioChannelDisconnected

Called when Vivox successfully disconnects a user from a voice channel.

Callback Method

Parameters

OnAudioConnecting

requires (IChannelSession channelSession)

OnAudioConnected

requires (IChannelSession channelSession)

OnAudioDisconnecting

requires (IChannelSession channelSession)

OnAudioDisconnected

requires (IChannelSession channelSession)

Subscribe to Voice Channel events if you want to perform actions based on each level of connecting/disconnecting or simply want to implement a Debug.Log statement to ensure the player is connected to a voice channel

Text Channel Events

Uses EasyEvents.cs to access Text Channel events

You can also access EasyEvents by injecting it into your class using Zenject dependency injection. Read more about it here.

Event

Purpose

TextChannelConnecting

Called when Vivox starts connecting a user to a channel. Channel must exist for text to connect

TextChannelConnected

Called when Vivox successfully connects a user to a text channel.

TextChannelDisconnecting

Called when Vivox starts disconnecting a user from a text channel.

TextChannelDisconnected

Called when Vivox successfully disconnects a user from a text channel.

Callback Method

Parameters

OnTextChannelConnecting

requires (IChannelSession channelSession)

OnTextChannelConnected

requires (IChannelSession channelSession)

OnTextChannelDisconnecting

requires (IChannelSession channelSession)

OnTextChannelDisconnected

requires (IChannelSession channelSession)

Subscribe to Text Channel events if you want to perform actions based on each level of connecting/disconnecting or simply want to implement a Debug.Log statement to ensure the player is connected to a text channel

Message Events

Uses EasyEvents.cs to access Channel and Direct message events

You can also access EasyEvents by injecting it into your class using Zenject dependency injection. Read more about it here.

Event

Purpose

ChannelMessageRecieved

Called when a channel message is received. The message is passed to the method parameter

EventMessageRecieved

Called when a channel event/hidden message is received. The message is passed to the method parameter

DirectMessageRecieved

Called when a direct message is received. The message is passed to the method parameter

DirectMessageFailed

Called when a message has failed to send. The message is passed to the method parameter

Callback Methods

Parameters

OnChannelMessageRecieved

requires (IChannelTextMessage textMessage)

OnEventMessageRecieved

requires (IChannelTextMessage textMessage)

OnDirectMessageRecieved

requires (IDirectedTextMessage directedTextMessage)

OnDirectMessageFailed

requires (IFailedDirectedTextMessage failedMessage)

These Message events are necessary to receive channel, event/hidden, or direct messages. Event/Hidden messages can be used if you (very useful if you are not using a Networking Stack) want to pass info to players in the channel. When a message fails to send you can use the OnDirectMessageFailed callback to store the message or try and resend it.

User Events

The keywords Fire and Called are used interchangeably

Uses EasyEvents.cs to access User events

You can also access EasyEvents by injecting it into your class using Zenject dependency injection. Read more about it here.

Event

Purpose

UserJoinedChannel

Called when a user joins a channel. This event will fire for every user that is in the same channel

UserLeftChannel

Called when a user leaves a channel. This event will fire for every user that is in the same channel

UserValuesUpdated

Called when a user values are updated in a channel such as speaking, muted, name change. This event will fire for every user that is in the same channel. This event is called many times by Vivox implement at your own peril 😬 . You can set

Callback Methods

Parameters

OnParticipantAdded

requires (IParticipant participant)

OnParticipantRemoved

requires (IParticipant participant)

OnParticipantValueUpdated

requires (IParticipant participant)

If you want to know if a user has joined or left a channel

Uses EasyEvents.cs to access User events

You can also access EasyEvents by injecting it into your class using Zenject dependency injection. Read more about it here.

Event

Purpose

UserMuted

Called when a user is muted

UserUnmuted

Called when a user is unmuted

UserSpeaking

Called when a user is speaking

UserNotSpeaking

Called when a user is no longer speaking

LocalUserMuted

Called when local user is muted

LocalUserUnmuted

Called when local user is unmuted

UserCrossMuted

Called when user has been Cross Muted , this action prevents the AccountId from sending or receiving voice or text communications.

UserCrossUnmuted

Called when user has been Cross Unmuted , this action resumes/allows the AccountId to send or receive ausio/voice or text communications.

Callback Method

Parameters

OnUserMuted

requires (IParticipant participant)

OnUserUnmuted

requires (IParticipant participant)

OnUserSpeaking

requires (IParticipant participant)

OnUserNotSpeaking

requires (IParticipant participant)

If you want to know if a player is speaking or muted to update your UI with a different image for each event.

Text To Speech ( TTS ) Events

Uses EasyEvents.cs to access Text-To-Speech events

You can also access EasyEvents by injecting it into your class using Zenject dependency injection. Read more about it here.

Event

Purpose

TTSMessageAdded

Called when a message is spoken or added to the TTS queue.

TTSMessageRemoved

Called when a message is removed from the TTS queue.

TTSMessageUpdated

Called when a message is spoken, overridden, removed, added to the TTS queue or TTS voice changed

OnTTSMessageAdded

requires (ITTSMessageQueueEventArgs ttsArgs)

OnTTSMessageRemoved

requires (ITTSMessageQueueEventArgs ttsArgs)

OnTTSMessageUpdated

requires (ITTSMessageQueueEventArgs ttsArgs)

If you want to keep a log of all messages sent thru TTS for accessibility reasons or send notifications to the user using TTS when their message is done playing or wants to send message after hearing it first

Unsubscribe From Vivox Events

Make sure to unsubscribe from all the events explained above on OnApplicationQuit() in Unity

Last updated