Skip to content

Commit

Permalink
Adding support for video.plcmt (#10841)
Browse files Browse the repository at this point in the history
  • Loading branch information
desidiver authored Dec 15, 2023
1 parent 2732783 commit 5292b63
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
4 changes: 2 additions & 2 deletions modules/yieldmoBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const VIDEO_PATH = '/exchange/prebidvideo';
const STAGE_DOMAIN = 'https://ads-stg.yieldmo.com';
const PROD_DOMAIN = 'https://ads.yieldmo.com';
const OUTSTREAM_VIDEO_PLAYER_URL = 'https://prebid-outstream.yieldmo.com/bundle.js';
const OPENRTB_VIDEO_BIDPARAMS = ['mimes', 'startdelay', 'placement', 'startdelay', 'skipafter', 'protocols', 'api',
const OPENRTB_VIDEO_BIDPARAMS = ['mimes', 'startdelay', 'placement', 'plcmt', 'skipafter', 'protocols', 'api',
'playbackmethod', 'maxduration', 'minduration', 'pos', 'skip', 'skippable'];
const OPENRTB_VIDEO_SITEPARAMS = ['name', 'domain', 'cat', 'keywords'];
const LOCAL_WINDOW = getWindowTop();
Expand Down Expand Up @@ -449,7 +449,7 @@ function openRtbImpression(bidRequest) {
imp.video.skip = 1;
delete imp.video.skippable;
}
if (imp.video.placement !== 1) {
if (imp.video.plcmt !== 1 || imp.video.placement !== 1) {
imp.video.startdelay = DEFAULT_START_DELAY;
imp.video.playbackmethod = [ DEFAULT_PLAYBACK_METHOD ];
}
Expand Down
18 changes: 14 additions & 4 deletions test/spec/modules/yieldmoBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe('YieldmoAdapter', function () {
video: {
playerSize: [640, 480],
context: 'instream',
mimes: ['video/mp4']
mimes: ['video/mp4'],
},
},
params: {
Expand All @@ -61,11 +61,11 @@ describe('YieldmoAdapter', function () {
api: [2, 3],
skipppable: true,
playbackmethod: [1, 2],
...videoParams
}
...videoParams,
},
},
transactionId: '54a58774-7a41-494e-8cbc-fa7b79164f0c',
...rootParams
...rootParams,
});

const mockBidderRequest = (params = {}, bids = [mockBannerBid()]) => ({
Expand Down Expand Up @@ -460,6 +460,16 @@ describe('YieldmoAdapter', function () {
expect(buildVideoBidAndGetVideoParam().minduration).to.deep.equal(['video/mp4']);
});

it('should add plcmt value to the imp.video', function () {
const videoBid = mockVideoBid({}, {}, { plcmt: 1 });
expect(utils.deepAccess(videoBid, 'params.video')['plcmt']).to.equal(1);
});

it('should add start delay if plcmt value is not 1', function () {
const videoBid = mockVideoBid({}, {}, { plcmt: 2 });
expect(build([videoBid])[0].data.imp[0].video.startdelay).to.equal(0);
});

it('should override mediaTypes.video.mimes prop if params.video.mimes is present', function () {
utils.deepAccess(videoBid, 'mediaTypes.video')['mimes'] = ['video/mp4'];
utils.deepAccess(videoBid, 'params.video')['mimes'] = ['video/mkv'];
Expand Down

0 comments on commit 5292b63

Please sign in to comment.