From 2699115a76ed891ec7f911ad924206b399790ad9 Mon Sep 17 00:00:00 2001 From: changjun Date: Wed, 18 Oct 2023 14:27:18 +0900 Subject: [PATCH] remove VIDEO_ORTB_PARAMS, BANNER_ORTB_PARAMS --- modules/tpmnBidAdapter.js | 49 ++++++++++++++------------------------- 1 file changed, 18 insertions(+), 31 deletions(-) diff --git a/modules/tpmnBidAdapter.js b/modules/tpmnBidAdapter.js index d64c39faa9d..752cc3e2f08 100644 --- a/modules/tpmnBidAdapter.js +++ b/modules/tpmnBidAdapter.js @@ -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'; @@ -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); + } + } } }); @@ -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; @@ -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 }; }