如何知道我的 WPF 应用程序可以播放哪些视频格式? [英] How to know which video formats my WPF application can play?
问题描述
我有一个允许播放视频的小应用程序.首先,我不限制用户选择特定类型的文件.我想要做的是确保我可以播放用户选择的文件.如何获取可用编解码器的列表,或查询 WPF 应用程序(MediaElement
控件)的播放质量?
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)?
建议的替代方法是在播放之前将任何选定的输入文件转换为统一格式(例如,MPEG),但这似乎更困难.
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.
推荐答案
你为什么不:
- 试玩一下
- 如果您立即收到来自媒体元素的错误,则不支持.
在执行此操作时,您始终可以隐藏媒体元素.这比任何预先计算支持和不支持的尝试都要可靠得多.
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.
这篇关于如何知道我的 WPF 应用程序可以播放哪些视频格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!