<!-- Notice: Codepen requires YouTube embed/video to be muted if using autoplay which adwire adds automatically for seamless user experience. This won't be required on your website. -->
<div class="adwire-responsive">
<iframe loading="lazy" width="560" height="315" src="https://www.youtube.com/embed/R6MlUcmOul8?mute=1" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen referrerpolicy="no-referrer"></iframe>
</div>
@charset "utf-8";
.adwire-responsive {
position: relative;
padding-bottom: 56.25%;
}
.adwire-responsive > iframe, /* original YouTube iframe */
.adwire-responsive .adwire-iframe,
.adwire-responsive .adwire {
position: absolute;
}
.adwire-responsive > iframe, /* original YouTube iframe */
.adwire-responsive .adwire-iframe,
.adwire-responsive .adwire,
.adwire-responsive .adwire .adwire-ad,
.adwire-responsive .adwire .adwire-ad > *,
.adwire-responsive .adwire .adwire-ad iframe,
.adwire-responsive .adwire .adwire-ad video {
width: 100% !important;
height: 100% !important;
}
"use strict";
window.pbjs = window.pbjs || {};
window.pbjs.que = window.pbjs.que || [];
const adTagPromise = new Promise((resolve) => {
const videoAdUnit = {
code: "video1",
mediaTypes: {
video: {
context: "outstream",
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 own placement id */
}
}
]
};
window.pbjs.que.push(() => {
window.pbjs.addAdUnits(videoAdUnit);
window.pbjs.setConfig({
debug: true,
cache: {
url: "https://prebid.adnxs.com/pbc/v1/cache"
}
});
window.pbjs.requestBids({
bidsBackHandler: (bids) => {
const videoUrl = window.pbjs.adServers.dfp.buildVideoUrl({
adUnit: videoAdUnit,
params: {
iu: "/19968336/prebid_cache_video_adunit",
output: "vast"
}
});
console.log("Got ad tag from prebid:", videoUrl);
resolve(videoUrl);
}
});
});
});
new Adwire({
adTagUrl: adTagPromise,
cookies: true,
mode: Adwire.Mode.INSTREAM_IFRAME_YOUTUBE,
private: true,
terms: true
}).run(document.querySelector("iframe[src^='https://www.youtube.com/embed/']"));