Qr
This commit is contained in:
parent
11e8e84064
commit
f4125a09ed
@ -375,7 +375,15 @@
|
||||
qrCodeResult: null,
|
||||
debounceTimeout: null,
|
||||
error: "",
|
||||
selectedConstraints: { facingMode: "environment" },
|
||||
selectedConstraints: {
|
||||
video: {
|
||||
facingMode: "environment", // Kamera belakang
|
||||
width: { ideal: 1920 }, // Resolusi tinggi
|
||||
height: { ideal: 1080 },
|
||||
focusMode: "continuous", // Auto-focus
|
||||
zoom: 2.0
|
||||
}
|
||||
},
|
||||
trackFunctionSelected: { text: 'outline', value: null },
|
||||
barcodeFormats: {
|
||||
qr_code: true, // Hanya mendukung QR Code
|
||||
@ -625,10 +633,12 @@
|
||||
}
|
||||
this.error = message;
|
||||
},
|
||||
|
||||
//Setting Camera
|
||||
async onCameraReady() {
|
||||
try {
|
||||
this.enableAutoFocus();
|
||||
},
|
||||
|
||||
async enableAutoFocus() {
|
||||
const devices = await navigator.mediaDevices.enumerateDevices();
|
||||
this.videoInputDevices = devices.filter(device => device.kind === 'videoinput');
|
||||
|
||||
@ -642,11 +652,19 @@
|
||||
} else {
|
||||
this.error = "No camera detected.";
|
||||
}
|
||||
} catch (err) {
|
||||
this.error = "Error accessing camera: " + err.message;
|
||||
|
||||
|
||||
const stream = await navigator.mediaDevices.getUserMedia({ video: true });
|
||||
const track = stream.getVideoTracks()[0];
|
||||
const capabilities = track.getCapabilities();
|
||||
|
||||
if(capabilities.focusMode) {
|
||||
await track.applyConstraints({ focusMode: "continuous" }); // Auto-focus
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
|
||||
//Update Camera Category
|
||||
updateCamera() {
|
||||
this.selectedConstraints = { deviceId: { exact: this.selectedCameraId } };
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"applicationUrl": "http://localhost:5124",
|
||||
"applicationUrl": "http://192.168.0.20:5124",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
@ -22,7 +22,7 @@
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"applicationUrl": "https://localhost:7036;http://localhost:5124",
|
||||
"applicationUrl": "https://192.168.0.20:7036;http://192.168.0.20:5124",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user