Added logic in ocr for capture
This commit is contained in:
@@ -825,8 +825,8 @@ function cameraCapture() {
|
|||||||
async capturePhoto() {
|
async capturePhoto() {
|
||||||
const video = this.$refs.video;
|
const video = this.$refs.video;
|
||||||
const canvas = this.$refs.canvas;
|
const canvas = this.$refs.canvas;
|
||||||
const overlay = this.$refs.overlay;
|
|
||||||
const snapshot = this.$refs.snapshot;
|
const snapshot = this.$refs.snapshot;
|
||||||
|
const overlay = this.$refs.overlay;
|
||||||
const ctx = canvas.getContext('2d');
|
const ctx = canvas.getContext('2d');
|
||||||
|
|
||||||
canvas.width = video.videoWidth;
|
canvas.width = video.videoWidth;
|
||||||
@@ -837,17 +837,22 @@ function cameraCapture() {
|
|||||||
this.$refs.hiddenInput.value = snapshotData;
|
this.$refs.hiddenInput.value = snapshotData;
|
||||||
this.capturedPhoto = snapshotData;
|
this.capturedPhoto = snapshotData;
|
||||||
|
|
||||||
// ✅ Hide live video immediately → prevents black frame
|
// ✅ Hide video and overlays immediately
|
||||||
video.classList.add('hidden');
|
video.classList.add('hidden');
|
||||||
overlay.classList.add('hidden');
|
overlay.classList.add('hidden');
|
||||||
|
|
||||||
// Stop camera stream after hide
|
// ✅ Set snapshot image and display in same place
|
||||||
if (this.stream) this.stream.getTracks().forEach(track => track.stop());
|
|
||||||
|
|
||||||
snapshot.src = snapshotData;
|
snapshot.src = snapshotData;
|
||||||
snapshot.classList.remove('hidden');
|
snapshot.classList.remove('hidden');
|
||||||
|
|
||||||
|
// ✅ Stop video stream (after hiding)
|
||||||
|
if (this.stream) {
|
||||||
|
this.stream.getTracks().forEach(track => track.stop());
|
||||||
|
}
|
||||||
|
|
||||||
this.stopDetection();
|
this.stopDetection();
|
||||||
},
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async verifyPhoto() {
|
async verifyPhoto() {
|
||||||
|
|||||||
Reference in New Issue
Block a user