Ok I need specific instruction on how to extract meta data (author,title,duration) from a Windows Media Audio file (.wma). References I have reviewed involve downloading an SDK ,are several pages long, and extremely complicated. I just want the metadata from the file and put it into strings.
This is what I tried:
public class MusicID3Tag
{
public byte[] TAGID = new byte[3]; // 3
public byte[] Title = new byte[30]; // 30
public byte[] Artist = new byte[30]; // 30
public byte[] Album = new byte[30]; // 30
public byte[] Year = new byte[4]; // 4
public byte[] Comment = new byte[30]; // 30
public byte[] Genre = new byte[1]; // 1
}
strFileName = "C:\\Develop\\Apps\\WQFX\\Music\\MySong.wma";
//Open the file and read the tags.
using (FileStream fs = File.OpenRead( strFileName))
{
if (fs.Length >= 128)
{
MusicID3Tag tag = new MusicID3Tag();
fs.Seek(-128, SeekOrigin.End);
fs.Read(tag.TAGID, 0, tag.TAGID.Length);
fs.Read(tag.Title, 0, tag.Title.Length);
//string theTAGID = Encoding.Default.GetString(tag.TAGID); Error: Encoding not recognized
//if (theTAGID.Equals("TAG"))
{
//string Title = Encoding.Default.GetString(tag.Title); Error: Encoding not recognized
//string Artist = Encoding.Default.GetString(tag.Artist);
}
}
Any help would be appreciated.