【问题标题】:artwork of current playing song using AVAudioPlayer使用 AVAudioPlayer 当前播放歌曲的艺术作品
【发布时间】:2013-04-01 03:42:59
【问题描述】:

我正在使用 AVAudioPlayer,想知道“如何在 MAC os x 中显示当前播放歌曲(音频)的艺术品(如果有的话)”。

【问题讨论】:

    标签: objective-c macos cocoa avaudioplayer


    【解决方案1】:

    -[AVAudioPlayer url] 会给你正在播放的文件的 url。

    将其传递给+[AVURLAsset assetWithURL:] 将为您提供一个AVURLAsset 对象,该对象代表正在播放的曲目。调用-[AVAsset commonMetadata] 将为您提供AVMetadataItems 的数组。您可以使用AVMetadataCommonKeyArtwork 键将该数组传递给+[AVMetadataItem metadataItemsFromArray:withKey:keySpace:],以获得与艺术品对应的正确AVMetadataItem

    相关文档:

    https://developer.apple.com/library/mac/#documentation/AVFoundation/Reference/AVAsset_Class/Reference/Reference.html#//apple_ref/occ/cl/AVAsset https://developer.apple.com/library/mac/#documentation/AVFoundation/Reference/AVURLAsset_Class/Reference/Reference.html#//apple_ref/occ/cl/AVURLAsset https://developer.apple.com/library/mac/#documentation/AVFoundation/Reference/AVMetadataItem_Class/Reference/Reference.html#//apple_ref/occ/cl/AVMetadataItem

    祝你好运!

    【讨论】:

      猜你喜欢
      • 2011-10-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多