|
2 | 2 | <html lang="en" class="html--no-js"> |
3 | 3 | <head> |
4 | 4 | {% include head--common.html %} {% include prebidjs-non-prod.html %} |
| 5 | + {% include loadScript.html %} |
| 6 | + {% include video/mock-video-bid.html %} |
5 | 7 |
|
6 | | - <!--pbjs and player code --> |
7 | | - <script type="text/plain" class="cmplazyload" data-cmp-purpose="c51"> |
8 | | - function updateJWPlayer() { |
9 | | - jwplayer.key = "ssbF6k0i9BPe87xfG/s0ipdp5gwbLoZaDON/GQvuwPU9nVJy"; //Test Key - replace this with your own valid JWPlayer license key |
10 | | - } |
11 | | - </script> |
12 | 8 |
|
13 | | - <script |
14 | | - type="text/plain" |
15 | | - class="cmplazyload" |
16 | | - data-cmp-purpose="c51" |
17 | | - data-cmp-src="https://ssl.p.jwpcdn.com/player/v/8.0.5/jwplayer.js" |
18 | | - ></script> |
| 9 | + <script type="text/javascript" class="cmplazyload" data-cmp-purpose="c51"> |
| 10 | + loadScript('https://ssl.p.jwpcdn.com/player/v/8.0.5/jwplayer.js') |
| 11 | + .then(() => { |
| 12 | + //Test Key - replace this with your own valid JWPlayer license key |
| 13 | + jwplayer.key = "ssbF6k0i9BPe87xfG/s0ipdp5gwbLoZaDON/GQvuwPU9nVJy"; |
19 | 14 |
|
20 | | - <script> |
21 | | - var pbjs = pbjs || {}; |
22 | | - pbjs.que = pbjs.que || []; |
| 15 | + window.pbjs = window.pbjs || {}; |
| 16 | + pbjs.que = pbjs.que || []; |
23 | 17 |
|
24 | | - var videoAdUnit = { |
25 | | - code: "video1", |
26 | | - mediaTypes: { |
27 | | - video: { |
28 | | - context: "instream", |
29 | | - playerSize: [640, 480], |
30 | | - mimes: ["video/mp4"], |
31 | | - protocols: [1, 2, 3, 4, 5, 6, 7, 8], |
32 | | - playbackmethod: [2], |
33 | | - skip: 1, |
34 | | - }, |
35 | | - }, |
36 | | - bids: [ |
37 | | - { |
38 | | - bidder: "appnexus", |
39 | | - params: { |
40 | | - placementId: 13232361, // Add your own placement id here |
| 18 | + var videoAdUnit = { |
| 19 | + code: "video1", |
| 20 | + mediaTypes: { |
| 21 | + video: { |
| 22 | + context: "instream", |
| 23 | + playerSize: [640, 480], |
| 24 | + mimes: ["video/mp4"], |
| 25 | + protocols: [1, 2, 3, 4, 5, 6, 7, 8], |
| 26 | + playbackmethod: [2], |
| 27 | + skip: 1, |
| 28 | + }, |
41 | 29 | }, |
42 | | - }, |
43 | | - ], |
44 | | - }; |
| 30 | + bids: [ |
| 31 | + { |
| 32 | + bidder: "appnexus", |
| 33 | + params: { |
| 34 | + placementId: 13232361, // Add your own placement id here |
| 35 | + }, |
| 36 | + }, |
| 37 | + ], |
| 38 | + }; |
45 | 39 |
|
46 | | - pbjs.que.push(function () { |
47 | | - pbjs.addAdUnits(videoAdUnit); // add your ad units to the bid request |
48 | | - pbjs.setConfig({ |
49 | | - debug: true, |
50 | | - cache: { |
51 | | - url: "https://prebid.example.com/pbc/v1/cache", |
52 | | - }, |
53 | | - }); |
| 40 | + pbjs.que.push(function () { |
| 41 | + pbjs.addAdUnits(videoAdUnit); // add your ad units to the bid request |
| 42 | + pbjs.setConfig({ |
| 43 | + debug: true, |
| 44 | + cache: { |
| 45 | + useLocal: true |
| 46 | + }, |
| 47 | + }); |
| 48 | + |
| 49 | + pbjs.requestBids({ |
| 50 | + bidsBackHandler: function (bids) { |
| 51 | + pbjs.adServers.gam.getVastXml({ |
| 52 | + bid: bids.video1.bids[0], |
| 53 | + adUnit: videoAdUnit, |
| 54 | + params: { |
| 55 | + iu: '/41758329/localcache', |
| 56 | + }, |
| 57 | + }).then(vastXml => { |
| 58 | + window.runJWPlayer(vastXml); |
| 59 | + }) |
54 | 60 |
|
55 | | - pbjs.requestBids({ |
56 | | - bidsBackHandler: function (bids) { |
57 | | - var videoUrl = pbjs.adServers.dfp.buildVideoUrl({ |
58 | | - adUnit: videoAdUnit, |
59 | | - params: { |
60 | | - iu: "/19968336/prebid_cache_video_adunit", |
61 | | - cust_params: { |
62 | | - section: "blog", |
63 | | - anotherKey: "anotherValue", |
64 | | - }, |
65 | | - output: "vast", |
66 | 61 | }, |
67 | 62 | }); |
68 | | - window.runJWPlayer(videoUrl); |
69 | | - }, |
70 | | - }); |
71 | | - }); |
| 63 | + }); |
| 64 | + |
| 65 | + }) |
72 | 66 | </script> |
73 | 67 | </head> |
74 | 68 |
|
|
0 commit comments