diff --git a/src/pages/Camera/CameraPage.tsx b/src/pages/Camera/CameraPage.tsx index e05fb1e..096a4b5 100644 --- a/src/pages/Camera/CameraPage.tsx +++ b/src/pages/Camera/CameraPage.tsx @@ -10,13 +10,27 @@ import LoadingSpinner from "../../components/LoadingSpinner"; const CameraPage: React.FC = () => { const navigate = useNavigate(); const toast = useToast(); - const accessToken = "your-access-token"; const [isCameraActive, setIsCameraActive] = useState(false); const [capturedImage, setCapturedImage] = useState(null); const [loading, setLoading] = useState(false); // 로딩 상태 추가 const videoRef = useRef(null); const canvasRef = useRef(null); const fileInputRef = useRef(null); // 파일 선택 input 참조 + const accessToken = localStorage.getItem("accessToken"); + + + useEffect(() => { + navigator.mediaDevices + .getUserMedia({ video: true }) + .then((stream) => { + if (videoRef.current) { + videoRef.current.srcObject = stream; + } + }) + .catch((err: unknown) => { + console.error("Camera access denied:", err); + }); + }, []); useEffect(() => { startCamera();