Skip to content

Commit

Permalink
Merge branch 'master' into liveintent-rtd-provider
Browse files Browse the repository at this point in the history
  • Loading branch information
wi101 committed Jan 10, 2025
2 parents b10615c + 7a210da commit fb0fbae
Show file tree
Hide file tree
Showing 21 changed files with 495 additions and 137 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@
params: {
vendorConfig: {
file: 'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/SubaruOutbackOnStreetAndDirt.mp4',
advertising: { client: 'vast' }
advertising: { client: 'vast' },
width: 640,
height: 480
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
params: {
vendorConfig: {
file: 'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/SubaruOutbackOnStreetAndDirt.mp4',
width: 640,
height: 480,
advertising: {
client: "googima",
schedule: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
params: {
vendorConfig: {
file: 'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/SubaruOutbackOnStreetAndDirt.mp4',
width: 640,
height: 480,
advertising: { client: 'vast' }
}
}
Expand Down
2 changes: 2 additions & 0 deletions integrationExamples/videoModule/jwplayer/eventListeners.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
vendorConfig: {
file: 'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/SubaruOutbackOnStreetAndDirt.mp4',
mediaid: 'd9J2zcaA',
width: 640,
height: 480,
advertising: { client: 'vast' }
}
}
Expand Down
2 changes: 2 additions & 0 deletions integrationExamples/videoModule/jwplayer/eventsUI.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@
file: 'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/SubaruOutbackOnStreetAndDirt.mp4',
title: "Subaru Outback on Street and Dirt",
}],
width: 640,
height: 480,
advertising: { client: 'vast' }
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
params: {
vendorConfig: {
file: 'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/SubaruOutbackOnStreetAndDirt.mp4',
width: 640,
height: 480,
advertising: { client: 'googima' }
}
}
Expand Down
4 changes: 3 additions & 1 deletion integrationExamples/videoModule/jwplayer/mediaMetadata.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@
file: 'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/SubaruOutbackOnStreetAndDirt.mp4',
title: 'Subaru Outback On Street And Dirt',
description: 'Smoking Tire takes the all-new Subaru Outback to the highest point we can find in hopes our customer-appreciation Balloon Launch will get some free T-shirts into the hands of our viewers.',
advertising: { client: 'googima' }
advertising: { client: 'googima' },
width: 640,
height: 480
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion integrationExamples/videoModule/jwplayer/playlist.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@
title : "Sintel",
description: "Sintel is an independently produced short film, initiated by the Blender Foundation as a means to further improve and validate the free/open source 3D creation suite Blender. With initial funding provided by 1000s of donations via the internet community, it has again proven to be a viable development model for both open 3D technology as for independent animation film.\nThis 15 minute film has been realized in the studio of the Amsterdam Blender Institute, by an international team of artists and developers. In addition to that, several crucial technical and creative targets have been realized online, by developers and artists and teams all over the world.\nwww.sintel.org",
}],
advertising: { client: 'vast' }
advertising: { client: 'vast' },
width: 640,
height: 480
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions libraries/vidazooUtils/bidderUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ export function buildRequestData(bid, topWindowUrl, sizes, bidderRequest, bidder
const userData = deepAccess(bidderRequest, 'ortb2.user.data', []);
const contentLang = deepAccess(bidderRequest, 'ortb2.site.content.language') || document.documentElement.lang;
const coppa = deepAccess(bidderRequest, 'ortb2.regs.coppa', 0);
const device = deepAccess(bidderRequest, 'ortb2.device', {});

if (isFn(bid.getFloor)) {
const floorInfo = bid.getFloor({
Expand Down Expand Up @@ -290,6 +291,7 @@ export function buildRequestData(bid, topWindowUrl, sizes, bidderRequest, bidder
bidderRequestsCount: bidderRequestsCount,
bidderWinsCount: bidderWinsCount,
bidderTimeout: bidderTimeout,
device,
...uniqueRequestData
};

Expand Down
2 changes: 2 additions & 0 deletions modules/conceptxBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ import { BANNER } from '../src/mediaTypes.js';
const BIDDER_CODE = 'conceptx';
const ENDPOINT_URL = 'https://conceptx.cncpt-central.com/openrtb';
// const LOG_PREFIX = 'ConceptX: ';
const GVLID = 1340;

export const spec = {
code: BIDDER_CODE,
supportedMediaTypes: [BANNER],
gvlid: GVLID,
isBidRequestValid: function (bid) {
return !!(bid.bidId && bid.params.site && bid.params.adunit);
},
Expand Down
3 changes: 2 additions & 1 deletion modules/ixBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -751,8 +751,9 @@ function buildRequest(validBidRequests, bidderRequest, impressions, version) {
method: 'POST',
url: exchangeUrl,
data: deepClone(r),
option: {
options: {
contentType: 'text/plain',
withCredentials: true
},
validBidRequests
});
Expand Down
105 changes: 99 additions & 6 deletions modules/jwplayerVideoProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ export function JWPlayerProvider(config, jwplayer_, adState_, timeState_, callba
VIDEO_MIME_TYPE.AAC,
VIDEO_MIME_TYPE.HLS
];
let height = null;
let width = null;

function init() {
if (!jwplayer) {
Expand Down Expand Up @@ -92,6 +94,20 @@ export function JWPlayerProvider(config, jwplayer_, adState_, timeState_, callba
const adConfig = config.advertising || {};
supportedMediaTypes = supportedMediaTypes || utils.getSupportedMediaTypes(MEDIA_TYPES);

if (height === null) {
height = utils.getPlayerHeight(player, config);
}

if (width === null) {
width = utils.getPlayerWidth(player, config);
}

if (config.aspectratio && !height && !width) {
const size = utils.getPlayerSizeFromAspectRatio(player, config);
height = size.height;
width = size.width;
}

const video = {
mimes: supportedMediaTypes,
protocols: [
Expand All @@ -102,8 +118,8 @@ export function JWPlayerProvider(config, jwplayer_, adState_, timeState_, callba
PROTOCOLS.VAST_3_0_WRAPPER,
PROTOCOLS.VAST_4_0_WRAPPER
],
h: player.getHeight(), // TODO does player call need optimization ?
w: player.getWidth(), // TODO does player call need optimization ?
h: height,
w: width,
startdelay: utils.getStartDelay(),
placement: utils.getPlacement(adConfig, player),
// linearity is omitted because both forms are supported.
Expand Down Expand Up @@ -414,10 +430,14 @@ export function JWPlayerProvider(config, jwplayer_, adState_, timeState_, callba
break;

case PLAYER_RESIZE:
getEventPayload = e => ({
height: e.height,
width: e.width,
});
getEventPayload = e => {
height = e.height;
width = e.width;
return {
height,
width
};
};
break;

case VIEWABLE:
Expand Down Expand Up @@ -585,6 +605,79 @@ export const utils = {
return jwConfig;
},

getPlayerHeight: function(player, config) {
let height;

if (player.getHeight) {
height = player.getHeight();
}

// Height is undefined when player has not yet rendered
if (height !== undefined) {
return height;
}

return config.height;
},

getPlayerWidth: function(player, config) {
let width;

if (player.getWidth) {
width = player.getWidth();
}

// Width is undefined when player has not yet rendered
if (width !== undefined) {
return width;
}

// Width can be a string when aspectratio is set
if (typeof config.width === 'number') {
return config.width;
}
},

getPlayerSizeFromAspectRatio: function(player, config) {
const aspectRatio = config.aspectratio;
let percentageWidth = config.width;

if (typeof aspectRatio !== 'string' || typeof percentageWidth !== 'string') {
return {};
}

const ratios = aspectRatio.split(':');

if (ratios.length !== 2) {
return {};
}

const containerElement = player.getContainer && player.getContainer();
if (!containerElement) {
return {};
}

const containerWidth = containerElement.clientWidth;
const containerHeight = containerElement.clientHeight;

const xRatio = parseInt(ratios[0], 10);
const yRatio = parseInt(ratios[1], 10);

if (isNaN(xRatio) || isNaN(yRatio)) {
return {};
}

const numericWidthPercentage = parseInt(percentageWidth, 10);

const desiredWidth = containerWidth * numericWidthPercentage / 100;
const desiredHeight = Math.min(desiredWidth * yRatio / xRatio, containerHeight);

return {
height: desiredHeight,
width: desiredWidth
};
},

getJwEvent: function(eventName) {
switch (eventName) {
case SETUP_COMPLETE:
Expand Down
51 changes: 33 additions & 18 deletions test/spec/modules/excoBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,36 @@ const VIDEO_BID = {
}
}

const ORTB2_DEVICE = {
sua: {
'source': 2,
'platform': {
'brand': 'Android',
'version': ['8', '0', '0']
},
'browsers': [
{'brand': 'Not_A Brand', 'version': ['99', '0', '0', '0']},
{'brand': 'Google Chrome', 'version': ['109', '0', '5414', '119']},
{'brand': 'Chromium', 'version': ['109', '0', '5414', '119']}
],
'mobile': 1,
'model': 'SM-G955U',
'bitness': '64',
'architecture': ''
},
w: 980,
h: 1720,
dnt: 0,
ua: 'Mozilla/5.0 (iPhone; CPU iPhone OS 17_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/125.0.6422.80 Mobile/15E148 Safari/604.1',
language: 'en',
devicetype: 1,
make: 'Apple',
model: 'iPhone 12 Pro Max',
os: 'iOS',
osv: '17.4',
ext: {fiftyonedegrees_deviceId: '17595-133085-133468-18092'},
};

const BIDDER_REQUEST = {
'gdprConsent': {
'consentString': 'consent_string',
Expand All @@ -117,24 +147,7 @@ const BIDDER_REQUEST = {
'gpp_sid': [7],
'coppa': 0
},
'device': {
'sua': {
'source': 2,
'platform': {
'brand': 'Android',
'version': ['8', '0', '0']
},
'browsers': [
{'brand': 'Not_A Brand', 'version': ['99', '0', '0', '0']},
{'brand': 'Google Chrome', 'version': ['109', '0', '5414', '119']},
{'brand': 'Chromium', 'version': ['109', '0', '5414', '119']}
],
'mobile': 1,
'model': 'SM-G955U',
'bitness': '64',
'architecture': ''
}
}
'device': ORTB2_DEVICE,
}
};

Expand Down Expand Up @@ -315,6 +328,7 @@ describe('ExcoBidAdapter', function () {
'bitness': '64',
'architecture': ''
},
device: ORTB2_DEVICE,
uniqueDealId: `${hashUrl}_${Date.now().toString()}`,
uqs: getTopWindowQueryParams(),
mediaTypes: {
Expand Down Expand Up @@ -386,6 +400,7 @@ describe('ExcoBidAdapter', function () {
'bitness': '64',
'architecture': ''
},
device: ORTB2_DEVICE,
url: 'https%3A%2F%2Fwww.greatsite.com',
referrer: 'https://www.somereferrer.com',
cb: 1000,
Expand Down
Loading

0 comments on commit fb0fbae

Please sign in to comment.