I am currently using the following instruction to discover music:
if MPMusicPlayerController.systemMusicPlayer().playbackState == .Playing { print("There is music playing") }
Great, but it will only work for the iTunes player, and not for music that may appear from another application, in particular, it talks about Spotify .
I donβt need to know what song is playing, is it just that something is playing, so I can decide if I provide my own background music for my game or not.
Edit: Ideally, the solution should cover any third-party music program, not just Spotify.
source share