Howplay mp4 songs using NAudio

断了今生、忘了曾经 提交于 2019-12-25 02:16:39

问题


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


回答1:


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



回答2:


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



来源:https://stackoverflow.com/questions/7609237/howplay-mp4-songs-using-naudio

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!