在未安装媒体播放器的Windows Server 2008 r2上使用NAudio.dll读取Mp3文件 [英] Reading Mp3 File using NAudio.dll on windows server 2008 r2 when media player is not installed

查看:418
本文介绍了在未安装媒体播放器的Windows Server 2008 r2上使用NAudio.dll读取Mp3文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用NAdutio.dll读取mp3文件的长度。我使用的代码示例是此处。我创建的应用程序是一个独立的桌面应用程序内置的C#4.0,并在所有与Windows Server 2008操作系统的计算机网络上使用。并且在这些计算机上没有安装媒体播放器。当我在我的本地机器上运行应用程序时,它正确返回mp3文件的长度,但是当它在任何pc上运行在该网络上,它返回零为每个文件。看来NAudio.dll本身使用wmp.dll来读取音频。但我无法获得安装媒体播放器或无法放置在每个这些计算机的DLL。有什么办法,我可以通过安装程序或代码中的一些工作来修复这个dll问题?任何一个请帮助我。

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.

感谢提前

推荐答案

尝试 NLayer 读取文件。最新版本的MpegFile实现应该很好地为您提供长度信息。只需读取.Length并除以.Channels * 4(。长度为字节,采样为32位浮点格式)。

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.

这篇关于在未安装媒体播放器的Windows Server 2008 r2上使用NAudio.dll读取Mp3文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆