Wagtail Lite YouTube Embed
A Wagtail embed finder to use
lite-youtube for more efficient and private YouTube embeds.
Performance concerns aside, there may also be legal concerns.
It's not super common, but there are a few places (example) on my blog where I embed YouTube videos. But if you notice, they all load incredibly fast, with minimal performance impact - but how?
Whilst I'd love to take it, the credit actually goes to lite-youtube-embed, a tool which postpones the stock YouTube embed until the user requests it. Until then, it's just an image and a play button. Check out this demo, which proves it.
At the time of writing, my website is built with Wagtail, so I wanted an easy way to plug
lite-youtube-embed into Wagtail's existing embed functionality. Unfortunately for me, one didn't exist (YouTube is natively supported, but it uses the stock embed) - so I wrote my own.
With just a few lines of code, I've overriden the stock YouTube embed with one which uses
lite-youtube-embed, and no horrible YouTube trackers!
By default, the video title isn't shown in the player embed - only the thumbnail. I had to do some tweaks to make that work