=== Video Overlay (Chromakey) ===
Contributors: custom
Tags: video, overlay, chromakey, green screen
Requires at least: 5.0
Tested up to: 6.6
Stable tag: 1.6.5
License: GPLv2 or later

Overlay chromakey (green-screen) videos on chosen pages of your site.

== Description ==

This plugin overlays floating videos on pages you choose, removing each
video's chromakey background color in real time so it appears to float over
your page content. From Settings > Video Overlay you can add one or more
"overlay" rules, each with its own:

* Page picker (a native WordPress page dropdown — pick any existing page,
  no need to know or type its URL)
* Video picker (opens the standard WordPress Media Library, filtered to
  video files, so you can pick an uploaded video or upload a new one —
  pasting a direct MP4/WebM URL manually still works too)
* Chromakey color picker (background color to remove, e.g. green)
* Video position (top-left, top-right, bottom-left, bottom-right, center)
* Video size (width in pixels; height scales automatically)
* Autoplay control (on/off) - when off, the video waits on its first frame
  until the visitor clicks it, instead of starting on its own
* Loop control (on/off)
* Sound control (muted, or attempt sound-on with automatic fallback to a
  click-to-unmute button, since browsers block audible autoplay until the
  visitor interacts with the page)

Visitors can dismiss any overlay with its close (X) button; once dismissed
it won't reappear for the rest of that browser session. Multiple overlays
anchored to the same corner of the same page stack neatly instead of
overlapping.

== Free vs. licensed ==

* Unlicensed sites: limited to 1 page/video overlay, shown with a repeating
  "UNLICENSED" watermark. The "Add Another Overlay" button is disabled once
  that 1 overlay is configured, and the limit is also enforced server-side
  on save (so it can't be bypassed by editing the page).
* Licensed sites: unlimited page/video overlay rules, no watermark. See
  "Licensing (Freemius setup)" below to configure paid tiers.

== Important limitations ==

* Chromakey removal only works with direct video files (MP4/WebM) served
  with proper CORS headers, not YouTube/Vimeo embeds, because the browser
  needs raw pixel access to process the video frames.
* If your video is hosted on a different domain than your site, that server
  must send an `Access-Control-Allow-Origin` header, or the browser will
  block pixel access and the plugin will fall back to showing the plain
  video without background removal.
* Browsers block audible (unmuted) autoplay by default. If you select
  "sound on," the plugin will attempt it and automatically fall back to
  starting muted with a small "Unmute" button, unmuting fully on the
  visitor's first click/tap on the page. This is a browser policy, not a
  plugin limitation.

== Installation ==

1. In your WordPress admin, go to Plugins > Add New > Upload Plugin.
2. Choose the video-overlay-chromakey.zip file and click Install Now.
3. Activate the plugin.
4. Go to Settings > Video Overlay. Pick the target page from the page
   dropdown, click "Select Video from Media Library" to choose (or upload)
   a video, then set chromakey color, position, size, loop, and sound
   settings. Use "+ Add Another Overlay" for additional page/video pairs
   (licensed sites only).
5. Visit the target page(s) to see the overlay(s) in action.

== Licensing (Freemius setup) ==

This plugin is registered with Freemius (product slug `video-overlay-chromakey`)
to sell tiered site licenses that unlock unlimited overlays and remove the
watermark for paying customers. The real product credentials are already
wired into video-overlay-chromakey.php. The only remaining step is:

1. Obtain the Freemius WordPress SDK and place it at
   .../video-overlay-chromakey/vendor/freemius/start.php

Until that file is present, the plugin safely defaults to unlicensed/
watermarked mode (1 page/video overlay, "UNLICENSED" watermark) instead of
erroring out. Once it's in place, Freemius automatically adds Account/
Upgrade/Contact screens under Settings > Video Overlay, emails license keys
on purchase, and gives customers a self-service portal to activate/
deactivate their own sites — without needing to contact you.

== Changelog ==

= 1.6.5 =
* Added a bundled User Manual (PDF), linked from Settings > Video Overlay.
* Replaced the third-party Freemius deploy action in the release pipeline
  with direct calls to Freemius's REST API (more reliable error reporting).
* Release pipeline now also uploads the release zip to this site's own
  wp-content/uploads/video-overlay-chromakey/ directory for a stable,
  directly-downloadable copy outside of Freemius.

= 1.6.0 =
* Wired in real Freemius SDK credentials (product id, public key, and
  wp.org gatekeeper key) in place of the previous placeholder constants.
* Renamed the plugin slug/folder from `video-overlay-plugin` to
  `video-overlay-chromakey` to match the slug registered with Freemius
  (required for Freemius's automatic wp.org free-version generation).
* Freemius's Account/Contact screens now attach as a submenu under
  Settings, next to the existing Video Overlay settings page, instead of
  their own top-level admin menu.
* The Freemius SDK itself (vendor/freemius/start.php) is not bundled in
  this repo; until it's added, the plugin continues to run safely in
  unlicensed/watermarked mode.

= 1.5.2 =
* No browser allows audible autoplay to start on its own - Chrome, Safari,
  and Firefox all require a genuine click/tap before sound is allowed,
  full stop. Before 1.5.1, a stuck-paused video meant visitors HAD to
  click it just to see it play, and that same click happened to satisfy
  the browser's sound requirement too - so sound "just worked" as an
  accidental side effect of the other bug. Now that 1.5.1 fixed the
  stuck-paused bug, the video autoplays muted on its own with no click
  needed, which means that accidental sound trigger no longer happens by
  itself - visitors now need to notice and click the fallback sound
  button. This release makes that button impossible to miss: an icon,
  clear "Tap for sound" label, and a gentle pulse animation, instead of a
  small unlabeled corner button that was easy to overlook.
* If guaranteed sound from the very first frame matters more than
  guaranteed autoplay, turn Autoplay off for that overlay instead: the
  click that starts the video is then a real gesture, so sound plays
  immediately with no separate button or extra tap required.

= 1.5.1 =
* Fixed: with Sound set to "Attempt sound-on," a successfully autoplaying
  (muted) video could end up stuck paused, requiring the visitor to click it
  to resume - with no Unmute button ever appearing. Cause: right after a
  muted autoplay succeeded, the plugin immediately tried to unmute it; some
  browsers respond to an un-gestured unmute by pausing the video outright
  (instead of silently re-muting it), which the old detection logic didn't
  account for. The check now also looks at whether the video got paused, and
  if so, puts it back to muted + playing and shows the Unmute button, instead
  of leaving it paused with no visible way to resume besides clicking the
  video itself.

= 1.5.0 =
* Added an "Autoplay" on/off setting per overlay (default: on, matching
  prior behavior). Previously the video always started playing on its own
  with no way to turn that off; when Autoplay is now unchecked, the video
  stays paused on its first (chromakeyed) frame until the visitor clicks it.
* Fixed: manually starting a muted video by clicking it never attempted to
  unmute, even when Sound was set to "Attempt sound-on" - clicking to play
  and autoplaying now go through the same start-of-playback logic, so a
  manual click gets sound just like a successful autoplay would.

= 1.4.2 =
* Updated plugin author to Prinme9AI.com.

= 1.4.1 =
* Clicking the video now pauses it; clicking again resumes it.

= 1.4.0 =
* Added a "Chromakey Tolerance" slider per overlay (10-200, default 90).
  Previously the color-match tolerance was hardcoded, so if your video's
  actual green/blue (which shifts slightly due to compression, often worse
  near the end of a clip) didn't fall within that fixed range, leftover
  background color would show through with no way to fix it except editing
  code. Raise the slider if background color is still visible; lower it if
  the subject itself starts turning translucent.

= 1.3.3 =
* Fixed: "Loop video playback" could stop after one play-through instead
  of looping. The native `loop` HTML attribute is not 100% reliable across
  every browser/device (some have been known to fire `ended` and stop
  instead of looping back). The `loop` attribute is now also set explicitly
  (not just the JS property), and a manual restart-on-ended fallback
  (`video.currentTime = 0; video.play();`) now guarantees looping even on
  a browser where the native attribute misbehaves.

= 1.3.2 =
* Fixed: the video could fail to autoplay. Two causes addressed:
  1. The hidden source `<video>` was set to `display:none`, which some
     browsers treat as "not rendered" and stop decoding/advancing frames on
     - it's now hidden via off-screen positioning + opacity instead, which
     keeps it in the render tree so playback isn't silently throttled.
  2. `muted`/`playsinline`/`autoplay` were only set as JS properties;
     Safari's autoplay permission check in particular can ignore a
     JS-only `.muted = true`. They're now also set as real HTML
     attributes.

= 1.3.1 =
* Gave the Chromakey Color field a proper `<label for="...">` with a
  unique id (instead of wrapping the input in a label), fixing a subtle
  wp-color-picker quirk where a wrapping label could cause its swatch
  toggle button to double-fire, and making the field name clearly visible
  above the picker.

= 1.3.0 =
* Replaced the manual "page URL" text field with a native WordPress page
  dropdown (wp_dropdown_pages) — target matching now uses is_page() against
  the selected page ID instead of comparing URL strings.
* Replaced manual video URL entry with a "Select Video from Media Library"
  button (the standard WP media picker, filtered to video files). The URL
  field is still editable directly if you want to paste an external video
  URL instead.
* Old installs auto-migrate: existing target URLs are resolved to a page ID
  via url_to_postid() where possible; unresolved rows fall back to "no page
  selected" and need to be re-picked once.

= 1.2.2 =
* Fixed: the "UNLICENSED" watermark could fail to render in some
  browsers (e.g. Edge) because it was drawn pixel-by-pixel onto the
  canvas each frame. It's now a plain HTML/CSS overlay on top of the
  canvas, which renders identically in every browser.

= 1.2.1 =
* Fixed: a non-looping video's last frame could leave a rim of the
  chromakey color visible once playback ended. The overlay now clears the
  canvas and hides itself when a non-looping video finishes.

= 1.2.0 =
* Reworked storage to support multiple page/video overlay rules.
* Unlicensed sites are now capped at 1 overlay (enforced in the admin UI
  and server-side on save); licensed sites get unlimited overlays.
* Overlays anchored to the same corner of the same page now stack instead
  of overlapping.
* Automatic one-time migration from the old single-overlay settings format.

= 1.1.0 =
* Added Freemius-based license enforcement with a watermark for
  unlicensed use.

= 1.0.0 =
* Initial release.
