Search Issue Tracker

Won't Fix

Votes

0

Found in

2021.3.34f1

2022.3.17f1

2023.2.5f1

2023.3.0b2

6000.0.0b11

Issue ID

UUM-60061

Regression

No

”AudioSource.isPlaying” stays set to true when receiving a call on a mobile device

-

How to reproduce:
1. Build And Run the user’s attached “Unity_isPlaying_ReproProject.zip” project on a mobile device
2. When the app is running, receive a call
3. Observe the “AudioSource.isPlaying” text

Expected result: “AudioSource.isPlaying” is false
Actual result: “AudioSource.isPlaying” is true

Reproducible with: 2021.3.34f1, 2022.3.17f1, 2023.2.5f1, 2023.3.0b2

Reproduced on:
VLNQA00494 - iPhone 14 Pro Max, 16.3.1 iOS
VLNQA00358 - iPhone 12, 14.1 iOS
VLNQA00392 - iPad (9th generation), 15.0 iOS
Xiaomi Xiaomi 11T (21081111RG), Android 13, CPU: NOT FOUND, GPU: Mali-G77 MC9
Not reproducible on: No other environment tested

Note: reproducible when getting calls with different methods/apps

  1. Resolution Note:

    We're not planning to update the AudioSource.isPlaying boolean in this case. There are other cases where isPlaying goes to false, like when headphones are plugged in (and the default device changes). In that case, the AudioSource is actually stopped and the whole engine is stopped and restarted. It's a normal thing to check for this, and call AudioSource.Play in response (for example, if a background music track stops playing). However, in the case of iOS interrupting our audio session, the AudioSource is still set up to play, so we don't want the user to see isPlaying false and call Play again. isPlaying would then continue to return false and this would be weird/confusing.

    If a user accepts a phone call while Unity is in the foreground, we'll end up losing audio session focus and Unity will be running and audio will not be updating. In this case, I think we just have to recommend that you write some Objective-C code to subscribe to those AVAudioSession callbacks, if you need to learn about this. Alternatively, you could also check one of your playing AudioSources and if AudioSource.time does not get updated in X frames, then you'll know audio is not updating and has lost focus (probably 2 frames would be enough for a 30fps game). In future versions of Unity, we’ll look into making it easier to discover when this happens, perhaps via a C# callback.

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.