Skip to content

Commit

Permalink
Initial commit for video support for pbs (prebid#1706)
Browse files Browse the repository at this point in the history
* initial commit for video support for pbs

* Don't mutate bidRequest
  • Loading branch information
Matt Kendall authored and mattpr committed Oct 31, 2017
1 parent e9bc7cc commit 7f68db9
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions modules/prebidServerBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,16 @@ function PrebidServer() {
/* Prebid executes this function when the page asks to send out bid requests */
baseAdapter.callBids = function(bidRequest) {
const isDebug = !!getConfig('debug');
convertTypes(bidRequest.ad_units);
const adUnits = utils.cloneJson(bidRequest.ad_units);
adUnits.forEach(adUnit => {
let videoMediaType = utils.deepAccess(adUnit, 'mediaTypes.video');
if (videoMediaType) {
// pbs expects a ad_unit.video attribute if the imp is video
adUnit.video = Object.assign({}, videoMediaType);
delete adUnit.mediaTypes.video;
}
})
convertTypes(adUnits);
let requestJson = {
account_id: config.accountId,
tid: bidRequest.tid,
Expand All @@ -114,7 +123,7 @@ function PrebidServer() {
secure: config.secure,
url: utils.getTopWindowUrl(),
prebid_version: '$prebid.version$',
ad_units: bidRequest.ad_units.filter(hasSizes),
ad_units: adUnits.filter(hasSizes),
is_debug: isDebug
};

Expand Down

0 comments on commit 7f68db9

Please sign in to comment.