天天看點

使用AVAsset擷取音頻檔案ID3資訊

AVAsset *mp3Asset = [AVAsset assetWithURL:audioUrl];
    for (NSString *format in [mp3Asset availableMetadataFormats])
    {
        for (AVMetadataItem *metadataItem in [mp3Asset metadataForFormat:format])
        {
        NSLog(@"key=%@,commonKey=%@",metadataItem.key,metadataItem.commonKey);
        }
}
           

key=TPE1,commonKey=artist

key=TALB,commonKey=albumName

key=TYER,commonKey=(null)//上市年份

key=USLT,commonKey=(null)//歌詞

key=APIC,commonKey=artwork

key=TIT2,commonKey=title