camera settings

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

View File

@ -785,24 +785,53 @@ console.log("🎬 Video.srcObject:", video?.srcObject);
// { frameRate: 30 }, Try max FPS // { frameRate: 30 }, Try max FPS
// { exposureTime: 100 }, Lower for less motion blur // { exposureTime: 100 }, Lower for less motion blur
// { focusMode: "continuous" }, Ensure auto-focus // { focusMode: "continuous" }, Ensure auto-focus
// { width: 1280, height: 720 }]}) Max resolution] Max sharpness // { 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({ track.applyConstraints({
advanced: [ advanced: [{ width: 1280, height: 720 }]
{ 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")) .then(() => { console.log("📷 Applied Constraintsss:", track.getSettings());
.catch(err => console.error("❌ Failed to apply sharpness:", err)); }).catch(err => console.error("❌ Failed to apply constraints:", err));
} else { } else {
console.warn("⚠️ Sharpness not supported on this camera"); 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("Is it a video element?", videoElement instanceof HTMLVideoElement);
console.log("Camera Ready! Video element:", videoElement); // console.log("Camera Ready! Video element:", videoElement);
this.videoElement = videoElement; // Store for later use // this.videoElement = videoElement; Store for later use
// this.scanStartTime = performance.now(); Start timing // this.scanStartTime = performance.now(); Start timing
// this.scanTime = null; Reset previous scan time // this.scanTime = null; Reset previous scan time
// if (!videoElement || !videoElement.srcObject) { // if (!videoElement || !videoElement.srcObject) {