Skip to content

Commit

Permalink
smartxBidAdapter: new Feature - Made Out-Stream Player configurable (p…
Browse files Browse the repository at this point in the history
…rebid#6239)

* 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

Co-authored-by: smartclip AdTechnology <adtech@smartclip.com>
Co-authored-by: Gino Cirlini <adtech@smartclip.tv>
  • Loading branch information
3 people authored and icflournoy committed Feb 5, 2021
1 parent 543cd90 commit b9a26d4
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 19 deletions.
50 changes: 42 additions & 8 deletions modules/smartxBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,16 +328,49 @@ export const spec = {
}

function createOutstreamScript(bid) {
// const slot = utils.getBidIdParameter('slot', bid.renderer.config.outstream_options);
// for SmartPlay 4.12
function scPrebidClose(ele, completeCollapsed) {
if (completeCollapsed) {
document.getElementById(ele.id).style.display = 'none';
}
}

const confMinAdWidth = utils.getBidIdParameter('minAdWidth', bid.renderer.config.outstream_options) || 290;
const confMaxAdWidth = utils.getBidIdParameter('maxAdWidth', bid.renderer.config.outstream_options) || 900;
const confStartOpen = utils.getBidIdParameter('startOpen', bid.renderer.config.outstream_options) || 'false';
const confEndingScreen = utils.getBidIdParameter('endingScreen', bid.renderer.config.outstream_options) || 'true';
const confHeaderText = utils.getBidIdParameter('headerText', bid.renderer.config.outstream_options) || '';
const confSkipOffset = utils.getBidIdParameter('skipOffset', bid.renderer.config.outstream_options) || 0;
const confDesiredBitrate = utils.getBidIdParameter('desiredBitrate', bid.renderer.config.outstream_options) || 1600;
const elementId = utils.getBidIdParameter('slot', bid.renderer.config.outstream_options) || bid.adUnitCode;

// for SmartPlay 4.12
let initCollapsed = true;
let completeCollapsed = true;
if (confStartOpen === 'true') {
initCollapsed = false;
}
if (confEndingScreen === 'true') {
completeCollapsed = false;
}

utils.logMessage('[SMARTX][renderer] Handle SmartX outstream renderer');
const elementId = bid.adUnitCode;

let smartPlayObj = {
minAdWidth: 290,
maxAdWidth: 900,
elementLocator: {
allowInViewport: false,
minimumElementWidth: 290,
scanPixelsBelowViewport: 800
minAdWidth: confMinAdWidth,
maxAdWidth: confMaxAdWidth,
headerText: confHeaderText,
skipOffset: confSkipOffset,
behaviourMatrix: {
init: {
'collapsed': initCollapsed
},
complete: {
'collapsed': completeCollapsed
}
},
environmentVars: {
desiredBitrate: confDesiredBitrate,
},
onStartCallback: function (m, n) {
try {
Expand All @@ -351,6 +384,7 @@ function createOutstreamScript(bid) {
},
onEndCallback: function (m, n) {
try {
scPrebidClose(n, completeCollapsed); // for SmartPlay 4.12
window.sc_smartIntxtEnd(n);
} catch (f) {}
},
Expand Down
34 changes: 24 additions & 10 deletions modules/smartxBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,18 @@ This adapter requires setup and approval from the smartclip team.
publisherId: '11986',
siteId: '22860',
bidfloor: 0.3,
bidfloorcur: "EUR",
bidfloorcur: 'EUR',
at: 2,
cur: ["EUR"],
cur: ['EUR'],
outstream_options: {
slot: 'video1'
slot: 'video1',
minAdWidth: 290,
maxAdWidth: 900,
headerText: '',
skipOffset: 0,
startOpen: 'true',
endingScreen: 'true',
desiredBitrate: 1600,
},
}
}],
Expand All @@ -57,11 +64,18 @@ This adapter requires setup and approval from the smartclip team.
publisherId: '11986',
siteId: '22860',
bidfloor: 0.3,
bidfloorcur: "EUR",
bidfloorcur: 'EUR',
at: 2,
cur: ["EUR"],
cur: ['EUR'],
outstream_options: {
slot: 'video1'
slot: 'video1',
minAdWidth: 290,
maxAdWidth: 900,
headerText: '',
skipOffset: 0,
startOpen: 'true',
endingScreen: 'true',
desiredBitrate: 1600,
},
user: {
data: [{
Expand Down Expand Up @@ -104,9 +118,9 @@ This adapter requires setup and approval from the smartclip team.
publisherId: '11986',
siteId: '22860',
bidfloor: 0.3,
bidfloorcur: "EUR",
bidfloorcur: 'EUR',
at: 2,
cur: ["EUR"]
cur: ['EUR']
}
}],
}];
Expand All @@ -129,9 +143,9 @@ This adapter requires setup and approval from the smartclip team.
publisherId: '11986',
siteId: '22860',
bidfloor: 0.3,
bidfloorcur: "EUR",
bidfloorcur: 'EUR',
at: 2,
cur: ["EUR"],
cur: ['EUR'],
user: {
data: [{
id: 'emq',
Expand Down
2 changes: 1 addition & 1 deletion test/spec/modules/smartxBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ describe('The smartx adapter', function () {
};
});

it('should attempt to insert the EASI script', function () {
it('should attempt to insert the script', function () {
var scriptTag;
sinon.stub(window.document, 'getElementById').returns({
appendChild: sinon.stub().callsFake(function (script) {
Expand Down

0 comments on commit b9a26d4

Please sign in to comment.