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:

Field Type Default Description
enabled boolean false Plugin is a no-op unless true
badge string — Small uppercase pill above the title
title string — Heading
subtitle string — Supporting line
html string — HTML filtered through core sanitizeHtml between subtitle and play button
cta { label, url, utm? } — Optional click-through link separate from the play button
image string — 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
dismissible boolean false Show a close button so the user can skip the card without playing

Behavior

Events

Name Payload When
intro-card:play-click undefined Play button clicked
intro-card:cta-click { label?: string; url?: string } CTA link clicked
intro-card:dismiss undefined Close 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

The CTA and close button are at least 44 px. Text on --ps-accent is white or black, whichever contrasts better with it.

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.