-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
mkomorski
wants to merge
8
commits into
master
Choose a base branch
from
mkomorski/local-cache
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
29bb63c
Local cache for video bids
mkomorski a93a356
clean up
mkomorski ced6862
clean up
mkomorski 3ee5de0
fix
mkomorski 8262d96
error message update
mkomorski 1c438e6
revoking blobs on auction expiry
mkomorski 10984b0
Update src/videoCache.js
mkomorski ce316d6
Update src/videoCache.js
mkomorski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
163 changes: 163 additions & 0 deletions
163
integrationExamples/videoModule/adPlayerPro/localVideoCache.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
132 changes: 132 additions & 0 deletions
132
integrationExamples/videoModule/jwplayer/localVideoCache.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 alreadyThere was a problem hiding this comment.
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
There was a problem hiding this comment.
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 ?