My iPhone audio player uses the kAudioSessionCategory_MediaPlayback category.
When it's playing and a user presses the "play/pause button" on the headphones cable, my interruption listener callback gets called with a kAudioSessionBeginInterruption event, my player stops and the iPod player starts playing in the background.
The user that presses the "play/pause button" on the headphones cable does this with the intention to play/pause my app and NOT the iPod player. He then presses the "play/pause button" on the headphones cable again to stop the iPod player but my application is never informed by the interruption listener callback about this and thus never calls AudioSessionSetActive(true) and it fails to start when the user presses the regular screen play button.
So, when my app is running, how can I prevent the iPod player to start playing in the background or even better, is there a way to trap the presses on the headphones cables and in that way control my player?
Thanks for any help, Rolf Nilsson |