diff --git a/resources/views/fields/camera-capture.blade.php b/resources/views/fields/camera-capture.blade.php index 2c87eee..3f333bf 100644 --- a/resources/views/fields/camera-capture.blade.php +++ b/resources/views/fields/camera-capture.blade.php @@ -774,6 +774,7 @@ function cameraCapture() { } catch (err) { console.error("Camera error:", err); alert("Camera error:\n" + (err.message || err)); + this.stopDetection(); } }, @@ -796,6 +797,7 @@ function cameraCapture() { this.capturedPhoto = snapshotData; // store for verification alert("Photo captured!"); + this.stopDetection(); }, async verifyPhoto() { @@ -870,6 +872,14 @@ function cameraCapture() { if (this.textDetectionInterval) clearInterval(this.textDetectionInterval); this.textDetectionInterval = setInterval(() => this.detectText(), 1000); } + + stopDetection() { + if (this.textDetectionInterval) { + clearInterval(this.textDetectionInterval); + this.textDetectionInterval = null; + console.log("Text detection stopped"); + } + } } }