I'm using an AVAudio player instance to play a user interface "click" sound when the user presses a button in my game.
When playing through my iPad's built in speakers I've found that the sound fails to play the first time if there has been a delay of more than 3 seconds since the last play. Subsequent plays do work as long as they are within 3 seconds. Everything works fine through the headphones, and also If I play background music continuously then the UI click sound works everytime. Also if I play music continuously at 0.0001 volume (effectively silent) then the click sound works....
So it seems that the iPad speaker is being aggressively switched off if it is inactive for about 3 seconds. Because my UI click sound is very short the speakers don't wake up quickly enough to play the sound.
Is there anyway to make this deactivation less agressive? I assume it helps save battery so I'm reluctant to just play a silent background track to workaround this, but 3 seconds is just a bit too aggressive and makes the app feel broken... Is there a way to do this without resorting to silent background tracks?
Thanks.