Handle camera errors
This commit is contained in:
parent
dbd076ae21
commit
36e080cb35
|
@ -81,14 +81,6 @@ function Form(): JSX.Element {
|
|||
return;
|
||||
}
|
||||
|
||||
// Check permissions to camera device
|
||||
try {
|
||||
navigator.mediaDevices.getUserMedia({video: true});
|
||||
} catch (e) {
|
||||
setErrorMessage("noCameraAccess");
|
||||
return;
|
||||
}
|
||||
|
||||
// Get preview Element to show camera stream
|
||||
const previewElem: HTMLVideoElement = document.querySelector('#cameraPreview');
|
||||
|
||||
|
@ -108,6 +100,9 @@ function Form(): JSX.Element {
|
|||
setGlobalControls(undefined);
|
||||
setIsCameraOpen(false);
|
||||
}
|
||||
if (error !== undefined) {
|
||||
setErrorMessage("noCameraAccess");
|
||||
}
|
||||
}
|
||||
)
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue