Photon Voice 2 not working on Oculus Quest (Unity3D)

I have created a VR multiplayer room using PUN2 which works well and I'm trying to add a voice chat support. I have followed meticulously the installation guide (https://doc.photonengine.com/en-us/voice/current/getting-started/voice-for-pun) and I'm able to activate the Debug echo and hear myself once in the room. The problem is that when I test with 2 Quest or a 1 Quest and the editor I cannot hear a sound.
The current setup is the following:
  • Photon Voice Network script added to a Global object in the room and with a pointed to the speak prefab
  • The speaker prefab is a LocalPlayerController which contains a LocalAvatar
  • The LocalAvatar contains the PhotonView Object, PhotonVoiceView Object, Recorder (connected to the PhotonVoiceView), Speaker (connected to the PhotonVoiceView), Audio Source and MicAmplifier (downloaded following the link provided by @JohnTube in another thread)
  • I have disabled "Can own microphone" in the Avatar script
  • I have disabled VAD
  • I have created a Photon Voice app and copy/pasted the App Id in the Photon Settings
  • I have updated the Photon Voice library today (Nov,28th 2019), so I have the latest release.
No specific error gets displayed in the log (I'm able to provide a text file but I would prefer not posting it in on the forum).
As previously mentioned, the Debug mode works well (Setup Debug Speaker + Debug Echo).
Please find in attachment the screenshots of all the objects configuration.
https://ibb.co/3B8nFV8
https://ibb.co/DK6hkWY
https://ibb.co/VTtfG4R
https://ibb.co/V2rx8C0
https://ibb.co/qdrHY00
https://ibb.co/yBzmTPb
https://ibb.co/mFY375Q
https://ibb.co/w0FpPdJ
https://ibb.co/Hxbwk3y

Comments

  • BFXBFX
    edited November 2019
    Just a quick update, I have added a logger to the LocalAvatar to track the recorder and speaker variable. This is the result both on the Editor and Quest when entering the room (both with Debug echo ON or OFF)

    recorder.IsInitialized --> TRUE
    recorder.IsRecording --> TRUE
    recorder.TransmitEnabled --> TRUE
    recorder.IsCurrentlyTransmitting --> FALSE
    speaker.IsLinked --> FALSE


    clearly there is a problem with the last two but I'm not sure how should I solve it
  • Hi @BFX,

    Thank you for choosing Photon and for your excellent report!

    Could you reproduce with the demo scenes?

    I would ask you to try the following (if possible):

    - manually call photonVoiceView.Init()
    - restart recording == stop then start, recorder.IsRecording = false (recorder.StopRecording()) then recorder.IsRecording = true (recorder.StartRecording())
    - changing the Microphone type from Photon to Unity
    - changing the microphone device at runtime (you could test using DemoVoice-UI scene)
    - setting Recorder.SourceType to AudioClip and adding any audio media file for testing purposes. With debug echo mode enabled you should hear the audio file being played back.
    - try PhotonVoiceView.UsePrimaryRecorder = true (enabled) and do not assign a Recorder (remove it from the prefab)
    - try a different Unity version.

    If you have other Recorder components on the scene, try to keep only one per client.
    Or at least one that is recording only using the same device.
    Also, make sure the Android application has the Microphone permission.

    When you test with the Quest and the Editor, do both clients not hear anything or one only can hear the other? I would assume the Quest could hear the Editor? or not?

    Could you log the following on each PhotonVoiceView on each client:
    photonView.ViewID
    photonVoiceView.IsSetup
    photonVoiceView.IsRecorder
    photonVoiceView.IsSpeaker
    Note: MicAmplifier is now part of Photon Voice package since v2.9 (August 16th, 2019). You can find it at: "Assets\Photon\PhotonVoice\Code\UtilityScripts\MicAmplifier\MicAmplifier.cs".
  • Hello
    Thanks a lot for your prompt response. It looks like I have a lot of testing work ahead :)
    I will take care of providing you a full report in the next few days. To be honest, I don’t think the problem is in the microphone as I can hear myElf correctly I’m debug mode both on Quest and in the Unity Editor. I’m particularly curious about those two Boolean which are false. Clearly is not transmitting and the audio source is disconnected for some reason. Is there any manual tweak I need to perform in the audio source? As far as I can see it’s an empty object.
    Thanks a lot for your support.
  • Hi @BFX,

    So you're saying

    DebugEchoMode works on the Unity Editor (you hear yourself)
    DebugEchoMode works on the Oculus Quest build (you hear yourself)

    however

    Unity Editor and Oculus Quest cannot hear other or it's one way only?
  • BFXBFX
    edited November 2019
    Exactly, I can always hear myself in the editor or in the quest but not between editor/quest or quest/quest(not a sound in any direction).
    Shall we change something in the required test cases?
  • BFXBFX
    edited November 2019
    A quick update

    - try a different Unity version.
    Tried. Same result.


    If you have other Recorder components on the scene, try to keep only one per client.
    Or at least one that is recording only using the same device.

    There is only one recorder.


    Also, make sure the Android application has the Microphone permission.
    The microphone works because of debug echo works

    - try PhotonVoiceView.UsePrimaryRecorder = true (enabled) and do not assign a Recorder (remove it from the prefab)
    I have done it: Created a recorder in the main object which contains the PhotonVoiceNetwork and added as primary recorder. Same results


    Could you log the following on each PhotonVoiceView on each client:
    After setting the primary recorder
    photonView.ViewID ---> Correctly set (i.e. 1001)
    photonVoiceView.IsSetup --> TRUE
    photonVoiceView.IsRecorder --> TRUE
    photonVoiceView.IsSpeaker --> TRUE

    By the way
    recorder.TransmitEnabled --> TRUE
    recorder.isTransmitting --> TRUE (It was true even before but I was not checking it in the update() method, that why it was returning false. It becomes true when you talk).

    However, speaker.isLinked is still false

    In other words all the boolean are TRUE except speaker.isLinked (which strangely is false even when the debug echo works, which does't seem to make sense to me)


    Doing research around I found this user which got the same problem (echo working but users cannot hear each other and speaker.isLinked--> False): https://forum.photonengine.com/discussion/9950/issues-getting-voice-to-work

    I have checked the AppID in the dashboard and I have one for the Multiplayer and one for the Voice. Is it supposed to be like that?

    Note:
    The speaker is inside a LocalAvatar object which is inside a LocalPlayerController object. LocalPlayerController is a prefab which gets created at run-time. Do you think this could be the problem? Would you suggest creating a separate prefab with a PhotonView,PhotonVoiceView,the Speaker and assigning it to the scene statically?

    Again this puzzles me, because if the speaker wouldn't work I wouldn't hear the echo.
  • Hi @BFX,

    Did you increase the log level of the voice components?
    Did you manually call Speaker.Init to try to force the linking?

    Maybe the Speaker you are using to log Speaker.IsLinked is not the same Speaker used by the PhotonVoiceView? Try to log PhotonVoiceView.SpeakerUsed.IsLinked.

    Also keep in mind that for each prefab there is a viewID and:

    PhotonVoiceView.IsRecorder should be true only for the local player's object
    PhotonVoiceView.IsSpeaker should be true for all remote players' objects
    PhotonVoiceView.IsSpeaker should be true for the local player's object if Recorder.DebugEchoMode is enabled and PhotonVoiceView.SetupDebugSpeaker is true.
  • BFXBFX
    edited December 2019
    Hello
    Did you manually call Speaker.Init to try to force the linking?

    there is not method Init() associated to the object speaker
    speaker = GetComponent();
            if (speaker != null)
            {
              speaker.Init(); // it doesn't compile
            }
    For the rest, I'm now logging PhotonVoiceView.SpeakerUsed.IsLinked and I can confirm that:

    When Debug Speaker is ON:
    1) all the logged boolean variables are TRUE
    2) I can hear myself in the Quest speaker but I cannot hear the other player

    When Debug Speaker is OFF:
    1) These two variables are FALSE:
    [Voice Debug] Photon Voice View - IsSpeaker:False
    [Voice Debug] Photon Voice View - IsSpeakerLinked:False
    2) I cannot hear anything
  • JohnTubeJohnTube mod
    edited December 2019
    Hi @BFX,

    Does this happen with our demos?
    I asked this before and I would like to try this.

    I meant PhotonVoiceView.Init not Speaker.Init sorry.

    Also are you sure both clients are in the same room?
    Maybe clients are on different servers/rooms?
    Did you go through our "Matchmaking Checklist"?
    Clients need to connect to the same virtual application (AppId, GameVersion/AppVersion, PUN version) and to the same servers (region).

    With two clients in the room, there should be two instantiated prefab objects, two PhotonView + two PhotonVoiceView. One for the local player and one for the remote one.
    One viewId is 1001 and one is 2001.
    Could you log the variables requested before for each PhotonVoiceView?
  • BFXBFX
    edited December 2019
    Hi,
    yes, I have tried to force the initialisation, with this code:
    void Start()
        {
            
            photonVoiceView = GetComponent< PhotonVoiceView >();
            photonVoiceView.Init();
    
            recorder = GetComponent< Recorder >();
            speaker = GetComponent< Speaker >();
            photonView = GetComponent< PhotonView >();
        }
    also, I can confirm the players (desktop and Quest) are in the same room, they can see each other and everything (except the voice chat) works well. Here are the logs (Voice Debug Echo is OFF):
    Client Desktop
    [Voice Debug] Photon View - View ID:2001
    [Voice Debug] Photon Voice View - IsSetup:True
    [Voice Debug] Photon Voice View - IsRecorder:True
    [Voice Debug] Photon Voice View - IsSpeaker:False
    [Voice Debug] Recorder - IsInitialized:True
    [Voice Debug] Recorder - IsRecording:True
    [Voice Debug] Recorder - TransmitEnabled:True
    [Voice Debug] Recorder - IsCurrentlyTransmitting:True
    [Voice Debug] Photon Voice View - IsSpeakerLinked:False
    Quest
    [Voice Debug] Photon View - View ID:1001
    [Voice Debug] Photon Voice View - IsSetup:True
    [Voice Debug] Photon Voice View - IsRecorder:True
    [Voice Debug] Photon Voice View - IsSpeaker:False
    [Voice Debug] Recorder - IsInitialized:True
    [Voice Debug] Recorder - IsRecording:True
    [Voice Debug] Recorder - TransmitEnabled:True
    [Voice Debug] Photon Voice View - IsSpeakerLinked:False
    As mentioned before, the only way to have IsSpeaker and IsSpeakerLinked set to TRUE is to activate the Voice Debug Echo.

    As usual, the Debug Mode works well and I can hear my echo on both devices but they cannot hear each other.

    Any other way to link the Speaker? (I have also tried to remove speaker and audio source and set "Create Speaker if none present" to TRUE)..it doesn't work

    I have increased the log level and effectively the problem with the speaker is clear:
    [MultiplayerManager.PhotonVoiceNetwork] No Speaker found for the PhotonView with ID 1001. Remote voice 1/1 not linked.
    [MultiplayerManager.PhotonVoiceNetwork] Speaker is null. Remote voice 1/1 not linked.

    I will look into the demo scenes, but this is so frustrating.

  • BFXBFX
    edited December 2019
    ..
  • BFXBFX
    edited December 2019
    Ok I think I have solved. The problem was that the remote avatar prefab was not getting his PhotonVoiceView+Speaker set up correctly. This resulted in a broken connection. The audio was quite low but I have added the mic amplifier to the local avatar prefab and it did the trick!!
    I would suggest adding this note to the main documentation as other people might experience the same problem.
    Thanks a lot for your help!
  • Hi @BFX,

    Thank you for the update.

    but this is so frustrating.
    Sorry about this.
    The problem was that the remote avatar prefab was not getting his PhotonVoiceView+Speaker set up correctly.
    How? Could you explain further what was wrong so it would benefit others and help us understand to avoid this or improve linking?
    I would suggest adding this note to the main documentation as other people might experience the same problem.
    I'm for the idea but what "note" idea did you have in mind?
  • BFXBFX
    edited December 2019
    Hi @JohnTube
    basically there is a procedure instantiating the remote and local avatars. My (wrong) assumption was that only the local avatar required a PhotonVoiceView+Speaker+Recorder, as I was thinking the speaker will collect the audio data from all the other remote players.
    The correct configuration was instead:

    - PhotonVoiceView+Recorder (Local)
    - PhotonVoiceView+Speaker (Remote)

    which is also pretty obvious from a logical standpoint (I record myself, and I hear all the others).

    Not sure if this is a generally correct approach or just a specific case that works by chance: I might still get it wrong but it did the trick for me.

    Other suggestion: Looks like isSpeakerLinked works only when the Debug Echo is activated but not when a Speaker component is attached and connected to PhotonVoiceView. That was really confusing for me, I would suggest refactoring the name or using a separate variable for tracking the linking process.

    Hope this will be useful and will help to improve the documentation.
  • Hey @BFX,

    I see now.

    which is also pretty obvious from a logical standpoint (I record myself, and I hear all the others).

    Not sure if this is a generally correct approach or just a specific case that works by chance: I might still get it wrong but it did the trick for me.
    Your understanding is correct.
    Recorder is used locally only.
    Speaker can be used for any incoming received stream which is usually a remote one OR when debug echo mode is enabled, you send your voice to the server and then receive it back.

    Other suggestion: Looks like isSpeakerLinked works only when the Debug Echo is activated but not when a Speaker component is attached and connected to PhotonVoiceView. That was really confusing for me, I would suggest refactoring the name or using a separate variable for tracking the linking process.
    A speaker is linked when there is a "remote" Recorder & incoming voice stream that will be player by it. For your case, the confusion is due to checking on the wrong GameObject. You always check the local player's GameObject and expect the Speaker to be linked to the other players.

    We will see how we could improve the situation.
    Thanks for your input.
  • @BFX I seem to have the same exact issue that you ran into and cant seem to solve it. I used the voicePUN example and copied their hierarchy but cannot get voice to consistently work across the PC and an oculus quest. Can you expand on what you changed?
  • JohnTubeJohnTube mod
    edited April 12
    Hi @Lassiiter,

    If you're not using the latest Photon Voice 2.15, please update.
    My suggestion is to try the demos as is first.
    Test between Unity Editor and standalone build.
    make sure both end up in the same room.

    Here you mentioned you "can hear the device echo on both the Quest adn the PC", you mean using DebugEchoMode right?

    Test between Unity Editor and Quest, check "Cached Remote Voices' Info" in the PhotonVoiceNetwork inspector from Unity Editor.

    To debug, first, increase the log level of voice components (PhotonVoiceNetwork, PhotonVoiceView, Recorder, Speaker) and check the logs for warnings or errors.
    Check if PhotonVoiceView.IsSetup, Recorder.IsInitialized and if the Speaker.IsLinked.

    Make sure Recorder is recording (IsRecording = true) and transmitting (TransmitEnabled = true).

    Also maybe AudioSource component has 3D settings, disable that by setting spatialBlend to zero.
  • BFX wrote: »
    Hi @JohnTube
    basically there is a procedure instantiating the remote and local avatars. My (wrong) assumption was that only the local avatar required a PhotonVoiceView+Speaker+Recorder, as I was thinking the speaker will collect the audio data from all the other remote players.
    The correct configuration was instead:

    - PhotonVoiceView+Recorder (Local)
    - PhotonVoiceView+Speaker (Remote)

    which is also pretty obvious from a logical standpoint (I record myself, and I hear all the others).

    Not sure if this is a generally correct approach or just a specific case that works by chance: I might still get it wrong but it did the trick for me.

    Hi! I'm trying to implement voice chat as well, with the Local and Remote Avatars. Yet, I tried your suggestion (at least I think I did) and it's not working. Would you mind sending me a list or video of step-by-step instructions?
  • for future reference, see solution here.
  • BFXBFX
    The solution doesn't seem working, also the thread ends with the user not being able to solve it apparently.
  • Please test again after importing this unitypackage into Photon Voice 2.16.1.
  • closing, continue here.
This discussion has been closed.