intro-card

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

Pre-roll splash overlay with marketing content — title, subtitle, badge, optional CTA, custom HTML, and a big branded play button. Different scope from branded-thumb: branded-thumb is “custom poster + click-to-load”, intro-card is “billboard before play”.

Quickstart

<player-stack
  src="https://example.com/v.mp4"
  data-config='{
    "controls": { "accent": "#a855f7" },
    "introCard": {
      "enabled": true,
      "badge": "FREE PREVIEW",
      "title": "Lesson 1: Kick-off",
      "subtitle": "5 minutes — what you will learn",
      "cta": { "label": "Buy the course", "url": "https://example.com/course" }
    }
  }'
></player-stack>

Config

config.introCard:

FieldTypeDefaultDescription
enabledbooleanfalsePlugin is a no-op unless true
badgestring—Small uppercase pill above the title
titlestring—Heading
subtitlestring—Supporting line
htmlstring—HTML filtered through core sanitizeHtml between subtitle and play button
cta{ label, url, utm? }—Optional click-through link separate from the play button
imagestring—Background image URL
position"fullscreen" | "bottom" | "center""fullscreen"Layout: cover the whole player, sit at the bottom, or float as a centered card
theme"dark" | "light" | "transparent""dark"Background style
dismissiblebooleanfalseShow a close button so the user can skip the card without playing

Behavior

Events

NamePayloadWhen
intro-card:play-clickundefinedPlay button clicked
intro-card:cta-click{ label?: string; url?: string }CTA link clicked
intro-card:dismissundefinedClose button clicked

HTML rendering rules

html passes through core’s sanitizeHtml before the resulting fragment is assigned to innerHTML.

This is a browser DOM-based rendering allowlist; without document, the helper returns an empty string. URL host policy and server-side validation remain the integrator’s responsibility.

cta.url is checked separately with isSafeHttpUrl from the same source file: only absolute HTTP(S) URLs render the CTA anchor. Valid CTAs open in a new tab with rel="noopener noreferrer".

Use cases

Scrolling content

Intro cards in fullscreen, center, and bottom positions are bounded by the player height and scroll inside their own overlay when content is too tall. Content stays centered when it fits and begins at the top when it overflows. Keyboard focus and pointer/touch scrolling do not move the player content.