Cannot hear voice in the editor neither see created speaker i the hierarchy. However works on device

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.

Cannot hear voice in the editor neither see created speaker i the hierarchy. However works on device

Reaper
2019-01-21 09:41:48

Currently added photon voice V2 chat along with UNET. Using also OVR plugin because using "Oculus GO" . My setup is that i have Voice connection, Recorder and ConnectAndJoin on a separate Game Object. Voice seems to connect just fine on our Oculus GO device. However when hosting from both editor and even standalone build voice seems not to work on those.
No errors seem to occur when running the application. I seems that it gives the same voice ID to both clients.
Here are the inspector settings:

https://drive.google.com/file/d/1eohou7RSeq72u1Vtj9s_XSV_tfaoBar1/view?usp=sharing

I am connecting manually on player object Start function therefor AutoConnect and AutoTransmit are disabled. Previously tried them enabled did not work. If you need anything to know other that I've posted. I will provide everything below.

Comments

JohnTube
2019-01-21 10:52:54

Hi @Reaper,

Thank you for choosing Photon!

However when hosting from both editor and even standalone build voice seems not to work on those.
I seems that it gives the same voice ID to both clients.
Could you make sure both Voice clients are connected to the same region (try setting explicit fixed region), have the same AppVersion (if you enable "Use PUN Settings", the value of AppVersion in ConnectAndJoin may be overwritten by that one) and joined to the same room (sometimes if you try random join from two clients at the same time, they end up creating two different rooms because no match was found by both)?
I am connecting manually on player object Start function
How?
Previously tried them enabled did not work.
What do you mean it didn't work?
If you need anything to know other that I've posted. I will provide everything below.
We usually ask for Photon Voice version and Unity version. On another note:
Currently added photon voice V2 chat along with UNET.
In this case if don't think you need PUN2 or Photon Chat, you could clean those up, read more here.

Reaper
2019-01-21 12:44:35

Hi @JohnTube
Thanks for quick response

Could you make sure both Voice clients are connected to the same region (try setting explicit fixed region), have the same AppVersion (if you enable "Use PUN Settings", the value of AppVersion in ConnectAndJoin may be overwritten by that one) and joined to the same room (sometimes if you try random join from two clients at the same time, they end up creating two different rooms because no match was found by both)?
I am going to try that then come back if it solved the issue. However i forgot to mention that it seems kinda random. Sometimes i hear voice on client only,sometimes i can hear on both and sometimes nether of them works. That is strange because i do not change anything i just relaunch programs
I am connecting manually on player object Start function How? Previously tried them enabled did not work. What do you mean it didn't work? Here the code that does that from a Player GameObject which is spawned by Network Manager
  
private ConnectAndJoin myVoiceConnector;  
private void Start()  
    {  
        myVoiceConnector = FindObjectOfType();
   if(isLocalPlayer)

      {

       ConnectVoice();

       }  
}  

private void ConnectVoice()
{

    myVoiceConnector.ConnectNow();

    myVoiceConnector.voiceConnection.PrimaryRecorder.TransmitEnabled = true;  
    myVoiceConnector.voiceConnection.PrimaryRecorder.Init(myVoiceConnector.voiceConnection.VoiceClient;

}  

We usually ask for Photon Voice version and Unity version.
Unity v 2018.3.1f1 and Photon v Pun: 2.2 Photon lib: 4.1.2.1
In this case if don't think you need PUN2 or Photon Chat, you could clean those up, read more here.
Thanks probably will do that aswell

Reaper
2019-01-22 10:30:20

Hi again @JohnTube

I've tried previous fix and that seem eliminate the case when nether of users gets the sound. But it still doesn't seem to work in the editor.And by "not working " i mean that i don't get to hear the sound and neither i see the speaker prefab appearing on editor side. Is there a reason to that? Can i make it work?

JohnTube
2019-01-22 10:36:55

Hi @Reaper,

And by "not working " i mean that i don't get to hear the sound and neither i see the speaker prefab appearing on editor side. Is there a reason to that?
Could you make sure both clients are connected to the same server/region, use the same AppVersion and are joined to the same room? try enabling SupportLogger or log those values manually.

Could you reproduce using DemoVoiceUI?

Reaper
2019-02-07 10:34:36

We've found out what the problem was. It was a microphone setting on a Recorder component. It used to be Unity microphone which was looking for Realtek mic on our Oculus Go and obviously fail) We've switched to Photon mic and that did the trick. By the way for the sake of sanity of all the developers that ran into our next problem with voice. App can sometimes not request a microphone permission on its first launch so force request on start if that happens.

Reaper
2019-02-07 10:37:28

Thanks for your help @JohnTube

JohnTube
2019-02-07 10:59:36

You're welcome @Reaper.

By the way for the sake of sanity of all the developers that ran into our next problem with voice. App can sometimes not request a microphone permission on its first launch so force request on start if that happens.
Do you have some clear steps to follow that we could add to our "Known Issues" page, Photon Voice section?

Reaper
2019-02-07 11:19:58

@JohnTube Yes of course)

The problem is that you app for some reason may not request a permission on its first launch.

Basically what you do is you write a following piece of code either on start of an existing script that is in your scene or create a new one.

void Start ()
{
#if PLATFORM_ANDROID
if (!Permission.HasUserAuthorizedPermission(Permission.Microphone))
{
Permission.RequestUserPermission(Permission.Microphone);
}
#endif
}

That is for android however it is similar for other platforms.
You can also go further and make an explanation message for user why do you need permissions.
More detailed explanation about it you can find here

JohnTube
2019-02-07 11:27:06

Ah I see now, this is a new feature in 2018.3!
Thanks for the link! we will add it here.

Reaper
2019-02-07 11:31:54

Ah I see now, this is a new feature in 2018.3! Thanks for the link! we will add it here.
Glad that this was actually helpful))

ganicus
2020-09-10 09:32:11

I am facing the same issue while using a photon voice some time one player is not able to hear another player but the other player is able to hear.

I also added code for permission for Microphone. Still facing the issue.

while debugging I came to know that the SimpleSpeakerFactory method is not getting called this method belongs to VoiceConnection class.

Back to top