How to initialize Recorder ? Photon Voice

The whole answer can be found below.

Please note: The Photon forum is closed permanently. After many dedicated years of service we have made the decision to retire our forum and switch to read-only: we've saved the best to last! And we offer you support through these channels:

Try Our
Documentation

Please check if you can find an answer in our extensive documentation on Voice.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Read More on
Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

How to initialize Recorder ? Photon Voice

sunil
2019-09-25 02:53:00

"Recorder require initialization, Call recorder.init(VoiceClient, object)"
How can i initialize recorder ?

https://doc.photonengine.com/en-us/voice/current/getting-started/recorder#initialization
in this section it is not properly mentioned.

Comments

JohnTube
2019-09-25 10:20:31

Hi @sunil,

Thank you for choosing Photon!

How are you using Photon Voice 2? with or without PUN 2?
Do you follow the flows we recommend here or here?

When using Photon Voice 2 with PUN 2 following the suggested flow, you do not need to manually/explicitly initialize the recorder(s). It's done implicitly automatically.

In any case, as the documentation suggests you need at least a VoiceClient object to initialize a Recorder.
So the VoiceClient can be found in the VoiceConnection (or PhotonVoiceNetwork) component.

recorder.Init(voiceConnection.VoiceClient, customObjectIfAny);

sunil
2019-09-25 10:51:22

Thanks !!😊

I am using Photon Voice 2 with PUN 2.
i follow the flows here

The problem has been solved.

recorder.Init(voiceConnection.VoiceClient, customObjectIfAny); this method automatically called when you instantiate player using PhotonNetwork.Instantiate("prefab_Name"); and it must have PhotonView component attached to it but in my project i was creating lobby player using unity Instantiate(prefab);, so i changed it PhotonNetwork.Instantiate("prefab_Name"); and, it worked .😁

RPhoton
2020-09-19 11:15:11

When I follow the PUN2 flow. I get this message "[PhotonVoice.PhotonVoiceNetwork] 2020-09-19T11:12:28:An instance of PhotonVoiceNetwork is already set. Destroying extra instance.
UnityEngine.Debug:LogErrorFormat(Object, String, Object[])"

I have made a gameobject and attached the PhotonVoiceNetwork to it. Also attached recorder and followed the instructions.
I attached a Photon Voice View and Speaker to a prefab character.

When I run in unity I get the above message.

JohnTube
2020-09-21 10:09:49

Hi @RPhoton,

Search your scenes' hierarchy for "t:PhotonVoiceView" and make sure you have only one instance at any given time, also make sure the prefab does not have any.
The error message means you have more than one PhotonVoiceView.

Back to top