Skip to content

Commit

Permalink
renames optimizeAds
Browse files Browse the repository at this point in the history
  • Loading branch information
karimMourra committed Oct 20, 2022
1 parent 6262eb4 commit c41f286
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 14 deletions.
7 changes: 2 additions & 5 deletions modules/jwplayerVideoProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ export function JWPlayerProvider(config, jwplayer_, adState_, timeState_, callba
break;

case AD_IMPRESSION:
case AD_CLICK:
getEventPayload = () => Object.assign({}, adState.getState(), timeState.getState());
break;

Expand All @@ -257,10 +258,6 @@ export function JWPlayerProvider(config, jwplayer_, adState_, timeState_, callba
};
break;

case AD_CLICK:
getEventPayload = () => Object.assign({}, adState.getState(), timeState.getState());
break;

case AD_SKIPPED:
getEventPayload = e => {
adState.clearState();
Expand Down Expand Up @@ -564,7 +561,7 @@ export const utils = {
jwConfig.key = config.licenseKey;
}

if (params.adOptimization === false) {
if (config.setupAds === false) {
return jwConfig;
}

Expand Down
5 changes: 3 additions & 2 deletions modules/videoModule/coreVideo.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ import { ParentModule, SubmoduleBuilder } from '../../libraries/video/shared/par

/**
* @function VideoProvider#onEvent
* @param {string} events - name of event for which the listener should be added
* @param {function} callback - function that will get called when one of the events is triggered
* @param {string} event - name of event for which the listener should be added
* @param {function} callback - function that will get called when the event is triggered
* @param {Object} basePayload - Base payload for every event; includes common parameters such as divId and type. Event payload should be built on top of this.
*/

/**
Expand Down
6 changes: 3 additions & 3 deletions modules/videoModule/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,10 @@ export function PbVideo(videoCore_, getConfig_, pbGlobal_, pbEvents_, videoEvent
}

// options: adXml, winner, adUnitCode,
function loadAdTag(adUrl, divId, options) {
const payload = Object.assign({ adUrl }, options);
function loadAdTag(adTagUrl, divId, options) {
const payload = Object.assign({ adTagUrl }, options);
pbEvents.emit(getExternalVideoEventName(AUCTION_AD_LOAD_ATTEMPT), payload);
videoCore.setAdTagUrl(adUrl, divId, options);
videoCore.setAdTagUrl(adTagUrl, divId, options);
}

function triggerVideoBidEvent(eventName, adEventPayload) {
Expand Down
2 changes: 1 addition & 1 deletion modules/videojsVideoProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,7 @@ export function adStateFactory() {
break

default:
updates.offset = adPodInfo.timeOffset;
updates.offset = '' + adPodInfo.timeOffset;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -608,18 +608,19 @@ describe('utils', function () {
expect(jwConfig).to.not.have.property('key');
});

it('should exclude fallback ad block when adOptimization is explicitly disabled', function () {
it('should exclude fallback ad block when setupAds is explicitly disabled', function () {
let jwConfig = getJwConfig({
setupAds: false,
params: {
adOptimization: false,

vendorConfig: {}
}
});

expect(jwConfig).to.not.have.property('advertising');
});

it('should set advertising block when adOptimization is allowed', function () {
it('should set advertising block when setupAds is allowed', function () {
let jwConfig = getJwConfig({
params: {
vendorConfig: {
Expand Down

0 comments on commit c41f286

Please sign in to comment.