branded-thumb

npm: @playerstack/plugin-branded-thumb

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:

FieldTypeDefaultDescription
enabledbooleanfalsePlugin is a no-op unless true
playButtonStyle"minimal" | "box" | "circle""circle"Visual style of the play button (CSS hook via data-style)
clickToLoadbooleanfalseDefer 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 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

Events

NamePayloadWhen
thumb:clickundefinedUser clicks the overlay

Track it via the event bus:

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