Changeset 2866032
- Timestamp:
- 02/15/2023 10:51:00 PM (3 years ago)
- Location:
- lazy-embed
- Files:
-
- 8 added
- 2 edited
-
tags/1.2.0 (added)
-
tags/1.2.0/index.php (added)
-
tags/1.2.0/lazy-embed.php (added)
-
tags/1.2.0/licence.txt (added)
-
tags/1.2.0/partials (added)
-
tags/1.2.0/partials/embed-styles.css (added)
-
tags/1.2.0/partials/play.svg (added)
-
tags/1.2.0/readme.txt (added)
-
trunk/lazy-embed.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lazy-embed/trunk/lazy-embed.php
r2865623 r2866032 7 7 * Plugin URI: https://wordpress.org/plugins/lazy-embed/ 8 8 * Description: Improves the performance and reduces the emissions of your website by only loading embeds (youtube, vimeo, etc) when they are clicked. 9 * Version: 1. 1.19 * Version: 1.2.0 10 10 * Requires PHP: 7.1 11 11 * Requires at least: 4.0 … … 232 232 private static function vimeoThumbnail(string $url): string 233 233 { 234 $id = self::extractID($url); 235 $transientName = 'lazy_embed_vimeo_' . $id; 236 237 if ($url = get_transient($transientName)) { 238 return $url; 239 } 240 234 241 // https://developer.vimeo.com/api/oembed/videos 235 $response = \wp_remote_get('https://vimeo.com/api/oembed.json?width=' . self::thumbnailSize() . '&url=' . $url); 242 $response = \wp_remote_get('https://vimeo.com/api/oembed.json?' . http_build_query([ 243 'url' => 'https://vimeo.com' . '/' . $id, 244 'width' => self::thumbnailSize(), 245 ])); 246 236 247 $json = \json_decode(\wp_remote_retrieve_body($response), true); 237 248 238 return !empty($json['thumbnail_url']) 239 ? $json['thumbnail_url'] 240 : ''; 249 if (empty($json['thumbnail_url'])) { 250 return ''; 251 } 252 253 set_transient($transientName, $json['thumbnail_url']); 254 255 return $json['thumbnail_url']; 241 256 } 242 257 -
lazy-embed/trunk/readme.txt
r2865660 r2866032 4 4 Requires at least: 4.0 5 5 Tested up to: 6.1 6 Stable tag: 1. 1.16 Stable tag: 1.2.0 7 7 Requires PHP: 5.6 8 8 License: GPLv2 or later … … 13 13 == Description == 14 14 15 Videos are one of the heavist assets that can be loaded on a webpage, and as such are one of the largest contributors to slow performance and high carbon emissions.15 Videos are one of the largest assets that can be loaded on a webpage, and as such are one of the largest contributors to slow performance and high carbon emissions. 16 16 17 17 In fact, adding a Youtube embed to a page using the latest default WordPress theme, increased the page transfer size from 21 kb to 973 kb, and loaded an additional 27 resources. That’s an increase in transfer size of 4533%. Adding a Vimeo video increased the transfer from 21 kb to 276 kb, an increase in transfer size of 1214%, and loaded an additional 7 resources. … … 27 27 == Changelog == 28 28 29 = 1.1.1 = 29 = 1.2.0 - 16/02/2023 = 30 Fix: Vimeo embeds werent always retrieving their thumbnail due to a malformed url being passed to the Vimeo API. This is now fixed. 31 Feat: Add caching of the response from the query to the Vimeo API to improve performance and reduce emissions. 32 33 = 1.1.1 - 15/02/2023 = 30 34 Fix: Change muted parameter to mute for youtube embeds. Thanks @procontentxyz 31 35 32 = 1.1.0 =36 = 1.1.0 - 02/02/2023 = 33 37 Fix: Use template_redirect hook to avoid iframe replacement on gutenberg save action 34 38 Feat: Add support for all embeds on a page, not just the Gutenberg and TinyMCE … … 39 43 QOL: House cleaning, formatting, and documentation 40 44 41 = 1.0.0 =45 = 1.0.0 - 11/01/2023 = 42 46 Initial release. 43 47 … … 51 55 52 56 = Why do I have to click a video twice somtimes for it to play? = 53 54 57 Browsers have become more restrictive around autoplaying a video. The first click on a video never reaches the video host, so they then show the default thumbnail. After the first time a Lazy Embed is interacted with, subsequent videos from that provider will not require a second load. 55 58 59 = I have updated the thumbnail for my video in Youtube/Vimeo/Dailymotion. Why am I not seeing the updated thumbnail? = 60 The thumbnails are cached to improve the performance (uncached frontend pages) and reduce the emissions (less requests to the video platform) of the Lazy Embed plugin. 61 62 The cache is known as transients. You can clear the transient cache using a plugin like https://wordpress.org/plugins/wp-sweep/ 63 56 64 = Why does it not work for my videos? = 57 58 65 It could be for one of a few reasons. 59 66
Note: See TracChangeset
for help on using the changeset viewer.