views:

317

answers:

1

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?

+1  A: 

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.

Dan Auclair