2014-09-20 20 views
0

我正在使用我的新應用程序修改ID3標籤。將圖片寫入mp3文件ID3.NET Windows商店應用程序

我可以編輯標題,專輯和藝術家,但我無法修改圖片。

這裏是我的小代碼

IList<string> artists = new List<string> { "test artist" }; 
       tag.Title.Value = "my test"; 
       tag.Album.Value = "album test"; 
       tag.Artists.Value.Add("test artist"); 
       tag.Pictures.Add(new Id3.Frames.PictureFrame 
       { 
        PictureData = array, 
        PictureType = Id3.Frames.PictureType.Media, 
        MimeType = "image/jpeg" 
       }); 
       stream.WriteTag(tag, 1, 0, WriteConflictAction.Replace); 
       stream.Dispose(); 

當我打開MP3文件,我無法看到圖像播放期間。

你能幫我嗎?謝謝。

回答

1
stream.WriteTag(tag, 1, 0, WriteConflictAction.Replace); 

1代表主要和0次ID3版本。由於版本1中沒有實現圖片/圖片等媒體類型,因此您至少需要使用版本2.(2.3是ID3標籤庫中使用的最流行版本,2.4是2000年發佈的最新版本)

stream.WriteTag(tag, 2, 3, WriteConflictAction.Replace); 

將解決您的問題。請注意,您還需要創建一個Idv23Tag應用上面的代碼時:

var tag = new Id3v23Tag();

更多信息請參見http://en.wikipedia.org/wiki/ID3

相關問題