camera settings

This commit is contained in:
ameerulrasyid 2025-03-06 08:34:13 +08:00
parent f4fc5dc103
commit 6018c3df2c

View File

@ -780,29 +780,58 @@ console.log("🎬 Video.srcObject:", video?.srcObject);
if (capabilities.sharpness) {
// track.applyConstraints({
// advanced: [ { sharpness: 100 }, Max sharpness
// { contrast: 50 }, Boost contrast
// { brightness: 60 }, Increase brightness
// { frameRate: 30 }, Try max FPS
// { exposureTime: 100 }, Lower for less motion blur
// { focusMode: "continuous" }, Ensure auto-focus
// { width: 1280, height: 720 }]}) Max resolution] Max sharpness
track.applyConstraints ({
advanced: [
{ width: 1280, height: 720 }
]
// { contrast: 50 }, Boost contrast
// { brightness: 60 }, Increase brightness
// { frameRate: 30 }, Try max FPS
// { exposureTime: 100 }, Lower for less motion blur
// { focusMode: "continuous" }, Ensure auto-focus
// { width: 1280, height: 720 }
//]
// }) Max resolution] Max sharpness
// track.applyConstraints ({
// advanced: [
// {sharpness: 80},
// { width: 1280, height: 720 }
// ]
// })
// .then(() => {console.log("✅ Sharpness applied"); console.log("📷 Applied Constraintsss:", track.getSettings()); })
// .catch(err => console.error("❌ Failed to apply sharpness:", err));
// Step 1: Apply resolution constraints first
track.applyConstraints({
advanced: [{ width: 1280, height: 720 }]
}).then(() => {
console.log("✅ Resolution applied", track.getSettings().width, "x", track.getSettings().height);
// Step 2: Apply sharpness separately
return track.applyConstraints({ advanced: [{ sharpness: 100 }] });
}).then(() => {console.log("✅ Sharpness applied")
// Step 2: Apply sharpness separately
return track.applyConstraints({ advanced: [{ whiteBalanceMode: "continuous" }] });
}).then(() => {console.log("✅ whitebalancemode continous applied");
})
.then(() => console.log("✅ Sharpness applied"))
.catch(err => console.error("❌ Failed to apply sharpness:", err));
.then(() => { console.log("📷 Applied Constraintsss:", track.getSettings());
}).catch(err => console.error("❌ Failed to apply constraints:", err));
} else {
console.warn("⚠️ Sharpness not supported on this camera");
}
}
console.log("📷 Applied Constraints:", track.getSettings());
console.log("📷 Applied Constraintsss:", track.getSettings());
console.log("📷 Applied Capabilities:",track.getCapabilities());
console.log("Is it a video element?", videoElement instanceof HTMLVideoElement);
console.log("Camera Ready! Video element:", videoElement);
this.videoElement = videoElement; // Store for later use
// console.log("Is it a video element?", videoElement instanceof HTMLVideoElement);
// console.log("Camera Ready! Video element:", videoElement);
// this.videoElement = videoElement; Store for later use
// this.scanStartTime = performance.now(); Start timing
// this.scanTime = null; Reset previous scan time
// if (!videoElement || !videoElement.srcObject) {