Skip to content

Commit

Permalink
YIELDONE adapter - support CMer Player (#5461)
Browse files Browse the repository at this point in the history
* added UserSync

* added UserSync Unit Test

* support for multi sizes

* register the adapter as supporting video

* supporting video

* change requestId acquisition method

* fix the parameter name of dealID

* update test parameters

* support instream video

* add test for bidRequest

* add test for interpretResponse

* add test params

* add note to documentaion

* add payload params

* add test

* delete tmax param

* add cmer renderer

* fix player url
  • Loading branch information
kusapan authored Jul 23, 2020
1 parent 6256e5a commit c67198f
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion modules/yieldoneBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const BIDDER_CODE = 'yieldone';
const ENDPOINT_URL = 'https://y.one.impact-ad.jp/h_bid';
const USER_SYNC_URL = 'https://y.one.impact-ad.jp/push_sync';
const VIDEO_PLAYER_URL = 'https://img.ak.impact-ad.jp/ic/pone/ivt/firstview/js/dac-video-prebid.min.js';
const CMER_PLAYER_URL = 'https://an.cmertv.com/hb/renderer/cmertv-video-yone-prebid.min.js';
const VIEWABLE_PERCENTAGE_URL = 'https://img.ak.impact-ad.jp/ic/pone/ivt/firstview/js/prebid-adformat-config.js';

export const spec = {
Expand Down Expand Up @@ -136,7 +137,11 @@ export const spec = {
} else if (response.adm) {
bidResponse.mediaType = VIDEO;
bidResponse.vastXml = response.adm;
bidResponse.renderer = newRenderer(response);
if (renderId === 'cmer') {
bidResponse.renderer = newCmerRenderer(response);
} else {
bidResponse.renderer = newRenderer(response);
}
}

bidResponses.push(bidResponse);
Expand Down Expand Up @@ -175,4 +180,26 @@ function outstreamRender(bid) {
});
}

function newCmerRenderer(response) {
const renderer = Renderer.install({
id: response.uid,
url: CMER_PLAYER_URL,
loaded: false,
});

try {
renderer.setRender(cmerRender);
} catch (err) {
utils.logWarn('Prebid Error calling setRender on newRenderer', err);
}

return renderer;
}

function cmerRender(bid) {
bid.renderer.push(() => {
window.CMERYONEPREBID.renderPrebid(bid);
});
}

registerBidder(spec);

0 comments on commit c67198f

Please sign in to comment.