{ "name": "cropper-video-demo", "type": "registry:example", "registryDependencies": [ "cropper", "button", "label", "select" ], "files": [ { "path": "examples/cropper-video-demo.tsx", "type": "registry:example", "content": "\"use client\";\n\nimport { PauseIcon, PlayIcon } from \"lucide-react\";\nimport * as React from \"react\";\nimport { Button } from \"@/registry/bases/base/ui/button\";\nimport {\n Cropper,\n CropperArea,\n type CropperPoint,\n CropperVideo,\n} from \"@/registry/bases/base/ui/cropper\";\n\nexport default function CropperVideoDemo() {\n const [crop, setCrop] = React.useState({ x: 0, y: 0 });\n const [zoom, setZoom] = React.useState(1);\n const [isPlaying, setIsPlaying] = React.useState(true);\n const videoRef = React.useRef(null);\n\n const onPlayToggle = React.useCallback(() => {\n if (videoRef.current) {\n if (isPlaying) {\n videoRef.current.pause();\n } else {\n videoRef.current.play();\n }\n setIsPlaying(!isPlaying);\n }\n }, [isPlaying]);\n\n const onMetadataLoaded = React.useCallback(() => {\n if (videoRef.current && isPlaying) {\n videoRef.current.play();\n }\n }, [isPlaying]);\n\n return (\n
\n \n {isPlaying ? (\n <>\n \n Pause\n \n ) : (\n <>\n \n Play\n \n )}\n \n \n \n \n \n
\n );\n}\n", "target": "" } ] }