如何知道我的 WPF 应用程序可以播放哪些视频格式? [英] How to know which video formats my WPF application can play?

查看:31
本文介绍了如何知道我的 WPF 应用程序可以播放哪些视频格式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个允许播放视频的小应用程序.首先,我不限制用户选择特定类型的文件.我想要做的是确保我可以播放用户选择的文件.如何获取可用编解码器的列表,或查询 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.

推荐答案

你为什么不:

  1. 试玩一下
  2. 如果您立即收到来自媒体元素的错误,则不支持.

在执行此操作时,您始终可以隐藏媒体元素.这比任何预先计算支持和不支持的尝试都要可靠得多.

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆