MediaUriElement.Play() doing nothing

Sep 8, 2010 at 10:36 PM

I'm programmatically creating a MediaUriElement on a WPF form but when I call Play, while it looks like IsPlaying flag is set, I see and hear nothing other than a black rectangle where the control is.  If I use a standard MediaElement control it works fine and when I've used MediaUriElement on a different PC it has worked fine too.  There are no exceptions or errors being thrown that I can see so I'm a bit stumped.  Can you think of any reasons for this behaviour?

Coordinator
Sep 9, 2010 at 11:27 PM
I would use the MediaKit build from the source control.  Make sure to do player.BeginInit() before setting anything, then do a player.EndInit afterwards.

Here is how it would be done with the DvdPlayerElement:
var player = new DvdPlayerElement();
player.BeginInit();
player.PlayOnInsert = true;
player.DvdDirectory = new Uri(@"d:\VIDEO_TS");
player.EndInit();
panel.Children.Add(player);

-Jer
Sep 10, 2010 at 9:17 AM

Thanks, it's definitely doing something now and I am now getting errors I can work with :)

I'm a little confused as to why I didn't need to use BeginInit/EndInit on 1 environment and the other I did though.