Hi,
I have a metronome app that is able to play audio in the background just fine. It even continues playing when the screens is locked. That is, until the screen goes dark after a few seconds. Playback stops, but it returns if I press any button that lights up the screen again.
I have Background Modes ON (Audio, Airplay and PiP checked), and set up my audio session with the following code:
AVAudioSessionCategoryOptions option = flag ? AVAudioSessionCategoryOptionMixWithOthers : 0;
if (![session setCategory:AVAudioSessionCategoryPlayback
withOptions:option
error:&setCategoryError]) { … }
A.f.a.i.k. this should be sufficient to ensure playback continues when the screen goes to sleep. I’ve had earlier incarnations of this app behave successfully with this feature since around 2010. I haven’t been able to figure out what caused this since its latest major release.
Any ideas what I might be overlooking or doing wrong?
- António