Detecting which audio track is playing on device in iOS Swift

╄→гoц情女王★ 提交于 2019-12-10 15:17:39

问题


I'm creating a mood tracking app that, among other things, should use information about the songs the user listens to. Specifically, I'm interested in just extracting the titles that are otherwise visible from the locked screen view, when a track is playing. I've search the interwebs and have had no luck finding a solution to access this data using Swift.

Can anyone help?


回答1:


The short answer is no.

You may be able to retrieve song information from the iTunes library (if it's not a shared song using Home Sharing). Read about MPMusicPlayerController for more information. Specially the nowPlayingItem is probably what you're looking for.

However, most third-party applications such as Spotify, Deezer or Pandora will most likely have implemented their own player, which does not integrate with the iPod music player. This blog post also covers some of the details.




回答2:


It is not about your ask, but it is about theme.

I made a code to get information about track in Itunes Media, and if you need get album art or correctly track name or artist, well I think it is will help you. The code is free to use in github.

ItunesSearch



来源:https://stackoverflow.com/questions/28581548/detecting-which-audio-track-is-playing-on-device-in-ios-swift

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!