问题
I am reading the length of mp3 files using NAdutio.dll. the code sample i used is here. the application i have created is a stand alone desktop application built in C# 4.0 and is used on the network of computers all with windows server 2008 operating systems. and there is no media player installed on any of those computer. when i run the application on my local machine it return the length of mp3 files correctly, but when it is run on any pc on that network it return zero for every file. it seems that the NAudio.dll itself use the wmp.dll to read the audio. but i can not get install the media player or can not place the dll in each of those computers. is there any way that i can fix this dll problem by some work arround in the installer or code? any one please help me.
Thanks in Advance
回答1:
Try NLayer to read the file. The latest version's MpegFile implementation should provide you with length information nicely. Just read the .Length and divide by .Channels * 4 (.Length is is bytes, and samples are in 32-bit float format).
Please Note: I've put a lot of work into this library, so while I'm not the maintainer, it is one of my projects.
来源:https://stackoverflow.com/questions/18500708/reading-mp3-file-using-naudio-dll-on-windows-server-2008-r2-when-media-player-is