How do I determine if MediaElement is playing?

Brian picture Brian · Dec 2, 2010 · Viewed 22.6k times · Source

Seems simple enough, but I cannot figure out any way to determine what the state of a MediaElement is. There are various properties for some states (such as IsBuffering) but I can't find any for states such as Play, Pause, etc. Silverlight seems to have a CurrentState property that shows all these.

Currently the way I'm determining whether a video is supposed to be playing is watching for various events and a timer that checks to see if any progress is being made.

I'm new to MediaElement and WPF (I'm actually only using MediaElement in a WinForms app). Is there something I am missing?

Answer

PeterL picture PeterL · Dec 3, 2010

You aren't missing anything. You pretty much have to manually keep track of whether or not the media is playing. It's a pity, since it is so easy in Silverlight, as you mention. Seems like a major oversight to me.