No Free Time

Because my therapist says I need to let things out

CurrentState Guesswork with Silverlight MediaElement

with 2 comments

The Silverlight MediaElement control has an event CurrentStateChanged. If you’re building a Silverlight app that makes use of video this is crucial to being able to implement state logic. You may want some other UI elements to wait until a video is ready to play before they do their thing, for instance. The idea is that you listen for the event and when it’s fire you check the _mediaElement.CurrentState property to see what state it’s in. CurrentState will be a value like Buffering, Paused, Stopped, Playing etc.

Well annoyingly the CurrentState value isn’t always what it should be. I’ve worked with MediaElement a lot over the last few months and I’ve noticed that when a video finishes buffering its state could be any one of

  • Stopped
  • Paused
  • Closed
  • Opening
  • Pondering
  • Being coy

I guess that external factors like browser cache, video format and progressive downloading might play a part but, come on, seriously, the runtime really should be providing the solutions or workarounds to these problems so that I don’t have to. In a lot of cases there simply is no workaround. Very aggravating indeed.

    Written by tad

    January 28th, 2010 at 5:45 am

    2 Responses to 'CurrentState Guesswork with Silverlight MediaElement'

    Subscribe to comments with RSS or TrackBack to 'CurrentState Guesswork with Silverlight MediaElement'.

    1. nice work. thanks

      Luci Nylund

      30 Jan 10 at 10:15 am

    2. [...] IronRuby, Exasp…Ben Hall on Cucumber, IronRuby, Exasp…Luci Nylund on CurrentState Guesswork with Si…Silverlight MediaEle… on Silverlight [...]

    Leave a Reply