diff --git a/libs/blocks/adobetv/adobetv.js b/libs/blocks/adobetv/adobetv.js index 85928d1c03..31cfc7a368 100644 --- a/libs/blocks/adobetv/adobetv.js +++ b/libs/blocks/adobetv/adobetv.js @@ -1,15 +1,22 @@ -import { decorateAnchorVideo } from '../../utils/decorate.js'; +import { createIntersectionObserver } from '../../utils/utils.js'; +import { applyHoverPlay, getVideoAttrs } from '../../utils/decorate.js'; -export default function init(a) { - a.classList.add('hide-video'); +const ROOT_MARGIN = 1000; + +const loadAdobeTv = (a) => { const bgBlocks = ['aside', 'marquee', 'hero-marquee']; if (a.href.includes('.mp4') && bgBlocks.some((b) => a.closest(`.${b}`))) { a.classList.add('hide'); + const { href, hash, dataset } = a; + const attrs = getVideoAttrs(hash || 'autoplay', dataset); + const video = ``; if (!a.parentNode) return; - decorateAnchorVideo({ - src: a.href, - anchorTag: a, - }); + a.insertAdjacentHTML('afterend', video); + const videoElem = document.body.querySelector(`source[src="${href}"]`)?.parentElement; + applyHoverPlay(videoElem); + a.remove(); } else { const embed = `