Powered by MSDN

US - English
NEW! Silverlight 5 is available Learn More

Detecting termination of streamed media RSS

2 replies

Last post Dec 04, 2008 09:33 PM by chandler.chao

(0)
  • card

    card

    Member

    1 Points

    3 Posts

    Detecting termination of streamed media

    Nov 25, 2008 06:47 PM | LINK

    I have a MediaElement playing back a wmv that is being streamed live.  However, when I stop the stream, the MediaElement goes into a Buffering state and never recovers, and stays this way rather than raising a MediaFailed event or anything similar.

     Is there a way to detect when a media stream has been killed by checking for any particular sequence of events? I've looked again and again at MediaElement.CurrentState and all the events that could be possibly raised, and all I get back when a stream is killed is the same unending set of buffering events in a vain attempt to continue playing a video that no longer exists.

     I'd rather avoid using a timeout or polling the server to check if a stream still exists; could anyone suggest a "clean" way of finding out if the stream's been killed?  Thanks so much in advance.

  • trent@zampit.com

    trent@zampit...

    Member

    2 Points

    4 Posts

    Re: Detecting termination of streamed media

    Nov 27, 2008 03:52 PM | LINK

    We got the same issue.. we would love to know the answer to this question as well.

  • chandler.chao

    chandler.chao

    Member

    307 Points

    87 Posts

    Re: Detecting termination of streamed media

    Dec 04, 2008 09:33 PM | LINK

    Apprently this is a known issue with Silverlight as I hear through my contacts.  What I've done to solve this is the following.  When the mediaElement enters the buffering state kick off a timer and record the current bufferingProgress.  When that timer ticks (perhaps 20s later), if the bufferingProgress has not changed then consider the live stream to have ended and act accordingly.  You are assuming that within that time period of course that a true buffering stream's bufferingProgress has changed even a hair so it won't be considered ended instead of truly buffering.

    Chandler Chao
    iStreamPlanet