mrwweb / enhanced-embed-block

Enhance the default YouTube Embed Block in WordPress to load faster.
GNU General Public License v3.0
4 stars 1 forks source link

Increase poster resolution to maximum #5

Closed cbirdsong closed 1 month ago

cbirdsong commented 2 months ago

The default poster image size for <lite-youtube> is "hqdefault", which I guess is 480x360. This looks bad when displayed full width in a content area. The component does support a posterquality attribute that accepts values that apparently correspond to the following resolutions:

name resolution
mqdefault 320x180
hqdefault 480x360
sddefault 640x480
maxresdefault 1280x720

Considering how the embed block renders, I think maxresdefault/1280x720 is the only reasonable choice for most sites. I would guess the default content area width in most themes is larger than sddefault's width of 640px.

(YouTube should really provide more granularity here, but I guess they didn't leave themselves much wiggle room after naming the 720p size "max res".)

mrwweb commented 2 months ago

Thanks for the excellent issue and PR, @cbirdsong. I think I'm on board but want to mull it over just a bit more. It will certainly increase the loading time for pages with a lot of videos. I think I may want to at least provide a filter to let that get customized, but I definitely think it's worth adding control.

If I do this, I also want to resolve #3 (solved in a local branch) with it, so that any old videos without the higher-quality thumbnails aren't penalized.

I don't have an ETA for the next release, but I'll land something for this in it for sure. Thanks again!

cbirdsong commented 2 months ago

Anecdotally, I'm seeing a ~3x increase in image size between the two, but I'm not sure how much that would matter in practice since the image is loading="lazy"? I'd be curious to see some testing of both sizes in practice.

A filter and/or settings screen with the option is probably a good idea either way.