Forcing the embedded player to reconnect when an error occurs
In the next few posts, I am going to discuss high availability scenarios for times when you absolutely must deliver your video.
For today's post, I'm going to talk about how to have an embedded version of WMP reconnect to the stream if there is an error. This is useful in the instances where you have a live stream and want the player to reconnect to the stream if there is an error. Here is the sample:
<OBJECT ID="MPlayer" height="310" width="320" CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6">
<PARAM NAME="URL" VALUE="mms://mediaserver/live">
I tried to keep this extremely simple, but whenever you're doing scripting for events for browsers there are always platform and versioning issues. Essentially we are just using the OBJECT tag to embed the WMP control. I pointed the URL to a live stream on a WMS server. I then created a script to listen for the error event on player object. In this example I don't check to see what the error is, I just tell the player to play. The assumption I am making is that maybe there was a temporary network error and I am just telling the player to reconnect.