changed logic in ocr related to init camera
This commit is contained in:
@@ -201,6 +201,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
// },
|
||||
async initCamera() {
|
||||
try {
|
||||
if (this.stream) this.stream.getTracks().forEach(track => track.stop());
|
||||
this.stream = await navigator.mediaDevices.getUserMedia({
|
||||
video: {
|
||||
facingMode: this.currentFacingMode, // 'user' or 'environment'
|
||||
@@ -212,6 +213,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
this.$refs.video.srcObject = this.stream;
|
||||
} catch (err) {
|
||||
console.error('Error accessing camera:', err);
|
||||
alert("Cannot access camera. Enable permissions or use HTTPS.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user