How to know which video formats my WPF application can play?

回眸只為那壹抹淺笑 提交于 2019-12-19 08:27:33

问题


I have a small application that allows the playback of videos. First off, I do not restrict the user to select particular types of file. What I want to do is make sure I can play the file the user selected. How do I get a list of available codecs, or query the playback qualities of the WPF application (the MediaElement control)?

The alternative proposed is to convert any selected input file to a uniform format (for example, MPEG) before it's played, but that seems to be more difficult.


回答1:


Why don't you:

  1. Try to play it
  2. if you immediately get an error from the media element, it isn't supported.

You could always make the media element hidden while you did this. This will be much more reliable than any attempt to pre-calculate what is and isn't supported.



来源:https://stackoverflow.com/questions/4162387/how-to-know-which-video-formats-my-wpf-application-can-play

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