Support » Plugin: Lazy Loader » Video and frames not lazy loading

  • Hi Florian,

    The main thing I want to achieve is just to lazy load embedded Youtube videos. I have activated the plugin and checked settings for frames and videos to lazy load, and also for the unveilhooks script to load (though I know it says this is not necessary). I have left every other setting at default. From what I can see in the source code, various images have been flagged to lazy load but not the videos. Any ideas?

    Many thanks,
    Tim

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Florian Brinkmann

    (@florianbrinkmann)

    Hi Tim,

    the videos are embedded via object elements, not iframes. That is the reason why Lazy Loader does not handle that. I will check if I can modify the plugin so that it also handles object elements.

    Best,
    Florian

    Thread Starter Tim Bick

    (@timbickvo)

    Thanks Florian, I can always change the code to iframe if not. However, I have many other pages with video where iframe is used instead such as this one:
    https://timbickvoiceover.co.uk/app-problem-explainers/

    and those don’t seem to lazy load either.

    Plugin Author Florian Brinkmann

    (@florianbrinkmann)

    Hi Tim,

    for that video I see the lazyloaded class that is added by the lazyload script, and in the network tab of the browser dev tools, the initiator for the first request to youtube.com is the lazysizes script that is used by Lazy Loader.

    Visually it seems that it is loaded right away because it is directly in the visible area. Do you have a page where an iframe video is more down below the page?

    Best,
    Florian

    Thread Starter Tim Bick

    (@timbickvo)

    You’re right of course, the lazyload class is defined in the iframe on that page, sorry. What led me to the conclusion it wasn’t is that when I run Pagespeed Insights on it, it tells me that third party code is blocking the main thread for 560ms and shows the Youtube code as being the cause of that. Perhaps I’m just misunderstanding how lazyload works and expecting too much of it.

    Anyway, I swapped my homepage objects for iframes (which are at the bottom of the page) and now the TBT is down to 0ms for that page so I’m very happy with that. Thank you.

    Plugin Author Florian Brinkmann

    (@florianbrinkmann)

    Great, you’re welcome, and thanks for your donation!

    »What led me to the conclusion it wasn’t is that when I run Pagespeed Insights on it, it tells me that third party code is blocking the main thread for 560ms and shows the Youtube code as being the cause of that. Perhaps I’m just misunderstanding how lazyload works and expecting too much of it.«

    Lazy loading prevents things like iframes or images from slowing down the initial page load. But if they are in the visible area, they are loaded right after that, and maybe Google Pagespeed does not only check the initial load but also things that happen after that. But I am not sure about that.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Video and frames not lazy loading’ is closed to new replies.