Search Issue Tracker

By Design

By Design in 2023.3.X

Votes

1

Found in

2021.3.30f1

2022.3.8f1

2023.1.10f1

2023.2.0b6

2023.3.0a3

Issue ID

UUM-48126

Regression

No

[Android] [IOS] AudioSettings.OnAudioConfigurationChanged is not called when connecting Bluetooth headset

Platform Audio

-

Reproduction steps:
1. Open the attached project "ReproProj" with Android/IOS Platform
2. Open the “/Assets/Scenes/SampleScene.unity” Scene
3. Build And Run
4. Connect Bluetooth headset to device
5. In Android LogCat search for "NewBehaviourScript.OnAudioConfigurationChanged"

Expected result: Log message "##### NewBehaviourScript.OnAudioConfigurationChanged: true" is seen and audio can be heard in headphones
Actual result: No "##### NewBehaviourScript.OnAudioConfigurationChanged: true" log message is seen

Reproducible with: 2021.3.30f1, 2022.3.8f1, 2023.1.10f1, 2023.2.0b6, 2023.3.0a3

Testing environment: Windows 10 Enterprise 21H2

Reproducible on:
VLNQA00494 - iPhone 14 Pro Max, 16.3.1 iOS
VLNQA00358 - iPhone 12, 14.1 iOS
VLNQA00392 - iPad (9th generation), 15.0 iOS
VLNQA00310 - iPad Pro 12.9", 13.4.1 iOS
VLNQA00332, Samsung Galaxy XCover4 (SM-G390F), Android 9, CPU: Exynos 7 Quad 7570, GPU: Mali-T720
VLNQA00325, Samsung Galaxy Note10 (SM-N970F), Android 12, CPU: Exynos 9 (9825), GPU: Mali-G76
VLNQA00318, Oneplus OnePlus 7 Pro (GM1913), Android 11, CPU: Snapdragon 855 SM8150, GPU: Adreno (TM) 640
VLNQA00231, Samsung Galaxy A5(2017) (SM-A520F), Android 8.0.0, CPU: Exynos 7 Octa 7880, GPU: Mali-T830
VLNQA00231, Huawei HUAWEI Mate 20 Pro (LYA-L29), Android 9, CPU: HiSilicon Kirin 980, GPU: Mali-G76

Not reproducible on: No other environment tested

  1. Resolution Note:

    I think this is more of a mis-understanding about how this callback works than a bug. You will get the OnAudioConfigurationChanged callback if the sample frequency or channel count of the audio output device changes. However, if Bluetooth headphones are connected, and the settings are all the same as before (i.e. stereo, 48K samples/second), then you will not get the callback. If the audio output frequency or channel count changes, the audio engine will be re-initialized, all playing state will be lost, and you will get the callback which will give you a chance to re-start loops and music (or any long-playing sounds).
    The OnAudioConfigurationChanged callback is related to audio output. If you want to know if something has changed on the input side, you need to check whether Microphone.IsRecording is true or not. For example, if you're recording with a Bluetooth mic, and it is disconnected, then your recording will stop. Also, sometimes if the audio output device is reset, the recording will also get stopped. The way to check for this is Microphone.IsRecording. If it stops, then you can re-run your code to look at the available microphones and possibly re-start your recording.

    We will update the documentation to try to explain this more clearly, as it is confusing.

  2. Resolution Note (2023.3.X):

    I think this is more of a mis-understanding about how this callback works than a bug. You will get the OnAudioConfigurationChanged callback if the sample frequency or channel count of the audio output device changes. However, if Bluetooth headphones are connected, and the settings are all the same as before (i.e. stereo, 48K samples/second), then you will not get the callback. If the audio output frequency or channel count changes, the audio engine will be re-initialized, all playing state will be lost, and you will get the callback which will give you a chance to re-start loops and music (or any long-playing sounds).
    The OnAudioConfigurationChanged callback is related to audio output. If you want to know if something has changed on the input side, you need to check whether Microphone.IsRecording is true or not. For example, if you're recording with a Bluetooth mic, and it is disconnected, then your recording will stop. Also, sometimes if the audio output device is reset, the recording will also get stopped. The way to check for this is Microphone.IsRecording. If it stops, then you can re-run your code to look at the available microphones and possibly re-start your recording.

    We will update the documentation to try to explain this more clearly, as it is confusing.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.