Skip to content

Commit

Permalink
ORTB2: don't rely on context to infer video.placement (#11719)
Browse files Browse the repository at this point in the history
* Update videojsVideoProvider.js

* Update ortb.js

* Update ortb.js

* Update video.js

* Update videojsVideoProvider.js

* Update jwplayerVideoProvider.js

* Update ixBidAdapter.js

* Update videojsVideoProvider.js

* Update ixBidAdapter.js

* Update ortb.js

* Update videojsVideoProvider_spec.js

* Update video.js

* Update jwplayerVideoProvider.js

* Update videojsVideoProvider.js

* Update videojsVideoProvider_spec.js

* Update videojsVideoProvider.js

* Update videojsVideoProvider_spec.js

* Update video_spec.js

* Update ixBidAdapter.js
  • Loading branch information
patmmccann committed Jun 6, 2024
1 parent 451135f commit e6868ca
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 14 deletions.
9 changes: 1 addition & 8 deletions libraries/ortbConverter/processors/video.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ const ORTB_VIDEO_PARAMS = new Set([
'playbackend'
]);

const PLACEMENT = {
'instream': 1,
}

export function fillVideoImp(imp, bidRequest, context) {
if (context.mediaType && context.mediaType !== VIDEO) return;

Expand All @@ -46,10 +42,7 @@ export function fillVideoImp(imp, bidRequest, context) {
}
Object.assign(video, format[0]);
}
const placement = PLACEMENT[videoParams.context];
if (placement != null) {
video.placement = placement;
}

imp.video = mergeDeep(video, imp.video);
}
}
Expand Down
15 changes: 14 additions & 1 deletion libraries/video/constants/ortb.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
* @property {number} w - Width of the video player in device independent pixels (DIPS).
* @property {number} h - Height of the video player in device independent pixels (DIPS).
* @property {number|undefined} startdelay - Indicates the offset of the ad placement.
* @property {number|undefined} placement - Placement type for the impression.
* @property {number|undefined} placement - Legacy Placement type for the impression.
* @property {number|undefined} plcmt - Modern placement type for the impression.
* @property {number|undefined} linearity - Indicates if the impression must be linear, nonlinear, etc. If omitted, assume all are allowed.
* @property {number} skip - Indicates if the player can allow the video to be skipped, where 0 is no, 1 is yes.
* @property {number|undefined} skipmin - Only ad creatives with a duration greater than this value can be skippable; only applicable if the ad is skippable.
Expand Down Expand Up @@ -97,6 +98,18 @@ export const PLACEMENT = {
INTERSTITIAL_SLIDER_FLOATING: 5
};

/**
* ADCOM - https://github.com/InteractiveAdvertisingBureau/AdCOM/blob/develop/AdCOM%20v1.0%20FINAL.md#list_plcmtsubtypesvideo
* @enum OrtbVideoParams.plcmt
*/
export const PLCMT = {
INSTREAM: 1,
ACCOMPANYING_CONTENT: 2,
INTERSTITIAL: 3,
OUTSTREAM: 4,
NO_CONTENT: 4
};

/**
* ORTB 2.5 section 5.4 - Ad Position
* @enum OrtbVideoParams.pos
Expand Down
5 changes: 3 additions & 2 deletions modules/videojsVideoProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
} from '../libraries/video/constants/events.js';
// missing events: , AD_BREAK_START, , AD_BREAK_END, VIEWABLE, BUFFER, CAST, PLAYLIST_COMPLETE, RENDITION_UPDATE, PLAY_ATTEMPT_FAILED, AUTOSTART_BLOCKED
import {
PROTOCOLS, API_FRAMEWORKS, VIDEO_MIME_TYPE, PLAYBACK_METHODS, PLACEMENT, VPAID_MIME_TYPE, AD_POSITION, PLAYBACK_END
PROTOCOLS, API_FRAMEWORKS, VIDEO_MIME_TYPE, PLAYBACK_METHODS, PLCMT, VPAID_MIME_TYPE, AD_POSITION, PLAYBACK_END
} from '../libraries/video/constants/ortb.js';
import { VIDEO_JS_VENDOR } from '../libraries/video/constants/vendorCodes.js';
import { submodule } from '../src/hook.js';
Expand Down Expand Up @@ -146,8 +146,9 @@ export function VideojsProvider(providerConfig, vjs_, adState_, timeState_, call
// ~ Sort of resolved check if the player has a source to tell if the placement is instream
// Still cannot reliably check what type of placement the player is if its outstream
// i.e. we can't tell if its interstitial, in article, etc.
// update: cannot infer instream ever, always need declarations
if (player.src()) {
video.placement = PLACEMENT.INSTREAM;
video.plcmt = PLCMT.ACCOMPANYING_CONTENT;
}

// Placement according to IQG Guidelines 4.2.8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
const {VideojsProvider, utils} = require('modules/videojsVideoProvider');

const {
PROTOCOLS, API_FRAMEWORKS, VIDEO_MIME_TYPE, PLAYBACK_METHODS, PLACEMENT, VPAID_MIME_TYPE, AD_POSITION
PROTOCOLS, API_FRAMEWORKS, VIDEO_MIME_TYPE, PLAYBACK_METHODS, PLCMT, VPAID_MIME_TYPE, AD_POSITION
} = require('libraries/video/constants/ortb.js');

const videojs = require('video.js').default;
Expand Down Expand Up @@ -139,7 +139,7 @@ describe('videojsProvider', function () {
expect(video.playbackmethod).to.include(PLAYBACK_METHODS.CLICK_TO_PLAY);
expect(video.playbackend).to.equal(1);
expect(video.api).to.deep.equal([2]);
expect(video.placement).to.be.equal(PLACEMENT.INSTREAM);
expect(video.plcmt).to.be.equal(PLCMT.ACCOMPANYING_CONTENT);
});

it('should populate oRTB Content', function () {
Expand Down
1 change: 0 additions & 1 deletion test/spec/ortbConverter/video_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ describe('pbjs -> ortb video conversion', () => {
h: 2,
mimes: ['video/mp4'],
skip: 1,
placement: 1,
},
},
},
Expand Down

0 comments on commit e6868ca

Please sign in to comment.