iOS background music quality degraded while in voice chat (Audio Session Options?)

Steps to repro:

  1. Open music app, play music w/bluetooth headphones
  2. Open unity app w/photon voice
  3. Join photon voice room
  4. Quality of music playing in background degrades significantly

I assume this is related to the iOS Audio Session options, but I've yet to find a combination of options that doesn't cause this issue. I've tried all of Photon's built-in presets (game, voip) and a variety of custom combinations. This is what I'm using atm:

new AudioSessionParameters()
{
    Category = AudioSessionCategory.PlayAndRecord,
    Mode = AudioSessionMode.Default,

    CategoryOptions = new AudioSessionCategoryOption[] 
    { 
        AudioSessionCategoryOption.AllowBluetooth, 
        AudioSessionCategoryOption.DefaultToSpeaker, 
        AudioSessionCategoryOption.DuckOthers,
    }
};

Any ideas?

Answers

  • Bump.

  • Bump

  • JohnTube
    JohnTube ✭✭✭✭✭

    Hi @Nobrega,

    Which Photon Voice version is this?

    Can you reproduce with Unity microphone type?

    Does this happen w/o bluetooth headphones?

    Unfortunately, we may not be in capacity to cover all cases and that is why we exposed the audio session parameters API directly in Photon Voice so you can try to figure out what works best for you.

  • Nobrega
    Nobrega
    edited January 24

    @JohnTube

    Which Photon Voice version is this?

    Photon Voice v2.26.2

    Can you reproduce with Unity microphone type?

    Does this happen w/o bluetooth headphones?

    Our project has a few requirements:

    • All of our users are using Bluetooth mics/earbuds
    • Our users need to be able to play music in the background (e.g. Spotify)

    By default, on iOS, Unity does support Bluetooth microphones while playing music in the background.

    To get around this (and reduce latency) we're using a custom Factory for mic input based on NatDevice.

    This lets us use Bluetooth mics + play music in the background.

    But the quality is affected as though the background music is being mixed to a mono channel, switched to telephone quality, or something similar.

    Any ideas would be appreciated!

  • JohnTube
    JohnTube ✭✭✭✭✭

    Hi @Nobrega,

    Photon Voice v2.26.2

    I would update to the latest first! E.g. lately we added reset of iOS audio session settings when recording stops.

    To get around this (and reduce latency) we're using a custom Factory for mic input based on NatDevice.

    Nice! I'm happy that our customers are making use of the flexibility and extensibility of Photon Voice!

    I have always wanted to add the NatDevice integration but didn't have the time to do it.

    But the quality is affected as though the background music is being mixed to a mono channel, switched to telephone quality, or something similar.

    Unfortunately, I think this is either due to the factory implementation itself or NatDevice. But most likely the latter and I would contact NatDevice about this.

    Did you try NatDevice on its own? does it cause this without Photon Voice?

    So the issue is happening on the sender (the one who talks, records and emits audio) or receiver (tho one who listens, playback) or both? (to make the test simple, use two separate clients, one talks only and one listens only without Recorder or recording does not start at all).