=== VidDefer – Deferred Video Embeds ===
Contributors:      kushang78
Tags:              lazy load, youtube, vimeo, performance, deferred
Requires at least: 6.0
Tested up to:      7.0
Stable tag:        1.0.0
Requires PHP:      8.0
License:           GPL-2.0-or-later
License URI:       https://www.gnu.org/licenses/gpl-2.0.html

Automatically lazy load YouTube, Vimeo, and self-hosted videos to dramatically boost page speed and Core Web Vitals.

== Description ==

**VidDefer – Deferred Video Embeds** replaces heavy video embeds with lightweight thumbnail placeholders. The real video only loads when a visitor clicks (or scrolls to) it — saving hundreds of kilobytes per page load.

= Supported Sources =

* **YouTube** — replaces iframes with thumbnail + play button
* **Vimeo** — replaces iframes with thumbnail + play button
* **Self-hosted videos** — replaces `<video>` elements (MP4, WebM, OGV)

= Key Features =

* Zero configuration — install, activate, done
* Click-to-load or scroll-triggered loading
* YouTube thumbnail quality control (SD / HQ / Max)
* 3 play button styles: YouTube-style, Circle, Minimal
* Custom play button & overlay colours
* GDPR / privacy notice overlay
* Exclude specific pages by ID or videos by CSS class
* No jQuery — pure ES6, < 2KB gzipped
* Works with Gutenberg, Elementor, Divi, WPBakery
* WCAG 2.1 keyboard-accessible placeholders
* Caches Vimeo thumbnails via WordPress transients

== Installation ==

1. Upload the plugin folder to `/wp-content/plugins/`
2. Activate the plugin through **Plugins → Installed Plugins**
3. Configure via **Settings → VidDefer**

== Screenshots ==

1. Lazy-loaded video placeholder with thumbnail and play button
2. General settings for load trigger and thumbnail quality
3. Appearance settings for play button style, colours, and overlay
4. Privacy and exclusion settings for GDPR notice and skipped videos

== Frequently Asked Questions ==

= Will it work with my page builder? =

Yes. The plugin uses PHP output buffering to intercept all video iframes and `<video>` tags regardless of how they were added to the page.

= Does it support YouTube Shorts? =

Yes, YouTube Shorts use the same embed format and are handled automatically.

= Will it break my video popups / lightboxes? =

Add the class `no-lazy` (configurable under Settings → VidDefer Exclusions) to any iframe, video element, or wrapping figure tag you want to skip.

= Does it require an API key? =

No. YouTube thumbnails use the public `img.youtube.com` CDN. Vimeo thumbnails use the public oEmbed endpoint.

== External services ==

This plugin can connect to external video services to display lazy-loaded video thumbnails and metadata.

= YouTube =

When YouTube lazy loading is enabled, the plugin uses YouTube's public thumbnail CDN to display thumbnail images for YouTube videos. The visitor's browser requests the thumbnail image from YouTube when a lazy-loaded YouTube placeholder is displayed. The request includes the YouTube video ID in the thumbnail URL and may include normal browser request data such as the visitor's IP address and user agent.

This service is provided by YouTube LLC. Terms of Service: https://www.youtube.com/t/terms Privacy Policy: https://policies.google.com/privacy

= Vimeo =

When Vimeo lazy loading is enabled, the plugin connects to Vimeo's public oEmbed endpoint to fetch the thumbnail URL and, when enabled, the video title for Vimeo videos. This request is made by the WordPress site server when a Vimeo video placeholder is generated and the metadata is not already cached in a WordPress transient. The request sends the Vimeo video URL, which includes the Vimeo video ID, and a user agent containing the plugin name/version and the site URL.

This service is provided by Vimeo.com, Inc. Terms of Service: https://vimeo.com/terms Privacy Policy: https://vimeo.com/privacy

== Changelog ==

= 1.0.0 = Released June 12 - 2026
* Initial release
* YouTube, Vimeo, self-hosted lazy load
* Click and scroll triggers
* Admin settings page
* GDPR notice support
