Skip to content

Commit

Permalink
AdPlayerPro Video Module : initial module release (#12150)
Browse files Browse the repository at this point in the history
* Add new video module for AdPlayer.Pro

* Fix offEvent function with callback
  • Loading branch information
artemAdp authored Oct 2, 2024
1 parent ffbe787 commit 323bc37
Show file tree
Hide file tree
Showing 7 changed files with 1,314 additions and 1 deletion.
143 changes: 143 additions & 0 deletions integrationExamples/videoModule/adPlayerPro/bidRequestScheduling.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
<html lang="en">

<head>
<script src="https://serving.stat-rock.com/player/prebidAdPlayerPro.js"></script>
<script async src="../../../build/dev/prebid.js"></script>

<title>AdPlayer.Pro bid request scheduling</title>

<!--This demo listens to the Video events to create an auction at every 10 seconds. -->

<script>
// Setup ad units
var adUnits = [{
code: 'div-gpt-ad-51545-0',
mediaTypes: {
video:{"context":"outstream"}
},
video: {
divId: 'player', // required to indicate which player is being used to render this ad unit.
},
bids: [
{
bidder: 'ix',
params: {
siteId: '300',
}
}
]
}];

var pbjs = pbjs || {};
pbjs.que = pbjs.que || [];

pbjs.que.push(function () {
pbjs.setConfig({
video: {
providers: [{
divId: 'player', // required, this is the id of the div element where the player will be placed
vendorCode: 3, // AdPlayer.Pro vendorCode
playerConfig: {
placementId: 'c9gebfehcqjE', // required, this placementId is only for demo purposes
params: {
'type': 'inView',
'muted': true,
'autoStart': true,
'advertising': {
'controls': true,
'closeButton': true,
// 'tag': {'client': 'googima'},
},
'width': '600',
'height': '300'
}
},
}]
},
debugging: {
enabled: true,
intercept: [
{
when: {
adUnitCode: 'div-gpt-ad-51545-0',
},
then: {
context: "outstream",
cpm: 10,
mediaType: "video",
vastXml: "<?xml version=\"1.0\" encoding=\"UTF-8\"?><VAST version=\"3.0\"><Ad><InLine><AdSystem>GDFP</AdSystem><AdTitle>Demo</AdTitle><Description><![CDATA[Demo]]></Description><Creatives><Creative><Linear ><Duration>00:00:11</Duration><VideoClicks><ClickThrough><![CDATA[https://adplayer.pro/]]></ClickThrough></VideoClicks><MediaFiles><MediaFile delivery=\"progressive\" width=\"640\" height=\"360\" type=\"video/mp4\" scalable=\"true\" maintainAspectRatio=\"true\"><![CDATA[https://static.adplayer.pro/video/demo_v2.mp4]]></MediaFile></MediaFiles></Linear></Creative></Creatives></InLine></Ad></VAST>",
renderer: {},
}
},
]
}
});
pbjs.addAdUnits(adUnits);

function refreshBid() {
pbjs.que.push(function() {
pbjs.requestBids({
adUnitCodes: ['div-gpt-ad-51545-0'],
});
});
}

pbjs.onEvent('videoSetupComplete', e => {
console.log('player setup complete: ', e);
});

pbjs.onEvent('videoSetupFailed', e => {
console.log('player setup failed: ', e);
});

pbjs.onEvent('videoDestroyed', e => {
console.log('player destroyed: ', e);
});

pbjs.onEvent('videoAdImpression', (e) => {
console.log('videos pb ad impression: ', e);
});

pbjs.onEvent('videoAdStarted', (e) => {
console.log('videos pb ad started: ', e);
});

pbjs.onEvent('videoAdPlay', (e) => {
console.log('videos pb ad play: ', e);
});

pbjs.onEvent('videoAdPause', (e) => {
console.log('videos pb ad pause: ', e);
});

pbjs.onEvent('videoAdComplete', (e) => {
console.log('videos pb ad complete: ', e);
setTimeout(refreshBid, 10000);
});

pbjs.onEvent('videoAdSkipped', (e) => {
console.log('videos pb ad skipped: ', e);
});

pbjs.onEvent('videoAdClick', (e) => {
console.log('videos pb ad click: ', e);
});

pbjs.onEvent('videoAdError', (e) => {
console.log('videos pb ad error: ', e);
});

pbjs.requestBids();
});
</script>

</head>

<body>
<h2>AdPlayer.Pro Event Listeners</h2>

<h5>Div-1: Player placeholder div</h5>
<div id='player'></div>
</body>

</html>
154 changes: 154 additions & 0 deletions integrationExamples/videoModule/adPlayerPro/eventListeners.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
<html lang="en">

<head>
<script src="https://serving.stat-rock.com/player/prebidAdPlayerPro.js"></script>
<script async src="../../../build/dev/prebid.js"></script>

<title>AdPlayer.Pro Event Listeners</title>

<!-- This demo listens to every video event and logs the event payload. -->

<script>
// Setup ad units
var adUnits = [{
code: 'div-gpt-ad-51545-0',
mediaTypes: {
video:{"context":"outstream"}
},
video: {
divId: 'player', // required to indicate which player is being used to render this ad unit.
},
bids: [
{
bidder: 'ix',
params: {
siteId: '300',
}
}
]
}];

var pbjs = pbjs || {};
pbjs.que = pbjs.que || [];

pbjs.que.push(function () {
pbjs.setConfig({
video: {
providers: [{
divId: 'player', // required, this is the id of the div element where the player will be placed
vendorCode: 3, // AdPlayer.Pro vendorCode
playerConfig: {
placementId: 'c9gebfehcqjE', // required, this placementId is only for demo purposes
params: {
'type': 'inView',
'muted': true,
'autoStart': true,
'advertising': {
'controls': true,
'closeButton': true,
// 'tag': {'client': 'googima'},
},
'width': '600',
'height': '300'
}
},
},]
},
debugging: {
enabled: true,
intercept: [
{
when: {
adUnitCode: 'div-gpt-ad-51545-0',
},
then: {
context: "outstream",
cpm: 10,
mediaType: "video",
vastXml: "<?xml version=\"1.0\" encoding=\"UTF-8\"?><VAST version=\"3.0\"><Ad><InLine><AdSystem>GDFP</AdSystem><AdTitle>Demo</AdTitle><Description><![CDATA[Demo]]></Description><Creatives><Creative><Linear ><Duration>00:00:11</Duration><VideoClicks><ClickThrough><![CDATA[https://adplayer.pro/]]></ClickThrough></VideoClicks><MediaFiles><MediaFile delivery=\"progressive\" width=\"640\" height=\"360\" type=\"video/mp4\" scalable=\"true\" maintainAspectRatio=\"true\"><![CDATA[https://static.adplayer.pro/video/demo_v2.mp4]]></MediaFile></MediaFiles></Linear></Creative></Creatives></InLine></Ad></VAST>",
renderer: {},
}
},
]
}
});
pbjs.addAdUnits(adUnits);

pbjs.onEvent('videoSetupComplete', e => {
console.log('player setup complete: ', e);
});

pbjs.onEvent('videoSetupFailed', e => {
console.log('player setup failed: ', e);
});

pbjs.onEvent('videoDestroyed', e => {
console.log('player destroyed: ', e);
});

pbjs.onEvent('videoAdImpression', (e) => {
console.log('videos pb ad impression: ', e);
});

pbjs.onEvent('videoAdStarted', (e) => {
console.log('videos pb ad started: ', e);
});

pbjs.onEvent('videoAdPlay', (e) => {
console.log('videos pb ad play: ', e);
});

pbjs.onEvent('videoAdPause', (e) => {
console.log('videos pb ad pause: ', e);
});

pbjs.onEvent('videoAdComplete', (e) => {
console.log('videos pb ad complete: ', e);
});

pbjs.onEvent('videoAdSkipped', (e) => {
console.log('videos pb ad skipped: ', e);
});

pbjs.onEvent('videoAdClick', (e) => {
console.log('videos pb ad click: ', e);
});

pbjs.onEvent('videoAdError', (e) => {
console.log('videos pb ad error: ', e);
});

pbjs.onEvent('videoAuctionAdLoadAttempt', (e) => {
console.log('videos pb auction ad load attempt: ', e);
});

pbjs.onEvent('videoAuctionAdLoadQueued', (e) => {
console.log('videos pb auction ad load queued: ', e);
});

pbjs.onEvent('videoAuctionAdLoadAbort', (e) => {
console.log('videos pb auction ad load attempt: ', e);
});

pbjs.onEvent('videoBidImpression', (e) => {
console.log('videos pb bid Impression: ', e);
});

pbjs.onEvent('videoBidError', (e) => {
console.log('videos pb bid Error: ', e);
});

pbjs.requestBids();
});
</script>

</head>

<body>
<h2>AdPlayer.Pro Event Listeners</h2>

<h5>Div-1: Player placeholder div</h5>
<div id='player'></div>
</body>

</html>
1 change: 1 addition & 0 deletions libraries/video/constants/vendorCodes.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Video Vendors
export const JWPLAYER_VENDOR = 1;
export const VIDEO_JS_VENDOR = 2;
export const AD_PLAYER_PRO_VENDOR = 3;

// Ad Server Vendors
export const GAM_VENDOR = 'gam';
3 changes: 2 additions & 1 deletion modules/.submodules.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@
],
"videoModule": [
"jwplayerVideoProvider",
"videojsVideoProvider"
"videojsVideoProvider",
"adplayerproVideoProvider"
],
"paapi": [
"paapiForGpt",
Expand Down
Loading

0 comments on commit 323bc37

Please sign in to comment.