如何在几秒钟内获得mp3文件长度?在.net [英] how get mp3 file length in seconds? in .net
本文介绍了如何在几秒钟内获得mp3文件长度?在.net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有fileinfo传递我的所有歌曲,我不会得到wongs legth
i看到TagLib包但只在asp.net项目中运行
请helppp:0)
i have the "fileinfo" that passing over all my songs , i wont to get wongs legth
i see the TagLib package but is running only in asp.net project
please helppp :0)
推荐答案
Timespan duration = new Mp3FileReader(filePath).TotalTime;
List<listitem> files = new List<listitem>();
foreach (string filePath in filePaths)
{
string p = filePath;
string fileExt=Path.GetExtension(p);
if (fileExt == ".mp3")
{
//Use NAudio to get the duration of the File as a TimeSpan object
Timespan duration = new Mp3FileReader(filePath).TotalTime;
}
}
这篇关于如何在几秒钟内获得mp3文件长度?在.net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文