From 14c5b3362bcbef389cb601fbeaa6ea90fbe4a156 Mon Sep 17 00:00:00 2001 From: Demetrio Girardi Date: Thu, 9 Apr 2026 13:41:45 -0700 Subject: [PATCH 1/3] fix videojs instream example --- _includes/loadScript.html | 11 ++ _includes/video/pb-is-vjs.html | 131 +++++++++--------- .../video/instream/videojs/pb-ve-videojs.html | 120 ++++++++-------- 3 files changed, 138 insertions(+), 124 deletions(-) create mode 100644 _includes/loadScript.html diff --git a/_includes/loadScript.html b/_includes/loadScript.html new file mode 100644 index 0000000000..fac994fb38 --- /dev/null +++ b/_includes/loadScript.html @@ -0,0 +1,11 @@ + \ No newline at end of file diff --git a/_includes/video/pb-is-vjs.html b/_includes/video/pb-is-vjs.html index bdedf89b65..c1d8069b49 100644 --- a/_includes/video/pb-is-vjs.html +++ b/_includes/video/pb-is-vjs.html @@ -2,6 +2,7 @@ {% include head--common.html %} {% include prebidjs-non-prod.html %} + {% include loadScript.html %} @@ -15,78 +16,84 @@ rel="stylesheet" /> - - - - - + diff --git a/examples/video/instream/videojs/pb-ve-videojs.html b/examples/video/instream/videojs/pb-ve-videojs.html index 24ded8fe3b..68ba056f49 100644 --- a/examples/video/instream/videojs/pb-ve-videojs.html +++ b/examples/video/instream/videojs/pb-ve-videojs.html @@ -92,31 +92,30 @@

Place this code in the page header.

}; pbjs.que.push(function() { - pbjs.addAdUnits(videoAdUnit); + pbjs.addAdUnits(videoAdUnit); - pbjs.setConfig({ - debug: true, - cache: { - url: 'https://prebid.example.com/pbc/v1/cache' - } - }); - - 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' - } - }); - invokeVideoPlayer(videoUrl); - } - }); + pbjs.setConfig({ + debug: true, + cache: { + useLocal: true + } + }); + + pbjs.requestBids({ + bidsBackHandler: function (bids) { + window.invokeVideoPlayer((callback) => { + pbjs.adServers.gam.getVastXml({ + bid: bids.video1.bids[0], + adUnit: videoAdUnit, + params: { + iu: '/41758329/localcache', + }, + }).then(vastXml => { + callback(null, vastXml) + }) + }); + }, + }); }); </script> @@ -148,50 +147,48 @@

Place this code in the page body.

page_load_time = new Date().getTime() - performance.timing.navigationStart; console.log(page_load_time + "ms -- Player loaded!"); - function invokeVideoPlayer(url) { - - page_load_time = new Date().getTime() - performance.timing.navigationStart; - console.log(page_load_time + "ms -- Prebid VAST url = " + url); - - /* Access the player instance by calling videojs() and passing - in the player's ID. Add a ready listener to make sure the - player is ready before interacting with it. */ + function invokeVideoPlayer = function (getVastXml) { + page_load_time = + new Date().getTime() - performance.timing.navigationStart; - videojs("vid1").ready(function() { + /* Access the player instance by calling videojs() and passing + in the player's ID. Add a ready listener to make sure the + player is ready before interacting with it. */ - page_load_time = new Date().getTime() - performance.timing.navigationStart; - console.log(page_load_time + "ms -- Player is ready!"); + videojs("vid1").ready(function () { - /* PASS SETTINGS TO VAST PLUGIN + page_load_time = new Date().getTime() - performance.timing.navigationStart; + console.log(page_load_time + "ms -- Player is ready!"); - Pass in a JSON object to the player's vastClient (defined - by the VAST/VPAID plugin we're using). The requires an - adTagUrl, which will be the URL returned by Prebid. You - can view all the options available for the vastClient - here: + /* PASS SETTINGS TO VAST PLUGIN - https://github.com/MailOnline/videojs-vast-vpaid#options */ + Pass in a JSON object to the player's vastClient (defined + by the VAST/VPAID plugin we're using). The requires an + adTagUrl, which will be the URL returned by Prebid. You + can view all the options available for the vastClient + here: - var player = this; - var vastAd = player.vastClient({ - adTagUrl: url, - playAdAlways: true, - verbosity: 4, - vpaidFlashLoaderPath: "https://github.com/MailOnline/videojs-vast-vpaid/blob/RELEASE/bin/VPAIDFlash.swf?raw=true", - autoplay: true - }); + https://github.com/MailOnline/videojs-vast-vpaid#options */ - page_load_time = new Date().getTime() - performance.timing.navigationStart; - console.log(page_load_time + "ms -- Prebid VAST tag inserted!"); + var player = this; + var vastAd = player.vastClient({ + adTagXML: getVastXml, + playAdAlways: true, + verbosity: 4, + vpaidFlashLoaderPath: "https://github.com/MailOnline/videojs-vast-vpaid/blob/RELEASE/bin/VPAIDFlash.swf?raw=true", + autoplay: true, + }); - player.muted(true); - player.play(); + page_load_time = new Date().getTime() - performance.timing.navigationStart; + console.log(page_load_time + "ms -- Prebid VAST tag inserted!"); - page_load_time = new Date().getTime() - performance.timing.navigationStart; - console.log(page_load_time + "ms -- invokeVideoPlayer complete!"); + player.muted(true); + player.play(); - }); - } + page_load_time = new Date().getTime() - performance.timing.navigationStart; + console.log(page_load_time + "ms -- invokeVideoPlayer complete!"); + }); + } </script> @@ -212,10 +209,9 @@

Place this code in the page body.

page_load_time = new Date().getTime() - performance.timing.navigationStart; console.log(page_load_time + "ms -- Player loaded!"); - window.invokeVideoPlayer = function (url) { + window.invokeVideoPlayer = function (getVastXml) { page_load_time = new Date().getTime() - performance.timing.navigationStart; - console.log(page_load_time + "ms -- Prebid VAST url = " + url); /* Access the player instance by calling videojs()` and passing in the player's ID. Add a `ready` listener to make sure the @@ -238,12 +234,13 @@

Place this code in the page body.

var player = this; var vastAd = player.vastClient({ - adTagUrl: url, + adTagXML: getVastXml, playAdAlways: true, verbosity: 4, vpaidFlashLoaderPath: "https://github.com/MailOnline/videojs-vast-vpaid/blob/RELEASE/bin/VPAIDFlash.swf?raw=true", autoplay: true, + adCancelTimeout: 10000 }); page_load_time = @@ -258,6 +255,5 @@

Place this code in the page body.

console.log(page_load_time + "ms -- invokeVideoPlayer complete!"); }); }; - window.resolveVideoJS(); } From 43aab871b0e0bba3418fc54bf2da065f2a09706c Mon Sep 17 00:00:00 2001 From: Demetrio Girardi Date: Thu, 9 Apr 2026 14:09:58 -0700 Subject: [PATCH 2/3] Fix jwplayer example 02 --- _includes/video/mock-video-bid.html | 21 ++++ _includes/video/pb-is-jw02.html | 110 +++++++++--------- _includes/video/pb-is-vjs.html | 18 +-- .../jwplayer/pb-ve-jwplayer-hosted.html | 48 ++++---- 4 files changed, 97 insertions(+), 100 deletions(-) create mode 100644 _includes/video/mock-video-bid.html diff --git a/_includes/video/mock-video-bid.html b/_includes/video/mock-video-bid.html new file mode 100644 index 0000000000..ec49e19765 --- /dev/null +++ b/_includes/video/mock-video-bid.html @@ -0,0 +1,21 @@ + \ No newline at end of file diff --git a/_includes/video/pb-is-jw02.html b/_includes/video/pb-is-jw02.html index 8162a69928..9b8dba6793 100644 --- a/_includes/video/pb-is-jw02.html +++ b/_includes/video/pb-is-jw02.html @@ -2,73 +2,67 @@ {% include head--common.html %} {% include prebidjs-non-prod.html %} + {% include loadScript.html %} + {% include video/mock-video-bid.html %} - - - + diff --git a/_includes/video/pb-is-vjs.html b/_includes/video/pb-is-vjs.html index c1d8069b49..ef411b5bfe 100644 --- a/_includes/video/pb-is-vjs.html +++ b/_includes/video/pb-is-vjs.html @@ -3,6 +3,7 @@ {% include head--common.html %} {% include prebidjs-non-prod.html %} {% include loadScript.html %} + {% include video/mock-video-bid.html %} @@ -50,23 +51,6 @@ pbjs.que.push(function () { pbjs.addAdUnits(videoAdUnit); - pbjs.setConfig({ - debugging: { - enabled: true, - intercept: [ - { - when: { - adUnitCode: 'video1', - }, - then: { - cpm: 1, - mediaType: "video", - vastXml: "GDFPDemo00:00:11" - } - }, - ] - } - }) pbjs.setConfig({ debug: true, diff --git a/examples/video/instream/jwplayer/pb-ve-jwplayer-hosted.html b/examples/video/instream/jwplayer/pb-ve-jwplayer-hosted.html index 67ab3e318d..261a78d8ca 100644 --- a/examples/video/instream/jwplayer/pb-ve-jwplayer-hosted.html +++ b/examples/video/instream/jwplayer/pb-ve-jwplayer-hosted.html @@ -57,8 +57,8 @@

Place this code in the page header.

// 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 invokeVideoPlayer = function(vastXml) { + tempTag = vastXml; } var videoAdUnit = { @@ -86,24 +86,18 @@

Place this code in the page header.

pbjs.setConfig({ debug: true, cache: { - url: 'https://prebid.example.com/pbc/v1/cache' + useLocal: true } }); pbjs.requestBids({ bidsBackHandler: function(bids) { - var videoUrl = pbjs.adServers.dfp.buildVideoUrl({ + pbjs.adServers.gam.getVastXml({ adUnit: videoAdUnit, params: { - iu: '/19968336/prebid_cache_video_adunit', - cust_params: { - section: 'blog', - anotherKey: 'anotherValue' - }, - output: 'vast' - } - }); - invokeVideoPlayer(videoUrl); + iu: '/41758329/localcache', + }, + }).then(vastXml => invokeVideoPlayer(vastXml)); } }); }); @@ -123,7 +117,7 @@

Place this code in the page body.

<script> var jwPlayerInstance = jwplayer("playerContainerJW"); - invokeVideoPlayer = function(url) { + invokeVideoPlayer = function(vastXml) { jwPlayerInstance.setup({ "file": "https://vjs.zencdn.net/v/oceans.mp4", "width": 640, @@ -132,12 +126,14 @@

Place this code in the page body.

"mute": false, "advertising": { client: "vast", + schedule: [ + { + vastxml: vastXml, + offset: 'pre' + } + ] } }); - - jwPlayerInstance.on('beforePlay', function() { - jwPlayerInstance.playAd(url); - }) } if (tempTag) { @@ -155,10 +151,10 @@

Place this code in the page body.

From b0b120dbf86ac0428171ba20256db0a77285a769 Mon Sep 17 00:00:00 2001 From: Demetrio Girardi Date: Thu, 9 Apr 2026 14:18:46 -0700 Subject: [PATCH 3/3] update jwplayer 01 --- _includes/video/pb-is-jw01.html | 104 +++++++++--------- .../jwplayer/pb-ve-jwplayer-platform.html | 43 +++----- 2 files changed, 66 insertions(+), 81 deletions(-) diff --git a/_includes/video/pb-is-jw01.html b/_includes/video/pb-is-jw01.html index a96915d12d..eeab1a3ddc 100644 --- a/_includes/video/pb-is-jw01.html +++ b/_includes/video/pb-is-jw01.html @@ -3,68 +3,66 @@ {% include head--common.html %} {% include prebidjs-non-prod.html %} + {% include loadScript.html %} + {% include video/mock-video-bid.html %} + diff --git a/examples/video/instream/jwplayer/pb-ve-jwplayer-platform.html b/examples/video/instream/jwplayer/pb-ve-jwplayer-platform.html index 64f06968ec..fe8c1035af 100644 --- a/examples/video/instream/jwplayer/pb-ve-jwplayer-platform.html +++ b/examples/video/instream/jwplayer/pb-ve-jwplayer-platform.html @@ -7,13 +7,6 @@ sidebarType: 4 --- - -
@@ -57,8 +50,8 @@

Place this code in the page header.

// 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 invokeVideoPlayer = function(vastXml) { + tempTag = vastXml; } var videoAdUnit = { @@ -88,26 +81,20 @@

Place this code in the page header.

pbjs.setConfig({ debug: true, cache: { - url: 'https://prebid.example.com/pbc/v1/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' - } - }); - invokeVideoPlayer(videoUrl); - } - }); + pbjs.requestBids({ + bidsBackHandler: function(bids) { + pbjs.adServers.gam.getVastXml({ + adUnit: videoAdUnit, + params: { + iu: '/41758329/localcache', + }, + }).then(vastXml => invokeVideoPlayer(vastXml)); + } + }); }); </script> @@ -157,7 +144,7 @@

Place this code in the page body.