Skip to content

Commit

Permalink
Rubicon able to read mediaTypes.size (prebid#2607)
Browse files Browse the repository at this point in the history
* Rubicon able to read mediaTypes.size

checkBidRequestSizes is normally present in adaptermanager.js to add the mediaTypes.banner.sizes to bid.sizes. However our adapter need to be able to read these fields in case the method is deprecated.
Same for the Video.
  • Loading branch information
Antoine Jacquemin (Rubicon) authored and dluxemburg committed Jul 17, 2018
1 parent ddd61aa commit 66e3443
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions modules/rubiconBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,9 @@ function parseSizes(bid) {
let params = bid.params;
if (spec.hasVideoMediaType(bid)) {
let size = [];
if (params.video && params.video.playerWidth && params.video.playerHeight) {
if (typeof utils.deepAccess(bid, 'mediaTypes.video.playerSize') !== 'undefined') {
size = bid.mediaTypes.video.playerSize;
} else if (params.video && params.video.playerWidth && params.video.playerHeight) {
size = [
params.video.playerWidth,
params.video.playerHeight
Expand All @@ -518,7 +520,16 @@ function parseSizes(bid) {
}

// deprecated: temp legacy support
let sizes = Array.isArray(params.sizes) ? params.sizes : mapSizes(bid.sizes)
let sizes = [];
if (Array.isArray(params.sizes)) {
sizes = params.sizes;
} else if (typeof utils.deepAccess(bid, 'mediaTypes.banner.sizes') !== 'undefined') {
sizes = mapSizes(bid.mediaTypes.banner.sizes);
} else if (Array.isArray(bid.sizes) && bid.sizes.length > 0) {
sizes = mapSizes(bid.sizes)
} else {
utils.logWarn('Warning: no sizes are setup or found');
}

return masSizeOrdering(sizes);
}
Expand Down

0 comments on commit 66e3443

Please sign in to comment.