Silverlight MediaElement 和 UI 虚拟化
我有一个应用程序,在面板上包含许多控件,每个控件都有自己的 MediaElement 播放视频。我一直在研究 Silverlight 3 的新 UI 虚拟化功能,以提高在较小的视口中滚动浏览许多此类控件时的性能。
根据我的经验,我的理解是,每当删除 MediaElement 控件然后将其重新添加到可视树时,媒体都必须重新缓冲。我猜测尝试在任何类型的填充 MediaElement 控件的自定义面板上实现 UI 虚拟化会导致任何屏幕外元素停止播放,然后在滚动到屏幕上后立即重新缓冲。有没有人有过这种情况的经验?
如果是这种情况,是否有任何解决方法或可能的方法来使用包含 MediaElement 的控件实现 UI 虚拟化,而不影响正在进行的播放?
I have an application that contains many controls on a panel, each with its own MediaElement playing video. I have been looking into the new UI Virtualization features of Silverlight 3 to improve performance when scrolling through many of these controls in a smaller view port.
From my experience, it is my understanding that any time a MediaElement control is removed and then re-added to the visual tree the media must rebuffer. I'm guessing that trying to implement UI Virtualization on any kind of custom panel filled with MediaElement controls would cause any off-screen elements to stop playing and then rebuffer before playing as soon as they are scrolled onto the screen. Has anyone had any experience with this situation?
If this is the case, are there any workarounds or possible ways to implement UI Virtualization with controls containing MediaElements without effecting playback that is in progress?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为这个问题没有任何好的解决方案,我在实现拖放时遇到了相同的重新缓冲问题,因为必须暂时删除控件,然后将其重新添加到可视化树中的新位置,导致 MediaElement重新缓冲。
如果其他人遇到此问题,我最好的解决方法是在实际控件上使用 VideoBrush,并将所有相应的 MediaElement 添加到应用程序级别的隐藏面板中。如果控件暂时离开可视化树(由于 UI 虚拟化或拖放),则仅删除 VideoBrush,而实际的 MediaElement 保留在隐藏面板上,因此不会发生重新缓冲。
I don't think there is any great solution to this problem, I faced the same rebuffering issue implementing drag and drop since the controls had to be temporarily removed and then re-added in the new spot in the visual tree, causing the MediaElement to rebuffer.
In case anyone else has this problem, my best workaround has been to use the VideoBrush on the actual controls with all the corresponding MediaElements being added to a hidden panel at the application-level. If the control temporarily leaves the visual tree (due to UI Virtualization or drag and drop) only the VideoBrush is removed and the actual MediaElement stays on the hidden panel, so no rebuffering occurs.