window.onload = function() {
const prerollDiv = document.getElementById(“vid_player”);
prerollDiv.style.position = “relative”;
const overlay = document.createElement(“div”);
overlay.id = “preroll-overlay”;
overlay.style.position = “absolute”;
overlay.style.top = “0”;
overlay.style.left = “0”;
overlay.style.width = “100%”;
overlay.style.height = “100%”;
overlay.style.background = “url(’00IMG/qMmgZJW9du.jpg’) no-repeat center center”;
overlay.style.backgroundSize = “cover”;
overlay.style.display = “flex”;
overlay.style.justifyContent = “center”;
overlay.style.alignItems = “center”;
const playButton = document.createElement(“button”);
playButton.classList.add(“play-button”);
playButton.textContent = “Play”;
playButton.style.padding = “20px 30px”;
playButton.style.backgroundColor = “rgba(0, 0, 0, 0.5)”;
playButton.style.color = “white”;
playButton.style.fontSize = “24px”;
playButton.style.border = “none”;
playButton.style.borderRadius = “5px”;
playButton.style.cursor = “pointer”;
playButton.style.fontFamily = “Arial, sans-serif”;
playButton.onmouseover = function() {
playButton.style.backgroundColor = “rgba(0, 0, 0, 0.7)”;
};
playButton.onmouseout = function() {
playButton.style.backgroundColor = “rgba(0, 0, 0, 0.5)”;
};
overlay.appendChild(playButton);
prerollDiv.appendChild(overlay);
playButton.onclick = function() {
// Remove the overlay and play button
overlay.style.display = “none”;
const iframe = document.createElement(“iframe”);
iframe.src = “https://bigwarp.io/e/23lo3vwrg6nj”;
iframe.width = “100%”;
iframe.height = “500px”;
iframe.scrolling = “no”;
iframe.frameBorder = “0”;
iframe.allowFullscreen = true;
prerollDiv.appendChild(iframe);
};
window.addEventListener(‘resize’, function() {
const prerollHeight = prerollDiv.offsetHeight;
const prerollWidth = prerollDiv.offsetWidth;
overlay.style.height = prerollHeight + ‘px’;
overlay.style.width = prerollWidth + ‘px’;
});
const prerollHeight = prerollDiv.offsetHeight;
const prerollWidth = prerollDiv.offsetWidth;
overlay.style.height = prerollHeight + ‘px’;
overlay.style.width = prerollWidth + ‘px’;
};