Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LunaMedia HB Bid Adapter: add video context & outstream handling #6458

Closed
wants to merge 17 commits into from
11 changes: 7 additions & 4 deletions modules/lunamediahbBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function isBidResponseValid(bid) {
case BANNER:
return Boolean(bid.width && bid.height && bid.ad);
case VIDEO:
return Boolean(bid.vastUrl);
return Boolean(bid.vastUrl) || Boolean(bid.vastXml);
case NATIVE:
return Boolean(bid.native && bid.native.impressionTrackers);
default:
Expand Down Expand Up @@ -74,10 +74,13 @@ export const spec = {
if (mediaType && mediaType[BANNER] && mediaType[BANNER].sizes) {
placement.sizes = mediaType[BANNER].sizes;
placement.traffic = BANNER;
} else if (mediaType && mediaType[VIDEO] && mediaType[VIDEO].playerSize) {
placement.wPlayer = mediaType[VIDEO].playerSize[0];
placement.hPlayer = mediaType[VIDEO].playerSize[1];
} else if (mediaType && mediaType[VIDEO]) {
if (mediaType[VIDEO].playerSize) {
placement.wPlayer = mediaType[VIDEO].playerSize[0];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prebid nests the playerSize array that is defined in the ad unit, meaning that [640, 480] is converted to [[640,480]]. So currently, you will only be passing an array through placement.wPlayer and placement.hPlayer is undefined and therefore dropped. I believe you are trying to pass the individual number values of the playerSize through their respective properties, so you will need to look into the second array in order to do so.

placement.wPlayer = mediaType[VIDEO].playerSize[0][0];
placement.hPlayer = mediaType[VIDEO].playerSize[0][1];

placement.hPlayer = mediaType[VIDEO].playerSize[1];
}
placement.traffic = VIDEO;
placement.videoContext = mediaType[VIDEO].context || 'instream'
} else if (mediaType && mediaType[NATIVE]) {
placement.native = mediaType[NATIVE];
placement.traffic = NATIVE;
Expand Down
17 changes: 17 additions & 0 deletions modules/lunamediahbBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,23 @@ Module that connects to lunamedia demand sources
}
]
},
{
code:'1',
mediaTypes:{
video: {
playerSize: [640, 480],
context: 'outstream'
}
},
bids:[
{
bidder: 'lunamediahb',
params: {
placementId: 0
}
}
]
},
{
code:'1',
mediaTypes:{
Expand Down
2 changes: 1 addition & 1 deletion test/spec/modules/lunamediahbBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ describe('LunamediaHBBidAdapter', function () {
expect(data).to.be.an('object');
let placement = data['placements'][0];
expect(placement).to.be.an('object');
expect(placement).to.have.keys('placementId', 'bidId', 'traffic', 'wPlayer', 'hPlayer', 'schain');
expect(placement).to.have.keys('placementId', 'bidId', 'traffic', 'wPlayer', 'hPlayer', 'schain', 'videoContext');
expect(placement.traffic).to.equal(VIDEO);
expect(placement.wPlayer).to.equal(playerSize[0]);
expect(placement.hPlayer).to.equal(playerSize[1]);
Expand Down