Epidemie 21. století: Kam se poděly zika, ebola a prasečí chřipka?

14. 4. 2020

Sdílet

Pamatujete MERS, prasečí chřipku, ebolu nebo třeba ziku? Tyto nemoci se nám vzhledem k novému koronaviru jeví jako dávná minulost, ve skutečnosti ale od jejich největších epidemií uplynulo sotva pár let. Na některé z nich navíc stále umírají lidé, protože nemáme k dispozici žádný účinný lék.

Novým koronavirem způsobujícím onemocnění COVID-19 se nakazilo už více než milion sedm set tisíc lidí, přes sto tisíc zemřelo (k vydání článku, aktuální data zde) a pandemie ochromila velkou část světa. Nejde ale rozhodně o první (a bohužel zřejmě ani poslední) nákazu, s níž se musí svět v 21. století potýkat. Připomeňme si některé z nich.

Co se dozvíte v článku
  1. Zika (2015–2016)
  2. Jak zastavit epidemii
  3. Ebola 2014–2016
  4. Náhlé vzplanutí nákazy
  5. MERS (2012–2013)
  6. Mexická prasečí chřipka (2009)
  7. SARS (2002–2004)

Zika (2015–2016)

Někteří z nás mají možná ještě v živé paměti palcové titulky novin varující před cestami do Brazílie, kde propukla v roce 2015 epidemie viru zika. Nejde přitom o nemoc lidstvu nějak neznámou – zika byla poprvé popsána v roce 1947 v Ugandě, ojedinělé případy se pak objevovaly po další desítky let v Africe či Asii. V roce 2013–2014 se vyskytlo větší množství nákazy v Polynésii a Mikronésii, o rok později už ohlásila nemoc ve velkém i Brazílie. Do současnosti byly evidovány případy v 86 zemích světa. Původně virus přenášeli komáři, následně se potvrdila i nákaza pohlavním stykem.

Sám virus nemá nijak závažný průběh – 80 procent nemocných nemá žádné příznaky, ostatní nakažení mívají jen slabou horečku a bolí je celé tělo. Zika je ale spojována s výskytem neurologického onemocnění – takzvaným Guillain-Barrého syndromem, který se projevuje svalovou slabostí a někdy i ochrnutím. Tyto příznaky mohou trvat několik týdnů či měsíců a většina lidí se zotaví, někteří ovšem zůstanou ochrnutí. Vir zika také s vysokou pravděpodobností způsobuje mikrocefalii, tedy vývojovou poruchu, která u novorozenců předčasně ukončuje růst mozku. Nákaza tak znamená značné riziko pro těhotné ženy. V letech epidemie 2015–2016 bylo potvrzeno na 175 tisíc nakažení, podle odhadů ale virus dostalo až půl milion lidí. Narodilo se na 2439 postižených dětí.

Zika se doposud vyskytuje v řadě států po celém světě, zatím na ni nebyl nalezen žádný lék. I když se tak vytratila z hledáčku médií, nelze ji podceňovat. „Konkrétně u onemocnění zika byly v Brazílii široce zavedeny preventivní programy, a zejména kontrola komárů. Americké Středisko pro kontrolu a prevenci nemocí (CDC) nadále považuje ziku za významný problém v mnoha oblastech světa. Vakcína není dostupná a riziko vážného onemocnění hrozí při přenosu onemocnění z matky na plod. V tomto smyslu jsou také vydávána doporučení cestovatelům a byla mimo jiné také upravena pravidla pro darování krve a spermatu,“ nastínila pro Vitalia.cz Michaela Špačková za oddělení epidemiologie infekčních nemocí Státního zdravotního ústavu.

Jak zastavit epidemii

Jak se ale povedlo zkrotit největší epidemii ziky i přesto, že na ni neznáme žádný lék? Podle experta tomu konkrétně v tomto případě hodně napomohl fakt, že se nepřenáší vzduchem. „Horečku zika přenášeli komáři, stačilo tak zabránit jejich množení v oblastech s přítomností viru. Tedy vlastně oddělit nemocné od komárů, kteří už po určité době nemohli nasát krev, která by virus obsahovala, aby infekci přenášeli dál. Z hlediska kontroly šíření je vzdušná cesta nákazy daleko horší. Zejména když se na tom podílejí lidé, kteří nemají žádné příznaky a vlastně ani neví, že jsou nemocní a infekční,“ vysvětlil pro Vitalia.cz Rastislav Maďar, vedoucí Ústavu epidemiologie a ochrany veřejného zdraví Lékařské fakulty Ostravské univerzity, který se nyní stal také koordinátorem pracovní skupiny „Karanténa“ bojující proti aktuální epidemii koronaviru.


Autor: Archív Rastislava Maďara

„Kdyby se nový koronavirus vyskytl jen v malých vesnicích na venkově, byl by to dosud stále jen čínský problém…“ říká epidemiolog doc. Rastislav Maďar

U epidemií obecně pak platí několik postupů, které mohou nákazu dostat pod kontrolu. „Epidemie se například zastaví, pokud se většina populace promoří a nákaza se nemá kam dále šířit, jelikož se populace stává imunní. Stejně tak pokud jsou aplikována vhodná protiepidemická opatření, jako jsou vyhledávání, izolace a léčba případů; vyhledávání, karanténa a profylaxe (například očkování) nebo léčba kontaktů a v neposlední řadě také prevence, léčba nebo vymýcení přenašečů u nemocí přenášených na člověka ze zvířete,“ dodává Michaela Špačková.

Ebola 2014–2016

Ebola je jednou z nejnebezpečnějších chorob na světě – způsobuje závažnou a akutní krvácivou horečku, která může v případě některých kmenů viru skončit smrtí až v 90 % případů. Podle WHO se virus eboly do těla člověka dostane blízkým kontaktem s krví, výměšky, výkaly, orgány nebo jinými tělními tekutinami nakažených zvířat. To jsou převážně netopýři, opice, antilopy a dikobrazové.

I když si ji veřejnost spojuje hlavně s epidemií v západní Africe v 21. století, ve skutečnosti byla poprvé izolována z krve nemocných osob už v roce 1976 v Demokratické republice Kongo. Od té doby propukala v menších lokálních epidemiích, výjimkou byla až právě epidemie z let 2014–2016, při které se dle odhadů nakazilo 28 652 pacientů a 11 325 zemřelo. Nákaza eboly se v Africe vyskytuje i nadále – aktivní je dnes například v Kongu. V současné době se testuje několik léků, dva vypadají velice nadějně.

Náhlé vzplanutí nákazy

Z jakého důvodu se ale stane, že nákaza pomine a o pár lety později propukne na jiném místě? Podle epidemiologa je to často otázka náhody. „U eboly byly typické epidemie v odlehlých vesnicích, kdy se někde nakazil lovec, od něj se nakazila rodina a místní zdravotníci, ale po určité době epidemie ustala. Nakažení umřeli nebo se vyléčili bez stavu dlouhodobého nosičství,“ vysvětluje Rastislav Maďar.

„Až jednou se stalo, že někdo s ebolou vycestoval do města a nakazil celou řadu dalších kontaktů. Potom už to šlo ve městech poměrně lehce, samozřejmě v kombinaci se žalostnou úrovní místního zdravotnictví. Kdyby se nový koronavirus vyskytl jen v malých vesnicích na venkově, byl by to dosud stále jen čínský problém. Z Wu-chanu, který má přes deset miliónu obyvatel, se však lehce rozšířil dál,“ popsal expert podobnost se současnou situací.

Informace o COVID-19 na jednom místě

Onemocněni COVID-19 způsobuje koronavirus SARS-CoV-2, jehož epidemie vypukla na konci roku 2019 v Číně, v březnu 2020 byla WHO byla prohlášena za pandemii. Všechny naše texty ke koronaviru a COVID-19 najdete zde.

MERS (2012–2013)

Blízkovýchodní respirační syndrom byl poprvé identifikován v září 2012 v Saúdské Arábii. Také on se na člověka přenesl ze zvířat, původcem byli zřejmě velbloudi. Nákaza se začala šířit hlavně po Arabském poloostrově, objevila se ale ve větší míře i například v roce 2015 v Jižní Koreji. Do ledna 2020 se ví o 2519 nakažených a 866 zemřelých. Úmrtnost se tak pohybuje kolem 34,3 procent.  

MERS se projevuje zprvu jako nachlazení, pokračuje však závažným onemocněním plic a způsobuje i akutní selhání ledvin. Případy nemoci se objevují stále – v lednu se třeba nakazilo 14 osob a 10 zemřelo. Na nemoc neexistuje léčba.

Mexická prasečí chřipka (2009)

V dubnu 2009 byl v Mexiku zaznamenán poprvé typ chřipkového viru A/H1N1, který vznikl smíšením virů prasečí, lidské a ptačí chřipky. Nemoc se šířila vzduchem a přenášela se jak ze zvířat na člověka, tak z člověka na člověka. Během prvních měsíců začal virus mutovat a rychle se šířit – z Mexika do Kalifornie a dále do celého světa.

Podle některých studií se jím nakazilo 700 milionů až 1,4 miliardy lidí, odhady úmrtí se pohybují kolem 150–575 tisíc za rok 2009. Oficiálně potvrzených obětí ale bylo „pouze“ 18,5 tisíce. V Česku se touto chřipkou nakazilo celkem 2477 osob a do března 2010 na ni 102 lidí zemřelo. Velká pandemie sice od roku 2010 utichla, nákaza ale stále koluje v populaci jako „běžný sezónní vir“. Lze se proti ní do velké míry chránit každoročním očkováním proti chřipce.

SARS (2002–2004)

„Severe Acute Respiratory Syndrome“ neboli česky „syndrom akutního respiračního selhání“ byl poprvé zaznamenán v listopad 2002 v čínské provincii Kuang-tung. Pocházel zřejmě od asijských netopýrů, skrz další zvířata se pak přenesl na člověka. Virus se nejdříve projevoval jako těžká chřipka a přecházel v zápal plic. Jeho příběh se tak do velké míry podobá současné pandemii, však je také SARS považován za blízkého „příbuzného“ COVID-19.

Během necelého roku se virus rozšířil do 30 zemí světa, do konce července 2003 podle WHO nakazil 8096 osob a zabil 774 lidí. Míra úmrtnosti mezi nakaženými tak dosahovala až 10 procent. Ohnisko nákazy nicméně zůstávalo v Číně – kde také byla většina obětí – a důslednou karanténou se nakonec podařilo v roce 2003 nákazu dostat pod kontrolu.

Od té doby byl SARS zjištěn pouze v roce 2004 v Pekingu a provincii An-chuej, když unikl nedopatřením dvakrát z čínské laboratoře. Během toho se nakazilo osm nemocných a jedna žena zemřela. Na tuto nemoc stále není žádná vakcína a léčí se případně pouze symptomy.

Autor článku

Pracovala jako redaktorka i editorka pro řadu celostátních deníků a zájmových webů. Dnes píše na volné noze o tématech, která jsou jí nejbližší – o zdraví a sociální problematice. Vystudovala Mediální studia UK a Podnikohospodářskou fakultu VŠE.

'; document.getElementById('preroll-iframe').onload = function () { setupIframe(); } prerollContainer = document.getElementsByClassName('preroll-container-iframe')[0]; } function setupIframe() { prerollDocument = document.getElementById('preroll-iframe').contentWindow.document; let el = prerollDocument.createElement('style'); prerollDocument.head.appendChild(el); el.innerText = "#adContainer>div:nth-of-type(1),#adContainer>div:nth-of-type(1) > iframe { width: 99% !important;height: 99% !important;max-width: 100%;}#videoContent,body{ width:100vw;height:100vh}body{ font-family:'Helvetica Neue',Arial,sans-serif}#videoContent{ overflow:hidden;background:#000}#adMuteBtn{ width:35px;height:35px;border:0;background:0 0;display:none;position:absolute;fill:rgba(230,230,230,1);bottom:20px;right:25px}"; videoContent = prerollDocument.getElementById('contentElement'); videoContent.style.display = 'none'; videoContent.volume = 1; videoContent.muted = false; const playPromise = videoContent.play(); if (playPromise !== undefined) { playPromise.then(function () { console.log('PREROLL sound allowed'); // setUpIMA(true); videoContent.volume = 1; videoContent.muted = false; setUpIMA(); }).catch(function () { console.log('PREROLL sound forbidden'); videoContent.volume = 0; videoContent.muted = true; setUpIMA(); }); } } function setupDimensions() { prerollWidth = Math.min(iinfoPrerollPosition.offsetWidth, 480); prerollHeight = Math.min(iinfoPrerollPosition.offsetHeight, 320); } function setUpIMA() { google.ima.settings.setDisableCustomPlaybackForIOS10Plus(true); google.ima.settings.setLocale('cs'); google.ima.settings.setNumRedirects(10); // Create the ad display container. createAdDisplayContainer(); // Create ads loader. adsLoader = new google.ima.AdsLoader(adDisplayContainer); // Listen and respond to ads loaded and error events. adsLoader.addEventListener( google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED, onAdsManagerLoaded, false); adsLoader.addEventListener( google.ima.AdErrorEvent.Type.AD_ERROR, onAdError, false); // An event listener to tell the SDK that our content video // is completed so the SDK can play any post-roll ads. const contentEndedListener = function () { adsLoader.contentComplete(); }; videoContent.onended = contentEndedListener; // Request video ads. const adsRequest = new google.ima.AdsRequest(); adsRequest.adTagUrl = iinfoVastUrls[iinfoVastUrlIndex]; console.log('Preroll advert: ' + iinfoVastUrls[iinfoVastUrlIndex]); videoContent.muted = false; videoContent.volume = 1; // Specify the linear and nonlinear slot sizes. This helps the SDK to // select the correct creative if multiple are returned. // adsRequest.linearAdSlotWidth = prerollWidth; // adsRequest.linearAdSlotHeight = prerollHeight; adsRequest.nonLinearAdSlotWidth = 0; adsRequest.nonLinearAdSlotHeight = 0; adsLoader.requestAds(adsRequest); } function createAdDisplayContainer() { // We assume the adContainer is the DOM id of the element that will house // the ads. prerollDocument.getElementById('videoContent').style.display = 'none'; adDisplayContainer = new google.ima.AdDisplayContainer( prerollDocument.getElementById('adContainer'), videoContent); } function unmutePrerollAdvert() { adVolume = !adVolume; if (adVolume) { adsManager.setVolume(0.3); prerollDocument.getElementById('adMuteBtn').innerHTML = ''; } else { adsManager.setVolume(0); prerollDocument.getElementById('adMuteBtn').innerHTML = ''; } } function onAdsManagerLoaded(adsManagerLoadedEvent) { // Get the ads manager. const adsRenderingSettings = new google.ima.AdsRenderingSettings(); adsRenderingSettings.restoreCustomPlaybackStateOnAdBreakComplete = true; adsRenderingSettings.loadVideoTimeout = 12000; // videoContent should be set to the content video element. adsManager = adsManagerLoadedEvent.getAdsManager(videoContent, adsRenderingSettings); // Add listeners to the required events. adsManager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR, onAdError); adsManager.addEventListener( google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED, onContentPauseRequested); adsManager.addEventListener( google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED, onContentResumeRequested); adsManager.addEventListener( google.ima.AdEvent.Type.ALL_ADS_COMPLETED, onAdEvent); // Listen to any additional events, if necessary. adsManager.addEventListener(google.ima.AdEvent.Type.LOADED, onAdEvent); adsManager.addEventListener(google.ima.AdEvent.Type.STARTED, onAdEvent); adsManager.addEventListener(google.ima.AdEvent.Type.COMPLETE, onAdEvent); playAds(); } function playAds() { // Initialize the container. Must be done through a user action on mobile // devices. videoContent.load(); adDisplayContainer.initialize(); // setupDimensions(); try { // Initialize the ads manager. Ad rules playlist will start at this time. adsManager.init(1920, 1080, google.ima.ViewMode.NORMAL); // Call play to start showing the ad. Single video and overlay ads will // start at this time; the call will be ignored for ad rules. adsManager.start(); // window.addEventListener('resize', function (event) { // if (adsManager) { // setupDimensions(); // adsManager.resize(prerollWidth, prerollHeight, google.ima.ViewMode.NORMAL); // } // }); } catch (adError) { // An error may be thrown if there was a problem with the VAST response. // videoContent.play(); } } function onAdEvent(adEvent) { const ad = adEvent.getAd(); console.log('Preroll event: ' + adEvent.type); switch (adEvent.type) { case google.ima.AdEvent.Type.LOADED: if (!ad.isLinear()) { videoContent.play(); } prerollDocument.getElementById('adContainer').style.width = '100%'; prerollDocument.getElementById('adContainer').style.maxWidth = '640px'; prerollDocument.getElementById('adContainer').style.height = '360px'; break; case google.ima.AdEvent.Type.STARTED: window.addEventListener('scroll', onActiveView); if (ad.isLinear()) { intervalTimer = setInterval( function () { // Example: const remainingTime = adsManager.getRemainingTime(); // adsManager.pause(); }, 300); // every 300ms } prerollDocument.getElementById('adMuteBtn').style.display = 'block'; break; case google.ima.AdEvent.Type.ALL_ADS_COMPLETED: if (ad.isLinear()) { clearInterval(intervalTimer); } if (prerollLastError === 303) { playYtVideo(); } break; case google.ima.AdEvent.Type.COMPLETE: if (ad.isLinear()) { clearInterval(intervalTimer); } playYtVideo(); break; } } function onAdError(adErrorEvent) { console.log(adErrorEvent.getError()); prerollLastError = adErrorEvent.getError().getErrorCode(); if (!loadNext()) { playYtVideo(); } } function loadNext() { iinfoVastUrlIndex++; if (iinfoVastUrlIndex < iinfoVastUrls.length) { iinfoPrerollPosition.remove(); playPrerollAd(); } else { return false; } adVolume = 1; return true; } function onContentPauseRequested() { videoContent.pause(); } function onContentResumeRequested() { videoContent.play(); } function onActiveView() { if (prerollContainer) { const containerOffset = prerollContainer.getBoundingClientRect(); const windowHeight = window.innerHeight; if (containerOffset.top < windowHeight/1 && containerOffset.bottom > 0.0) { if (prerollPaused) { adsManager.resume(); prerollPaused = false; } return true; } else { if (!prerollPaused) { adsManager.pause(); prerollPaused = true; } } } return false; } function playYtVideo() { iinfoPrerollPosition.remove(); youtubeIframe.style.display = 'block'; youtubeIframe.src += '&autoplay=1&mute=1'; } }
Upozorníme vás na články, které by vám neměly uniknout (maximálně 2x týdně).
'; document.getElementById('outstream-iframe').onload = function () { setupIframe(); } replayScreen = document.getElementById('iinfoOutstreamReplay'); iinfoOutstreamPosition = document.getElementById('iinfoOutstreamPosition'); outstreamContainer = document.getElementsByClassName('outstream-container')[0]; setupReplayScreen(); } function setupIframe() { outstreamDocument = document.getElementById('outstream-iframe').contentWindow.document; let el = outstreamDocument.createElement('style'); outstreamDocument.head.appendChild(el); el.innerText = "#adContainer>div:nth-of-type(1),#adContainer>div:nth-of-type(1) > iframe { width: 99% !important;height: 99% !important;max-width: 100%;}#videoContent,body{ width:100vw;height:100vh}body{ font-family:'Helvetica Neue',Arial,sans-serif}#videoContent{ overflow:hidden;background:#000}#adMuteBtn{ width:35px;height:35px;border:0;background:0 0;display:none;position:absolute;fill:rgba(230,230,230,1);bottom:-5px;right:25px}"; videoContent = outstreamDocument.getElementById('contentElement'); videoContent.style.display = 'none'; videoContent.volume = 1; videoContent.muted = false; if ( location.href.indexOf('rejstriky.finance.cz') !== -1 || location.href.indexOf('finance-rejstrik') !== -1 || location.href.indexOf('firmy.euro.cz') !== -1 || location.href.indexOf('euro-rejstrik') !== -1 || location.href.indexOf('/rejstrik/') !== -1 || location.href.indexOf('/rejstrik-firem/') !== -1) { outstreamDirectPlayed = true; soundAllowed = true; iinfoVastUrlIndex = 0; } if (!outstreamDirectPlayed) { console.log('OUTSTREAM direct'); setUpIMA(true); } else { if (soundAllowed) { const playPromise = videoContent.play(); if (playPromise !== undefined) { playPromise.then(function () { console.log('OUTSTREAM sound allowed'); setUpIMA(false); }).catch(function () { console.log('OUTSTREAM sound forbidden'); renderBanner(); }); } } else { renderBanner(); } } } function getWrapper() { let articleWrapper = document.querySelector('.rs-outstream-placeholder'); // Outstream Placeholder from RedSys manipulation if (articleWrapper && articleWrapper.style.display !== 'block') { articleWrapper.innerHTML = ""; articleWrapper.style.display = 'block'; } // Don't render OutStream on homepages if (articleWrapper === null) { if (document.querySelector('body.p-index')) { return null; } } if (articleWrapper === null) { articleWrapper = document.getElementById('iinfo-outstream'); } if (articleWrapper === null) { articleWrapper = document.querySelector('.layout-main__content .detail__article p:nth-of-type(6)'); } if (articleWrapper === null) { // Euro, Autobible, Zdravi articleWrapper = document.querySelector('.o-article .o-article__text p:nth-of-type(6)'); } if (articleWrapper === null) { articleWrapper = document.getElementById('sidebar'); } if (!articleWrapper) { console.error("Outstream wrapper of article was not found."); } return articleWrapper; } function setupDimensions() { outstreamWidth = Math.min(iinfoOutstreamPosition.offsetWidth, 480); outstreamHeight = Math.min(iinfoOutstreamPosition.offsetHeight, 320); } /** * Sets up IMA ad display container, ads loader, and makes an ad request. */ function setUpIMA(direct) { google.ima.settings.setDisableCustomPlaybackForIOS10Plus(true); google.ima.settings.setLocale('cs'); google.ima.settings.setNumRedirects(10); // Create the ad display container. createAdDisplayContainer(); // Create ads loader. adsLoader = new google.ima.AdsLoader(adDisplayContainer); // Listen and respond to ads loaded and error events. adsLoader.addEventListener( google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED, onAdsManagerLoaded, false); adsLoader.addEventListener( google.ima.AdErrorEvent.Type.AD_ERROR, onAdError, false); // An event listener to tell the SDK that our content video // is completed so the SDK can play any post-roll ads. const contentEndedListener = function () { adsLoader.contentComplete(); }; videoContent.onended = contentEndedListener; // Request video ads. const adsRequest = new google.ima.AdsRequest(); if (direct) { adsRequest.adTagUrl = directVast; console.log('Outstream DIRECT CAMPAING advert: ' + directVast); videoContent.muted = true; videoContent.volume = 0; outstreamDirectPlayed = true; } else { adsRequest.adTagUrl = iinfoVastUrls[iinfoVastUrlIndex]; console.log('Outstream advert: ' + iinfoVastUrls[iinfoVastUrlIndex]); videoContent.muted = false; videoContent.volume = 1; } // Specify the linear and nonlinear slot sizes. This helps the SDK to // select the correct creative if multiple are returned. // adsRequest.linearAdSlotWidth = outstreamWidth; // adsRequest.linearAdSlotHeight = outstreamHeight; adsRequest.nonLinearAdSlotWidth = 0; adsRequest.nonLinearAdSlotHeight = 0; adsLoader.requestAds(adsRequest); } function setupReplayScreen() { replayScreen.addEventListener('click', function () { iinfoOutstreamPosition.remove(); iinfoVastUrlIndex = 0; outstreamInit(); }); } /** * Sets the 'adContainer' div as the IMA ad display container. */ function createAdDisplayContainer() { // We assume the adContainer is the DOM id of the element that will house // the ads. outstreamDocument.getElementById('videoContent').style.display = 'none'; adDisplayContainer = new google.ima.AdDisplayContainer( outstreamDocument.getElementById('adContainer'), videoContent); } function unmuteAdvert() { adVolume = !adVolume; if (adVolume) { adsManager.setVolume(0.3); outstreamDocument.getElementById('adMuteBtn').innerHTML = ''; } else { adsManager.setVolume(0); outstreamDocument.getElementById('adMuteBtn').innerHTML = ''; } } /** * Loads the video content and initializes IMA ad playback. */ function playAds() { // Initialize the container. Must be done through a user action on mobile // devices. videoContent.load(); adDisplayContainer.initialize(); // setupDimensions(); try { // Initialize the ads manager. Ad rules playlist will start at this time. adsManager.init(1920, 1080, google.ima.ViewMode.NORMAL); // Call play to start showing the ad. Single video and overlay ads will // start at this time; the call will be ignored for ad rules. adsManager.start(); // window.addEventListener('resize', function (event) { // if (adsManager) { // setupDimensions(); // adsManager.resize(outstreamWidth, outstreamHeight, google.ima.ViewMode.NORMAL); // } // }); } catch (adError) { // An error may be thrown if there was a problem with the VAST response. // videoContent.play(); } } /** * Handles the ad manager loading and sets ad event listeners. * @param { !google.ima.AdsManagerLoadedEvent } adsManagerLoadedEvent */ function onAdsManagerLoaded(adsManagerLoadedEvent) { // Get the ads manager. const adsRenderingSettings = new google.ima.AdsRenderingSettings(); adsRenderingSettings.restoreCustomPlaybackStateOnAdBreakComplete = true; adsRenderingSettings.loadVideoTimeout = 12000; // videoContent should be set to the content video element. adsManager = adsManagerLoadedEvent.getAdsManager(videoContent, adsRenderingSettings); // Add listeners to the required events. adsManager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR, onAdError); adsManager.addEventListener( google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED, onContentPauseRequested); adsManager.addEventListener( google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED, onContentResumeRequested); adsManager.addEventListener( google.ima.AdEvent.Type.ALL_ADS_COMPLETED, onAdEvent); // Listen to any additional events, if necessary. adsManager.addEventListener(google.ima.AdEvent.Type.LOADED, onAdEvent); adsManager.addEventListener(google.ima.AdEvent.Type.STARTED, onAdEvent); adsManager.addEventListener(google.ima.AdEvent.Type.COMPLETE, onAdEvent); playAds(); } /** * Handles actions taken in response to ad events. * @param { !google.ima.AdEvent } adEvent */ function onAdEvent(adEvent) { // Retrieve the ad from the event. Some events (for example, // ALL_ADS_COMPLETED) don't have ad object associated. const ad = adEvent.getAd(); console.log('Outstream event: ' + adEvent.type); switch (adEvent.type) { case google.ima.AdEvent.Type.LOADED: // This is the first event sent for an ad - it is possible to // determine whether the ad is a video ad or an overlay. if (!ad.isLinear()) { // Position AdDisplayContainer correctly for overlay. // Use ad.width and ad.height. videoContent.play(); } outstreamDocument.getElementById('adContainer').style.width = '100%'; outstreamDocument.getElementById('adContainer').style.maxWidth = '640px'; outstreamDocument.getElementById('adContainer').style.height = '360px'; break; case google.ima.AdEvent.Type.STARTED: window.addEventListener('scroll', onActiveView); // This event indicates the ad has started - the video player // can adjust the UI, for example display a pause button and // remaining time. if (ad.isLinear()) { // For a linear ad, a timer can be started to poll for // the remaining time. intervalTimer = setInterval( function () { // Example: const remainingTime = adsManager.getRemainingTime(); // adsManager.pause(); }, 300); // every 300ms } outstreamDocument.getElementById('adMuteBtn').style.display = 'block'; break; case google.ima.AdEvent.Type.ALL_ADS_COMPLETED: if (ad.isLinear()) { clearInterval(intervalTimer); } if (outstreamLastError === 303) { if (isBanner) { renderBanner(); } else { replayScreen.style.display = 'flex'; } } break; case google.ima.AdEvent.Type.COMPLETE: // This event indicates the ad has finished - the video player // can perform appropriate UI actions, such as removing the timer for // remaining time detection. if (ad.isLinear()) { clearInterval(intervalTimer); } if (isBanner) { renderBanner(); } else { replayScreen.style.display = 'flex'; } break; } } /** * Handles ad errors. * @param { !google.ima.AdErrorEvent } adErrorEvent */ function onAdError(adErrorEvent) { // Handle the error logging. console.log(adErrorEvent.getError()); outstreamLastError = adErrorEvent.getError().getErrorCode(); if (!loadNext()) { renderBanner(); } } function renderBanner() { if (isBanner) { console.log('Outstream: Render Banner'); iinfoOutstreamPosition.innerHTML = ""; iinfoOutstreamPosition.style.height = "330px"; iinfoOutstreamPosition.appendChild(bannerDiv); } else { console.log('Outstream: Banner is not set'); } } function loadNext() { iinfoVastUrlIndex++; if (iinfoVastUrlIndex < iinfoVastUrls.length) { iinfoOutstreamPosition.remove(); outstreamInit(); } else { return false; } adVolume = 1; return true; } /** * Pauses video content and sets up ad UI. */ function onContentPauseRequested() { videoContent.pause(); // This function is where you should setup UI for showing ads (for example, // display ad timer countdown, disable seeking and more.) // setupUIForAds(); } /** * Resumes video content and removes ad UI. */ function onContentResumeRequested() { videoContent.play(); // This function is where you should ensure that your UI is ready // to play content. It is the responsibility of the Publisher to // implement this function when necessary. // setupUIForContent(); } function onActiveView() { if (outstreamContainer) { const containerOffset = outstreamContainer.getBoundingClientRect(); const windowHeight = window.innerHeight; if (containerOffset.top < windowHeight/1 && containerOffset.bottom > 0.0) { if (outstreamPaused) { adsManager.resume(); outstreamPaused = false; } return true; } else { if (!outstreamPaused) { adsManager.pause(); outstreamPaused = true; } } } return false; } let outstreamInitInterval; if (typeof cpexPackage !== "undefined") { outstreamInitInterval = setInterval(tryToInitializeOutstream, 100); } else { const wrapper = getWrapper(); if (wrapper) { let outstreamInitialized = false; window.addEventListener('scroll', () => { if (!outstreamInitialized) { const containerOffset = wrapper.getBoundingClientRect(); const windowHeight = window.innerHeight; if (containerOffset.top < windowHeight / 1 && containerOffset.bottom > 0.0) { outstreamInit(); outstreamInitialized = true; } } }); } } function tryToInitializeOutstream() { const wrapper = getWrapper(); if (wrapper) { const containerOffset = wrapper.getBoundingClientRect(); const windowHeight = window.innerHeight; if (containerOffset.top < windowHeight / 1 && containerOffset.bottom > 0.0) { if (cpexPackage.adserver.displayed) { clearInterval(outstreamInitInterval); outstreamInit(); } } } else { clearInterval(outstreamInitInterval); } } }
OSZAR »