我目前正在开发一款 iOS 音乐应用程序。我正在使用 AVPlayer 来播放歌曲。 到目前为止,除了不是从 iCloud 下载的歌曲外,这一切都运行良好。 这首歌没有播放:(
NSArray *itemsFromQuery = [[MPMediaQuery songsQuery] items];
MPMediaItem *song = [itemsFromQuery objectAtIndex:0];
NSURL *songURL = [song valueForProperty:MPMediaItemPropertyAssetURL];
AVURLAsset *urlAsset = [[AVURLAsset alloc] initWithURL:songURL options:nil];
在此示例中,对于 iCould 歌曲,songUrl 为 null,但对于已下载的歌曲则可以...
但是需要有一种方法来播放 iCloud 歌曲,因为像 Groove 这样的应用程序正在这样做......
感谢您的帮助, 厄克曼
最佳答案
经过大量阅读和测试,目前看来没有 MPMusicPlayerController 就无法播放 iCloud 歌曲。
Groove 等应用程序也使用 MPMusicPlayerController...
关于iOS:从 iCloud 播放歌曲,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16823901/