iPhone 播放特定播放列表/iMix
我想从我的程序中播放特定的播放列表(作为 iMix 构建的),只要它存在即可。我可以用来
[[MPMediaQuery albumsQuery] addFilterPredicate:[MPMediaPropertyPredicate predicateWithValue:@"MyAlbum" forProperty:MPMediaItemPropertyAlbumTitle]];
获取专辑中的所有歌曲(以及艺术家的许多其他选项等),但似乎无法访问播放列表。
有没有不同的方法来做到这一点,或者我是否会被迫将播放列表中的所有歌曲存储在我的代码中并以这种方式访问它们?
I want to play a specific playlist (that was constructed as an iMix) from my program, as long as it exists. I am able to use
[[MPMediaQuery albumsQuery] addFilterPredicate:[MPMediaPropertyPredicate predicateWithValue:@"MyAlbum" forProperty:MPMediaItemPropertyAlbumTitle]];
to get all songs in an album (as well as many other options for artists, etc.) but there seems to be no way to access playlists.
Is there a different way to do this, or will I be forced to store all the songs in the playlist within my code and access them all that way?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我自己没有使用过它,但我在文档中看到了
[MPMediaQuery playlistsQuery]
和MPMediaGroupingPlaylist
...此链接有帮助吗?
http://discussions.apple.com/thread。 jspa?threadID=2084104&tstart=0&messageID=9838244
I haven't used it myself, but I see a
[MPMediaQuery playlistsQuery]
andMPMediaGroupingPlaylist
in the docs...Does this link help?
http://discussions.apple.com/thread.jspa?threadID=2084104&tstart=0&messageID=9838244
我最终不得不通过包含播放列表信息的文本文件来推出自己的。这是代码。 [Globals split] 函数仅接受一个字符串,并使用单个字符 ([Globals split: with:]) 或字符串中的每个字符 ([Globals split: withMany:]) 将其拆分为字符串数组。
使用 iTunes 可以轻松生成文本文件。您所需要做的就是在 iTunes 中创建播放列表,从列表中删除除标题、艺术家和专辑之外的所有歌曲信息,选择全部,然后粘贴到文本文件中。它将自动以制表符分隔并用回车符分隔。您也无需担心输入错误或类似的问题。
I ended up having to roll my own via a text file that contains playlist information. here is the code. The [Globals split] function just takes a string and splits it into an array of strings using either a single character ([Globals split: with:]) or each character in a string ([Globals split: withMany:]).
The text file is very easily generated using iTunes. All you need to do is create your playlist in iTunes, remove all the song info from your list except for Title, Artist, and Album, select all, and then paste into a text file. It will automatically be tab-delimitted and split by carriage returns. You also won't need to worry about mistyping or anything like that.