{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "media-07",
  "type": "registry:block",
  "description": "Cinematic video player with custom controls, seek bar chapter markers, captions and a chapter grid.",
  "dependencies": [
    "lucide-react"
  ],
  "registryDependencies": [],
  "files": [
    {
      "path": "registry/designali/blocks/media/media-07.tsx",
      "content": "\"use client\"\n\nimport { useEffect, useState } from \"react\"\nimport {\n  Captions,\n  Maximize,\n  Pause,\n  Play,\n  RotateCcw,\n  RotateCw,\n  Settings,\n  Volume2,\n  VolumeX,\n} from \"@designali/icons\"\n\nconst DURATION = 754\nconst chapters = [\n  { at: 0, label: \"Cold open\" },\n  { at: 128, label: \"The first sketch\" },\n  { at: 342, label: \"First Designali block\" },\n  { at: 560, label: \"Launch day\" },\n]\n\nconst fmt = (s: number) =>\n  `${Math.floor(s / 60)}:${String(Math.floor(s % 60)).padStart(2, \"0\")}`\n\nexport default function Media07() {\n  const [playing, setPlaying] = useState(false)\n  const [time, setTime] = useState(212)\n  const [muted, setMuted] = useState(false)\n  const [cc, setCc] = useState(true)\n\n  useEffect(() => {\n    if (!playing) return\n    const id = setInterval(\n      () => setTime((t) => (t + 1 >= DURATION ? 0 : t + 1)),\n      1000\n    )\n    return () => clearInterval(id)\n  }, [playing])\n\n  const chapter = [...chapters].reverse().find((c) => time >= c.at)!\n  const seek = (delta: number) =>\n    setTime((t) => Math.min(DURATION, Math.max(0, t + delta)))\n\n  return (\n    <section className=\"w-full bg-background py-16\">\n      <div className=\"mx-auto max-w-6xl px-6\">\n        <div className=\"mb-6 flex flex-wrap items-end justify-between gap-3\">\n          <div>\n            <p className=\"text-xs tracking-widest text-muted-foreground uppercase\">\n              Documentary - 12 min\n            </p>\n            <h2 className=\"mt-2 text-2xl font-semibold tracking-tight md:text-3xl\">\n              Made by Design: The Designali Story\n            </h2>\n          </div>\n          <p className=\"text-sm text-muted-foreground\">A film by Ali Imam</p>\n        </div>\n        <div className=\"group relative aspect-video w-full overflow-hidden border border-border bg-black text-white\">\n          <img\n            src=\"/stock/wallpaper-1.jpg\"\n            alt=\"Still from The Designali Story\"\n            className=\"absolute inset-0 size-full object-cover transition-transform duration-[2000ms]\"\n            style={{ transform: playing ? \"scale(1.04)\" : \"scale(1)\" }}\n          />\n          <button\n            type=\"button\"\n            aria-label={playing ? \"Pause\" : \"Play\"}\n            onClick={() => setPlaying((p) => !p)}\n            className=\"absolute inset-0 flex items-center justify-center\"\n          >\n            {!playing && (\n              <span className=\"flex size-16 items-center justify-center rounded-full bg-white/90 text-black transition-transform hover:scale-105 md:size-20\">\n                <Play className=\"size-6 translate-x-0.5 fill-current md:size-8\" />\n              </span>\n            )}\n          </button>\n          {cc && (\n            <p className=\"pointer-events-none absolute inset-x-0 bottom-20 mx-auto w-fit max-w-[85%] bg-black/70 px-3 py-1 text-center text-xs md:bottom-24 md:text-base\">\n              &ldquo;Where thoughtful design meets production-ready code.&rdquo;\n            </p>\n          )}\n          <div className=\"absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/90 to-transparent px-3 pt-10 pb-3 transition-opacity md:px-5 md:pb-4\">\n            <div className=\"relative h-4\">\n              <div className=\"absolute top-1/2 h-1 w-full -translate-y-1/2 bg-white/25\">\n                <div\n                  className=\"h-full bg-white\"\n                  style={{ width: `${(time / DURATION) * 100}%` }}\n                />\n              </div>\n              {chapters.slice(1).map((c) => (\n                <span\n                  key={c.at}\n                  className=\"absolute top-1/2 h-1 w-0.5 -translate-y-1/2 bg-black\"\n                  style={{ left: `${(c.at / DURATION) * 100}%` }}\n                />\n              ))}\n              <input\n                type=\"range\"\n                min={0}\n                max={DURATION}\n                value={time}\n                onChange={(e) => setTime(Number(e.target.value))}\n                aria-label=\"Seek\"\n                className=\"absolute inset-0 w-full cursor-pointer opacity-0\"\n              />\n            </div>\n            <div className=\"mt-2 flex items-center gap-1 text-sm md:gap-2\">\n              <button\n                type=\"button\"\n                aria-label={playing ? \"Pause\" : \"Play\"}\n                onClick={() => setPlaying((p) => !p)}\n                className=\"flex size-8 items-center justify-center hover:bg-white/10\"\n              >\n                {playing ? (\n                  <Pause className=\"size-4 fill-current\" />\n                ) : (\n                  <Play className=\"size-4 fill-current\" />\n                )}\n              </button>\n              <button\n                type=\"button\"\n                aria-label=\"Back 10 seconds\"\n                onClick={() => seek(-10)}\n                className=\"hidden size-8 items-center justify-center hover:bg-white/10 sm:flex\"\n              >\n                <RotateCcw className=\"size-4\" />\n              </button>\n              <button\n                type=\"button\"\n                aria-label=\"Forward 10 seconds\"\n                onClick={() => seek(10)}\n                className=\"hidden size-8 items-center justify-center hover:bg-white/10 sm:flex\"\n              >\n                <RotateCw className=\"size-4\" />\n              </button>\n              <button\n                type=\"button\"\n                aria-label={muted ? \"Unmute\" : \"Mute\"}\n                onClick={() => setMuted((m) => !m)}\n                className=\"flex size-8 items-center justify-center hover:bg-white/10\"\n              >\n                {muted ? (\n                  <VolumeX className=\"size-4\" />\n                ) : (\n                  <Volume2 className=\"size-4\" />\n                )}\n              </button>\n              <span className=\"ml-1 font-sans text-xs tabular-nums\">\n                {fmt(time)} / {fmt(DURATION)}\n              </span>\n              <span className=\"ml-2 hidden truncate text-xs text-white/70 md:inline\">\n                - {chapter.label}\n              </span>\n              <div className=\"ml-auto flex items-center gap-1\">\n                <button\n                  type=\"button\"\n                  aria-label=\"Captions\"\n                  aria-pressed={cc}\n                  onClick={() => setCc((c) => !c)}\n                  className={`flex size-8 items-center justify-center hover:bg-white/10 ${cc ? \"text-white\" : \"text-white/50\"}`}\n                >\n                  <Captions className=\"size-4\" />\n                </button>\n                <button\n                  type=\"button\"\n                  aria-label=\"Settings\"\n                  className=\"hidden size-8 items-center justify-center hover:bg-white/10 sm:flex\"\n                >\n                  <Settings className=\"size-4\" />\n                </button>\n                <button\n                  type=\"button\"\n                  aria-label=\"Fullscreen\"\n                  className=\"flex size-8 items-center justify-center hover:bg-white/10\"\n                >\n                  <Maximize className=\"size-4\" />\n                </button>\n              </div>\n            </div>\n          </div>\n        </div>\n        <div className=\"mt-4 grid grid-cols-2 gap-px border border-border bg-border md:grid-cols-4\">\n          {chapters.map((c) => (\n            <button\n              key={c.at}\n              type=\"button\"\n              onClick={() => setTime(c.at)}\n              className={`bg-background p-3 text-left text-sm transition-colors hover:bg-muted ${chapter.at === c.at ? \"text-foreground\" : \"text-muted-foreground\"}`}\n            >\n              <span className=\"block font-sans text-xs\">{fmt(c.at)}</span>\n              <span className=\"mt-0.5 block truncate font-medium\">\n                {c.label}\n              </span>\n            </button>\n          ))}\n        </div>\n      </div>\n    </section>\n  )\n}\n",
      "type": "registry:component"
    }
  ],
  "meta": {
    "iframeHeight": "850px"
  },
  "categories": [
    "media"
  ]
}