Archived topic
Lazy loading youtube or using facade until it's needed?
1 reply · Started by Josef on August 7, 2021
My page speed was 80, but then embedding a youtube video slowed it down to 59.
So the question is, how could I insert a youtube video without slowing down my site significantly?
Googe page speed suggestions:
1.)
Reduce unused JavaScript
Reduce unused JavaScript and defer loading scripts until they are required to decrease bytes consumed by network activity. Learn more.LCP
WordPress
Consider reducing, or switching, the number of WordPress plugins loading unused JavaScript in your page. To identify plugins that are adding extraneous JS, try running code coverage in Chrome DevTools. You can identify the theme/plugin responsible from the URL of the script. Look out for plugins that have many scripts in the list which have a lot of red in code coverage. A plugin should only enqueue a script if it is actually used on the page.
…en_US/base.js(www.youtube.com)
…www-embed-player.vflset/www-embed-player.js(www.youtube.com)
2.)
Reduce the impact of third-party code Third-party code blocked the main thread for 1,090 ms
Third-party code can significantly impact load performance. Limit the number of redundant third-party providers and try to load third-party code after your page has primarily finished loading. Learn more.
3.)
Some third-party resources can be lazy loaded with a facade 1 facade alternative available
Some third-party embeds can be lazy loaded. Consider replacing them with a facade until they are required.
Hi Josef,
This isn't a theme-related question.
I Googled the keyword "Lazy loading youtube wordpress" and found lots of discussions and articles on this so that might be a good starting point.
Or you can also try a caching plugin to see if it offers the option.
Hope this helps.