Control other apps music playing from inside my app?

Viewed 930

Inside my app I'd like to have a control to stop/play, skipToNext and goToPrevious song if any other app is already playing music. Similar to what the control-center does already, but I wand those buttons to be available inside my app.

I've seen that MPMusicPlayerController allows that for the Apple Music app using skipToPreviousItem(), skipToBeginning(), skipToNextItem(). But I'm looking for a solution that would work for any other app (SoundCloud, Spotify, Deezer, ...), similarly as the control-center does.

Is there any way to control other apps music playing from inside my app?

1 Answers

There are two potential workarounds: A) There is a Spotify App Remote SDK now https://github.com/spotify/ios-app-remote-sdk#sptappremoteuserapi. You can use that to control the Spotify app directly.

B) If you can live with only controlling stop/play you can take over the audio session which will stop Spotify and then end your session hoping that Spotify will automatically resume.

Related