JW 6 Player Live Stream Time Out Algorithm

Follow

For JW 6 users who have bandwidth limitations or if using Teredak cube and bond where publishing stream may time out. This player will seek stream until publishing stream is re-enabled.

You are on cellular networks and the bandwidth fluctuates. 

 

<!DOCTYPE html>

<html>
<head>
<title>Channel Test Wowza DIRECT</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<script src="http://jwpsrv.com/library/YOURPLAYERJW6ID.js"></script>

<script type="text/javascript">
var file = "http://rtmpid.live.cloud.influxis.com/rtmpid/live/playlist.m3u8";
if ((navigator.userAgent.indexOf('Android 4') != -1) ||
(navigator.userAgent.indexOf('Android 4') != -1)) {


document.write("<video width= '");
document.write( 900 + "'")
document.write("height='");
document.write( 600 + "'");
document.write("poster preload='true' controls>");
document.write("<source src=" + file + ">");
}
</script>
<script type="text/javascript">

if ((navigator.userAgent.indexOf('Android 2') != -1) ||
(navigator.userAgent.indexOf('BlackBerry') != -1) ||
(navigator.userAgent.indexOf('Android 3') != -1)) {

window.location = = "rtsp://rtmpid.live.cloud.influxis.com/wxefw5/live";
</script>

</head>

<body>
<center>
<div id='my-video'></div>
<script type='text/javascript'>
var chkBand = ""; bwRead = ""; isRunning = false;

jwplayer('my-video').setup({
playlist: [{
image: "http://YOURIMAGEPATH",
sources: [{
file: "rtmp://RTMPID.live.cloud.influxis.com/RTMPID/_definst_/STREAMNAME",
},{
file: "http://RTMPID.live.cloud.influxis.com:1935/RTMPID/_definst_/STREAMNAME/playlist.m3u8"
}]
}],
height: "100%",
width:"100%",
'controls': 'true',
'title': 'Please Stand By...',
autostart: 'false',
repeat: 'false',
events: {
onError: function(event) {
jwplayer('my-video').stop();
clearInterval(bwRead); isRunning = false;
document.getElementById('bwStat').innerHTML = '';

setTimeout(reconnect, 3000);
},
onPlay: function(v) {
if (!isRunning) {
bwRead = setInterval(function(){sTimer()},1000);
isRunning = true;
}
},
onMeta: function(e) {
if(e.metadata.bandwidth) {
var htmlx = e.metadata.bandwidth;
if (parseInt(htmlx) > 10) {
chkBand = "Bandwidth: " + htmlx + " Kbps";
} else {
chkBand = ""; clearInterval(bwRead);
}
}
},
onReady: function(event) {
jwplayer('my-video').play();
}
}
});

jwplayer().setVolume(75);
//jwplayer().addButton("http://YOURIMAGEPATH", "New", goLink, "TEST);

function sTimer() {
document.getElementById('bwStat').innerHTML = chkBand;
}

function reconnect() {
jwplayer('my-video').play();
}

</script>

<div id="bwStat"></div>

</center>
</body>

</html>

Have more questions? Submit a request

Comments

Powered by Zendesk