Voice not working

Hi! In my multiuser app, voice chat used to work fine, but now nothing works anymore since an unknown change (and there were many) -- I can't hear my echo, I can't hear others, no matter which device (all of which allow mics) I'm testing with. I'm not even sure where to start debugging, but maybe my setup below -- showing two different users seated opposite each others, running simultaneously -- can help give some clues of what I'm doing wrong? Thanks!



(The Universe node, which exists right from the start, has the Photon Voice Network and main Recorder. The Person node, which is instantiated after the Photon Room was successfully joined, sets up the body with head containing the Photon Voice View and Speaker.)

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @Philipp,

    I see the warning in the Recorder, it's not initialized yet which should be done automatically by the PhotonVoiceView.
    Some customer on the forum reported that they had to force this manually.
    But I think it's only a workaround and we need to identify the actual issue.

    Also, for debugging info you could expand the foldouts at the bottom of the PhotonVoiceNetwork component. Especially "Cached Remote Voice' Info" and see if it contains one or two (two if debug echo) and if they are linked or not.
  • Thank you very much. I will try reinitializing the recorder and report back on Monday.

    Here are my expanded inspector fields -- note that "Cached Remote Voice' Info", even though expanded (arrow points down), is not showing anything.


  • (PS: I understand the linked workaround code is pseudocode (e.g. FindObjectOfType() without type provided doesn't exist in Unity for me), but that should be fine when rewritten, which I already did.)
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @Philipp,

    I fixed the code in the workaround post.
    It was an issue with the formatting.
  • Oh cool thank you!
  • Hi! When trying to add the workaround code, during running I get a warning "[Universe.Recorder] Recorder does not require restart." And nothing seems to change.

    How would I call the suggested Recorder.Init(VoiceClient) manually, by the way? What is my current VoiceClient to pass? And I understand it shouldn't be needed in the first place, as I use automatic setup?

    Also, is it appropriate in my loading sequence that PhotonVoiceNetwork and Recorder are at the top level in the gameObject tree and available right from the start, whereas the individual Speaker, AudioSource and PhotonVoiceView component are only loaded a second or so later via the body loading, or could that cause issues? On purpose, I only instantiate a person (and their body, and the Speaker etc. coming with it) once OnJoinedRoom() happened.

    I'm lost, please help, thanks! I can also send the full project source code if there's interest (it's a bit bigger).
  • JohnTube
    JohnTube ✭✭✭✭✭
    edited September 2019
    Hi @Philipp,

    The actual implicit automatic initialization of the Recorder happens inside PhotonVoiceView's SetupRecorder(Recorder) method, specifically this line:

    RecorderInUse.Init(PhotonVoiceNetwork.Instance.VoiceClient, photonView.ViewID);

    I have modified PhotonVoiceView code a bit (get it here), since the automatic init happens inside OnEnable maybe it's a timing issue, so I added the same code inside Start as well and I also added a warning if this fails due to PhotonView not ready yet. Also, the PhotonVoiceView.Init method is public so you could do it yourself manually.

    Could you try it (copy-paste code to overwrite PhotonVoiceView) and let me know?
    I'm planning a Photon Voice 2 update this week anyway, it would be nice if we fix this issue together.
  • JohnTube
    JohnTube ✭✭✭✭✭
    @Philipp,

    also increase logging level to WARNING at least of the PhotonVoiceView.
  • Thank you very much!

    Using your new code, I'm getting this warning twice now -- it seems to be a very helpful pointer:

    this.Logger.LogWarning("Tried to initialize PhotonVoiceView but PhotonView does not have a valid allocated ViewID yet.");

    (The PhotonView on this gameObject is all default: Owner/ ViewID "Set At Runtime", Method "Fixed", and Observe option "Unreliable On Change".)
  • Philipp
    Philipp
    edited September 2019
    PS: Maybe relevant -- while I'm using PhotonNetwork.Instantiate to Instantiate the Person object, this object then by itself instatiates the Body using a normal Unity Instantiate of a prefab (in its own Start()). That prefab is then containing the head with the PhotonView/ VoiceView/ Speaker etc. (It's a two-level wrapping because a Person persists in the Room, but they may dynamically change their Body, like the gender.) The last time Photon Voice chat worked, incidentally, I still had no body switching feature available, so the PhotonView was inside the main, PhotonNetwork-Instantiated prefab that contained both Person + Body.
  • Philipp
    Philipp
    edited September 2019
    Indeed, after a further check, as soon as I include the Body right within the Photon-Instantiated Person prefab, the warnings disappear, and the mic & voice work again!

    I think the solution to my problems for now then has to be to include the whole PhotonVoiceView & Speaker with a persistent object loaded right with the prefab (unless there's another way to do it).
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @Philipp,

    a normal Unity instantiate cannot allocate a PhotonViewID and sync the GameObject to which the PhotonView is attached.
    So how do you do this? or you don't need this synchronized over the network or you have a custom logic that does this?

    if you manually allocate a ViewID and assign it to that PhotonView manually (custom manual instantiation) maybe you can call PhotonVoiceView.Init later once done?
  • > a normal Unity instantiate cannot allocate a PhotonViewID and sync the
    > GameObject to which the PhotonView is attached.

    Right gotcha. I had figured, I guess, it would take the PhotonViewID of its parent wrapper, as that parent wrapper was properly instantiated using PhotonNetwork.Instantiate. But I guess that's not what happens. So now I moved these respective Photon(Voice)View bits into a head node which comes right with the PhotonNetwork.Instantiate wrapper and it all seems to work!

    Thanks for the help, it looks like my particular issue is fixed now!
  • JohnTube
    JohnTube ✭✭✭✭✭
    Just FYI: the fix will be part of the next Photon Voice version 2.10 which will be released this week.
  • Thank you!

  • JohnTube
    JohnTube ✭✭✭✭✭
    Photon Voice 2.10 was released yesterday.
  • Thanks for the update!