fix camera showing

This commit is contained in:
mphstar 2025-02-23 20:06:40 +07:00
parent 2b86d44021
commit cc98d85658
3 changed files with 7 additions and 4 deletions

View File

@ -37,7 +37,7 @@ const Home = () => {
if (videoRef.current) { if (videoRef.current) {
videoRef.current.srcObject = stream; videoRef.current.srcObject = stream;
} }
setLoadCamera(true);
// setLoadCamera(true); // setLoadCamera(true);
await initializeHandDetection(); await initializeHandDetection();
@ -146,6 +146,7 @@ const Home = () => {
loadModel(); loadModel();
startWebcam(); startWebcam();
setLoadCamera(true);
return () => { return () => {

View File

@ -51,7 +51,7 @@ const Quiz = () => {
videoRef.current.srcObject = stream; videoRef.current.srcObject = stream;
} }
setLoadCamera(true);
// setLoadCamera(true); // setLoadCamera(true);
await initializeHandDetection(); await initializeHandDetection();
@ -238,6 +238,8 @@ const Quiz = () => {
loadModel(); loadModel();
startWebcam(); startWebcam();
setLoadCamera(true);
return () => { return () => {
if (handLandmarker) { if (handLandmarker) {
handLandmarker.close(); handLandmarker.close();

View File

@ -41,8 +41,6 @@ const Quiz = () => {
videoRef.current.srcObject = stream; videoRef.current.srcObject = stream;
} }
setLoadCamera(true);
// setLoadCamera(true); // setLoadCamera(true);
await initializeHandDetection(); await initializeHandDetection();
} catch (error) { } catch (error) {
@ -188,6 +186,8 @@ const Quiz = () => {
loadModel(); loadModel();
startWebcam(); startWebcam();
setLoadCamera(true);
return () => { return () => {
if (handLandmarker) { if (handLandmarker) {
handLandmarker.close(); handLandmarker.close();