minznerjosh / vast-player

Playback VAST creatives in a web browser.
MIT License
45 stars 32 forks source link

Support for Companion Ads. #17

Open rohanraj7316 opened 5 years ago

rohanraj7316 commented 5 years ago

hello, I have been trying to implement Companion Ads. but I am unable to figure out provisions to implement Companion Ads. Could you guide me regarding the implementation of "Companion Ads" present in VAST? @minznerjosh

minznerjosh commented 5 years ago

You should be able to access the vast property of your VASTPlayer to access the companion ad:

const player = new VASTPlayer({/* opts here */});

player.load('/some/vast/url').then(() => {
  const companions = player.vast.find('ads[0].creatives', creative => (
    creative.type === 'companions'
  ));
  companions.forEach(companion => {
    // do stuff to render companions
  });
});

I'd also be open to a PR that adds companion support directly to the library, if you're interested in implementing that!

rohanraj7316 commented 5 years ago

@minznerjosh can we have another div where we should inject the companion banner !! how do you prefer to proceed?

minznerjosh commented 5 years ago

Does this library need to provide a div? You could just use your own, right?

rohanraj7316 commented 5 years ago

i can write the implementation for the companion banners. but i can't decide the positioning of the banners. for that library need to provide the div.