Skip to content

Commit

Permalink
remove VIDEO_ORTB_PARAMS, BANNER_ORTB_PARAMS
Browse files Browse the repository at this point in the history
  • Loading branch information
changjun committed Oct 18, 2023
1 parent 8bf7567 commit 2699115
Showing 1 changed file with 18 additions and 31 deletions.
49 changes: 18 additions & 31 deletions modules/tpmnBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,6 @@ const SUPPORTED_AD_TYPES = [BANNER, VIDEO];
// const BIDDER_ENDPOINT_URL = 'http://localhost:8081/ortb/pbjs_bidder';
const BIDDER_ENDPOINT_URL = 'https://gat.tpmn.io/ortb/pbjs_bidder';
const IFRAMESYNC = 'https://gat.tpmn.io/sync/iframe';
const VIDEO_ORTB_PARAMS = [
'mimes',
'minduration',
'maxduration',
'placement',
'protocols',
'startdelay',
'skip',
'skipafter',
'minbitrate',
'maxbitrate',
'delivery',
'playbackmethod',
'api',
'linearity',
'battr',
'plcmt'
];
const BANNER_ORTB_PARAMS = [
'battr'
];

export const VIDEO_RENDERER_URL = 'https://acdn.adnxs.com/video/outstream/ANOutstreamVideo.js';
export const ADAPTER_VERSION = '2.0';
Expand Down Expand Up @@ -183,6 +162,18 @@ const CONVERTER = ortbConverter({
}
}
return bidResponse;
},
overrides: {
imp: {
video(orig, imp, bidRequest, context) {
let videoParams = bidRequest.mediaTypes[VIDEO];
if (videoParams) {
videoParams = Object.assign({}, videoParams, bidRequest.params.video);
bidRequest = {...bidRequest, mediaTypes: {[VIDEO]: videoParams}}
}
orig(imp, bidRequest, context);
}
}
}
});

Expand Down Expand Up @@ -253,11 +244,9 @@ function buildVideoImp(bidRequest, imp) {
utils.deepSetValue(imp, 'video.h', videoSizes[0][1]);
}

VIDEO_ORTB_PARAMS.forEach((param) => {
if (videoParams.hasOwnProperty(param)) {
utils.deepSetValue(imp, `video.${param}`, videoParams[param]);
}
});
if (videoParams.hasOwnProperty('battr')) {
utils.deepSetValue(imp, `video.battr`, videoParams['battr']);
}

if (imp.video && videoParams?.context === 'instream') {
imp.video.placement = imp.video.placement || 1;
Expand Down Expand Up @@ -286,11 +275,9 @@ function buildBannerImp(bidRequest, imp) {
utils.deepSetValue(imp, 'banner.h', sizes[0][1]);
}

BANNER_ORTB_PARAMS.forEach((param) => {
if (bannerParams.hasOwnProperty(param)) {
utils.deepSetValue(imp, `banner.${param}`, bannerParams[param]);
}
});
if (bannerParams.hasOwnProperty('battr')) {
utils.deepSetValue(imp, `banner.battr`, bannerParams['battr']);
}

return { ...imp };
}
Expand Down

0 comments on commit 2699115

Please sign in to comment.