import type { Media } from "@/content/site"; import { optimizedImageUrl } from "@/lib/image-url"; import { MediaFrame } from "./MediaFrame"; /** Reels sind hoch und hoechstens ein Drittel breit. */ const POSTER_WIDTH = 1080; type Slot = { name: string | null; caption: string | null; poster: Media | null; src: string | null }; /** * Ein Video aus dem eigenen Medienverzeichnis, im eigenen Seitenverhaeltnis * (quer oder hoch). Es startet nie von selbst. Mit Vorschaubild laedt vorab * nichts vom Video, ohne nur Metadaten und erstes Bild (#t=0.1). Kein * externer Anbieter. */ export function VideoSlot({ slot, index, showDrafts }: { slot: Slot; index: number; showDrafts: boolean }) { const label = slot.name ? `Video von ${slot.name}` : `Video ${index + 1}`; // Vorschaubild ueber die Bildoptimierung statt im Original (ein Reel-PNG // hatte 1,3 MB); mit Vorschaubild laedt vom Video vorab nichts. const poster = slot.poster?.kind === "image" ? optimizedImageUrl(slot.poster.src, POSTER_WIDTH) : undefined; return (
{slot.src ? ( ) : (
)} {(slot.name || slot.caption || (showDrafts && !slot.src)) && (
{slot.name ? {slot.name} : showDrafts && Name und Freigabe folgen} {slot.caption && {slot.caption}}
)}
); }