I am currently using the following statement to detect music:
if MPMusicPlayerController.systemMusicPlayer().playbackState == .Playing {
print("There is music playing")
}
Great, however this will only work for iTunes player, and not music that might be coming from a different app, specifically talking about Spotify.
I don't need to know the song being played, simply whether there is anything playing at all, so I can decide whether I provide my own background music for my game or not.
Edit: ideally the solution should cover any 3rd party music program, not just Spotify.