Photon Voice - Recorder Microphone Setup

I'm creating a multiplayer app in Unity 2019.1.7f1 using PUN 2 and Photon Voice, but when I create Android builds for my Oculus Quest, no player hears the other players. In Unity, in the Recorder component there's a message under Audio Source Settings which states, "Devices list and current selection is valid in Unity Editor only. In build, you need to set it via code preferably at run time." However the Photon Documentation provides neither any reference to this issue nor any guidance or example code. Please assist if you can.

Best Answer

Answers

  • JohnTubeJohnTube mod
    edited October 29
    Hi @OjosLindos,

    Thank you for choosing Photon!

    I think the issue you're having may not be directly related to the choice of the microphone device in builds.

    While the choice of the microphone API (Unity or Photon) persists between Unity Editor and the output build, the choice of the actual device does not.
    The list of the microphone devices available in the Unity Editor may not be the same on the machine where the build will be running.
    The build can be running on a different platform with a different system.
    That is why, if needed, you can switch from a default device to another one -if available- explicitly via code at runtime on the device the build is running on.

    At runtime, in build clients, by default Photon Voice will use the default microphone device if any as set by the operating system. You can of course explicitly switch by setting Recorder.UnityMicrophoneDevice (which can be any value from UnityEngine.Microphone.devices string array) if the MicrophoneType is Unity or Recorder.PhotonMicrophoneDeviceId (which can be obtained using the Recorder.PhotonMicrophoneEnumerator if supported) if the MicrophoneType is Photon.

    We already have this information here.

    To debug the issue you reported, I would first make sure that all clients are joined to the same room.
    Could you go through our "Matchmaking Checklist"?
  • Thanks for responding. I went through the Matchmaking Checklist; all clients join to the same room. Everything's working fine except the clients can't hear each other.

    I have to admit I'm a relative newbie at coding. I tried to put the "Recorder.PhotonMicrophoneEnumerator" code from the webpage you sent me a link to in a script but get compiler errors which I don't know how to resolve. I also don't know how to use "Recorder.PhotonMicrophoneDeviceId". I would appreciate it if you would explain how this is done for me in as simple a manner as possible.

    Note that, in Unity, in the Recorder component the only choice available under the Microphone Device drop-down is Microphone (Rift Audio). Will it be possible to use Photon Voice in an Android build for the Oculus Quest?
  • I think I've got Photon Voice working by changing some Unity Inspector settings; I didn't have to do any coding. There appears to be about a half a second of latency between when something's spoken and when it's heard. Is that something which can somehow be improved? Anyway, thanks for your assistance @JohnTube.
  • I feel like an idiot, but what I may have done is either overlook including a PhotonVoiceView component entirely or putting it in a scene object rather than a prefab object, or something along those lines. I thought I had followed the instructions in the Photon Documentation carefully but apparently I hadn't. I'm sorry I took up your time unnecessarily on the mic setup issue. Thanks for your recommendation regarding the latency, which I'll try.
Sign In or Register to comment.