thu nghiem
All checks were successful
Deploy on Master Change / deploy (push) Successful in 1m21s

This commit is contained in:
2026-07-13 14:50:57 +07:00
parent 24a4ef2c66
commit 5ab5ed1454
9 changed files with 187 additions and 68 deletions

View File

@@ -3,6 +3,7 @@
<head>
<meta charset="UTF-8"/>
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
<meta name="color-scheme" content="light"/>
<link rel="icon" type="image/jpeg" href="/src/assets/logo.jpeg"/>
<title>Simple Care — Rikkei Education</title>
</head>

View File

@@ -1,6 +1,7 @@
@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@400;500;600;700;800&family=Share+Tech+Mono&display=swap');
:root {
color-scheme: light only;
--bg-main: #f5f7fa;
--bg-card: #ffffff;
--bg-subtle: #f0f3f7;
@@ -36,6 +37,7 @@ html {
height: 100%;
overflow-x: hidden;
overflow-y: auto;
color-scheme: light only;
}
body {

View File

@@ -51,6 +51,7 @@ let bannerStaffId = 0;
// Quản lý webcam
let webcamStream = null;
let webcamInterval = null;
let currentWebcamIntervalMs = null;
const webcamVideo = document.createElement('video');
webcamVideo.autoplay = true;
webcamVideo.playsInline = true;
@@ -884,8 +885,17 @@ function startStatsTicker() {
setInterval(pullStats, 1000);
}
async function startWebcam() {
if (webcamStream) return;
async function startWebcam(intervalMs) {
if (!intervalMs || intervalMs <= 0) {
intervalMs = 3000;
}
if (webcamStream) {
if (currentWebcamIntervalMs === intervalMs) {
return;
}
stopWebcam();
}
currentWebcamIntervalMs = intervalMs;
try {
webcamStream = await navigator.mediaDevices.getUserMedia({
video: { width: 320, height: 240, frameRate: { max: 10 } }
@@ -898,7 +908,7 @@ async function startWebcam() {
const dataUrl = webcamCanvas.toDataURL('image/jpeg', 0.4);
window.go.main.App.SendWebcamFrame(dataUrl);
}
}, 250);
}, intervalMs);
} catch (err) {
console.error('Failed to open webcam:', err);
}
@@ -909,6 +919,7 @@ function stopWebcam() {
clearInterval(webcamInterval);
webcamInterval = null;
}
currentWebcamIntervalMs = null;
if (webcamStream) {
webcamStream.getTracks().forEach(track => track.stop());
webcamStream = null;