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

Forums

/

AutoStart an ad and then stop

21 replies [Last post]
Reply

Hello, i am new to this, i have a question about autoplay or playonce in ova configuration file (xml).
I need the player to strat when someone enters the page, showing the pre-roll ad, and then stop.
I dont want to autostart the video after the ad is showed.
How do i do that?

Reply

Hi Christian,

That's a little tricky.. it's a nice scenario though.

By default, "autostart" with the JW Player options, or "autoPlay" as an OVA option means that playback will continue to the stream after the pre-roll.

So, the question is - are we able to work around that in some way to force the player to "stop" once the ad has complete.

It may be possible using the OVA Javascript callbacks.

What I think you could try to do is listen for the "onLinearAdFinish(ad)" callback from OVA and then go "jwplayer("container").stop()" to force the player to stop.

To use the "onLinearAdFinish(ad)" callback, you need to be running at least OVA RC5 (from the OVA Developer Site at http://developer.longtailvideo.com/ova - register on there and grab the RC5 SWF from the "Download the Latest" page).

Here's an example of the Javascript callbacks in action - this may help give you some guidance...

http://static.openvideoads.org/qa/rc6-13/ova.jwplayer.5x/examples/pages/javascript/example1.02.html

I'm not 100% sure that the approach will work, but I'm pretty sure it's worth a go...

Hope this helps,

Paul

Reply

PS: Check out section 17 in the RC5 for more information on the OVA Javascript callbacks:

http://developer.longtailvideo.com/ova/wiki/OvaReleaseNote-0.5.0-RC5

Paul

Reply

Hi, oh actually, I just thought of another way you could do this...

Use the JW Player Javascript events (onComplete) to listen for the end of the ad stream and then trigger a player.stop() Javascript call.

That's also feasible...

See this doc for more info on the JW Player Javascript events:

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

Paul

Reply

Thank you for the answers i will try it, i have another question about this, if i do what you told me, what will happend the next time i click on play on the player?
I only want to do that the first time, i you hav already entered the page and the pre roll has stoped, the next time you press play it should run the ad and then the video, or the video only.

( sorry for my english )

Reply

Hi,

You'll have to put some logic into the Javascript code that you right so that you only stop() the player once.. it's pretty easy to do - just set a variable like "firstTime=true" so that the next time it happens, you can test if it's already been done... ;)

Paul

Reply

i had put this code into jwplayer javascript call but it doesnt work
the video starts anyway.

events: {
onPlay: function() {
},
onComplete: function() {
stop();
}
}

i hav tryied to use, jwplayer.stop(); , player().stop(); and stop(), and couldnt made it work,
Do you hav and idea why??

THANK YOU FOR YOUR HELP, really i am lost :P

Reply

Hi,

here you go - I've written the code for you (you can see this running here:

http://static.openvideoads.org/support/christian-frigo/events/jwplayer.html

...
<script type="text/javascript" src="http://static.openvideoads.org/qa/latest/ova.jwplayer.5x/dist/js/jwplayer-5.7.js"></script>

<div id="container">Loading the player ...</div>

<script type="text/javascript">
var _firstCompleteEvent = true;

jwplayer("container").setup({
'flashplayer': "http://static.openvideoads.org/qa/latest/ova.jwplayer.5x/dist/swf/5.7.swf",
'width': 480,
'height': 360,
'controlbar.position': 'bottom',
'file': 'http://streaming.openvideoads.org:81/shows/the-black-hole.mp4',
'duration': 60,
'plugins': {
    'http://static.openvideoads.org/qa/latest/ova.jwplayer.5x/dist/swf/ova-jw.swf': {
        "debug": { "levels": "fatal, config, vast_template, http_calls" },
        "ads": {
            "schedule": [
               {
                  "position": "pre-roll",
                  "tag": "put-your-ad-tag-here"
               }
            ]
        }
    }
}
});

jwplayer("container").onComplete(
   function() {
       if(_firstCompleteEvent) {
           jwplayer("container").stop();
       }
       _firstCompleteEvent = false;
   }
);
</script>
...

Hope this helps,

Paul

Reply

Thanks this worked lovely,
only one final question http://static.openvideoads.org/qa/latest/ova.jwplayer.5x/dist/swf/ova-jw.swf' can i download this plugin?, cause i want to have it local by petition of a client, do i have to purchase it ?, i have purchased the jwplayer, but i dont find this plugin in the folders.

Thank You!

Reply

Another problem that i want to fix, dont know if it is possible, is when the adserver dont return an ad and the video main video starts on his own, is there any way to see if the ad server returns null, and dont autostart any video at all?

Reply

Also i discovered that when i use ova plugin, in js call plugins, other plugin that i have been using doesnt work (share.js), for example to share in facebook the url forms this way "http://www.facebook.com/sharer/sharer.php?u=Not%20available" when i remove ova from plugins it works fine.

Reply

Hi Christian,

On the ad server returning no ad question - sure, that's easy. Just use the OVA Javascript callbacks to see if OVA got an ad from the ad server.

The ones of interest are:

onAdSchedulingStarted()
onLinearAdScheduled(ad:Object)
onNonLinearAdScheduled(ad:Object)
onCompanionAdScheduled(divSpecification:Object, companionAd:Object, parentAd:Object)
onAdSchedulingComplete(ads:Array)

See section 17 of the RC5 release note:

http://developer.longtailvideo.com/ova/wiki/OvaReleaseNote-0.5.0-RC5

And there is an example of those Javascript callbacks in action here:

http://static.openvideoads.org/qa/rc6-13/ova.jwplayer.5x/examples/pages/javascript/example1.01.00.ht...

Paul

Reply

Hi Christian,

On the question about getting the plugin and storing it locally, sure - download it from the OVA Developer Site (http://developer.longtailvideo.com/ova) - register on the site and then grab the RC5 or RC6 development SWF from the "Download the Latest" page.

It's important to grab your own copy at the moment because the QA server URLs will come and go as we update the QA releases. They are only temporarily URLs.

If you run OVA on a commercial site, you need to purchase a specific (and separate) OVA license via this URL:

http://www.longtailvideo.com/order/promo?id=229

All the best,

Paul

Reply

How can i add OVA Javascript callbacks, to the code you gave me, and make it work, like i want?

Reply

About the license they told me they already purchase it with the "ova.jwplayer.5x" pack, but the ova.swf that comes in the pack doesnt work. I am using the one you told me to grab from download pages, swf-jw.swf, are we having any problem with license, what should we do?

Reply

Hey Christian, if you've bought an OVA license, then don't worry about any licensing issues with the ova-jw.swf from the OVA developer site.

The version of the OVA SWF on the OVA Developer Site will be the production version the first week of February. It will replace the one in the download pack once it's officially released.

So, in short - if you've purchased a license for OVA then go ahead and use the "ova-jw.swf" version from the OVA Developer Site instead of the version you got when you purchased the license.

If you have any issues at all, please email us via "enquiries@openvideoads.org" and we'll sort it out...

Paul

Reply

PS: Regarding implementing the OVA Javascript callbacks, to understand how to implement the OVA Javascript callbacks the best thing to do is to take a look at the page source code of the following example:

http://static.openvideoads.org/qa/rc6-13/ova.jwplayer.5x/examples/pages/javascript/example1.01.00.ht...

That example shows you each of the ad scheduling calls and roughly how they can be used to check for the existence of ads...

Paul

Reply

Great, thank you for all your support, i have another technical question, How can i add OVA Javascript callbacks, to the code you gave me, and make it work, like i want?, i mean the code you gave me on friday, that work perfectly, i only want to add a OVA javascript callbak to that code beacause when the adserver donesnt return an ad the main video starts on his own. i Dont wnat this to happend, if the ad servers doesnt return an ad it shoul not start autoplaying.

I dont know how to make this happend, can you help me ?

Reply

Hi,

Here's the code you want:

<script type="text/javascript">
var _firstCompleteEvent = true;

function onAdSchedulingComplete(ads) {
    if(ads.length > 0) {
         // We have ads, so do nothing
    }
    else {
         // Put your code in here to do whatever you need to do if there aren't any ads
    }
}

jwplayer("container").setup({
....

Paul

Reply

// Put your code in here to do whatever you need to do if there aren't any ads.

I dont know what to put in this part, i just want to not autoplay if doesnt found any ads.

plugins: {
'/static/{{VAR:paquete}}/swf/jwplayer/ova-jw.swf': {
"autoPlay": true,
"playOnce": true,
"debug": { "levels": "none" },
"ads": {
"schedule": [
{
"position": "pre-roll",
"notice": {
"show": true,
"message": "Este anuncio terminara en: _countdown_ segundos"
},

"tag": "http://localhost/prueba/prueba.xml"
}
]
}
}
},

i guess i have to disable autoplay or playonce, cause is making the main video start if it doesnt found an ad.

Reply

I tried this :
function onAdSchedulingComplete(ads) {
if(ads.length > 0) {
var AutoPlaySwitch = true;
}
else {
var AutoPlaySwitch = false;
}
}

and then on the jwplayersetup:

plugins: {
'/static/{{VAR:paquete}}/swf/jwplayer/ova-jw.swf': {
"autoPlay": AutoPlaySwitch,
"playOnce": AutoPlaySwitch,
"debug": { "levels": "none" },
"ads": {
"schedule": [

But it seems that doesnt read the var in time cause the jwplayer doenst appear at all.
Any Ideas?

Reply

Paul Thanks for everything i figured it out,
I just deleted the AutoPlay:true and PlayOnce:true in jwplayer setup, and and wrote this in ova call :

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

So if it find an Ad, it will start Playing if it not, i will do nothing.

:D

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