Originally Posted by
schlumpumpie
Hi Acorn,
thanks for your support but i think I`m doing something wrong.
either nothing happens (the same problem as before) or the video does not start at all or is not visible when I press the trigger.
this is my YT- iframe :
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/XXXXXXXXXXXXXX" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen>
</iframe>
how it should be installed? if i add lazy="loading" nothing changes. and with "display: none or visibility: hidden applied." the Pop Up donīt start and itīs not visible.
Hmmmmm
loading="lazy"
Well, what you provided errors either because it is not a real video or the added -nocookie actually requires a YT account that is published following GDPR compliance.
YT suggest no cookies are then used but tracking still continues in LocalStorage - this a another matter.
The correct parameter and value is loading="lazy" or loading ='lazy'.
Here is my embed:
Code:
<iframe width="1023" height="575" src="https://www.youtube.com/embed/ErMSHiQRnc8" title="Animation vs. Physics" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen loading="lazy"></iframe>
I normally set my dimensions to 100%; I'll leave that to you.
All this will do is not load the video until the pop-up is opened.
I think that hiding off-screen will not work for YT.
YT changes coding all the time so instead of chasing what used to work, which I have been doing this afternoon, it will be better to adopt another approach.
Browsers have changed too so few will now allow autostart without a user activation, especially if there is a sound track.
What used to work was adding the parameter mute=1, but I believe this too is now not working.
I have scrubbed the pop-up layer for this demo file: JS - YT external Stop Start controls.xar
What is does is toggle in and out the embed URL.
The IFRAME now has an ID. The Page Body has the JavaScript to do the toggling. The Red & Green buttons invoke the JS function calls.
Acorn
Bookmarks