Can anyone confirm possible bug in Core Media Element when switching streams?

Apr 30, 2010 at 7:57 PM

I have what may be a bug in the Core Media Element when switching stream sources.

Take the following example:

  1. Set source to a Smooth Streaming manifest (e.g. SmoothStreamSource="url") and start playback.
  2. Within the context of a single method, call mediaElement.Stop(), then change the source to a classic Windows Media source (e.g. Source="mms://url..."), and start playback.
  3. Switch back and forth between these two sources.

What appears to happen is that the mediaElement.Stop() method is somehow asynchronous, and the "stop" may not happen until after the next source has started playback. As a result, you see a couple frames of the next source before the player stops/pauses. To make things more confusing it happens ~50% of the time, which is really making me think this is an async/timing issue.

The only workaround I have found to this issue is to create a DispatcherTimer that keeps polling the MediaElement's current playback state until it is stopped, and then loading the next media source.

Does anyone else see/confirm this behavior?

Apr 30, 2010 at 8:06 PM

I know there is a RetryTimer that is on the CoreSmoothStreamingMediaElement that tries to do some fancy tricks to get it to play something that may have failed. Like it has LastSmoothStreamingSource property for it's retries. This may be what is tripping it up. You may want to just do some lambda enclosures to wait on setting the next url until the Media has stopped/ended/failed.