Inconsistent behaviour with Litespeed Cache
-
This might be out-of-scope for this plugin, but if the
iframe
is lazy-loaded by the Litespeed Cache Plugin, then your.play-button
is still added to the page, but the click doesn’t triggerautoplay
on theiframe
.By watching the behaviour in the browser inspector, I can see that your script still removes the
template
tag when the button is clicked. Your script adds the iframe to the page, which is evident because I’ve modified your script to add thedata-wilkinson
attribute. I’ve also addedautoplay="autoplay"
, just in case that was the problem: it isn’t. This doesn’t actually start the video playing when the iframe is inserted.If I disable LCP on this page, the autoplay works as you originally programmed it. Therefore, I’d suggest you check to see whether the iframe is being lazy-loaded. The HTML of the iframe when it’s being lazy-loaded by LCP is:
<iframe data-lazyloaded="1" src="about:blank" title="Haytor 2023" width="1280" height="720" data-src="https://www.youtube.com/embed/mBaxkFq2jxM?feature=oembed&hq=1" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen=""></iframe>
(Note: I’ve since deactivated lazy-loading of the iframes in LCP so that the page works as intended.)
The page I need help with: [log in to see the link]
- You must be logged in to reply to this topic.