如何预加载视频文件以在 VB/WPF 项目中的 mediaelement 中使用
我的项目中有一个 mediaelement(它使用 WPF4 XAML 和 Visual Basic 2010 的组合),并且我在后面的 VB 代码中设置了 mediaelement 源(相对 URI)。这一切都进展顺利。
但是,我的项目包含大量视频,所有这些视频都将投影在 WPF 窗口的所有其他元素后面(从而充当某种背景)。我需要这些视频能够顺利地从一个视频过渡到另一个视频,而无需剪辑。为此,我需要预加载特定部分的所有视频。
如何预加载位于相对 URI 的视频,以便它们在被调用时立即出现?
(顺便说一句,我所做的一切都是我可以完成这个项目的唯一方法,所以请不要评论我应该做什么。我只需要预加载视频或找到其他方法使它们无缝,无论客户如何计算机速度。)
谢谢! -杰森·C·麦克唐纳
I have a mediaelement in my project (which uses a combination of WPF4 XAML and Visual Basic 2010), and I have the mediaelement source (a relative URI) set in VB code behind. All this works swimmingly.
However, my project contains a LOT of videos, all of which will be projected behind all the other elements of the WPF window (thus acting as a background of sorts). I need these videos to smoothly transition from one to another, without a cut. To do this, I need to preload all the videos for a particular section.
How do I preload videos located at a relative URI, so they come up the instant they are called?
(By the way, everything I have working is the only way I can do this project, so please, no comments on what I should do instead. I just need to preload the videos or find some other way of making them seamless regardless of client computer speed.)
Thank you!
-Jason C. McDonald
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我后来了解到,在应用程序中预加载显然是不可能/不可取的。与预加载(缓冲)涉及将文件下载到本地系统的 Web 不同,本地系统上的缓冲受到系统资源和处理器/CPU 速度的限制。以更紧凑的格式(例如 Theora)以及较低的比特率和质量渲染视频文件将有助于减轻视频“跳频”,超过这一点,视频播放的速度完全由用户的系统决定。
因此,有必要在多个系统上测试应用程序,以确定消除视频播放瓶颈所需的最低硬件要求和系统资源。
在某些情况下,虚拟化还可能有助于提高程序速度,释放用于视频播放的资源。
I have since learned that preloading is apparently not possible/not desirable in an application. Unlike the web, where preloading (buffering) involves downloading the file to the local system, buffering on a local system is limited by the system's resources and processor/CPU speed. Rendering a video file in a more compact format (such as Theora), and in a lower bitrate and quality will help alleviate video "skipping," beyond which point, the speed of video playback is determined entirely by the user's system.
Thus, testing the application on multiple systems is necessary to determine the minimum hardware requirements and system resources needed to eliminate the bottleneck in video playback.
In some cases, virtualization may also help improve program speed, freeing up resources to be used in video playback.