2

I can get information (artist, album, title) of the song that is currently playing with:

let t = MPMusicPlayerController().nowPlayingItem?.title

It works fine when the music is streaming from the iOS Music Player. However, when the streaming is from other source (Spotify, Napster, Youtube, Tuneinradio, etc.) I can not get information. How can I get this information for any app?

ashleedawg
  • 20,365
  • 9
  • 72
  • 105
Luis Abós
  • 41
  • 4
  • try this one. http://stackoverflow.com/questions/31427763/i-need-to-implement-music-player-using-av-player-in-swift – Badal Shah Oct 16 '15 at 05:46
  • sorry but I do not need to play nothing in my app. My app is running and other app (Player, Spotify, Napster, ...) is playing something. I want to know the title of the song which is playing in those apps to show it in my app – Luis Abós Oct 16 '15 at 12:42

1 Answers1

0

Use the nowPlayingInfo dictionary on MPNowPlayingInfoCenter.defaultCenter():

let t = MPNowPlayingInfoCenter.defaultCenter().nowPlayingInfo[MPMediaItemPropertyTitle]

MPNowPlayingInfoCenter class reference here.

JAL
  • 41,701
  • 23
  • 172
  • 300