Form changes Horizon - Upload Daily Field Work Photo
Specific Folder FTP Upload / ftp-deploy (push) Successful in 1m24s
Details
Specific Folder FTP Upload / ftp-deploy (push) Successful in 1m24s
Details
This commit is contained in:
parent
d9fa99e414
commit
de0ef5dcaa
|
|
@ -368,9 +368,10 @@
|
|||
$('#start-photo-camera').on('click', async function () {
|
||||
try {
|
||||
if (!navigator.mediaDevices || !navigator.mediaDevices.getUserMedia) {
|
||||
throw new Error('Camera access is not supported by this browser.');
|
||||
throw new Error('Camera access requires HTTPS or localhost.');
|
||||
}
|
||||
|
||||
// This triggers the browser's native camera permission prompt
|
||||
photoStream = await navigator.mediaDevices.getUserMedia({
|
||||
video: { facingMode: { ideal: 'environment' } },
|
||||
audio: false
|
||||
|
|
@ -385,13 +386,26 @@
|
|||
$('#retake-photo').hide();
|
||||
|
||||
} catch (error) {
|
||||
console.error('Camera error:', error);
|
||||
|
||||
if (error.name === 'NotAllowedError' ||
|
||||
error.name === 'PermissionDeniedError') {
|
||||
|
||||
Swal.fire({
|
||||
icon: 'warning',
|
||||
title: 'Camera Permission Required',
|
||||
text: 'Please allow camera access in your browser settings and click Open Camera again.'
|
||||
});
|
||||
|
||||
} else {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Camera Unavailable',
|
||||
text: 'Please allow camera access and try again.'
|
||||
text: 'Unable to access your camera. Please check your camera and try again.'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$('#capture-photo').on('click', function () {
|
||||
if (!photoStream || !video.videoWidth) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue