I'm try to implement face recognition component using react-use-face-detection and @mediapipe library.When I unmount component react-webcam not closed successfully.How I fix that error?
const { webcamRef, boundingBox, isLoading, detected, facesDetected } = useFaceDetection({
faceDetectionOptions : {
model: 'short'
},
faceDetection: new FaceDetection.FaceDetection({
locateFile: (file) => {
return `/face_detection/${file}`
},
}),
camera: ({ mediaSrc, onFrame, width, height }) =>
new Camera(mediaSrc, {
onFrame,
width,
height,
}),
});
How I fix this issue?
I have rewrited this package you're using to fit some needs of my project but with this I've fixed this issue about camera not unmounting.
In this case I've removed
boundingBox, isLoading, detected and facesDetectedprops from the return. If you doesn't need this you can try using it.Here you can find it.