Copy link to clipboard
Copied
Hi,
I'm facing a very annoying issue on iOS. I made some guided meditations apps, and I need to play the meditation is the background. Problem is that whenever the device goes into idle mode (either by waiting, or by pressing the power button), the sound stutters and is silenced for 1 or 2 seconds. Which is very annoying, especially when you are in the middle of a meditation and need to hear instructions clearly.
I have a bit more complex code in my apps, using SoundChannel and SoundLoaderContext objects, but even with the very simple code below, the problem happens:
package {
import flash.display.Sprite;
import flash.media.Sound;
import flash.net.URLRequest;
public class Main extends Sprite
{
public function Main()
{
var mySound:Sound = new Sound();
mySound.load(new URLRequest("Local/Demo.mp3"));
mySound.play();
}
}
}
In my application.xml file, I have:
<InfoAdditions><![CDATA[
<key>UIBackgroundModes</key>
<array>
<string>audio</string>
</array>
]]></InfoAdditions>
I tried many things, like using a big buffer in my SoundLoaderContext object, or using "NativeApplication.nativeApplication.executeInBackground = true", but nothing helps. It happens on several devices (iPhone 4S and iPhone 6). Happens with AIR 19 and latest AIR 22 beta.
The only occurrence when it doesn't happen is when I launch the audio, press the HOME button (so the app is sent to the background and I see the iOS dashboard), then press the power button. Here, no sound interruption. But if I press the power button while the app is in the foreground, the stuttering/hiccup/pause bug occurs.
If you simply want to hear what it sounds like, you can download this app: Beyond Affirmations - Guided Meditations on the App Store
Then launch the free audio session, and once it starts playing, press the Power button of the device. You'll hear the sound is silenced briefly for a second or 2, but it's enough to be very annoying.
Could you please help us with this, as this must be a general blocking issue for anyone making an audio player on iOS, and it is very unpleasant for the user.
Thank you very much!
Frédéric
PS: I read about this ANE: GitHub - freshplanet/ANE-Background-Music: Air Native Extension (iOS and Android) for managing backg... and I don't know if it would solve the problem. Unfortunately, it is 4 years old, and I develop on PC, so I can't recompile it. Would someone have a more recent build please?
I just tested AIR 24 beta, and the issue is indeed fixed! Thank you so much to the Adobe AIR team, this is a life saver for audio apps developers. Cheers!
Copy link to clipboard
Copied
Hi Frédéric,
We are looking into this issue and let you know soon as we have the fix.
-Roshan
Adobe AIR
Copy link to clipboard
Copied
Thank you very much Roshan. I made a few more tests, and realized that by setting
SoundMixer.audioPlaybackMode = AudioPlaybackMode.VOICE,
the stuttering is then quasi non-existent when device goes into idle mode (just a very light skipping). But the sound is then very low. I then set SoundMixer.useSpeakerphoneForVoice to true, and now the sound is loud again as it uses the speaker. Unfortunately, if the user wants to use headphones (which is likely for listening to music or meditations), then the sound is still output through the speaker. I suppose I would need a way to detect that headphones are plugged and then change the useSpeakerphoneForVoice value accordingly, but all this seems pretty cumbersome.
Anyway, thank you very much for investigating. Cheers!
Copy link to clipboard
Copied
Hi Roshan,
Any update on this very annoying issue, please? Did you at least manage to reproduce it on your side? Sorry for asking, but this is almost a showstopper for us, and for anybody willing to make an iOS app playing sound in the background. Thank you very much!
Copy link to clipboard
Copied
Hi @Frederic,
We have been able to reproduce this bug at our end and our team is looking into this.
-Roshan
Adobe AIR
Copy link to clipboard
Copied
Thank you Roshan, this is good news! Good luck to your team!
Copy link to clipboard
Copied
Hi,
I checked with the current AIR 23 beta, but the issue is still there. Do I need to create an entry in the bugs database? Is it fixable on your side? (I'm asking because I plan to make other similar audio apps, but this 2 seconds interruption is compromising it).
Thank you!
Copy link to clipboard
Copied
Hi,
Thanks for reporting the issue to us.
Could you please log a bug at bugbase.adobe.com ?
Thanks,
Adobe AIR Team
Copy link to clipboard
Copied
OK I created an entry here: Bug#4184841 - Background sound stuttering when going idle in IOS
Please tell me if you need more information.
Copy link to clipboard
Copied
I just tested AIR 24 beta, and the issue is indeed fixed! Thank you so much to the Adobe AIR team, this is a life saver for audio apps developers. Cheers!