Hey there i am busy trying to find a way of solving this problem i am having with a Live streaming video..
What happens is after about half an hour or even longer etc the video stream disconnects/ loses connection..
i have tried to build a script that listens for an error and when there is an error reloads the video..
i have got this to work but now i need to make sure that the actual page does not refresh but rather the video element itself ie object reconnects..
the streaming video is viewed mostly in full screen and with my script when it jams it reloads back to normal size video , no fullscreen..
what is needed is that the video can stay its full screen state without any interuptions..
it is a Tv channel stream this is why..
Is it possible to create a function that listens for any error in the video connection and when there is a disconnection,
can the script reestablish the connection without a page reload..
i was thinking maybe onIdle etc..
Any help would be much appreciated..
here is the script i have tried so far..
Note: the OnVideoError is what i am using so far..
///////
<html>
<head>
<script type=”text/javascript” src=”
<script type=”text/javascript” src=”
<script type=”text/javascript”>
//********************LOGGER BLOCK – Do not touch this
function newLog()
{
document.getElementById(“logger”).value = “”;
}
function log(message)
{
// check to see if the message is complex data and decompose if so
if (typeof message == “object”)
{
for (var prop in message)
{
if (typeof message[prop] == “object”)
{
log(prop+”: “);
log(message[prop]);
}
else
{
log(prop+”: “+message[prop]);
}
}
}
}
//********************LOGGER BLOCK ENDS
//********************Javascript BLOCK for Player APIS – Works for non-DVR Content and DVR content
//FOR DVR content you will have to listen for isLive() which gives out false when the on-demand video begins to play
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());
}
//******************** JS BLOCK ENDS
</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>
<!– Begin Script Logger –>
<textarea style=”display:none;” id=”logger” name=”logger” rows=”12″ cols=”150″></textarea>
<!– End Debugging Helper –>
</body>
</html>