hey there i have a streaming video feed that i need help with..

every half an hour or so the video disconnects and we don't know why..

i need to make a script that listens to the video and if there is any disconnection/error it will make the video reconnect..

i have managed to build a script that refreshes the page when the video has an error,

but now i cant have the webpage reload because it interupts the current feed..

what i'm looking for is a solution that keeps the page the same but will reconnect the video if it becomes Idle or there is an error with it..

it would be helpful if this script could run and no interference with the video is made.. ie when we view the video full screen, it must stay full screen even when script is running..

any help would be greatly appreciated kind regards

ps

here is the script i have made so far..



<script type="text/javascript">

var player,video, content, exp;

function onTemplateLoaded(pPlayer)
{
player = bcPlayer.getPlayer(pPlayer);
video = player.getModule(APIModules.VIDEO_PLAYER);
content = player.getModule(APIModules.CONTENT);
exp = player.getModule(APIModules.EXPERIENCE);
exp.addEventListener(BCExperienceEvent.TEMPLATE_READY, onTemplateReady);
video.addEventListener(BCMediaEvent.PROGRESS, onProgress);
video.addEventListener(BCMediaEvent.COMPLETE, onVideoComplete);
}

//Works for non-DVR,DVR LIVE Video


function onTemplateReady(e)
{
video.addEventListener("mediaError", onVideoError);
}

//Works for non-DVR, DVR LIVE Video
function onVideoError(e)
{
var img = document.createElement("IMG");
img.src = "images/pleaseStandBy1.png";
var live_div= document.getElementById("live_video_div");
while (live_div.hasChildNodes()) {
live_div.removeChild(live_div.lastChild);
location.reload();
}
document.getElementById("live_video_div").appendChild(img);
}



//Works for non-DVR, DVR LIVE Video
function onTemplateError(event)
{
log("type: " + event.type);
log("errorType: " + event.errorType)
}

function onProgress(e)
{
log("position = "+e.position+" || is LIVE = " +video.mediaIsLive()+" || is PLAYING = " +video.isPlaying());
}

</script>


</head>

<body>



<div id="live_video_div">


<object id="myExperience2176497899001" class="BrightcoveExperience">
<param name="bgcolor" value="#FFFFFF" />
<param name="width" value="480" />
<param name="height" value="270" />
<param name="playerID" value="1847432356001" />
<param name="playerKey" value="AQ~~,AAAAksdab5E~,uSnu82XezIZ7ueRQ1JqfT4-A0whaLgE3" />
<param name="isVid" value="true" />
<param name="isUI" value="true" />
<param name="dynamicStreaming" value="true" />
<param name="autoStart" value ="true"/>
<param name="@videoPlayer" value="2176497899001" />
<!-- <param name="templateErrorHandler" value="onTemplateError"/>-->


<param name="showNoContentMessage" value ="true"/>
</object>
<script type="text/javascript">brightcove.createExperiences();</script>

</div>

</body>
</html>