开发者

Howplay mp4 songs using NAudio

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


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.

  • Link to Demo-Apps
  • Link to Source Code

The implementation is in the WasapiOutGuiThread class:

WasapiOutGuiThread  : IWavePlayer


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).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜