My application needs to play some audio files, and I want to make an iPod sound, play my file, and then as soon as my sound stops playing iPod again (just like the iPhone handles iPod music when an incoming call arrives)
I configure my Audio Session application as kAudioSessionCategory_MediaPlayback, and then before playing my file, I call AudioSessionSetActive (true) then when my file ends, I call AudioSessionSetActive (false)
What happens is that the iPod sound fades out with an call to AudioSessionSetActive (true), but it never fades out after I call AudioSessionSetActive (false)
I use the AVFoundation class to play my audio, I have audioPlayerDidFinishPlaying in my delegate method and where I call AudioSessionSetActive (false).
What am I missing here? Why doesn't the iPod disappear when I deactivate my audio session? Do I have the wrong category of audio sessions for this?
source
share