Skip to content

Commit

Permalink
Merge pull request #12 from team-GDGline/feat/modify
Browse files Browse the repository at this point in the history
feat: 카메라 허용 권한 요청
  • Loading branch information
Catleap02 authored Nov 15, 2024
2 parents 4828d9a + a39168d commit 66afc88
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/pages/Camera/CameraPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<string | null>(null);
const [loading, setLoading] = useState(false); // 로딩 상태 추가
const videoRef = useRef<HTMLVideoElement>(null);
const canvasRef = useRef<HTMLCanvasElement>(null);
const fileInputRef = useRef<HTMLInputElement>(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();
Expand Down

0 comments on commit 66afc88

Please sign in to comment.