Player Kit

Landing Video Player — Complete Rebuild Kit (.txt)

================================================================
  LANDING VIDEO PLAYER — COMPLETE REBUILD KIT
  Autism Spectrum Help · 2026-09-06
================================================================

This file contains EVERYTHING needed to rebuild the exact video
player and generate new 1-person and 2-person cartoon affirmation
videos that drop into it.

Contents:
  PART 1 — How the player works (overview)
  PART 2 — LandingVideoPlayer.jsx (full code)
  PART 3 — Video data file structure (example)
  PART 4 — 1-Person video rules + prompt template
  PART 5 — 2-Person video rules + prompt template
  PART 6 — Style palette + content rules
  PART 7 — Batch execution rules (HARD LIMITS)
  PART 8 — Wiring a new series into the player
  PART 9 — Series 5 production log (reference)


================================================================
  PART 1 — HOW THE PLAYER WORKS
================================================================

- Autoplay-muted sequential <video> player.
- Plays every video one-by-one, loops forever.
- Controls: play/pause, stop, skip back, skip forward, mute toggle,
  subtitle toggle, fullscreen toggle.
- Subtitles are OFF by default (user toggles on).
- Videos live in data files: landingVideosSeries{N}.js
- Each entry: { id, title, subtitle, videoUrl }
- Player imports all series, newest first, original ambient last:
  [...SERIES_6, ...SERIES_5, ...SERIES_4, ...SERIES_3, ...SERIES_2, ...BASE]
- Subtitle field is shown when the user toggles captions on.
- No login required — pure static <video> element.


================================================================
  PART 2 — LandingVideoPlayer.jsx (FULL CODE)
================================================================

import React, { useState, useRef, useEffect, useCallback } from 'react';
import { Play, Pause, Square, SkipForward, SkipBack, Volume2, VolumeX, Maximize, Minimize, Captions, CaptionsOff } from 'lucide-react';
import { LANDING_VIDEOS as _BASE_VIDEOS } from '@/data/landingVideos';
import { LANDING_VIDEOS_SERIES_2 } from '@/data/landingVideosSeries2';
import { LANDING_VIDEOS_SERIES_3 } from '@/data/landingVideosSeries3';
import { LANDING_VIDEOS_SERIES_4 } from '@/data/landingVideosSeries4';
import { LANDING_VIDEOS_SERIES_5 } from '@/data/landingVideosSeries5';
import { LANDING_VIDEOS_SERIES_6 } from '@/data/landingVideosSeries6';

// Newest videos first, original ambient videos last.
const LANDING_VIDEOS = [...LANDING_VIDEOS_SERIES_6, ...LANDING_VIDEOS_SERIES_5, ...LANDING_VIDEOS_SERIES_4, ...LANDING_VIDEOS_SERIES_3, ...LANDING_VIDEOS_SERIES_2, ..._BASE_VIDEOS];

export default function LandingVideoPlayer() {
  const videoRef = useRef(null);
  const containerRef = useRef(null);
  const [currentIndex, setCurrentIndex] = useState(0);
  const [isPlaying, setIsPlaying] = useState(true);
  const [isMuted, setIsMuted] = useState(true);
  const [hasStarted, setHasStarted] = useState(false);
  const [showSubtitles, setShowSubtitles] = useState(false);
  const [isFullscreen, setIsFullscreen] = useState(false);

  const current = LANDING_VIDEOS[currentIndex];

  useEffect(() => {
    const v = videoRef.current;
    if (!v) return;
    v.muted = true;
    const tryPlay = v.play();
    if (tryPlay && typeof tryPlay.then === 'function') {
      tryPlay.then(() => setHasStarted(true)).catch(() => setHasStarted(false));
    }
  }, []);

  const goNext = useCallback(() => {
    setCurrentIndex((i) => (i + 1) % LANDING_VIDEOS.length);
  }, []);

  const goPrev = useCallback(() => {
    setCurrentIndex((i) => (i - 1 + LANDING_VIDEOS.length) % LANDING_VIDEOS.length);
  }, []);

  useEffect(() => {
    const v = videoRef.current;
    if (!v) return;
    v.load();
    if (isPlaying) {
      const p = v.play();
      if (p && typeof p.then === 'function') p.catch(() => {});
    }
  }, [currentIndex]);

  const togglePlay = () => {
    const v = videoRef.current;
    if (!v) return;
    if (isPlaying) { v.pause(); setIsPlaying(false); }
    else {
      const p = v.play();
      if (p && typeof p.then === 'function') p.then(() => setIsPlaying(true)).catch(() => setIsPlaying(false));
      else setIsPlaying(true);
      setHasStarted(true);
    }
  };

  const stop = () => {
    const v = videoRef.current;
    if (!v) return;
    v.pause(); v.currentTime = 0; setCurrentIndex(0); setIsPlaying(false);
  };

  const toggleMute = () => {
    const v = videoRef.current;
    if (!v) return;
    v.muted = !v.muted; setIsMuted(v.muted);
  };

  const toggleFullscreen = () => {
    const el = containerRef.current;
    if (!el) return;
    if (!document.fullscreenElement) el.requestFullscreen?.().catch(() => {});
    else document.exitFullscreen?.().catch(() => {});
  };

  useEffect(() => {
    const onFsChange = () => setIsFullscreen(!!document.fullscreenElement);
    document.addEventListener('fullscreenchange', onFsChange);
    return () => document.removeEventListener('fullscreenchange', onFsChange);
  }, []);

  useEffect(() => {
    if (hasStarted) return;
    const startOnInteraction = () => {
      const v = videoRef.current;
      if (!v) return;
      v.muted = true;
      const p = v.play();
      if (p && typeof p.then === 'function') p.then(() => { setIsPlaying(true); setHasStarted(true); }).catch(() => {});
    };
    window.addEventListener('click', startOnInteraction, { once: true });
    window.addEventListener('touchstart', startOnInteraction, { once: true });
    return () => {
      window.removeEventListener('click', startOnInteraction);
      window.removeEventListener('touchstart', startOnInteraction);
    };
  }, [hasStarted]);

  return (
    <div className="w-full">
      <div ref={containerRef} className="relative overflow-hidden rounded-2xl bg-black shadow-lg ring-2 ring-primary/20">
        <video ref={videoRef} className="aspect-video w-full bg-black object-cover" src={current.videoUrl} playsInline muted={isMuted} onEnded={goNext} onClick={togglePlay} />
        <div className="pointer-events-none absolute left-0 right-0 top-0 flex items-start justify-between p-3">
          <div className="rounded-lg bg-black/60 px-3 py-1.5 backdrop-blur-sm">
            <p className="font-heading text-sm font-semibold tracking-wide text-white">{current.title}</p>
          </div>
          <div className="rounded-lg bg-black/60 px-2.5 py-1.5 backdrop-blur-sm">
            <p className="text-[10px] font-medium text-white/80">{currentIndex + 1} / {LANDING_VIDEOS.length}</p>
          </div>
        </div>
        {showSubtitles && (
          <div className="pointer-events-none absolute bottom-16 left-1/2 -translate-x-1/2 px-3">
            <p className="rounded-lg bg-black/60 px-3 py-1.5 text-center text-xs font-medium text-white backdrop-blur-sm">{current.subtitle}</p>
          </div>
        )}
        {!hasStarted && (
          <div className="absolute inset-0 flex items-center justify-center bg-black/40">
            <button onClick={togglePlay} className="flex flex-col items-center gap-2 rounded-full bg-primary/90 p-5 text-primary-foreground transition-transform hover:scale-105">
              <Play className="h-8 w-8 fill-current" />
              <span className="text-xs font-medium">Tap to play</span>
            </button>
          </div>
        )}
      </div>
      <div className="mt-3 flex flex-wrap items-center justify-center gap-2">
        <button onClick={goPrev} className="flex h-11 w-11 items-center justify-center rounded-xl bg-secondary text-secondary-foreground hover:bg-accent/20" aria-label="Previous"><SkipBack className="h-5 w-5" /></button>
        <button onClick={togglePlay} className="flex h-12 w-12 items-center justify-center rounded-xl bg-primary text-primary-foreground hover:bg-primary/90" aria-label={isPlaying ? 'Pause' : 'Play'}>{isPlaying ? <Pause className="h-5 w-5 fill-current" /> : <Play className="h-5 w-5 fill-current" />}</button>
        <button onClick={stop} className="flex h-11 w-11 items-center justify-center rounded-xl bg-secondary text-secondary-foreground hover:bg-accent/20" aria-label="Stop"><Square className="h-4 w-4 fill-current" /></button>
        <button onClick={goNext} className="flex h-11 w-11 items-center justify-center rounded-xl bg-secondary text-secondary-foreground hover:bg-accent/20" aria-label="Next"><SkipForward className="h-5 w-5" /></button>
        <button onClick={toggleMute} className="flex h-11 w-11 items-center justify-center rounded-xl bg-secondary text-secondary-foreground hover:bg-accent/20" aria-label={isMuted ? 'Unmute' : 'Mute'}>{isMuted ? <VolumeX className="h-5 w-5" /> : <Volume2 className="h-5 w-5" />}</button>
        <button onClick={() => setShowSubtitles((s) => !s)} className={`flex h-11 w-11 items-center justify-center rounded-xl ${showSubtitles ? 'bg-primary text-primary-foreground' : 'bg-secondary text-secondary-foreground hover:bg-accent/20'}`} aria-label={showSubtitles ? 'Hide subtitles' : 'Show subtitles'}>{showSubtitles ? <Captions className="h-5 w-5" /> : <CaptionsOff className="h-5 w-5" />}</button>
        <button onClick={toggleFullscreen} className="flex h-11 w-11 items-center justify-center rounded-xl bg-secondary text-secondary-foreground hover:bg-accent/20" aria-label={isFullscreen ? 'Exit fullscreen' : 'Enter fullscreen'}>{isFullscreen ? <Minimize className="h-5 w-5" /> : <Maximize className="h-5 w-5" />}</button>
      </div>
    </div>
  );
}


================================================================
  PART 3 — VIDEO DATA FILE STRUCTURE (EXAMPLE)
================================================================

File: src/data/landingVideosSeries5.js

/**
 * 18 two-person inspiration dialogues.
 * Each: 8s, 16:9, audio-enabled (dialogue + music), no on-screen text.
 */
export const LANDING_VIDEOS_SERIES_5 = [
  {
    id: 's5-new-day',
    title: 'NEW DAY',
    subtitle: 'P1: "Yesterday was terrible." — P2: "Yesterday ended. Today gives you another beginning."',
    videoUrl: 'https://media.base44.com/videos/public/.../S5_New_Day.mp4',
  },
  // ... more entries
];

File: src/data/landingVideos.js (base ambient)
export const LANDING_VIDEOS = [
  { id, title, subtitle, videoUrl },
  // ...
];

Entry fields:
  id       — unique slug (e.g. 's5-new-day', 's6-patience')
  title    — short uppercase display title
  subtitle — for 1-person: the spoken affirmation
             for 2-person: P1: "line 1" — P2: "line 2"
  videoUrl — hosted .mp4 URL


================================================================
  PART 4 — 1-PERSON VIDEO RULES (Series 1–3)
================================================================

FORMAT: 6-second, 16:9 cartoon, single character speaking one affirmation aloud.

STRUCTURE:
- One cartoon character (no human faces/hands — cartoon only).
- Character speaks a single affirmation statement.
- Genre-specific silly background music (ukulele, xylophone, flute, etc.).
- Diverse styles across the set: anime, robots, 80s/90s cartoon, claymation.
- The subtitle field = the spoken affirmation.
- No text on screen.
- Photorealistic nature/object imagery policy does NOT apply — cartoons only.

PROMPT TEMPLATE (1-person):
  6-second 16:9 cartoon animation. A [style] [character type] cartoon
  character stands in [setting]. The character speaks aloud with
  expressive mouth movement: "[affirmation]". [Genre] silly background
  music. [Art style] style. No text on screen. No human faces.


================================================================
  PART 5 — 2-PERSON VIDEO RULES (Series 4+)
================================================================

FORMAT: 8-second, 16:9 cartoon, two distinct characters having a short dialogue with music.

STRUCTURE:
- Two distinct cartoon characters facing each other.
- Person 1 expresses a struggle/doubt (1 line).
- Person 2 responds with encouragement/wisdom (1 line).
- Both characters get mouth movement synced to their line.
- Silly, genre-specific background music.
- Diverse art styles per video (one style per video for variety).
- The subtitle field = P1: "..." — P2: "..." so users see both lines.
- No text on screen. No human faces.

SCRIPT RULES:
- Total duration ~8 seconds (two short lines fit comfortably).
- Person 1's line: a relatable struggle (giving up, lost, scared, stuck).
- Person 2's line: encouragement without preaching — practical, warm, brief.
- Keep lines short enough to speak in ~3 seconds each.

PROMPT TEMPLATE (2-person):
  8-second 16:9 cartoon animation. Two characters facing each other in
  [setting]. A [style] [character type] (Person 1) [action/expression]
  and speaks: "[line 1]". A [style] [character type] (Person 2) [action]
  and speaks: "[line 2]". [Genre] silly background music. Expressive
  mouth movements for both characters. [Art style] style. No text on
  screen. No human faces.

RELIABLE PROMPT STRUCTURE:
  Start: "8-second 16:9 cartoon animation with sound."
  End: "Both characters have expressive mouth movements synced to their
       dialogue. [Style] art style, [color] background. No text on
       screen. No human faces."
  Embed the exact spoken lines in quotes inside the prompt so the audio
  model produces the dialogue.
  Name a specific background music genre each time.

AUDIO: 2-person videos MUST pass generate_audio: true — without it the
video generates silently (no dialogue, no music). This is the most
common "redo" cause. Always set generate_audio: true for talking videos.


================================================================
  PART 6 — STYLE PALETTE + CONTENT RULES
================================================================

STYLE:
- Cartoon only — no photorealism, no human faces, no hands, no racial identifiers.
- Warm sage/terracotta/cream palette for backgrounds where applicable.
- Diverse character types: blobs, animals, robots, mythical creatures,
  objects-with-faces.
- Silly, light, non-preaching tone.

CONTENT FILTER SAFETY:
- Do NOT reference self-harm, violence, or crisis themes in cartoon
  video prompts. Keep themes to struggle→encouragement (mild emotional
  vocabulary only).
- Known block: Video 8 ACT theme.

DIVERSITY ACROSS A SERIES:
- Assign each video a unique character-pair + art-style + music-genre
  triple. No two videos in the same series should reuse the same style
  combination.

ORDERING:
- Talking videos (1-person and 2-person) come BEFORE ambient/nature videos.
- New additions append to the END of the talking-video block (before ambient).
- Newest series is prepended in the player array:
  [...NEWEST, ...older, ...BASE_AMBIENT]

SUBTITLE FIELD FORMAT:
- 1-person: the spoken affirmation
- 2-person: P1: "[line 1]" — P2: "[line 2]"


================================================================
  PART 7 — BATCH EXECUTION RULES (HARD LIMITS)
================================================================

HARD LIMIT: max 6 generate_video calls per single assistant message.
  The 7th+ calls fail with "Reached the limit of 6 videos per message"
  — they do NOT queue, they error out immediately and do not take effect.

To generate a batch larger than 6:
  Send them 6 at a time across multiple messages ("continue"),
  collect every URL, then write the data file + wire the player in ONE
  final message once all URLs are in hand.

- Sending 6 in parallel in one message succeeds reliably — all 6 complete.
- Sending 18 in one message fails 12 of them.

REUSABLE VISUAL METAPHOR PATTERNS (from Series 5):
- Make P2 the "healed version" of P1's object for resilience themes
  (e.g. cracked teacup → kintsugi gold-vein bowl).
- Make P2 the "abundant version" of P1's singular object for scarcity
  themes (e.g. closed door → row of glowing open doorways).
- Pair a frantic/struggling animal with a calm/content one for any
  "you're already okay" theme (hamster-on-wheel vs cat-in-sunbeam).
- Voice-speed contrast reinforces the script (frantic spinning top vs
  slow tortoise for "breathe").


================================================================
  PART 8 — WIRING A NEW SERIES INTO THE PLAYER
================================================================

1. Create src/data/landingVideosSeries{N}.js exporting an array of entries.
2. In LandingVideoPlayer.jsx, import it and prepend to the array:
   const LANDING_VIDEOS = [...SERIES_N, ...SERIES_(N-1), ..., ..._BASE_VIDEOS];
3. Subtitles stay OFF by default — user toggles.
4. Newest series goes first in the array.

That's it. The player auto-plays the first entry and sequences through all.


================================================================
  PART 9 — SERIES 5 PRODUCTION LOG (REFERENCE)
================================================================

All 18 generated in three batches of 6, audio-enabled, 8s/16:9.

| # | Title | Character pair | Art style | Music |
|---|-------|-----------------|-----------|-------|
| 1 | New Day | Raincloud / Sun w/ sunglasses | Watercolor storybook | Soft piano |
| 2 | Believe | Purple octopus / Goldfish in bowl | Chibi anime | Lo-fi beat |
| 3 | Failure | Crumpled paper ball / Pencil w/ arms | Hand-drawn doodle | Ukulele |
| 4 | Hope | Dim firefly / Wise owl | Cut-paper collage | Gentle flute |
| 5 | Courage | Shaking robot / Knight-helmet mouse | 80s Saturday cartoon | Synth hero riff |
| 6 | Tomorrow | Worried moon / Rising sun | Claymation | Xylophone |
| 7 | Small Wins | Ant w/ crumb / Elephant | 90s cartoon | Bouncy marimba |
| 8 | Start Again | Spilled paint bucket / Paintbrush | Finger-paint toddler | Kazoo + tambourine |
| 9 | Inner Strength | Wilting cactus / Mountain w/ face | Minimalist line art | Singing bowl hum |
| 10 | Possibility | Cardboard box / Star constellation | Retro 70s flat | Mellow synth pad |
| 11 | Change | Caterpillar / Butterfly mid-emergence | Storybook gouache | Harp glissando |
| 12 | Patience | Stopwatch / Blooming flower | Botanical etching | Acoustic guitar |
| 13 | Peace | Tangled yarn ball / Koi fish | Sumi-e ink wash | Bamboo flute |
| 14 | Mistakes | Lumpy clay blob / Smooth clay blob | Stop-motion clay | Toy piano |
| 15 | Confidence | Flickering candle / Lighthouse | Papercut silhouette | Cello drone |
| 16 | Dreams | Paper boat / Origami crane | Origami craft paper | Music box |
| 17 | Beginning | Lost compass / Breadcrumb trail | Nordic folk tale | Glockenspiel |
| 18 | Future | Hourglass / Sprouting seedling | Vintage botanical | Gentle chimes |
| 19 | Let Go | Barnacle on anchor / Jellyfish | Soft pastel dreamy | Gentle harp arpeggios |
| 20 | Worth | Dull pebble / Oyster with pearl | Glossy 3D render | Warm marimba + soft pads |
| 21 | Light | Dim-winged moth / Glowing lantern | Stained glass | Ambient drone + chimes |
| 22 | Breathe | Wobbling spinning top / Calm tortoise | Retro 1930s rubber-hose | Slow jazz brushes |
| 23 | Stronger | Cracked teacup / Kintsugi gold-vein bowl | Japanese ink + gold leaf | Taiko + swelling strings |
| 24 | Direction | Spinning weather vane / Signpost | Folk-art woodcut | Acoustic mandolin |
| 25 | Opportunity | Closed door / Row of glowing open doorways | Warm oil painting | Hopeful strings + piano |
| 26 | Love | Wilted red rose / Cupped hands holding glowing heart | Soft chalk pastel | Gentle fingerpicked guitar |
| 27 | Enough | Hamster on spinning wheel / Cat in sunbeam | Crayon sketch | Warm music box + soft cello |
| 28 | Comparison | Anxious checkered flag / Turtle with tiny house | Mid-century modern flat | Light marimba + brushes |
| 29 | Slow Down | Over-ticking pocket watch / Slow-melting snowman | Watercolor children's book | Calm vibraphone |
| 30 | Persistence | Ant pushing boulder uphill / Mountain trail with cairns | Pen-and-ink hatching | Steady acoustic guitar strum |

================================================================
  END OF KIT
================================================================