Skip to content

Commit

Permalink
CCX Bid Adapter: add support for mediatypes video parameters (#6736)
Browse files Browse the repository at this point in the history
* adomain support

* adomain support

* adomain support

* adomain support

* adomain support

* video params

* docs changes
  • Loading branch information
mjaworskiccx authored May 20, 2021
1 parent 507c437 commit a031f8d
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 58 deletions.
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
58 changes: 6 additions & 52 deletions modules/ccxBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,67 +32,21 @@ Module that connects to Clickonometrics's demand sources
mediaTypes: {
video: {
playerSize: [1920, 1080]

protocols: [2, 3, 5, 6], //default
mimes: ["video/mp4", "video/x-flv"], //default
playbackmethod: [1, 2, 3, 4], //default
skip: 1, //default 0
skipafter: 5 //delete this key if skip = 0
}
},
bids: [
{
bidder: "ccx",
params: {
placementId: 3287742,
//following options are not required, default values will be used. Uncomment if you want to use custom values
/*video: {
//check OpenRTB documentation for following options description
protocols: [2, 3, 5, 6], //default
mimes: ["video/mp4", "video/x-flv"], //default
playbackmethod: [1, 2, 3, 4], //default
skip: 1, //default 0
skipafter: 5 //delete this key if skip = 0
}*/
placementId: 3287742
}
}
]
}

];

# Pre 1.0 Support

var adUnits = [
{
code: 'test-banner',
mediaType: 'banner',
sizes: [300, 250],
bids: [
{
bidder: "ccx",
params: {
placementId: 3286844
}
}
]
},
{
code: 'test-video',
mediaType: 'video',
sizes: [1920, 1080]
bids: [
{
bidder: "ccx",
params: {
placementId: 3287742,
//following options are not required, default values will be used. Uncomment if you want to use custom values
/*video: {
//check OpenRTB documentation for following options description
protocols: [2, 3, 5, 6], //default
mimes: ["video/mp4", "video/x-flv"], //default
playbackmethod: [1, 2, 3, 4], //default
skip: 1, //default 0
skipafter: 5 //delete this key if skip = 0
}*/
}
}
]
}

];
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);
});
});
});

0 comments on commit a031f8d

Please sign in to comment.