branded-thumb

Package: @playerstack/plugin-branded-thumb (source), not published to npm yet

Renders a custom poster overlay with an accessible play button. Optional clickToLoad mode defers the underlying iframe until the user clicks — eliminating third-party cookies and dramatically improving Largest Contentful Paint.

Quickstart

<player-stack
  src="https://youtu.be/dQw4w9WgXcQ"
  poster="https://cdn.example.com/poster.webp"
  data-config='{"brandedThumb":{"enabled":true,"clickToLoad":true,"playButtonStyle":"box"}}'
>
</player-stack>

Config

config.brandedThumb:

Field Type Default Description
enabled boolean false Plugin is a no-op unless true
playButtonStyle "minimal" | "box" | "circle" "circle" Visual style of the play button (CSS hook via data-style)
clickToLoad boolean false Defer iframe load until click (LCP + GDPR)

Why clickToLoad

YouTube and Vimeo iframes fetch tracking cookies as soon as they load — even before the user plays anything. With clickToLoad: true:

The poster is a request too. clickToLoad holds back the video provider, not the poster image: the browser fetches the poster when the thumbnail comes into view (it uses loading="lazy"). A poster from i.ytimg.com (YouTube’s thumbnail CDN) therefore sends the visitor’s IP address and your site’s address (Referer, by default the origin) to Google before any click. For full privacy, serve your own poster from your domain or CDN (for example a frame exported from the video), and give it the same aspect ratio as the player.

The trade-off: the user has to click twice (once to load, once to play). For most use cases that’s acceptable.

How it works

When clickToLoad: true:

  1. The sources plugin sees the flag and skips setting src on the inner media element, so the YouTube/Vimeo iframe (or the <video> request) is never made
  2. The plugin mounts an overlay with the poster and play button
  3. On click, the plugin sets the src attribute (the inner element loads), calls play() synchronously to preserve the user-gesture for autoplay policy, removes the overlay, and emits thumb:click

With the standalone script, the YouTube, Vimeo, HLS, Wistia or Twitch provider file downloads in parallel with the thumbnail instead of before it, so the poster and play button appear without waiting for it. A click before the provider arrives starts playback as soon as it loads. If the provider fails to load, the thumbnail is removed and the element dispatches playerstack:error.

Events

Name Payload When
thumb:click undefined User clicks the overlay

Track it via the event bus:

ctx.events.on("thumb:click", () => {
  // analytics / consent prompt / etc.
});