PDA

View Full Version : Pause iPod when the current song ends?




ArtOfWarfare
Sep 23, 2012, 05:48 PM
Hi, I'm looking through Apple's docs on Audio sessions (such as this one: http://developer.apple.com/library/ios/#documentation/Audio/Conceptual/AudioSessionProgrammingGuide/Configuration/Configuration.html ) and I can't tell whether it's possible to achieve what I want or not:

1 - Get the metadata of the iPod song playing when my app launches.
2 - Pause the iPod when it reaches the end of the current song.
3 - Play the audio for my own app (as AVAudioSessionCategoryPlayback - it should play even if the screen is locked.)
4 - Get the metadata of the iPod song that will play next.
5 - Resume the iPod when my app reaches the end of its own audio.

Ultimately, I want my app to coexist with the iPod. It should respect other audio applications that might be running by not abruptly stopping them when my app is launched (my app will have a button for the user to abruptly stop the iPod and start my app's audio if they want,) but it should stop them as they reach the end of their own audio. When my app reaches the end of its audio, it should resume whatever audio was previously playing.