Photon Voice v2.22.1

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

This class can be used to automatically sync client states between PUN and Voice. It also sets a custom PUN Speaker factory to find the Speaker component for a character's voice. For this to work attach a PhotonVoiceView next to the PhotonView of your player's prefab. More...

Inherits VoiceConnection.

Public Member Functions

bool ConnectAndJoinRoom ()
 Connect voice client to Photon servers and join a Voice room More...
 
void Disconnect ()
 Disconnect voice client from all Photon servers More...
 
- Public Member Functions inherited from VoiceConnection
bool ConnectUsingSettings (AppSettings overwriteSettings=null)
 Connect to Photon server using Settings More...
 
void InitRecorder (Recorder rec)
 Initializes the Recorder component to be able to transmit audio. More...
 
void SetPlaybackDelaySettings (PlaybackDelaySettings gpds)
 Sets the global configuration for the playback behaviour in case of delays. More...
 
void SetGlobalPlaybackDelaySettings (int low, int high, int max)
 Sets the global configuration for the playback behaviour in case of delays. More...
 

Public Attributes

bool AutoConnectAndJoin = true
 Auto connect voice client and join a voice room when PUN client is joined to a PUN room More...
 
bool AutoLeaveAndDisconnect = true
 Auto disconnect voice client when PUN client is not joined to a PUN room More...
 
bool WorkInOfflineMode = true
 Whether or not Photon Voice client should follow PUN client if the latter is in offline mode. More...
 
- Public Attributes inherited from VoiceConnection
AppSettings Settings
 Settings to be used by this voice connection More...
 
Func< int, byte, object, SpeakerSpeakerFactory
 Special factory to link Speaker components with incoming remote audio streams More...
 
float MinimalTimeScaleToDispatchInFixedUpdate = -1f
 Configures the minimal Time.timeScale at which Voice client will dispatch incoming messages within LateUpdate. More...
 
bool AutoCreateSpeakerIfNotFound = true
 Auto instantiate a GameObject and attach a Speaker component to link to a remote audio stream if no candidate could be found More...
 

Static Public Attributes

const string VoiceRoomNameSuffix = "_voice_"
 Suffix for voice room names appended to PUN room names. More...
 

Protected Member Functions

override void Awake ()
 
override void OnDisable ()
 
override void OnDestroy ()
 
override void OnVoiceStateChanged (ClientState fromState, ClientState toState)
 
override Speaker SimpleSpeakerFactory (int playerId, byte voiceId, object userData)
 
- Protected Member Functions inherited from VoiceConnection
override void Awake ()
 
virtual void Update ()
 
virtual void FixedUpdate ()
 
void Dispatch ()
 Dispatches incoming network messages for Voice client. Called in FixedUpdate or LateUpdate. More...
 
override void OnDisable ()
 
void CalcStatistics ()
 
void LinkSpeaker (Speaker speaker, RemoteVoiceLink remoteVoice)
 

Properties

static PhotonVoiceNetwork Instance [get, set]
 Singleton instance for PhotonVoiceNetwork More...
 
bool UsePunAuthValues [get, set]
 Whether or not to use the same PhotonNetwork.AuthValues in PhotonVoiceNetwork.Instance.Client.AuthValues. More...
 
- Properties inherited from VoiceConnection
VoiceLogger Logger [get, protected set]
 Logger used by this component More...
 
DebugLevel LogLevel [get, set]
 Log level for this component More...
 
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]
 Main Recorder to be used for transmission by default More...
 
DebugLevel GlobalRecordersLogLevel [get, set]
 
DebugLevel GlobalSpeakersLogLevel [get, set]
 
int GlobalPlaybackDelay [get, set]
 
string BestRegionSummaryInPreferences [get, set]
 Used to store and access the "Best Region Summary" in the Player Preferences. More...
 
int GlobalPlaybackDelayMinSoft [get]
 Gets the global value in ms above which the audio player tries to keep the delay. More...
 
int GlobalPlaybackDelayMaxSoft [get]
 Gets the global value in ms below which the audio player tries to keep the delay. More...
 
int GlobalPlaybackDelayMaxHard [get]
 Gets the global value in ms that audio play delay will not exceed. More...
 
- Properties inherited from ILoggable
DebugLevel LogLevel [get, set]
 
VoiceLogger Logger [get]
 

Additional Inherited Members

- Protected Attributes inherited from VoiceConnection
List< RemoteVoiceLinkcachedRemoteVoices = new List<RemoteVoiceLink>()
 
- Events inherited from VoiceConnection
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

This class can be used to automatically sync client states between PUN and Voice. It also sets a custom PUN Speaker factory to find the Speaker component for a character's voice. For this to work attach a PhotonVoiceView next to the PhotonView of your player's prefab.

Member Function Documentation

◆ ConnectAndJoinRoom()

bool ConnectAndJoinRoom ( )

Connect voice client to Photon servers and join a Voice room

Returns
If true, connection command send from client

◆ Disconnect()

void Disconnect ( )

Disconnect voice client from all Photon servers

Member Data Documentation

◆ AutoConnectAndJoin

bool AutoConnectAndJoin = true

Auto connect voice client and join a voice room when PUN client is joined to a PUN room

◆ AutoLeaveAndDisconnect

bool AutoLeaveAndDisconnect = true

Auto disconnect voice client when PUN client is not joined to a PUN room

◆ VoiceRoomNameSuffix

const string VoiceRoomNameSuffix = "_voice_"
static

Suffix for voice room names appended to PUN room names.

◆ WorkInOfflineMode

bool WorkInOfflineMode = true

Whether or not Photon Voice client should follow PUN client if the latter is in offline mode.

Property Documentation

◆ Instance

PhotonVoiceNetwork Instance
staticgetset

Singleton instance for PhotonVoiceNetwork

◆ UsePunAuthValues

bool UsePunAuthValues
getset

Whether or not to use the same PhotonNetwork.AuthValues in PhotonVoiceNetwork.Instance.Client.AuthValues.