Photon Voice 2 - Quest 2 Speaker/Headphones

paulgumr
paulgumr
edited March 2021 in Photon Voice
I have a working configuration with the latest of everything (Pun Voice 2.24, Unity 2020.3.2f1, Oculus 25.0), Windows to Windows works great, but as soon as I use Quest 1 or 2 I have the problem that I cannot have sound coming through the earphones plugged into the device, no matter what I do it comes through the built-in speaker.

The issue is also seen with PUN Voice 2.23.1, Unity 2019.4.22f1, Oculus 23.1.

All other sounds come through the earphones perfectly before the app starts, so the earphones work. The fact that it occurs on both Quest 1 and 2 appears to rule out the device.

This all worked in Pun Voice 1. Note this is with remote and local avatars (not Oculus), and as already mentioned it all works apart from where the sound comes from on the Oculus headsets.

It is also noticeable that once the app starts you can't change the volume with the switch under the Quest device, again this worked with Photon Voice 1.

Logcat shows a number of errors summarised below, I have the complete logcat with Log Levels set to INFO if required
2021-03-31 19:40:20.483 6344-6383/io.meetingroom.meetingroom.quest E/Unity: [MeetingRoomAudioManager.Recorder] 2021-03-31T18:40:20:[PV] AndroidAudioInAEC: UnityEngine.AndroidJavaException: java.lang.UnsupportedOperationException: Cannot create AudioRecord
2021-03-31 19:40:20.484 6344-6383/io.meetingroom.meetingroom.quest E/Unity: [MeetingRoomAudioManager.Recorder] 2021-03-31T18:40:20:Photon microphone input source creation failure: UnityEngine.AndroidJavaException: java.lang.UnsupportedOperationException: Cannot create AudioRecord
2021-03-31 19:40:20.484 6344-6383/io.meetingroom.meetingroom.quest E/Unity: [MeetingRoomAudioManager.Recorder] 2021-03-31T18:40:20:Photon microphone failed. Falling back to Unity microphone
2021-03-31 19:40:20.487 6344-6383/io.meetingroom.meetingroom.quest E/Unity: [MeetingRoomAudioManager.Recorder] 2021-03-31T18:40:20:No Unity microphone device available (Microphone.devices is empty).
2021-03-31 19:40:20.487 6344-6383/io.meetingroom.meetingroom.quest E/Unity: [MeetingRoomAudioManager.Recorder] 2021-03-31T18:40:20:Unity microphone input source creation failure: UnityEngine.AndroidJavaException: java.lang.UnsupportedOperationException: Cannot create AudioRecord
2021-03-31 19:40:20.487 6344-6383/io.meetingroom.meetingroom.quest E/Unity: [MeetingRoomAudioManager.Recorder] 2021-03-31T18:40:20:Local input source setup and voice stream creation failed. No recording or transmission will be happening. See previous error log messages for more details.
2021-03-31 19:40:20.528 6344-6383/io.meetingroom.meetingroom.quest E/Unity: [MeetingRoomAudioManager.Recorder] 2021-03-31T18:40:20:[PV] AndroidAudioInAEC: UnityEngine.AndroidJavaException: java.lang.UnsupportedOperationException: Cannot create AudioRecord
2021-03-31 19:40:20.528 6344-6383/io.meetingroom.meetingroom.quest E/Unity: [MeetingRoomAudioManager.Recorder] 2021-03-31T18:40:20:Photon microphone input source creation failure: UnityEngine.AndroidJavaException: java.lang.UnsupportedOperationException: Cannot create AudioRecord
2021-03-31 19:40:20.528 6344-6383/io.meetingroom.meetingroom.quest E/Unity: [MeetingRoomAudioManager.Recorder] 2021-03-31T18:40:20:Photon microphone failed. Falling back to Unity microphone
2021-03-31 19:40:20.532 6344-6383/io.meetingroom.meetingroom.quest E/Unity: [MeetingRoomAudioManager.Recorder] 2021-03-31T18:40:20:No Unity microphone device available (Microphone.devices is empty).
2021-03-31 19:40:20.532 6344-6383/io.meetingroom.meetingroom.quest E/Unity: [MeetingRoomAudioManager.Recorder] 2021-03-31T18:40:20:Unity microphone input source creation failure: UnityEngine.AndroidJavaException: java.lang.UnsupportedOperationException: Cannot create AudioRecord
2021-03-31 19:40:20.532 6344-6383/io.meetingroom.meetingroom.quest E/Unity: [MeetingRoomAudioManager.Recorder] 2021-03-31T18:40:20:Local input source setup and voice stream creation failed. No recording or transmission will be happening. See previous error log messages for more details.
2021-03-31 19:40:20.664 6344-6383/io.meetingroom.meetingroom.quest E/Unity: [MeetingRoomAudioManager.Recorder] 2021-03-31T18:40:20:[PV] AndroidAudioInAEC: UnityEngine.AndroidJavaException: java.lang.UnsupportedOperationException: Cannot create AudioRecord
2021-03-31 19:40:20.664 6344-6383/io.meetingroom.meetingroom.quest E/Unity: [MeetingRoomAudioManager.Recorder] 2021-03-31T18:40:20:Photon microphone input source creation failure: UnityEngine.AndroidJavaException: java.lang.UnsupportedOperationException: Cannot create AudioRecord
2021-03-31 19:40:20.665 6344-6383/io.meetingroom.meetingroom.quest E/Unity: [MeetingRoomAudioManager.Recorder] 2021-03-31T18:40:20:Photon microphone failed. Falling back to Unity microphone
2021-03-31 19:40:20.666 6344-6383/io.meetingroom.meetingroom.quest E/Unity: [MeetingRoomAudioManager.Recorder] 2021-03-31T18:40:20:No Unity microphone device available (Microphone.devices is empty).
2021-03-31 19:40:20.666 6344-6383/io.meetingroom.meetingroom.quest E/Unity: [MeetingRoomAudioManager.Recorder] 2021-03-31T18:40:20:Unity microphone input source creation failure: UnityEngine.AndroidJavaException: java.lang.UnsupportedOperationException: Cannot create AudioRecord
2021-03-31 19:40:20.667 6344-6383/io.meetingroom.meetingroom.quest E/Unity: [MeetingRoomAudioManager.Recorder] 2021-03-31T18:40:20:Local input source setup and voice stream creation failed. No recording or transmission will be happening. See previous error log messages for more details.
2021-03-31 19:40:20.719 6344-6383/io.meetingroom.meetingroom.quest E/Unity: [MeetingRoomAudioManager.Recorder] 2021-03-31T18:40:20:[PV] AndroidAudioInAEC: UnityEngine.AndroidJavaException: java.lang.UnsupportedOperationException: Cannot create AudioRecord
2021-03-31 19:40:20.719 6344-6383/io.meetingroom.meetingroom.quest E/Unity: [MeetingRoomAudioManager.Recorder] 2021-03-31T18:40:20:Photon microphone input source creation failure: UnityEngine.AndroidJavaException: java.lang.UnsupportedOperationException: Cannot create AudioRecord
2021-03-31 19:40:20.719 6344-6383/io.meetingroom.meetingroom.quest E/Unity: [MeetingRoomAudioManager.Recorder] 2021-03-31T18:40:20:Photon microphone failed. Falling back to Unity microphone
2021-03-31 19:40:20.720 6344-6383/io.meetingroom.meetingroom.quest E/Unity: [MeetingRoomAudioManager.Recorder] 2021-03-31T18:40:20:No Unity microphone device available (Microphone.devices is empty).
2021-03-31 19:40:20.721 6344-6383/io.meetingroom.meetingroom.quest E/Unity: [MeetingRoomAudioManager.Recorder] 2021-03-31T18:40:20:Unity microphone input source creation failure: UnityEngine.AndroidJavaException: java.lang.UnsupportedOperationException: Cannot create AudioRecord
2021-03-31 19:40:20.721 6344-6383/io.meetingroom.meetingroom.quest E/Unity: [MeetingRoomAudioManager.Recorder] 2021-03-31T18:40:20:Local input source setup and voice stream creation failed. No recording or transmission will be happening. See previous error log messages for more details.

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @paulgumr,

    What the logs are showing is that recording fails to start.

    This is probably due to permissions not granted ye (first time app is installed/launched?) and the timing between asking/granting them and recording start.
    Make sure to read this first. (we will probably update that documentation section to address this timing issue).
    And then take a look at the solutions suggested on the forum here. We may include something similar as a UtilityScript in the package.
  • @JohnTube Thanks for the reply.

    Just to be clear. I restart the recorder later in the process and the application works, permissions have already been granted in a splash screen scene. My only issue is the earphones don't work and the volume on the mic as per the other thread. I need earphones for the spatial sound.

    There is no denying that there is a timing issue as this is the Recorder and its own initialization process that appears to be causing an issue on the Quest. All of these messages occur before I start doing anything, the recorder is attached to a GameObject that is activated in the scene. Note that none of these error messages occur when run on Windows.

    It feels like the software has somehow got hold of the wrong devices on the Quest, or has failed to grab and has defaulted to using something that I am not expecting.

    What I don't completely understand is the relationship between the listener in the scene, PhotonVoice, and the available hardware. Can you point me at anything that may enlighten me?

    In the meantime, I will try and build a simple project that I can share that exhibits the issue. I am in no tearing hurry as the current published project uses Photon Voice 1 and that works.
  • @JohnTube If you have a Quest I can give you access to the apk you can jump into a meeting with me and you can see what I mean.
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @paulgumr,

    I don't have a Quest.

    You can try to use Unity as Recorder.MicrophoneType and disable MicrophoneFallback.
    Also get rid of the warnings first (make use of the delayed recorder.StartRecording() until permissions are granted)
    What I don't completely understand is the relationship between the listener in the scene, PhotonVoice, and the available hardware. Can you point me at anything that may enlighten me?
    Photon Voice records microphone input via Unity's Microphone class/API or via native plugins (Photon microphone type) then transmits it using Photon Realtime as 'transport layer' (LoadBalancingClient) and plays received audio using Unity's AudioSource component. For audio playback we don't do anything special so this is handled by Unity. The usual relationship between AudioListener and AudioSource(s) still applies as well as the 3D/2D effects and audio spatialization etc.
  • @JohnTube Thanks for your help. I have it working and now need to clean it up. Appears to be as you suggested a combination of things.

    1) Recorder.MicrophoneType can't be Photon it has to be Unity and fallback disabled
    2) Delayed initialization of the Recorder and PhotonNetwork definitely helps, although there are still error messages from the recorder even when it's not enabled.
    3) Checking for Voice Permissions as per your links
    4) I also cleaned up the audiosources in the project

    I also moved back to Unity 2019 in the process as there are still too many issues with the Quest OpenXR and Unity and it was causing other issues.
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hey @paulgumr,
    although there are still error messages from the recorder even when it's not enabled.
    I think maybe Recorder.RecordOnlyWhenEnabled could be useful for you here?