MailOnline / videojs-vast-vpaid

video.js vast plugin
MIT License
296 stars 231 forks source link

Multiple pre rolls #174

Open ntamblyn opened 8 years ago

ntamblyn commented 8 years ago

is it possible to serve multiple pre rolls with this plugin either from the same VAST file or different VAST sources?

if so do you have an example?

egick666 commented 8 years ago

Have the same question!

I've two different ad platforms (ad sources) and want to play 2 pre-rolls from them consecutive. Can I point to vast plugin smthg like that: ... "vastClient": { "adTagUrl": "http://ad_server_1/path_to_creative", "adTagUrl": "http://ad_server_2/path_to_creative", "adCancelTimeout": 5000, "adsEnabled": true } ...

And ads should play in such sequence: first plays ad from "ad_server_1" and then "ad_server_2"

ntamblyn commented 8 years ago

@egick666 I have gone down the route of using this https://github.com/googleads/videojs-ima , and using a VMAP file to wrap my ads. This is serving ads that are hosted on my S3 bucket , and also from google DFP.

Hope this helps

egick666 commented 8 years ago

@ntamblyn Thanks for your tip.

Could you please share me some examples of using this plugin with several ad engines/sources? I'm also not so good with VMAP, that's why it would be better to look at complete example of using. Thanks in advance!

ntamblyn commented 8 years ago

@egick666 sure here are a few examples.

This first one makes use of DFP then serving an ad from my S3 bucket.

<?xml version="1.0" encoding="UTF-8"?>
<vmap:VMAP xmlns:vmap="http://www.iab.net/videosuite/vmap" version="1.0">
 <vmap:AdBreak timeOffset="start" breakType="linear" breakId="preroll">
  <vmap:AdSource id="preroll-ad-1" allowMultipleAds="false" followRedirects="true">
   <vmap:AdTagURI templateType="vast3"><![CDATA[url goes here to VAST file]]></vmap:AdTagURI>
  </vmap:AdSource>
 </vmap:AdBreak>
 <vmap:AdBreak timeOffset="start" breakType="linear" breakId="preroll">
  <vmap:AdSource id="preroll-post-bumper" allowMultipleAds="false" followRedirects="true">
   <vmap:AdTagURI templateType="vast3"><![CDATA[URL here to vast file]]></vmap:AdTagURI>
  </vmap:AdSource>
  <vmap:Extensions>
   <vmap:Extension type="bumper" suppress_bumper="true"></vmap:Extension>
  </vmap:Extensions>
 </vmap:AdBreak>
</vmap:VMAP>

The example above will play preroll-ad-1 first then will follow up with preroll-post-bumper. Exactly what you want to do.

This is an example of the VAST file i am using to server the ads from my S3 Bucket.

<?xml version="1.0" encoding="UTF-8"?>
<VAST version="2.0">
   <Ad id="preroll-1">
      <InLine>
         <AdSystem>2.0</AdSystem>
         <AdTitle>5748406</AdTitle>
         <Error />
         <Impression id="itv"><![CDATA[/pixel.gif]]></Impression>
         <Creatives>
            <Creative>
               <Linear>
                  <Duration>00:00:20</Duration>
                  <TrackingEvents>
                     <Tracking event="start"><![CDATA[/pixel.gif]]></Tracking>
                     <Tracking event="midpoint"><![CDATA[/pixel.gif]]></Tracking>
                     <Tracking event="complete"><![CDATA[/pixel.gif]]></Tracking>
                     <Tracking event="complete"><![CDATA[/pixel.gif]]></Tracking>
                     <Tracking event="complete"><![CDATA[/pixel.gif]]></Tracking>
                     <Tracking event="fullscreen"><![CDATA[/pixel.gif]]></Tracking>
                  </TrackingEvents>
                  <VideoClicks>
                     <ClickThrough id="redirect"><![CDATA[click through link here]]></ClickThrough>
                  </VideoClicks>
                  <MediaFiles>
                     <MediaFile height="396" width="600" bitrate="496" type="video/mp4">
                     <![CDATA[url to media file]]>
                     </MediaFile>
                  </MediaFiles>
               </Linear>
            </Creative>
         </Creatives>
      </InLine>
   </Ad>
</VAST>

VMAP example of just one preroll

<?xml version="1.0" encoding="UTF-8"?>
<vmap:VMAP xmlns:vmap="http://www.iab.net/videosuite/vmap" version="1.0">
 <vmap:AdBreak timeOffset="start" breakType="linear" breakId="preroll">
  <vmap:AdSource id="preroll-ad-1" allowMultipleAds="false" followRedirects="true">
   <vmap:AdTagURI templateType="vast3"><![CDATA[google dfp url here]]></vmap:AdTagURI>
  </vmap:AdSource>
 </vmap:AdBreak>
</vmap:VMAP>

Using the VMAP File you can also schedule mid rolls and post rolls as well.

Example with two prerolls & midroll 11 seconds into video.

<?xml version="1.0" encoding="UTF-8"?>
<vmap:VMAP xmlns:vmap="http://www.iab.net/videosuite/vmap" version="1.0">
 <vmap:AdBreak timeOffset="start" breakType="linear" breakId="preroll">
  <vmap:AdSource id="preroll-ad-1" allowMultipleAds="false" followRedirects="true">
   <vmap:AdTagURI templateType="vast3"><![CDATA[url here]]></vmap:AdTagURI>
  </vmap:AdSource>
 </vmap:AdBreak>
 <vmap:AdBreak timeOffset="start" breakType="linear" breakId="preroll">
  <vmap:AdSource id="preroll-post-bumper" allowMultipleAds="false" followRedirects="true">
   <vmap:AdTagURI templateType="vast3"><![CDATA[url here]]></vmap:AdTagURI>
  </vmap:AdSource>
  <vmap:Extensions>
   <vmap:Extension type="bumper" suppress_bumper="true"></vmap:Extension>
  </vmap:Extensions>
 </vmap:AdBreak>
 <vmap:AdBreak breakType="linear" breakId="mymid2" timeOffset="00:00:11.2">
    <vmap:AdSource allowMultipleAds="true" followRedirects="true" id="3">
        <vmap:AdTagURI templateType="vast3">
            <![CDATA[url here]]>
        </vmap:AdTagURI>
    </vmap:AdSource>
    <vmap:Extensions>
        <vmap:Extension type="application/xml"><psns:PlayPolicy deleteAfterPlayed="true"/></vmap:Extension>
    </vmap:Extensions>
</vmap:AdBreak>
</vmap:VMAP>

Not sure if this is the best way to do it, but this is how i am doing it as it works :)

egick666 commented 8 years ago

@ntamblyn Thank you so much! I'll try such approach and this should help!