Photon Voice v2.14

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...
 

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 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...
 
- 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...
 

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...
 
- 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...
 
- 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

◆ AutoCreateSpeakerIfNotFound

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

◆ 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.

Property Documentation

◆ Instance

PhotonVoiceNetwork Instance
staticgetset

Singleton instance for PhotonVoiceNetwork