在 .NET 中播放媒体文件有什么简单的方法吗?

发布于 2024-10-08 03:33:12 字数 249 浏览 0 评论 0原文

有没有什么方法可以在 WinForms 应用程序中播放媒体文件,而不必费力使用 VLC 控件或类似控件?

我想做的是打开里面的电影或音频文件,比如一个面板,然后能够暂停、恢复和停止播放。

这样做的唯一方法(正如我发现的)是将 VLC 嵌入到我的应用程序中,这非常令人沮丧,因为 VLC 通常无法播放任何内容(也许我做的完全错误)。

不管怎样,如果有人向我指出一个易于使用的库或类似的库,它只是为我处理播放,(大部分)没有错误,我会很高兴

are there any ways to play media files inside a WinForms application without having to struggle with VLC controls or similar?

What I'd like to do is to open movies or audio files inside, say a panel, and then be able to pause, resume and stop the playback.

The only way of doing that (as I've found) is to embed VLC inside my applications, which is quite frustrating as VLC usually fails to play anything (maybe I'm doing it totally wrong though).

Anyway, I'd be happy if someone pointed me to a easy-to-use library or similar that just took care of the playback for me, (mostly) bug free

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

甜中书 2024-10-15 03:33:12

为此,您可能应该使用 DirectX。或者,我看到了使用 Silverlight 的解决方案,其中 Silverlight 驻留在托管的 Web 浏览器面板中。这是一个非常肮脏的黑客行为,但如果这是一个问题的话,跨平台性会稍微高一些。但是,DirectX 是您应该开始的地方: http: //msdn.microsoft.com/en-us/library/bb324497%28v=vs.85%29.aspx

You should probably utilize DirectX for this. Alternatively, I have seen a solution using Silverlight, where Silverlight resides in a hosted web browser panel. A very dirty hack, but would be slightly more cross-platform if that's an issue. But, DirectX is where you should begin: http://msdn.microsoft.com/en-us/library/bb324497%28v=vs.85%29.aspx

伤痕我心 2024-10-15 03:33:12

我认为您可以在 Visual Studio 中导入一个 Windows Media Player dll: wmp.dll

http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/7db19938-c34c-4085-bbe5-9e0725827e8c/

唐不知道这是否适合您的需求...

I think there is a windows media player dll you can import in Visual studio: wmp.dll

http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/7db19938-c34c-4085-bbe5-9e0725827e8c/

Don't know that will fit your needs ...

感情旳空白 2024-10-15 03:33:12

如果可能,请使用 MediaElement...我在 WPF 上使用它,它只是加载音频/视频文件的 URI,然后开始播放(它甚至可以从互联网上流式传输)。我认为这也适用于 SL,但我不太确定:S

Use a MediaElement if possible... i use it on WPF and its just about loading the URI for the audio/video file and it starts playing (It can even stream off internet). I think this is also available for SL, but im not quite sure :S

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文