Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
11 changes: 11 additions & 0 deletions _includes/loadScript.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<script type="text/javascript">
function loadScript(url) {
const scr = document.createElement('script');
scr.src = url;
return new Promise((resolve, reject) => {
scr.onerror = reject;
scr.onload = resolve;
document.head.appendChild(scr);
});
}
</script>
21 changes: 21 additions & 0 deletions _includes/video/mock-video-bid.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<script>
window.pbjs = window.pbjs || {};
pbjs.que = pbjs.que || [];
pbjs.que.push(() => {
pbjs.setConfig({
debugging: {
enabled: true,
intercept: [
{
when: {},
then: {
cpm: 1,
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>"
}
},
]
}
})
})
</script>
104 changes: 51 additions & 53 deletions _includes/video/pb-is-jw01.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,68 +3,66 @@
<head>
{% include head--common.html %}
{% include prebidjs-non-prod.html %}
{% include loadScript.html %}
{% include video/mock-video-bid.html %}

<!--pbjs and player code -->
<script type="text/javascript" class="cmplazyload" data-cmp-purpose="c51">
loadScript('https://cdn.jwplayer.com/libraries/dNV4UKpE.js')
.then(() => {
//Test Key - replace this with your own valid JWPlayer license key
jwplayer.key = "ssbF6k0i9BPe87xfG/s0ipdp5gwbLoZaDON/GQvuwPU9nVJy";

<script>
var pbjs = pbjs || {};
pbjs.que = pbjs.que || [];
window.pbjs = window.pbjs || {};
pbjs.que = pbjs.que || [];

// define invokeVideoPlayer in advance in case we get the bids back from prebid before the entire page loads
var tempTag = false;
var invokeVideoPlayer = function (url) {
tempTag = url;
};

var videoAdUnit = {
code: "video1",
mediaTypes: {
video: {
context: "instream",
playerSize: [640, 480],
mimes: ["video/mp4"],
protocols: [1, 2, 3, 4, 5, 6, 7, 8],
playbackmethod: [2],
skip: 1,
},
},
bids: [
{
bidder: "appnexus",
params: {
placementId: 13232361, // Add your own placement id here
var videoAdUnit = {
code: "video1",
mediaTypes: {
video: {
context: "instream",
playerSize: [640, 480],
mimes: ["video/mp4"],
protocols: [1, 2, 3, 4, 5, 6, 7, 8],
playbackmethod: [2],
skip: 1,
},
},
},
],
};

pbjs.que.push(function () {
pbjs.addAdUnits(videoAdUnit); // add your ad units to the bid request
bids: [
{
bidder: "appnexus",
params: {
placementId: 13232361, // Add your own placement id here
},
},
],
};

pbjs.setConfig({
debug: true,
cache: {
url: "https://prebid.example.com/pbc/v1/cache",
},
});
pbjs.que.push(function () {
pbjs.addAdUnits(videoAdUnit); // add your ad units to the bid request
pbjs.setConfig({
debug: true,
cache: {
useLocal: true
},
});

pbjs.requestBids({
bidsBackHandler: function (bids) {
var videoUrl = pbjs.adServers.dfp.buildVideoUrl({
adUnit: videoAdUnit,
params: {
iu: "/19968336/prebid_cache_video_adunit",
cust_params: {
section: "blog",
anotherKey: "anotherValue",
},
output: "vast",
pbjs.requestBids({
bidsBackHandler: function (bids) {
pbjs.adServers.gam.getVastXml({
bid: bids.video1.bids[0],
adUnit: videoAdUnit,
params: {
iu: '/41758329/localcache',
},
}).then(vastXml => {
window.runJWPlayer(vastXml);
})
},
});
window.runJWPlayer(videoUrl);
},
});
});
});

})
</script>
</head>

Expand Down
110 changes: 52 additions & 58 deletions _includes/video/pb-is-jw02.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,73 +2,67 @@
<html lang="en" class="html--no-js">
<head>
{% include head--common.html %} {% include prebidjs-non-prod.html %}
{% include loadScript.html %}
{% include video/mock-video-bid.html %}

<!--pbjs and player code -->
<script type="text/plain" class="cmplazyload" data-cmp-purpose="c51">
function updateJWPlayer() {
jwplayer.key = "ssbF6k0i9BPe87xfG/s0ipdp5gwbLoZaDON/GQvuwPU9nVJy"; //Test Key - replace this with your own valid JWPlayer license key
}
</script>

<script
type="text/plain"
class="cmplazyload"
data-cmp-purpose="c51"
data-cmp-src="https://ssl.p.jwpcdn.com/player/v/8.0.5/jwplayer.js"
></script>
<script type="text/javascript" class="cmplazyload" data-cmp-purpose="c51">
loadScript('https://ssl.p.jwpcdn.com/player/v/8.0.5/jwplayer.js')
.then(() => {
//Test Key - replace this with your own valid JWPlayer license key
jwplayer.key = "ssbF6k0i9BPe87xfG/s0ipdp5gwbLoZaDON/GQvuwPU9nVJy";

<script>
var pbjs = pbjs || {};
pbjs.que = pbjs.que || [];
window.pbjs = window.pbjs || {};
pbjs.que = pbjs.que || [];

var videoAdUnit = {
code: "video1",
mediaTypes: {
video: {
context: "instream",
playerSize: [640, 480],
mimes: ["video/mp4"],
protocols: [1, 2, 3, 4, 5, 6, 7, 8],
playbackmethod: [2],
skip: 1,
},
},
bids: [
{
bidder: "appnexus",
params: {
placementId: 13232361, // Add your own placement id here
var videoAdUnit = {
code: "video1",
mediaTypes: {
video: {
context: "instream",
playerSize: [640, 480],
mimes: ["video/mp4"],
protocols: [1, 2, 3, 4, 5, 6, 7, 8],
playbackmethod: [2],
skip: 1,
},
},
},
],
};
bids: [
{
bidder: "appnexus",
params: {
placementId: 13232361, // Add your own placement id here
},
},
],
};

pbjs.que.push(function () {
pbjs.addAdUnits(videoAdUnit); // add your ad units to the bid request
pbjs.setConfig({
debug: true,
cache: {
url: "https://prebid.example.com/pbc/v1/cache",
},
});
pbjs.que.push(function () {
pbjs.addAdUnits(videoAdUnit); // add your ad units to the bid request
pbjs.setConfig({
debug: true,
cache: {
useLocal: true
},
});

pbjs.requestBids({
bidsBackHandler: function (bids) {
pbjs.adServers.gam.getVastXml({
bid: bids.video1.bids[0],
adUnit: videoAdUnit,
params: {
iu: '/41758329/localcache',
},
}).then(vastXml => {
window.runJWPlayer(vastXml);
})

pbjs.requestBids({
bidsBackHandler: function (bids) {
var videoUrl = pbjs.adServers.dfp.buildVideoUrl({
adUnit: videoAdUnit,
params: {
iu: "/19968336/prebid_cache_video_adunit",
cust_params: {
section: "blog",
anotherKey: "anotherValue",
},
output: "vast",
},
});
window.runJWPlayer(videoUrl);
},
});
});
});

})
</script>
</head>

Expand Down
Loading
Loading