2

我目前正在构建一个音乐应用程序,我想获取当前播放项目的播放列表(在 Apple Music 中)。

我并不是说我想使用 MPMediaPickerController,因为我只想获取当前播放列表的媒体项。

非常感谢您的帮助!

4

2 回答 2

4

如果您不自己启动播放列表,则无法检索接下来要播放的项目。

您可以通过从播放器获取 nowPlayingItem 来获取当前播放歌曲的信息,但任何与队列相关的 API 都是只写的。

于 2016-08-22T22:40:11.070 回答
2

MPMusicPlayerController.systemMusicPlayer

导入媒体播放器

let audioInfo = MPNowPlayingInfoCenter.defaultCenter()
let audioName = audioPath.lastPathComponent!.stringByDeletingPathExtension
audioInfo.nowPlayingInfo = [ MPMediaItemPropertyTitle: audioName, MPMediaItemPropertyArtist:"artistName"]

文档:

https://developer.apple.com/library/ios/documentation/MediaPlayer/Reference/MPMusicPlayerController_ClassReference/

于 2016-08-08T11:04:45.110 回答