v16.3.0
Latest
2020.3+

Class VivoxParticipant

Representation of a player that is in a Vivox voice and/or text channel.

Inheritance
VivoxParticipant
Namespace: Unity.Services.Vivox
Syntax
public sealed class VivoxParticipant

Properties

AudioEnergy

The AudioEnergy of the participant. This can be used to create a voice activity meter for participants in a channel.

Declaration
public double AudioEnergy { get; }
Property Value
TypeDescription
Double

ChannelName

The unique identifier of the channel that this participant is associated with.

Declaration
public string ChannelName { get; }
Property Value
TypeDescription
String

ChannelURI

The universal resource identifier of the channel this participant is associated with.

Declaration
public string ChannelURI { get; }
Property Value
TypeDescription
String

DisplayName

The DisplayName of the participant.

Declaration
public string DisplayName { get; }
Property Value
TypeDescription
String

IsMuted

Whether or not this participant is muted.

Declaration
public bool IsMuted { get; }
Property Value
TypeDescription
Boolean

IsSelf

Whether or not this participant is the logged in user.

Declaration
public bool IsSelf { get; }
Property Value
TypeDescription
Boolean

LocalVolume

The volume of a participant only for the local user in a given channel.

Declaration
public int LocalVolume { get; }
Property Value
TypeDescription
Int32

ParticipantTapAudioSource

The AudioSource component of a VivoxParticipantTap gameobject if one has been created. This will be null if there is no active VivoxParticipantTap associated with this participant object.

Declaration
public AudioSource ParticipantTapAudioSource { get; }
Property Value
TypeDescription
UnityEngine.AudioSource

PlayerId

The PlayerId and unique identifier of a Vivox channel participant. This will be either a Unity Authentication Service PlayerId if the Authentication package is in use, or a unique GUID assigned by Vivox during the account creation process.

Declaration
public string PlayerId { get; }
Property Value
TypeDescription
String

SpeechDetected

Whether or not the AudioEnergy has surpassed the threshold to be considered speech.

Declaration
public bool SpeechDetected { get; }
Property Value
TypeDescription
Boolean

URI

The Vivox universal resource identifier of this participant.

Declaration
public string URI { get; }
Property Value
TypeDescription
String

Methods

CreateVivoxParticipantTap(String, Boolean)

Creates a GameObject containing the VivoxParticipantTap and AudioSource for this VivoxParticipant

Declaration
public GameObject CreateVivoxParticipantTap(string gameObjectName = "", bool silenceInChannelAudioMix = true)
Parameters
TypeNameDescription
StringgameObjectName

Optional name to give to the created GameObject

BooleansilenceInChannelAudioMix

Whether to mute this Participant in the Channel Audio Mix output (defaults to true)

Returns
TypeDescription
UnityEngine.GameObject

The built GameObject with the VivoxParticipantTap. This will return null if the creation fails for any reason.

DestroyVivoxParticipantTap()

Destroys the GameObject containing the VivoxParticipantTap for this VivoxParticipant and sets the AudioSource to null

Declaration
public void DestroyVivoxParticipantTap()

MutePlayerLocally()

Sets this participant as muted for the local user only in the channel associated with this participant. In order to mute this player across multiple channels you will need to iterate over ActiveChannels and leverage this method on the additional VivoxParticipant objects that match this instance's PlayerId.

Declaration
public void MutePlayerLocally()

SetLocalVolume(Int32)

Sets the volume of a participant for the local user only in the channel associated with this participant. In order to adjust the volume of this player across multiple channels you will need to iterate over ActiveChannels. Similar participants will have a matching PlayerId as the current VivoxParticipant. This only affects the audio that is heard locally, and does not change the audio that is heard by any of the other participants in a channel. Volume value is clamped between -50 and 50 with a default of 0.

Declaration
public void SetLocalVolume(int volume)
Parameters
TypeNameDescription
Int32volume

The value to set the participant to for the local user - clamped between -50 and 50 with a default of 0

UnmutePlayerLocally()

Sets this participant as unmuted for the local user only in the channel associated with this participant. In order to unmute this player across multiple channels you will need to iterate over ActiveChannels and leverage this method on the additional VivoxParticipant objects that match this instance's PlayerId.

Declaration
public void UnmutePlayerLocally()

Events

ParticipantAudioEnergyChanged

An event that fires if the Participants audio energy changes.

Declaration
public event Action ParticipantAudioEnergyChanged
Event Type
TypeDescription
Action

ParticipantMuteStateChanged

An event that fires if the mute state of the participant changes.

Declaration
public event Action ParticipantMuteStateChanged
Event Type
TypeDescription
Action

ParticipantSpeechDetected

An event that fires if the Participant's speech detected status changes.

Declaration
public event Action ParticipantSpeechDetected
Event Type
TypeDescription
Action