Skip to main content
Home Forums Silverlight Programming Report a Silverlight Bug MediaElement BufferingProgressChanged gets stuck when connection is closed
1 replies. Latest Post by EricSmith on January 12, 2009.
(0)
EricSmith
Member
141 points
34 Posts
01-06-2009 7:33 PM |
I'm working on a Silverlight application for viewing live video. There are two scenarios for how the video makes it from the source (a desktop application) to the Silverlight player: (1) relaying through a media server and (2) connecting directly to a port opened by the desktop application.
The playback works fine in either case, but there seems to be a problem (Silverlight bug?) in scenario 2 when the desktop app closes the connection on which it had been streaming video.Scenario 1 has the expected behavior:
The unexpected behavior is:
I would have expected either a MediaEnded event or MediaFailed event.
I think I can work around the problem -- it is detectable by the repeated same value in BufferingProgressChanged, which the documentation says shouldn't happen -- but if I'm doing something fundamentally wrong I'd rather fix that. If it's a bug in Silverlight, hopefully Microsoft could fix it.
Thanks,
Eric
01-12-2009 6:45 PM |
I've been digging into this a bit more and have some updates.
The problem I'm having can be replicated with Windows Media Encoder and a simple Silverlight application using a MediaElement:
Is the issue that Silverlight can't tell the difference between an ended stream and network interruption, and that it will patiently wait forever for the stream to reappear? Does Windows Media Server do something different so that the player gets a MediaEnded event instead?
I also tried the above experiment with the video player on CodePlex and saw the same behavior. After letting things sit for a while in the buffering state, I started up the encoder again. The video player played a few new frames, stopped playing for a bit, played some video really fast and finally stopped playing again (though the elapsed time continued to tick).
This turns out to be harder than I expected to work around since contrary to the BufferingProgressChanged documentation that says "The event will occur when the BufferingProgress value increases by 0.05 or more, compared to the last time the event was raised, and also when the value reaches 1.0", the event is actually raised many times when BufferingProgress remains the same. Maybe this is a difference between live and progressive download?
Anybody have any advice on this? I discovered another thread about this; a timer would be an unfortunate workaround.