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
And based on Rich S an extension can be implement
//don't forget
using System.Windows.Controls;
using System.Reflection;
public static class Util
{
public static MediaState GetMediaState(this MediaElement myMedia)
{
FieldInfo hlp = typeof(MediaElement).GetField("_helper", BindingFlags.NonPublic | BindingFlags.Instance);
object helperObject = hlp.GetValue(myMedia);
FieldInfo stateField = helperObject.GetType().GetField("_currentState", BindingFlags.NonPublic | BindingFlags.Instance);
MediaState state = (MediaState)stateField.GetValue(helperObject);
return state;
}
}