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

CCX Bid Adapter: add support for mediatypes video parameters #6736

Merged
merged 8 commits into from
May 20, 2021
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions modules/ccxBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,12 @@ function _buildBid (bid) {
}
}

placement.video.protocols = utils.deepAccess(bid, 'params.video.protocols') || SUPPORTED_VIDEO_PROTOCOLS
placement.video.mimes = utils.deepAccess(bid, 'params.video.mimes') || SUPPORTED_VIDEO_MIMES
placement.video.playbackmethod = utils.deepAccess(bid, 'params.video.playbackmethod') || SUPPORTED_VIDEO_PLAYBACK_METHODS
placement.video.skip = utils.deepAccess(bid, 'params.video.skip') || 0
if (placement.video.skip === 1 && utils.deepAccess(bid, 'params.video.skipafter')) {
placement.video.skipafter = utils.deepAccess(bid, 'params.video.skipafter')
placement.video.protocols = utils.deepAccess(bid, 'mediaTypes.video.protocols') || utils.deepAccess(bid, 'params.video.protocols') || SUPPORTED_VIDEO_PROTOCOLS
placement.video.mimes = utils.deepAccess(bid, 'mediaTypes.video.mimes') || utils.deepAccess(bid, 'params.video.mimes') || SUPPORTED_VIDEO_MIMES
placement.video.playbackmethod = utils.deepAccess(bid, 'mediaTypes.video.playbackmethod') || utils.deepAccess(bid, 'params.video.playbackmethod') || SUPPORTED_VIDEO_PLAYBACK_METHODS
placement.video.skip = utils.deepAccess(bid, 'mediaTypes.video.skip') || utils.deepAccess(bid, 'params.video.skip') || 0
if (placement.video.skip === 1 && (utils.deepAccess(bid, 'mediaTypes.video.skipafter') || utils.deepAccess(bid, 'params.video.skipafter'))) {
placement.video.skipafter = utils.deepAccess(bid, 'mediaTypes.video.skipafter') || utils.deepAccess(bid, 'params.video.skipafter')
}
}

Expand Down
54 changes: 54 additions & 0 deletions test/spec/modules/ccxBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -434,4 +434,58 @@ describe('ccxAdapter', function () {
expect(spec.getUserSyncs(syncOptions, [{body: response}])).to.be.empty;
});
});
describe('mediaTypesVideoParams', function () {
it('Valid video mediaTypes', function () {
let bids = [
{
adUnitCode: 'video',
auctionId: '0b9de793-8eda-481e-a548-c187d58b28d9',
bidId: '3u94t90ut39tt3t',
bidder: 'ccx',
bidderRequestId: '23ur20r239r2r',
mediaTypes: {
video: {
playerSize: [[640, 480]],
protocols: [2, 3, 5, 6],
mimes: ['video/mp4', 'video/x-flv'],
playbackmethod: [1, 2, 3, 4],
skip: 1,
skipafter: 5
}
},
params: {
placementId: 608
},
sizes: [[640, 480]],
transactionId: 'aefddd38-cfa0-48ab-8bdd-325de4bab5f9'
}
];

let imps = [
{
video: {
w: 640,
h: 480,
protocols: [2, 3, 5, 6],
mimes: ['video/mp4', 'video/x-flv'],
playbackmethod: [1, 2, 3, 4],
skip: 1,
skipafter: 5
},
id: '3u94t90ut39tt3t',
secure: 1,
ext: {
pid: 608
}
}
];

let bidsClone = utils.deepClone(bids);

let response = spec.buildRequests(bidsClone, {'bids': bidsClone});
let data = JSON.parse(response.data);

expect(data.imp).to.deep.have.same.members(imps);
});
});
});