Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/jsf/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 使用标签库C在Mp3中嵌入相册艺术#_C#_Ios6_Taglib_Id3 Tag_Taglib Sharp - Fatal编程技术网

C# 使用标签库C在Mp3中嵌入相册艺术#

C# 使用标签库C在Mp3中嵌入相册艺术#,c#,ios6,taglib,id3-tag,taglib-sharp,C#,Ios6,Taglib,Id3 Tag,Taglib Sharp,尝试使用c#标记库添加专辑艺术 TagLib.File trackFile = TagLib.File.Create(strLocalFile); Picture picture = new Picture("Picture path"); picture.Type = PictureType.FrontCover; picture.MimeType = "image/jpeg"; picture.Description = "Front Cover";

尝试使用c#标记库添加专辑艺术

  TagLib.File trackFile = TagLib.File.Create(strLocalFile);
  Picture picture = new Picture("Picture path");
  picture.Type = PictureType.FrontCover;
  picture.MimeType = "image/jpeg";
  picture.Description = "Front Cover";        
  trackFile.Tag.Pictures = new IPicture[1] { picture };
  trackFile.Save();
我在windows media player、itunes和iphone(仅在纵向模式下)中获得图片。当我切换到横向模式时,将显示相册艺术,但当幻灯片滑过封面时,相册艺术将消失

我在代码中遗漏了什么吗

我在iPhone 4s上使用iTunes 11和iOS 6,让我举个例子:

我发现iTunes讨厌UTF-16,这就是问题所在

targetMp3File = TagLib.File.Create(...);

// define picture
TagLib.Id3v2.AttachedPictureFrame pic = new TagLib.Id3v2.AttachedPictureFrame();
pic.TextEncoding = TagLib.StringType.Latin1;
pic.MimeType     = System.Net.Mime.MediaTypeNames.Image.Jpeg;
pic.Type         = TagLib.PictureType.FrontCover;
pic.Data         = TagLib.ByteVector.FromPath(...);

// save picture to file
targetMp3File.Tag.Pictures = new TagLib.IPicture[1] { pic };    
targetMp3File.Save();
所以基本上整个过程都在
pic.textcodeding
行中。此外,我还通过.NET常量指定了Mime类型

来源:

这应该适用于iTunes和iPod/iPad/iPhone。但这只适用于MP3文件…

更新:这一特定问题是由于iPhone的选择性分辨率。当我降低图像的分辨率时,相册艺术在iPhone的封面流动模式下正确显示。