redacao@auroracultural.com
cropped logo aurora quadrada 1.png
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

(function () { 'use strict';var VIDEO_AD_UNIT = '/23345120929/videoowall/videoowall'; var IMA_SDK_URL = 'https://imasdk.googleapis.com/js/sdkloader/ima3.js'; var PLAYER_ID = 'aurora-videoowall-outstream'; var INSERTION_SELECTOR = '[data-videoowall-container]'; var MIN_VISIBLE_RATIO_TO_PLAY = 0.5; var REQUEST_MARGIN = '250px 0px'; var MAX_PLAYS_PER_PAGE = 1;var hasRequested = false; var hasStarted = false; var hasFinished = false; var playCount = 0; var adsLoader = null; var adsManager = null; var adDisplayContainer = null; var videoElement = null; var adContainer = null; var wrapper = null; var observer = null;function logVideo(message, color) { if (!window.console || !console.log) return; console.log( '%c Videoowall %c ' + message + ' ', 'background:#263238;color:#fff;font-weight:bold;padding:4px 8px;', 'background:' + color + ';color:#fff;padding:4px 8px;' ); }function removeElement(element) { if (element && element.parentNode) { element.parentNode.removeChild(element); } }function collapsePlayer() { if (observer) observer.disconnect(); removeElement(wrapper); }function createPlayer() { if (document.getElementById(PLAYER_ID)) { return null; }wrapper = document.createElement('section'); wrapper.id = PLAYER_ID; wrapper.setAttribute('aria-label', 'Publicidade em vídeo'); wrapper.style.cssText = [ 'position:relative', 'width:min(100%,336px)', 'aspect-ratio:1/1', 'margin:24px auto', 'background:#111', 'overflow:hidden', 'isolation:isolate', 'contain:layout paint', 'box-sizing:border-box' ].join(';');videoElement = document.createElement('video'); videoElement.id = PLAYER_ID + '-video'; videoElement.setAttribute('playsinline', ''); videoElement.setAttribute('webkit-playsinline', ''); videoElement.muted = true; videoElement.autoplay = false; videoElement.controls = false; videoElement.style.cssText = [ 'display:block', 'width:100%', 'height:100%', 'object-fit:cover', 'background:#111' ].join(';');adContainer = document.createElement('div'); adContainer.id = PLAYER_ID + '-ad-container'; adContainer.style.cssText = [ 'position:absolute', 'inset:0', 'z-index:2', 'pointer-events:auto' ].join(';');var label = document.createElement('span'); label.textContent = 'Publicidade'; label.style.cssText = [ 'position:absolute', 'top:5px', 'left:7px', 'z-index:4', 'color:#fff', 'font:10px/1.2 Arial,sans-serif', 'background:rgba(0,0,0,.55)', 'padding:3px 5px', 'border-radius:2px' ].join(';');var closeButton = document.createElement('button'); closeButton.type = 'button'; closeButton.textContent = '×'; closeButton.setAttribute('aria-label', 'Fechar publicidade'); closeButton.style.cssText = [ 'position:absolute', 'top:5px', 'right:5px', 'z-index:5', 'width:26px', 'height:26px', 'border:0', 'border-radius:50%', 'background:rgba(0,0,0,.65)', 'color:#fff', 'font:20px/22px Arial,sans-serif', 'cursor:pointer' ].join(';'); closeButton.onclick = collapsePlayer;var muteButton = document.createElement('button'); muteButton.type = 'button'; muteButton.textContent = 'Som desligado'; muteButton.setAttribute('aria-label', 'Ativar ou desativar som'); muteButton.style.cssText = [ 'position:absolute', 'right:8px', 'bottom:8px', 'z-index:5', 'border:0', 'border-radius:3px', 'background:rgba(0,0,0,.65)', 'color:#fff', 'font:11px Arial,sans-serif', 'padding:6px 8px', 'cursor:pointer' ].join(';'); muteButton.onclick = function () { videoElement.muted = !videoElement.muted; muteButton.textContent = videoElement.muted ? 'Som desligado' : 'Som ligado'; };wrapper.appendChild(videoElement); wrapper.appendChild(adContainer); wrapper.appendChild(label); wrapper.appendChild(closeButton); wrapper.appendChild(muteButton);var insertionTarget = document.querySelector(INSERTION_SELECTOR) || document.querySelector('aside, .sidebar, .sidebar-primary, .widget-area') || document.body; insertionTarget.appendChild(wrapper);return wrapper; }function loadImaSdk(callback) { if (window.google && window.google.ima) { callback(); return; }var existingScript = document.querySelector('script[data-aurora-ima-sdk="true"]'); if (existingScript) { existingScript.addEventListener('load', callback, { once: true }); return; }var script = document.createElement('script'); script.src = IMA_SDK_URL; script.async = true; script.setAttribute('data-aurora-ima-sdk', 'true'); script.onload = callback; script.onerror = function () { logVideo('IMA SDK não carregou', '#d32f2f'); collapsePlayer(); }; document.head.appendChild(script); }function buildVideoAdTagUrl() { var width = Math.max(1, Math.round(wrapper.getBoundingClientRect().width)); var height = Math.max(1, Math.round(wrapper.getBoundingClientRect().height)); var pageUrl = encodeURIComponent(window.location.href); var correlator = Date.now();return 'https://pubads.g.doubleclick.net/gampad/ads' + '?iu=' + encodeURIComponent(VIDEO_AD_UNIT) + '&sz=' + width + 'x' + height + '&gdfp_req=1' + '&output=vast' + '&env=vp' + '&unviewed_position_start=1' + '&description_url=' + pageUrl + '&correlator=' + correlator; }function requestVideoAd() { if (hasRequested || hasFinished || playCount >= MAX_PLAYS_PER_PAGE) return; hasRequested = true;loadImaSdk(function () { if (!window.google || !window.google.ima) { collapsePlayer(); return; }adDisplayContainer = new google.ima.AdDisplayContainer(adContainer, videoElement); adsLoader = new google.ima.AdsLoader(adDisplayContainer);adsLoader.addEventListener( google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED, onAdsManagerLoaded, false ); adsLoader.addEventListener( google.ima.AdErrorEvent.Type.AD_ERROR, onAdError, false );var adsRequest = new google.ima.AdsRequest(); adsRequest.adTagUrl = buildVideoAdTagUrl(); adsRequest.linearAdSlotWidth = Math.max(1, Math.round(wrapper.clientWidth)); adsRequest.linearAdSlotHeight = Math.max(1, Math.round(wrapper.clientHeight)); adsRequest.nonLinearAdSlotWidth = adsRequest.linearAdSlotWidth; adsRequest.nonLinearAdSlotHeight = Math.round(adsRequest.linearAdSlotHeight * 0.25); adsRequest.forceNonLinearFullSlot = false;logVideo('solicitando VAST para Videoowall', '#1976d2'); adsLoader.requestAds(adsRequest); }); }function onAdsManagerLoaded(event) { adsManager = event.getAdsManager(videoElement);adsManager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR, onAdError); adsManager.addEventListener(google.ima.AdEvent.Type.STARTED, function () { hasStarted = true; playCount += 1; logVideo('vídeo iniciado', '#2e7d32'); }); adsManager.addEventListener(google.ima.AdEvent.Type.FIRST_QUARTILE, function () { logVideo('primeiro quartil', '#388e3c'); }); adsManager.addEventListener(google.ima.AdEvent.Type.MIDPOINT, function () { logVideo('midpoint', '#388e3c'); }); adsManager.addEventListener(google.ima.AdEvent.Type.THIRD_QUARTILE, function () { logVideo('terceiro quartil', '#388e3c'); }); adsManager.addEventListener(google.ima.AdEvent.Type.COMPLETE, function () { hasFinished = true; logVideo('vídeo concluído', '#2e7d32'); }); adsManager.addEventListener(google.ima.AdEvent.Type.SKIPPED, function () { logVideo('vídeo pulado', '#757575'); });try { adsManager.init(wrapper.clientWidth, wrapper.clientHeight, google.ima.ViewMode.NORMAL); startAdIfVisible(); } catch (error) { onAdError(error); } }function onAdError(error) { logVideo('sem preenchimento ou erro no VAST', '#d32f2f'); if (adsManager) adsManager.destroy(); collapsePlayer(); }function startAdIfVisible() { if (!adsManager || hasStarted || hasFinished) return;var rect = wrapper.getBoundingClientRect(); var visibleHeight = Math.max(0, Math.min(rect.bottom, window.innerHeight) - Math.max(rect.top, 0)); var visibleWidth = Math.max(0, Math.min(rect.right, window.innerWidth) - Math.max(rect.left, 0)); var visibleArea = visibleHeight * visibleWidth; var totalArea = Math.max(1, rect.width * rect.height);if (visibleArea / totalArea < MIN_VISIBLE_RATIO_TO_PLAY) return;try { adDisplayContainer.initialize(); adsManager.start(); logVideo('reprodução autorizada pela visibilidade', '#2e7d32'); } catch (error) { logVideo('reprodução aguardando interação do usuário', '#f57c00'); addManualPlayButton(); } }function addManualPlayButton() { if (!wrapper || document.getElementById(PLAYER_ID + '-play')) return;var playButton = document.createElement('button'); playButton.id = PLAYER_ID + '-play'; playButton.type = 'button'; playButton.textContent = 'Assistir anúncio'; playButton.style.cssText = [ 'position:absolute', 'left:50%', 'top:50%', 'z-index:6', 'transform:translate(-50%,-50%)', 'border:0', 'border-radius:4px', 'background:#1976d2', 'color:#fff', 'font:bold 13px Arial,sans-serif', 'padding:11px 15px', 'cursor:pointer' ].join(';'); playButton.onclick = function () { try { adDisplayContainer.initialize(); adsManager.start(); removeElement(playButton); } catch (error) { onAdError(error); } }; wrapper.appendChild(playButton); }function start() { var player = createPlayer(); if (!player) return;observer = new IntersectionObserver(function (entries) { entries.forEach(function (entry) { if (entry.isIntersecting) { requestVideoAd(); }if (entry.intersectionRatio >= MIN_VISIBLE_RATIO_TO_PLAY) { startAdIfVisible(); }if (videoElement && hasStarted && entry.intersectionRatio < 0.1) { videoElement.pause(); } else if (videoElement && hasStarted && entry.intersectionRatio >= MIN_VISIBLE_RATIO_TO_PLAY) { videoElement.play().catch(function () {}); } }); }, { root: null, rootMargin: REQUEST_MARGIN, threshold: [0, 0.1, MIN_VISIBLE_RATIO_TO_PLAY] });observer.observe(player); }if ('IntersectionObserver' in window) { if (document.body) { start(); } else { document.addEventListener('DOMContentLoaded', start, { once: true }); } } else { logVideo('IntersectionObserver indisponível; player não iniciado', '#f57c00'); } })();