-
Notifications
You must be signed in to change notification settings - Fork 44
Description
Stop doesnt seem to do anything. Calling it or not calling it has no effect and the callback continuously gets called.
Code Below
const controlsRef: MutableRefObject<IScannerControls | null | undefined> = useRef(undefined);
useEffect(()=>{
const codeReader = new BrowserQRCodeReader(undefined, {
delayBetweenScanAttempts:props.qrReaderProps.scanDelay,
});
codeReader.decodeFromConstraints({ video:props.qrReaderProps.constraints }, props.qrReaderProps.videoId, (result, error,controls) => {onResult(result,error,controls,codeReader)})
.then((controls: IScannerControls) => {
controlsRef.current = controls;
})
.catch((error: Error) => {
if(props.qrReaderProps.onResult){
onResult(null, error, controlsRef.current, codeReader);
}
});
return () => {
BrowserCodeReader.releaseAllStreams()
controlsRef.current?.stop();
};
},[])