If you are having problems losing video....

May 6, 2011 at 2:12 AM
Edited May 6, 2011 at 2:12 AM

I was trying to get a playbackcontrol to work inside of a docking panel and anytime it docked. The video would be lost and you cannot reload either. And you can lose video in other situations also.

The problem is that Docking controls. (and most anything that manipulates the window) call "Unload" and then "Load" before and after docking. This is not a window destroy but just an event to tell you that the panel will be unavailable during this time.

What is happening is that in the file "MediaElementBase.cs" there is a default UnloadBehavior and it is set to "MediaState.Close" which totally cleans up the filtergraph (as it should in a close situation). this should be set to "MediaState.Pause" as the Load behavior will be "MediaState.Play" which should of seamlessly begun playing the video again.

It is a shame the author seems to have abandoned the project as no posts are ever answered which seems in years because there is just a few niggly bugs in it that when fixed make this into an extremely powerful DirectShow to WPF bridge, which was done masterfully.

What is not mentioned anywhere is that he included the ability to run standard PixelShaders on Directshow allowing anybody to process the video at GPU speed.
He fully implemented dependency property's on just about every important feature you need in DirectShow (all hookable by Xaml)
He fully used RoutedEvents for just about everything you need to grab from the various graphNotifyEvents (all hookable by Xaml).
He created a totally vector based DVR Control panel (with fairly fancy wpf behaviors) with dropshadows, basically the works all in Xaml.
He implemented a fully working Enhanced video renderer bridge to replace the VMR9 on Windows7/Vista. Which is huge because this is MediaFoundation.

Because of the way he implemented it it is 100% equivalent in functionality to the useless MediaElement. You can transform it,  Alpha channel it, overlay any wpf control on it.
And of course you can create any kind of DirectShow graph you want which is the whole reason to use this.

So he effectively restored the ability to use Directshow again in a WPF world.

pm me if your trying to fix up this library and want to trade some bug fixes for bug fixes :)