Skip to content

Commit

Permalink
fix: handle camera is not plugged in mid-verification (#328)
Browse files Browse the repository at this point in the history
Signed-off-by: bunsy-0900 <[email protected]>
  • Loading branch information
bunsy-0900 authored Aug 29, 2024
1 parent 0f86a49 commit 2238b8f
Showing 1 changed file with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,29 @@ export const VerificationScreen = ({
sendMessage(request);
};

useEffect(() => {
// checking camera permission in every 1 second
const cameraCheckInterval = setInterval(
cameraDeviceCheck,
1000
);
return () => clearInterval(cameraCheckInterval);
}, []);

const cameraDeviceCheck = () => {
navigator.mediaDevices
.getUserMedia({ video: true })
.catch(stopEkycVerificationCheck);
};

const stopEkycVerificationCheck = (err: DOMException) => {
if (connected) {
unsubscribe();
client.deactivate();
}
setStep(EkycVerificationStep.IdentityVerificationStatus);
}

const convertResponseToState = (
res: IdentityVerificationResponseDto
): IdentityVerificationState => {
Expand Down

0 comments on commit 2238b8f

Please sign in to comment.