Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

control background music from 3rd party apps ios

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?

like image 637
audub Avatar asked Nov 13 '22 06:11

audub


1 Answers

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

like image 160
jsd Avatar answered Dec 25 '22 18:12

jsd