How to get the Properties of a *.mp3 File in C#

前端 未结 2 1987
有刺的猬
有刺的猬 2020-12-03 11:23

I´m programming a little media player with a song library. Now I need to get the properties of a mp3,wma file, like the artist name or the song duration.

What is the

相关标签:
2条回答
  • 2020-12-03 11:43

    You can examine the ID3 tag of the mp3s. The taglib-sharp library is great for doing so. Source code available (here). Example code:

    TagLib.File tagFile = TagLib.File.Create(pathtofile);
    string artist = tagFile.Tag.FirstAlbumArtist;
    string album = tagFile.Tag.Album;
    string title = tagFile.Tag.Title;
    ...
    

    Not sure if tag-lib supports .wma though... Tag-lib can however be ported to silverlight (if needed).

    0 讨论(0)
  • 2020-12-03 11:55

    using an ID3 library. A quick google gave me: csid3lib

    0 讨论(0)
提交回复
热议问题