
Autoplay Video when Live Stream is offline
Hello,
I have found a few resources and had help from Ethan on stackoverflow for some issues we were having with our stream. I have embedded the following code. I'm having problems with the way it functions in the following scenarios.
1.) When I visit the website (with live stream off) the mp4 video container refreshes over and over every 5 seconds and does not Autostart, to stop the refresh I have to hit play.
2.) When the Stream is live and I visit the website, and I turn the stream off during the visit, the mp4 video doesn't automatically load, I have to refresh the entire page.
3.) When the mp4 file is playing and I start the stream it doesn't interrupt and turn on but starts at the end of the video play, which is okay but it sure would be nice to interrupt the mp4 when the feed goes live (Like Ustream does)
<script src="http://wpc.E74E.edgecastcdn.net/28DJ2/jwplayer.js"></script>
<script type='text/javascript'>
jwplayer('playerjxUzssOPVgxA').setup({
file: 'rtmp://fml.E74E.edgecastcdn.net/28DJ23/mySteam',
image: 'http://www.longtailvideo.com/content/images/jw-player/lWMJeVvV-876.jpg',
width: '635',
height: '360',
autostart: 'true',
primary: 'html5',
rtmp: { subscribe: true }
});
jwplayer().onError(function(){
jwplayer().load({file:"http://www.domain.com/intro.mp4"});
jwplayer().play();
});
jwplayer().onComplete(function(){
window.location = window.location.href;
});
jwplayer().onBuffer(function(){
theTimeout = setTimeout(function(){
jwplayer().load({file:"http://www.domain.com/intro.mp4"});
jwplayer().play();
},5000);
});
jwplayer().onPlay(function(){
clearTimeout(theTimeout);
});
I'm thinking there is some switches we can enter and maybe some customized source. Any help is greatly appreciated. Thanks so much for your time...