paulirish / lite-youtube-embed

A faster youtube embed.
https://paulirish.github.io/lite-youtube-embed/
Other
5.68k stars 260 forks source link

Added Support for WebP Thumbnail if suported by the browser #131

Closed gilbertococchi closed 10 months ago

gilbertococchi commented 1 year ago

Hi @paulirish, please review the proposed changes to add support for WebP Image Thumbnail.

Used Canvas element WebP check instead of Browser versioning to dynamically check new browsers supporting WebP.

gilbertococchi commented 1 year ago

@paulirish please reivew the proposed changes:

1) WebP detection via User Agent here: https://github.com/paulirish/lite-youtube-embed/pull/131/commits/ae3958d00a91f0f4c473cc6c912a3b65d6dbd493

2) Background image is "sddefault", either WebP or JPG, Developers can customize the image variant by using the thumbnail attribute.

3) If a Picture tag is detected, no Background element is added for Pro users.