I need to know how to get information about which player is currently streaming (player, spotify, napster...)
Asked Answered
P

1

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?

Pillsbury answered 16/10, 2015 at 5:41 Comment(2)
try this one. #31428263Dovetail
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 appNettlesome
C
0

Use the nowPlayingInfo dictionary on MPNowPlayingInfoCenter.defaultCenter():

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

MPNowPlayingInfoCenter class reference here.

Conductor answered 16/10, 2015 at 18:58 Comment(3)
Allways returns null value from newPlayingInfoKyrakyriako
It seems this API is for setting the info not to getting, and that's the reason of gets nil.Equivalence
Ye, so is there any API to get it ?Vigil

© 2022 - 2024 — McMap. All rights reserved.