Nejslavnější porodní báby. Kariéru jedné zničila mrtvá princezna, další zavraždili Indiáni

13. 4. 2024

Sdílet

Autor: Depositphotos
Ženy si odedávna navzájem pomáhaly při porodech a pečovaly o sebe ve chvílích nejtěžších. Ženským údělem bývalo přivádět na svět dědice, rodit děti jako na běžícím pásu, proto porodní báby měly stále co dělat. Byly potřebné, stejně jako jejich letité zkušenosti a znalosti léčivých bylin či různých pověr a magických rituálů.

Kdo se nejvíce zasloužil o rozvoj babického řemesla, které porodní báby se proslavily, jaké byly jejich osudy a kteří muži jim byli v porodnictví nápomocni?

Nejprve si pojďme připomenout, kdo se mohl stát porodní bábou a co všechno bylo po těchto ženách vyžadováno. Kupodivu se velice dbalo na to, aby porodní báby byly znalé a vyškolené, bezúhonné, počestné, čistotné, zodpovědné, mlčenlivé a diskrétní, také bylo vhodné, aby již samy porodily alespoň jedno dítě, a dobře tak věděly, o čem to je. 

Neměla jim chybět ani dobrá fyzická kondice a psychická odolnost, protože se často nevyspaly a musely odcházet k porodům, kdykoliv to bylo potřeba. Tuto práci rozhodně nemohla provádět jakákoliv žena, které se jen tak zlíbilo. Od 18. století například i císařovna Marie Terezie podporovala to, aby byly porodní báby pečlivě školené a aby se vzdělávaly.

Porodní asistentky se staly součástí dědictví UNESCO, čeští lékaři jim uvolňují pozice jen neradi Přečtěte si také:

Porodní asistentky se staly součástí dědictví UNESCO, čeští lékaři jim uvolňují pozice jen neradi

Vina za smrt se svalovala na bábu

Porodní báby to napříč časem neměly vůbec jednoduché. Třeba v případech, kdy se něco nepovedlo. Což se bohužel stávalo až příliš často a většinou za to ani nemohly. Ve chvílích, kdy nebyla lékařská péče a hygiena na takové úrovni, poměrně často docházelo k úmrtí ženy či dítěte při porodu, anebo bezprostředně po něm.

Dítě mohlo zemřít během porodu či těsně po něm, matky dostávaly horečku omladnic, nebo umíraly na preeklampsii či další porodní komplikace. Někdy zemřela matka i dítě během komplikovaného porodu, jindy se dítě narodilo s vývojovou vadou neslučitelnou se životem. 

Ambulantně u Apolináře? Nevídáno, neslýcháno. A teď ještě aspoň ty porodní domy Přečtěte si také:

Ambulantně u Apolináře? Nevídáno, neslýcháno. A teď ještě aspoň ty porodní domy

V mnoha případech se vina a zodpovědnost za život a smrt matky i dítěte svalovala právě na porodní bábu, která kvůli tomu pak byla pronásledována, trestána či zbavena možnosti vykonávat dále svou práci. To v těch lepších případech, protože jí třeba hrozily i daleko horší tresty včetně trestu smrti a obvinění ze zabití.

Proto bylo babictví velice důležité, potřebné, ale zároveň příliš zodpovědné a nevděčné povolání. Přivést na svět nového člověka vyžadovalo obrovskou zodpovědnost. Porodní báby měly zkušenosti a znalosti z medicíny, lékař často nebyl po ruce a chudé rodiny si jej rozhodně nemohly dovolit. 

Mezi porodními asistentkami a lékaři navíc panoval odvěký boj o to, kdo s koho. Kdo je lepší, kdo lépe rozumí své práci, nebo kdo co zpackal. To se dochovalo do dneška. Někdy ale lékaři rádi spolupracovali a školili porodní sestry, aby tak mohly samostatně pomáhat dětem na svět a lékařům ulehčovaly práci.

Líbí se vám, když nekomplikovaný porod vedou jen porodní asistentky?

Vyškolili tisícovky porodních asistentek

V 19. století mezi lékaře podporující práci porodních asistentek patřil například český lékař Antonín Jan Jungmann (1775–1854), bratr obrozeneckého Josefa Jungmanna. Tento lékař převzal po lékaři Janu Meličovi, který rovněž pomáhal rozvoji porodnictví, místo na pražské klinice a usiloval o zdokonalení porodnického umění a školení porodních asistentek. 

Založil porodnickou školu a napsal učebnici pro porodní báby Úvod k babení, která byla později vydána jako Umění babické k užitku žen při porodu obsluhujících, přepracovaná do podoby otázek a odpovědí. Jungmann zavedl psaní porodopisů, zařídil pro ženy českou knihovnu, nechal postavit byty pro porodní báby a vybudoval i tajné pokoje, kdy mohly ženy porodit anonymně v utajení.

Soud zrušil pokutu za porod doma, ale ministerstvo je zatím asistentkám nedovolí Přečtěte si také:

Soud zrušil pokutu za porod doma, ale ministerstvo je zatím asistentkám nedovolí

Jeho porodnická škola získala věhlas po celé tehdejší Evropě i Americe. V druhé polovině 19. století za ním přišly k vyškolení celé tisícovky asistentek z celého světa. Mezi jeho žáky a nástupce, kteří se věnovali rozvoji porodnictví, patřili například František Jan Mošner (1797–1876) a předčasně zemřelý Alexander Kiwisch (1814–1851). Oba mají své zásluhy a František Mošner rovněž sepsal učebnici pro porodní asistentky. Výuku porodních asistentek vedl také Václav Rubeška (1854–1933), který prosazoval moderní postupy a vyškolil více než 5000 porodních asistentek. Napsal pro ně i učebnici Porodnictví pro babičky, která poprvé vyšlo roku 1893.

Ale zatímco Antonín Jungmann získal největší věhlas, jeho o něco málo starší kolega Jan Melič (1763–1837), po němž Jungmann převzal kliniku, se moc uznání nedočkal. Založil a vedl privátní porodnici, kterou později rozšířil na ambulantní nemocnici pro chudé matky a opuštěné děti. To vše na vlastní náklady. Měl silné sociální cítění a snažil se pomáhat tam, kde to bylo potřeba. Vymyslel i systém zdravotního pojištění a sociální péče pro chudé. Také vyučoval porodní asistentky. Pro neshody s profesorským sborem lékařské fakulty však odešel v roce 1906 do Vídně. Zemřel v chudobě a zapomnění.

Zpackaný porod jí poznamenal kariéru

Jednou za známých francouzských porodních bab, která působila již v 16. a 17. století, byla Louise Bourgeois Boursier (1563–1636). Napsala několik příruček pro porodní báby, například v roce 1609 Různá pozorování o neplodnosti, ztrátě plodu, plodnosti, porodech a nemocech žen a dětí. Tuto knihu věnovala francouzské královně, druhé vydání obsahovalo navíc kapitolu O porodech, Křtění dětí Francie, Pod králem Jindřichem IV. a Pokyny mé dceři. 

Později vydala Pravdivou zprávu narození pánů a dam, dětí Francie a v roce 1635 první učebnici pro porodní báby s četnými zkušenostmi ze své praxe. Budoucí porodní asistentky nabádala k tomu, aby důkladně poznaly ženskou anatomii, třeba i tím, že se budou účastnit pitev ženských těl.

Tuto věhlasnou porodní bábu začalo porodnictví zajímat tehdy, kdy měla za sebou svůj první porod. Navíc měla jako manželka chirurga přístup k mnoha zajímavým informacím. Pracovala pak na francouzském královském dvoře, bohužel však její bezchybná pověst utrpěla v roce 1627, kdy zemřela princezna Marie de Bourbon-Montpensier na horečku omladnic. To velmi negativně poznamenalo její kariéru porodní báby.

Jednou z dalších významných francouzských porodních bab byla Marguerite du Tertre de Lamarche (1638–1706), která se velice věnovala vzdělávání porodních asistentek. Organizovala pro ně také tříměsíční vzdělávací kurzy a vydávala učebnice.

Galerie: Nejhezčí porodní fotky roku 2023 podle asociace fotografů

Zavražděna Indiány

Další známá porodní bába měla tragický osud. Anna Hutchinson (1590–1643), která působila v Bostonu, patřila mezi velmi zodpovědné porodní báby, byla silně věřící a zároveň také bojovala za práva žen. Bohužel měla velkou smůlu. Jednou se narodilo dítě s vrozenou vývojovou vadou neslučitelnou se životem, navíc se dostávala do věčných sporů s puritánskými kolonisty a byla považována za kacířku. Veškerá vina padla na nebohou porodní bábu, která byla nakonec s rodinou vyhoštěna.

Usadila se na Rhode Islandu, kde záhy přišla o život s šesti nejmladšími dětmi a členy domácnosti, kdy je nelítostně a brutálně povraždili Siwanoyové. Za svůj život porodila 15 dětí, starší zůstali v Nové Anglii, po masakru byla ušetřena devítiletá dcera se zrzavými vlasy, která byla na sběru borůvek a kterou Indiáni vzali do zajetí, pak s nimi následujících šest let žila. Podle Anny Hutchinson byla pojmenovaná řeka Hutchinson River. K této výjimečné ženě se váže i spousta legend.

I když neměla děti, babila

Známou německou porodní bábou byla Justine Dittrich Siegemundin (1636–1705). Tato dcera faráře si myslela, že je těhotná, proto se začala zajímat o porodnictví. Její těhotenství se však nepotvrdilo, a přestože sama neměla děti, mohla později vykonávat profesi porodní báby. Postupně si získala uznání a pruský císař Fridrich III. ji jmenoval Dvorní porodní bábou Pruska. V roce 1690 vydala knihu o porodním babictví, která byla napsána formou dialogu mezi ní a její studentkou Christinou.

Zdroje: 

en.wikipedia.org, diplomová práce Vzdělávání porodních asistentek, Bc. Anna Holinková, DOLEŽAL, Antonín, 2001. Od babictví k porodnictví. Praha: Karolinum. VRÁNOVÁ, Věra, 2007. Historie babictví a současnost porodní asistence. Olomouc:
Univerzita Palackého v Olomouci.

Autor článku

Externí redaktorka a copywriterka píšící pro webové i tištěné magazíny. Zaměřuje se na oblast zdraví, historie medicíny, psychologie, filozofie, etikoterapie a alternativní medicíny.

'; 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 »