如何使用 NAudio 播放 mp4 歌曲
我们可以使用 NAudio 播放 mp4 歌曲吗? 请提供一些播放 mp4 歌曲的代码 我需要 c# 代码来帮助我播放 mp4 歌曲
Can we play mp4 songs using NAudio?
Please provide some code to play mp4 songs
I need a c# code that will help me play mp4 songs
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用NAudio播放.mp4文件,官方页面中有一个演示。
下载演示应用程序并查找“媒体基础演示”。演示的 C# 代码可以在 NAudio 的源代码中找到。
实现位于 WasapiOutGuiThread 类中:
You can play .mp4 files using NAudio, there is a demo in the official page.
Donwload the Demo-Apps and look for the "Media Foundation Demo". The C# code of the demo can be found at the Source Code of NAudio.
The implementation is in the WasapiOutGuiThread class:
更新: NAudio 现在可以使用
MediaFoundationReader
播放 MP4 文件(假设您安装了适当的编解码器)。这适用于 Windows Vista 及更高版本,如果您运行的是 Windows Server,则可能需要安装“桌面体验”。替代方法是查看 WPF Media Element 是否可以播放它,或者使用 Windows Media Player ActiveX 控件(在可以播放 MP4 的操作系统上)。
Update: NAudio can now play MP4 files using the
MediaFoundationReader
assuming you have the appropriate codecs installed. This works on Windows Vista and above, and if you are running Windows Server you may need to have the "Desktop Experience" installed.Alternative approaches would be to see if the WPF Media Element can play it, or using the Windows Media Player ActiveX control (on an OS that can play MP4s).