Reputation: 435
Is there a way to control music currently playing in the background? I am able to control the native ipod application with the MPMusicPlayerController iPodMusicPlayer
, but what i basically want is the functionality of the ipod controller in the task switcher. I want to be able to control the app currently playing (next/prev). The controls in the task switcher controls spotify, pandora or any other app currently playing.
Any ideas?
Upvotes: 5
Views: 1833
Reputation: 7703
You can do this. Make sure you are using the AVAudioSessionCategoryPlayback audio session, first off. After you activate the audio session, call:
[[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
See here for more details http://developer.apple.com/library/ios/#documentation/EventHandling/Conceptual/EventHandlingiPhoneOS/RemoteControl/RemoteControl.html
Upvotes: 1