{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "voice-input-demo",
  "title": "Voice Input Demo",
  "description": "A worked example of Voice Input: A microphone that draws what it is hearing, so a live one is told apart from a dead one at a glance.",
  "registryDependencies": [
    "https://ui.tinkererslabs.com/r/voice-input.json"
  ],
  "files": [
    {
      "path": "components/demos/voice-input-demo.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\n\nimport { VoiceInput } from \"@/registry/default/voice-input/voice-input\"\n\nexport function VoiceInputDemo() {\n  const [recording, setRecording] = React.useState<{\n    url: string\n    seconds: number\n  } | null>(null)\n  const startedAt = React.useRef(0)\n\n  React.useEffect(\n    () => () => {\n      if (recording) URL.revokeObjectURL(recording.url)\n    },\n    [recording]\n  )\n\n  return (\n    <div className=\"w-full max-w-md space-y-3\">\n      <VoiceInput\n        maxDuration={30}\n        onStart={() => {\n          startedAt.current = Date.now()\n          setRecording(null)\n        }}\n        onResult={(blob) => {\n          setRecording({\n            url: URL.createObjectURL(blob),\n            seconds: (Date.now() - startedAt.current) / 1000,\n          })\n        }}\n      />\n\n      {recording ? (\n        <div className=\"border-border bg-muted/40 space-y-2 rounded-lg border p-3\">\n          <p className=\"text-muted-foreground text-xs\">\n            {recording.seconds.toFixed(1)} seconds captured. Nothing left this\n            page: the recording is a blob in memory, for you to send wherever it\n            gets read.\n          </p>\n          <audio controls src={recording.url} className=\"w-full\" />\n        </div>\n      ) : null}\n    </div>\n  )\n}\n",
      "type": "registry:example"
    }
  ],
  "type": "registry:example"
}