Beautiful Open-Source Form Builder
Barcode scanner issue fixed (#721)
Chirag Chhatralac3c66e0b7168
diff --git a/client/components/forms/components/CameraUpload.vue b/client/components/forms/components/CameraUpload.vueindex 7e981f06a..9aa65026d 100644--- a/client/components/forms/components/CameraUpload.vue+++ b/client/components/forms/components/CameraUpload.vue@@ -165,6 +165,10 @@ export default {this.openCameraUpload()},+ beforeUnmount() {+ this.cleanupCurrentStream()+ },+methods: {async cleanupCurrentStream() {if (this.quaggaInitialized) {@@ -183,6 +187,8 @@ export default {const webcamElement = document.getElementById("webcam")if (webcamElement && webcamElement.srcObject) {+ const tracks = webcamElement.srcObject.getTracks()+ tracks.forEach(track => track.stop())webcamElement.srcObject = null}},@@ -226,6 +232,7 @@ export default {}const stream = await navigator.mediaDevices.getUserMedia(constraints)+ this.mediaStream = stream // Store the stream referencewebcamElement.srcObject = streamthis.webcam = new Webcam(@@ -289,12 +296,8 @@ export default {},cancelCamera() {this.isCapturing = false- this.capturedImage = null- if (this.quaggaInitialized) {- Quagga.stop()- this.quaggaInitialized = false- }- this.webcam.stop()+ this.capturedImage = null+ this.cleanupCurrentStream() // Use the cleanup methodthis.$emit("stopWebcam")},processCapturedImage() {