Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Video Module: Local cache for video bids #12502

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
var adUnits = [{
code: 'div-gpt-ad-51545-0',
mediaTypes: {
video:{"context":"outstream"}
video:{
"context":"outstream",
playerSize: [640, 360]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

playerSize shouldn't be required; the Video Module should be populating this, not the publisher. The Video Module is the source of truth.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mkomorski why was playerSize in all the demos, this should be populated by the Video Module already

Copy link
Collaborator Author

@mkomorski mkomorski Dec 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@karimMourra so it seems that it's not populated for some reason, at least in all the demos. without the publisher explicitly setting playerSize to adUnit, none of the examples works. I'm not very familiar with the details of the video module, but maybe this means there is some issue? Here's the example that I was basing on - Removing playerSize from this example's code breaks it as well

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mkomorski in the case of the JW Player examples, the auction happens before the player is fully instantiated. So the player's exact size isn't available. In this case, for JW Player I will add logic to calculate the size based on values in the config. Please remove the changes to the JW Player examples.
Are you a maintainer of Ad Player Pro ?

}
},
video: {
divId: 'player', // required to indicate which player is being used to render this ad unit.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
var adUnits = [{
code: 'div-gpt-ad-51545-0',
mediaTypes: {
video:{"context":"outstream"}
video: {
"context":"outstream",
playerSize: [640, 360]
}
},
video: {
divId: 'player', // required to indicate which player is being used to render this ad unit.
Expand Down
163 changes: 163 additions & 0 deletions integrationExamples/videoModule/adPlayerPro/localVideoCache.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@

<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 with Local Cache</title>

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

const 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>"

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

pbjs.que.push(function () {
pbjs.setConfig({
cache: {
useLocal: true
},
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,
width: 640,
height: 360,
advertising: {
closeButton: true,
// 'tag': {'client': 'googima'},
}
}
},
}]
},
//settings for demo only
debugging: {
enabled: true,
intercept: [
{
when: {
adUnitCode: 'div-gpt-ad-51545-0',
},
then: {
context: "outstream",
cpm: 10,
mediaType: "video",
// vastUrl: url,
vastXml,
renderer: {},
}
},
]
},
consentManagement: {cmpApi: 'static', consentData: {getTCData: {gdprApplies: false}}},
bidResponseFilter: {cat: {blockUnknown: false}, adv: {blockUnknown: false}, attr: {blockUnknown: false}}
});
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 with Local Cache</h2>

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

</html>
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
var adUnits = [{
code: 'div-gpt-ad-51545-0',
mediaTypes: {
video: {}
video: {
playerSize: [640, 360]
}
},
video: {
divId: 'player', // required to indicate which player is being used to render this ad unit.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
var videoAdUnit = {
code: videoAdUnitCode,
mediaTypes: {
video: {}
video: {
playerSize: [640, 360]
}
},
video: {
divId: 'player', // required to indicate which player is being used to render this ad unit.
Expand Down
4 changes: 3 additions & 1 deletion integrationExamples/videoModule/jwplayer/eventListeners.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
var adUnits = [{
code: 'div-gpt-ad-51545-0',
mediaTypes: {
video: {}
video: {
playerSize: [640, 360]
}
},
video: {
divId: 'player',
Expand Down
4 changes: 3 additions & 1 deletion integrationExamples/videoModule/jwplayer/eventsUI.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
var adUnits = [{
code: 'testUnit',
mediaTypes: {
video: {}
video: {
playerSize: [640, 360]
}
},
video: {
divId: 'player', // required to indicate which player is being used to render this ad unit.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
var adUnits = [{
code: 'div-gpt-ad-51545-0',
mediaTypes: {
video: {}
video: {
playerSize: [640, 360]
}
},
video: {
divId: 'player', // required to indicate which player is being used to render this ad unit.
Expand Down
132 changes: 132 additions & 0 deletions integrationExamples/videoModule/jwplayer/localVideoCache.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
<html>

<head>
<script src="https://cdn.jwplayer.com/libraries/l5MchIxB.js"></script>
<script async src="../../../build/dev/prebid.js"></script>

<title>JW Player with Local Cache</title>

<script>
// Setup ad units
var adUnits = [{
code: 'div-gpt-ad-51545-0',
mediaTypes: {
video: {
playerSize: [640, 360],
}
},
video: {
divId: 'player', // required to indicate which player is being used to render this ad unit.
},

bids: [{
bidder: 'jwplayer',
params: {
publisherId: 'test-publisher-id',
siteId: 'test-site-id',
placementId: 'test-placement-id'
}
}, {
bidder: 'ix',
params: {
siteId: '300',
}
}]
}];
const 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>"

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

pbjs.que.push(function () {
pbjs.setConfig({
cache: {
useLocal: true
},
video: {
providers: [{
divId: 'player',
vendorCode: 1, // JW Player vendorCode
playerConfig: {
params: {
licenseKey: 'zwqnWJlovTKhXv2JIcKBj0Si//K7cVPmBDEyaILcAMw+nVKaizsJRA==',
vendorConfig: {
playlist: [{
mediaid: 'XYXYXYXY',
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.',
}, {
mediaid: 'ZAZAZAZA',
file : "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4",
title : "Big Buck Bunny",
description : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
}, {
mediaid: 'WSWSWSWS',
file: "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/Sintel.mp4",
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' }
}
}
}
},]
},
debugging: {
enabled: true,
intercept: [
{
when: {
adUnitCode: 'div-gpt-ad-51545-0',
},
then: {
cpm: 25,
mediaType: "video",
vastXml
}
},
]
}
});
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('videoPlaylist', (e) => {
console.log('videos pb playlist: ', e);
});

// request a bid when media is loaded
pbjs.onEvent('videoContentLoaded', (e) => {
console.log('videos pb contentLoaded: ', e);
});

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

pbjs.onEvent('videoPlaylistComplete', (e) => {
console.log('videos pb playlistComplete: ', e);
});

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

</head>

<body>
<h2>JW Player with Local cache</h2>

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

</html>
4 changes: 3 additions & 1 deletion integrationExamples/videoModule/jwplayer/mediaMetadata.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
var adUnits = [{
code: 'div-gpt-ad-51545-0',
mediaTypes: {
video: {}
video: {
playerSize: [640, 360]
}
},
video: {
divId: 'player', // required to indicate which player is being used to render this ad unit.
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 @@ -13,7 +13,9 @@
var adUnits = [{
code: 'div-gpt-ad-51545-0',
mediaTypes: {
video: {}
video: {
playerSize: [640, 360]
}
},
video: {
divId: 'player', // required to indicate which player is being used to render this ad unit.
Expand Down
Loading
Loading