Plugin for faster YouTube embeds

Creating and modifying plugins.
Post Reply
User avatar
onli
Regular
Posts: 2519
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Plugin for faster YouTube embeds

Post by onli » Sun Jun 06, 2021 9:01 am

serendipity_event_lazyoutube is a plugin that transforms the iframe usually used to embed a Youtube video.

The regular Youtube iframes load and run a lot of Javascript code on page load. This is a real problem for site performance as soon as more than one or two are on a page, which easily happens on the frontpage of our blogs. By replacing the default iframe with an iframe that only shows a preview image at first and then loads the player after a click, Youtube embeds stop being a performance problem. This plugin does that transformation automatically when it detects the standard Youtube iframe code.

https://www.onli-blogging.de/2040/YouTu ... lugin.html has some more explanation (in german) and shows an example.

It is not on spartacus yet, but has its own Github repo at https://github.com/onli/serendipity_event_lazyoutube. If you'd like to use that plugin, download the code and place it in your s9y blog under plugins/serendipity_event_lazyoutube. Then you can install it in the plugin installation menu (search either for serendipity_event_lazyoutube or for the title, currently "Markup: Lazy YouTube Embeds").

User avatar
onli
Regular
Posts: 2519
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: Plugin for faster YouTube embeds

Post by onli » Thu Jul 01, 2021 10:24 pm

For what it's worth: It continues to work in my blog, and I see it as finished. But sure, more tests would be nice.

Post Reply