Skip to content

Commit

Permalink
Smartx Bid Adapter: update to newest smartclip outstream player versi…
Browse files Browse the repository at this point in the history
…on 6 (prebid#8721)

* Add smartclipBidAdapter

* smartxBidAdapter.js - removed unused variables, removed debug, added window before the outstream related functions

* - made outstream player configurable

* remove wrong named files

* camelcase

* fix

* Out-Stream render update to SmartPlay 5.2

* ESlint fix

* ESlint fix

* ESlint fix

* adjust tests, fixes

* ESlint

* adjusted desired bitrate examples

* added bid.meta.advertiserDomains support

* bug fix for numeric elementID outstream render

* fix renderer url

* support for floors module

* bugfixes to be openRTB 2.5 compliant

* update internal renderer usage

* remove unused outstream_function logic

* bugfix outstream options for default outstream renderer configuration

* [PREB-10] fix empty title not configurable

* add pbjs version

* testing with outstream 5.3.0

* pbjs version into content.ext

* made visibilityThreshold configurable

* adjust position of pbjs version

* Merge branch 'master' of https://github.com/prebid/Prebid.js into HEAD

* update smartclip outstream player version to support outstream 6 release along with necessary config changes

Co-authored-by: smartclip AdTechnology <[email protected]>
Co-authored-by: Gino Cirlini <[email protected]>
  • Loading branch information
3 people authored and jorgeluisrocha committed May 18, 2023
1 parent 60f2edc commit 3511bfa
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 28 deletions.
58 changes: 33 additions & 25 deletions modules/smartxBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ export const spec = {
const playersize = deepAccess(currentBidRequest, 'mediaTypes.video.playerSize');
const renderer = Renderer.install({
id: 0,
url: 'https://dco.smartclip.net/?plc=7777778',
url: 'https://dco.smartclip.net/?plc=7777779',
config: {
adText: 'SmartX Outstream Video Ad via Prebid.js',
player_width: playersize[0][0],
Expand Down Expand Up @@ -353,65 +353,73 @@ function createOutstreamConfig(bid) {

logMessage('[SMARTX][renderer] Handle SmartX outstream renderer');

var smartPlayObj = {
var playerConfig = {
minAdWidth: confMinAdWidth,
maxAdWidth: confMaxAdWidth,
onStartCallback: function (m, n) {
coreSetup: {},
layoutSettings: {},
onCappedCallback: function() {
try {
window.sc_smartIntxtStart(n);
} catch (f) {}
},
onCappedCallback: function (m, n) {
try {
window.sc_smartIntxtNoad(n);
} catch (f) {}
},
onEndCallback: function (m, n) {
try {
window.sc_smartIntxtEnd(n);
window.sc_smartIntxtNoad();
} catch (f) {}
},
};

if (confStartOpen == 'true') {
smartPlayObj.startOpen = true;
playerConfig.startOpen = true;
} else if (confStartOpen == 'false') {
smartPlayObj.startOpen = false;
playerConfig.startOpen = false;
}

if (confEndingScreen == 'true') {
smartPlayObj.endingScreen = true;
playerConfig.endingScreen = true;
} else if (confEndingScreen == 'false') {
smartPlayObj.endingScreen = false;
playerConfig.endingScreen = false;
}

if (confTitle || (typeof bid.renderer.config.outstream_options.title == 'string' && bid.renderer.config.outstream_options.title == '')) {
smartPlayObj.title = confTitle;
playerConfig.layoutSettings.advertisingLabel = confTitle;
}

if (confSkipOffset) {
smartPlayObj.skipOffset = confSkipOffset;
playerConfig.coreSetup.skipOffset = confSkipOffset;
}

if (confDesiredBitrate) {
smartPlayObj.desiredBitrate = confDesiredBitrate;
playerConfig.coreSetup.desiredBitrate = confDesiredBitrate;
}

if (confVisibilityThreshold) {
smartPlayObj.visibilityThreshold = confVisibilityThreshold;
playerConfig.visibilityThreshold = confVisibilityThreshold;
}

smartPlayObj.adResponse = bid.vastContent;
playerConfig.adResponse = bid.vastContent;

const divID = '[id="' + elementId + '"]';

var playerListener = function callback(event) {
switch (event) {
case 'AdSlotStarted':
try {
window.sc_smartIntxtStart();
} catch (f) {}
break;

case 'AdSlotComplete':
try {
window.sc_smartIntxtEnd();
} catch (f) {}
break;
}
};

try {
// eslint-disable-next-line
let _outstreamPlayer = new OutstreamPlayer(divID, smartPlayObj);
outstreamplayer.connect(divID).setup(playerConfig, playerListener)
} catch (e) {
logError('[SMARTX][renderer] Error caught: ' + e);
}
return smartPlayObj;
return playerConfig;
}

/**
Expand Down
6 changes: 3 additions & 3 deletions test/spec/modules/smartxBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ describe('The smartx adapter', function () {

responses[0].renderer.render(responses[0]);

expect(responses[0].renderer.url).to.equal('https://dco.smartclip.net/?plc=7777778');
expect(responses[0].renderer.url).to.equal('https://dco.smartclip.net/?plc=7777779');

window.document.getElementById.restore();
});
Expand Down Expand Up @@ -542,7 +542,7 @@ describe('The smartx adapter', function () {

responses[0].renderer.render(responses[0]);

expect(responses[0].renderer.url).to.equal('https://dco.smartclip.net/?plc=7777778');
expect(responses[0].renderer.url).to.equal('https://dco.smartclip.net/?plc=7777779');

window.document.getElementById.restore();
});
Expand All @@ -560,7 +560,7 @@ describe('The smartx adapter', function () {

responses[0].renderer.render(responses[0]);

expect(responses[0].renderer.url).to.equal('https://dco.smartclip.net/?plc=7777778');
expect(responses[0].renderer.url).to.equal('https://dco.smartclip.net/?plc=7777779');

window.document.getElementById.restore();
});
Expand Down

0 comments on commit 3511bfa

Please sign in to comment.