Order Now AdSolution Sign Up | Login » Bits on the Run Sign Up | Login »

Forums

/

Help with autostart on a ad

3 replies [Last post]
Reply

I made a script to autostart my ad when the page load:

function onAdSchedulingComplete(ads) {
if(ads.length > 0) {
jwplayer("mediaplayer_{{VAR:contentId}}").play();
}
else {
}
}

This works, but not the first time i enter the page, starts working after first refresh.
Does anyone know how to make it work, in the first load of the web ??

Reply

Interesting... do you have a URL where I can see this happening?

Paul

Reply

Just thinking aloud, but the player may still be locked when that first onAdSchedulingComplete() is called - so your "play()" may not be doing anything.. it's just a guess.

Have you tried listening to the player "onReady" event to see if it can be used to start playback first time around?

e.g:

jwplayer("mediaplayer_{{VAR:contentId}}").onReady(function() {
     jwplayer("mediaplayer_{{VAR:contentId}}").play();
});

Just a thought...

More info here:

http://www.longtailvideo.com/support/jw-player/jw-player-for-flash-v5/12540/javascript-api-reference

Paul

Reply

i am working locally, so i dont have an url to show you =(
i am trying to put the function onAdSchedulingComplete(ads) call after the jwplayer.setup()... but i dont seems to make any difference its hard to tell when cache is involved. Any ideas?

Post new comment

  • Allowed HTML tags: <code> <blockquote> <em> <strong> <strike> <ul> <li> <ol>
  • You may post code using <code>...</code> .
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options