Photon Voice v2.53

Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | Properties | Events | List of all members
VoiceConnection Class Reference

Component that represents a Voice client. More...

Inherits ConnectionHandler.

Inherited by UnityVoiceClient, and VoiceFollowClient.

Public Member Functions

virtual bool ConnectUsingSettings (AppSettings overwriteSettings=null)
 Connect to Photon server using Settings More...
 
bool AddSpeaker (Speaker speaker, object userData)
 Tries to link local Speaker with remote voice stream using UserData. Useful if Speaker created after stream is started. More...
 
Speaker InstantiateSpeakerPrefab (GameObject parent, bool destroyOnRemove)
 Instantiates SpeakerPrefab, optionally attaches it to the provided parent. More...
 
bool AddRecorder (Recorder rec)
 
void RemoveRecorder (Recorder rec)
 

Public Attributes

virtual bool AlwaysUsePrimaryRecorder => false
 
AppSettings Settings
 Settings to be used by this Voice Client More...
 
VoiceLogger VoiceLogger => voiceComponentImpl.VoiceLogger
 
bool UsePrimaryRecorder => this.usePrimaryRecorder
 Use VoiceConnection.PrimaryRecorder directly. More...
 

Static Public Attributes

const int ChannelAudio = 1
 Recommended Photon Transport channel for audio. Chosen not to interfere with video and default channel. More...
 
const int ChannelVideo = 2
 Recommended Photon Transport channel for video. Chosen not to interfere with audio and default channel. More...
 

Protected Member Functions

override void Awake ()
 
virtual void Update ()
 
virtual void FixedUpdate ()
 
virtual void OnDestroy ()
 
virtual Speaker InstantiateSpeakerForRemoteVoice (int playerId, byte voiceId, object userData)
 
virtual void OnVoiceStateChanged (ClientState fromState, ClientState toState)
 
void CalcStatistics ()
 
virtual void OnOperationResponseReceived (OperationResponse operationResponse)
 

Protected Attributes

Voice.ILogger Logger => voiceComponentImpl.Logger
 

Properties

new LoadBalancingTransport Client [get]
 
VoiceClient VoiceClient [get]
 Returns underlying Photon Voice client. More...
 
ClientState ClientState [get]
 Returns Photon Voice client state. More...
 
float FramesReceivedPerSecond [get]
 Number of frames received per second. More...
 
float FramesLostPerSecond [get]
 Number of frames lost per second. More...
 
float FramesLostPercent [get]
 Percentage of lost frames. More...
 
GameObject SpeakerPrefab [get, set]
 Prefab that contains Speaker component to be instantiated when receiving a new remote audio source info More...
 
Recorder PrimaryRecorder [get, set]
 Primary Recorder to be used by VoiceConnection implementations directly or via integration objects. More...
 
string BestRegionSummaryInPreferences [get, set]
 Used to store and access the "Best Region Summary" in the Player Preferences. More...
 

Events

Action< SpeakerSpeakerLinked
 Fires when a speaker has been linked to a remote audio stream More...
 
Action< RemoteVoiceLinkRemoteVoiceAdded
 Fires when a remote voice stream is added More...
 

Detailed Description

Component that represents a Voice client.

Member Function Documentation

◆ AddSpeaker()

bool AddSpeaker ( Speaker  speaker,
object  userData 
)

Tries to link local Speaker with remote voice stream using UserData. Useful if Speaker created after stream is started.

Parameters
speakerSpeaker ot try linking.
userDataUserData object used to bind local Speaker with remote voice stream.
Returns

◆ ConnectUsingSettings()

virtual bool ConnectUsingSettings ( AppSettings  overwriteSettings = null)
virtual

Connect to Photon server using Settings

Parameters
overwriteSettingsOverwrites Settings before connecting
Returns
If true voice connection command was sent from client

Reimplemented in UnityVoiceClient.

◆ InstantiateSpeakerPrefab()

Speaker InstantiateSpeakerPrefab ( GameObject  parent,
bool  destroyOnRemove 
)

Instantiates SpeakerPrefab, optionally attaches it to the provided parent.

VoiceConnection manages the instantiated object (destroys on OnRemoteVoiceRemoveAction).

Parameters
parentThe object to attach Steaker to.
destroyOnRemoveAutomatically destroy instantiated prefab when remote voice is removed (the caller does not manages the instance).
Returns
Instantiated Speaker or null.

Member Data Documentation

◆ ChannelAudio

const int ChannelAudio = 1
static

Recommended Photon Transport channel for audio. Chosen not to interfere with video and default channel.

◆ ChannelVideo

const int ChannelVideo = 2
static

Recommended Photon Transport channel for video. Chosen not to interfere with audio and default channel.

◆ Settings

AppSettings Settings

Settings to be used by this Voice Client

◆ UsePrimaryRecorder

bool UsePrimaryRecorder => this.usePrimaryRecorder

Property Documentation

◆ BestRegionSummaryInPreferences

string BestRegionSummaryInPreferences
getset

Used to store and access the "Best Region Summary" in the Player Preferences.

◆ ClientState

ClientState ClientState
get

Returns Photon Voice client state.

◆ FramesLostPercent

float FramesLostPercent
get

Percentage of lost frames.

◆ FramesLostPerSecond

float FramesLostPerSecond
get

Number of frames lost per second.

◆ FramesReceivedPerSecond

float FramesReceivedPerSecond
get

Number of frames received per second.

◆ PrimaryRecorder

Recorder PrimaryRecorder
getset

Primary Recorder to be used by VoiceConnection implementations directly or via integration objects.

◆ SpeakerPrefab

GameObject SpeakerPrefab
getset

Prefab that contains Speaker component to be instantiated when receiving a new remote audio source info

◆ VoiceClient

Returns underlying Photon Voice client.

Event Documentation

◆ RemoteVoiceAdded

Action<RemoteVoiceLink> RemoteVoiceAdded

Fires when a remote voice stream is added

◆ SpeakerLinked

Action<Speaker> SpeakerLinked

Fires when a speaker has been linked to a remote audio stream