Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

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...

10 Community Answers

bargainsbeyond

User  
0 rated :

http://www.bargainsbeyond.com is the url for the debug

Ethan Feldman

JW Player Support Agent  
0 rated :

It looks like there is an issue with the file you are loading – http://www.bargainsbeyond.com/intro.mp4

Please run it through this tool – http://renaun.com/blog/2010/06/qtindexswapper-2/

bargainsbeyond

User  
0 rated :

Ethan,

Thanks for your reply I downloaded the tool and ran it on the file but the output said: "ERROR: MOOV is in proper place, processing not needed."

I downloaded this video directly from youtube, so I'm guessing it may already be organized as the guy suggested on renaun.

Just to let you know I set the timer to 15000, since the video refreshed every 5 seconds without auto playing and it was sort of annoying.

Do you have any ideas why this video wont auto play when streaming is off?

Ethan Feldman

JW Player Support Agent  
0 rated :

Try to re encode with – http://handbrake.fr/

Use default settings + web optimized.

bargainsbeyond

User  
0 rated :

Ethan,

I downloaded handbrake and converted the intro.mp4 to intro2.mp4 with the settings you recommended. The results are the same however, the video downloads in the bar but does not automatically start. Do I need to remind the player to autoplay since the first instruction maybe was a closed argument in the streaming part of the code on lines 1-11?

Thanks so much for your help, I really appreciate your time.


Ethan Feldman

JW Player Support Agent  
0 rated :

That is odd, as our example autostarts…you can see that play() is called, which causes the player to play.

bargainsbeyond

User  
1 rated :

Yeah,

Very strange.. I decided to experiment with the code and discovered that this is making it autostart.

jwplayer().autoplay();
vs
jwplayer().play();

I'm blown away it worked. I'm going to experiment with the rest of the scenarios and let you know how those play out.

Ethan Feldman

JW Player Support Agent  
0 rated :

jwplayer().autoplay(); is not a valid api call, that makes no sense to me…but if this works for you, then that is great. Maybe you have your player autostarting, so calling play() again is actually just making it pause. I would just remove the play() line all together, that should probably do the trick.

bargainsbeyond

User  
0 rated :

Ethan,

Your right removal of the lines had the same effect, so the autoplay at the top was all that was necessary. I am going to the studio tomorrow to see how the videos play when the stream goes off air and starts up again.. I will let you know how it works as soon as possible. Thanks so much for your help so far. :)

Ethan Feldman

JW Player Support Agent  
0 rated :

Np :)

This question has received the maximum number of answers.