4

I'm trying to control the active music player from my app to skip the currently playing song. I'm able to do it for the iPod music player with

MPMusicPlayerController *musicPlayer = [MPMusicPlayerController systemMusicPlayer];
[musicPlayer skipToNextItem];

The problem is that i would like to control the Spotify app, or any other music app currently playing. Since they can be controlled with the control on the lock screen i though there might be a way to do it. I thought a solution was to post a UIEventSubtypeRemoteControlNextTrack notification, but i can't found how to build a UIEvent notification. Has anyone already solved something like that ?

Thanks

M to the K
  • 1,576
  • 3
  • 17
  • 27

1 Answers1

0

You can not stop Spotify app or any other app from playing using your app.
Spotify has it's own process, which is separated from your process. The notification you are trying to send will be sent within your app, the system uses this notification to send to all processes (apps) registered for this notification when the user interacts with the remote.

What you are doing is initiating a music player for your app and skipping to next track, which will not affect Spotify app at all, Because Spotify has it's own MPMusicPlayerController instance

Basheer_CAD
  • 4,908
  • 24
  • 36
  • Thanks for your response, i understand that Spotify has it's own MPMusicPlayerController that's why i stated that this solution doesn't work.... The question is: is there a way to simulate the "next" notification send by Apple from the lock screen ? Because this notification allow any player currently playing a song to skip to the next. – M to the K Mar 09 '15 at 11:10
  • No @MtotheK you can not, this is a system private method, and unfortunately you cannot do this on iOS – Basheer_CAD Mar 09 '15 at 11:11