从 MP3 文件/ID3 标签获取专辑封面
我正在尝试从 MP3 文件获取专辑封面。
在本例中,我使用 AVAudioPlayer
来播放文件。
这是我认为可以获取专辑插图的代码:
MPMusicPlayerController *controller = [MPMusicPlayerController applicationMusicPlayer];
MPMediaItem *current = controller.nowPlayingItem;
MPMediaItemArtwork *artwork = [current valueForProperty:MPMediaItemPropertyArtwork];
UIImage *artwork2 = [artwork imageWithSize:artwork.bounds.size];
[artworkView setImage:artwork2];
但是 artworkView
不包含任何图像。
我有点卡住了。
如果有人可以帮助我提供有关在哪里/如何直接从 ID3 标签获取艺术品的建议,那将很有用。
任何帮助表示赞赏。
I'm trying to get the album artwork from a MP3 file.
In this case I use AVAudioPlayer
to play the file.
Here's the code that I thought would get the album artwork:
MPMusicPlayerController *controller = [MPMusicPlayerController applicationMusicPlayer];
MPMediaItem *current = controller.nowPlayingItem;
MPMediaItemArtwork *artwork = [current valueForProperty:MPMediaItemPropertyArtwork];
UIImage *artwork2 = [artwork imageWithSize:artwork.bounds.size];
[artworkView setImage:artwork2];
However artworkView
doesn't contain any image whatsoever.
I'm a little bit stuck.
If any one could help by providing suggestions to where/how I can get the artwork directly from the ID3 tag, that would be of great use.
Any help appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须使用 enumerateValuesForProperties 这是一个示例:
You have to use enumerateValuesForProperties here is a sample: