使用AVMutableMetadataItem

时间:2019-02-22 08:26:39

标签: swift cocoa id3

我正在尝试使用AVMutableMetadataItem修改iTunes库中某些歌曲的信息,但是对此不走运。我仍在学习如何做,但找不到任何文档。

static func writeID3(_ audioFiles: URL)
{
    let audio = AVPlayerItem(url: audioFiles)
    let meta = audio.asset.metadata(forFormat: .iTunesMetadata)

    for eachMeta in meta
    {
        let av = AVMutableMetadataItem()
        av.keySpace = AVMetadataKeySpace.iTunes
        av.key = AVMetadataKey.iTunesMetadataKeyAlbumArtist as NSString
        av.value = "Various Artists" as NSString
    }
}

0 个答案:

没有答案