Smooth Video Transitions for WPF
I'm using VB.net 2010 and WPF 4. I need to have a smooth transition between two videos played on the mediaelement. I absolutely cannot use anything that requires me to use a winhost in the WPF window, as that will make my project impossible (since the video is full screen, and the controls are over the video)
Basically, I n开发者_如何学Ceed for the video to play through, and then smoothly go to another video specified in code behind. I cannot splice the two videos together - they must be separate.
How do I have the videos transition smoothly, with no "blink"?
I'm guessing without testing here. You're probably going to need some CPU cores and a good video card.
If you have the memory, use two MediaElement
s.
- Queue up both videos, one on each element.
- Set the opacity of the second one to completely transparent. They're
UIElements
so this should work... - Use timers of some kind keyed from the start of playback on the first one so that you get an event a couple of seconds before playback ends.
- With that event delegate, start the video in the second
MediaElement
, animate the first one's opacity to zero while simultaneously animating the second one to fully opaque. - If you need to do it again, set up the timer again and make sure your delegate animates things the other way.
精彩评论