@meeeetup/camera-web 0.6.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +116 -9
- package/dist/index.d.ts +8 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/react/components/CameraViewport.d.ts +16 -3
- package/dist/react/components/CameraViewport.d.ts.map +1 -1
- package/dist/react/components/CameraViewport.js +29 -6
- package/dist/react/components/CameraViewport.js.map +1 -1
- package/dist/react/components/CaptureButton.d.ts +8 -1
- package/dist/react/components/CaptureButton.d.ts.map +1 -1
- package/dist/react/components/CaptureButton.js +20 -4
- package/dist/react/components/CaptureButton.js.map +1 -1
- package/dist/react/components/SingleAlignmentOverlay.d.ts +13 -0
- package/dist/react/components/SingleAlignmentOverlay.d.ts.map +1 -0
- package/dist/react/components/SingleAlignmentOverlay.js +41 -0
- package/dist/react/components/SingleAlignmentOverlay.js.map +1 -0
- package/dist/react/context/MeeeetUpCamContext.d.ts +18 -2
- package/dist/react/context/MeeeetUpCamContext.d.ts.map +1 -1
- package/dist/react/context/MeeeetUpCamContext.js.map +1 -1
- package/dist/react/context/MeeeetUpCamProvider.d.ts +47 -5
- package/dist/react/context/MeeeetUpCamProvider.d.ts.map +1 -1
- package/dist/react/context/MeeeetUpCamProvider.js +79 -8
- package/dist/react/context/MeeeetUpCamProvider.js.map +1 -1
- package/dist/react/useAutoUpload.d.ts +17 -0
- package/dist/react/useAutoUpload.d.ts.map +1 -0
- package/dist/react/useAutoUpload.js +46 -0
- package/dist/react/useAutoUpload.js.map +1 -0
- package/dist/react/useSingleCapture.d.ts +89 -0
- package/dist/react/useSingleCapture.d.ts.map +1 -0
- package/dist/react/useSingleCapture.js +334 -0
- package/dist/react/useSingleCapture.js.map +1 -0
- package/llms.txt +53 -0
- package/package.json +4 -3
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from "react";
|
|
2
|
+
import { FaceCaptureSession, MIN_PENDING_CONFIRMED_FRAMES, TRACK_CONFIRM_MS, WINDOW_RESUME_GAP_MS, getFaceDirection, getFrontalness, } from "@meeeetup/camera-core";
|
|
3
|
+
import { MediapipeDetector } from "../detectors/mediapipe-detector.js";
|
|
4
|
+
import { CameraLoop } from "../camera-loop.js";
|
|
5
|
+
/**
|
|
6
|
+
* Floor for the detector score. The detector itself is created at this
|
|
7
|
+
* confidence, so a slider value below it is silently clamped — the gate below
|
|
8
|
+
* never sees detections the detector itself filtered out.
|
|
9
|
+
*/
|
|
10
|
+
export const MIN_SCORE_FLOOR = 0.3;
|
|
11
|
+
export const MIN_WINDOW_MS = 1000;
|
|
12
|
+
export const MAX_WINDOW_MS = 60000;
|
|
13
|
+
/**
|
|
14
|
+
* Capture quality 0–100: SDK frontalness penalised by how far off-camera the
|
|
15
|
+
* head points. `getFrontalness` alone ranks a face looking *down* above the
|
|
16
|
+
* same face looking at the lens, because its vertical-tilt check is measured
|
|
17
|
+
* against the detector box which foreshortens with the chin. Multiplying by
|
|
18
|
+
* (1 − hypot(yaw, pitch)) brings an anatomy-based pose check in to keep a
|
|
19
|
+
* frontal subject essentially unpenalised and drop a clearly turned one under
|
|
20
|
+
* the quality floor.
|
|
21
|
+
*/
|
|
22
|
+
function captureQuality(d, dir = getFaceDirection(d.keypoints, d.boundingBox.width)) {
|
|
23
|
+
const deviation = Math.min(1, Math.hypot(dir.yaw, dir.pitch));
|
|
24
|
+
return (getFrontalness(d.keypoints, d.boundingBox.width, d.boundingBox.height) *
|
|
25
|
+
(1 - deviation));
|
|
26
|
+
}
|
|
27
|
+
const DEFAULT_MIN_SCORE = 0.9;
|
|
28
|
+
const DEFAULT_MIN_FACE_SIZE = 0.26;
|
|
29
|
+
const DEFAULT_MIN_FRONTALNESS = 10;
|
|
30
|
+
const DEFAULT_CAPTURE_WINDOW_MS = 1000;
|
|
31
|
+
/**
|
|
32
|
+
* One-subject, best-shot capture. Streams the camera through MediaPipe, pre-
|
|
33
|
+
* filters detections against the four quality gates, feeds the biggest
|
|
34
|
+
* surviving detection to `FaceCaptureSession` for stable tracking, and keeps
|
|
35
|
+
* the best `captureQuality` crop seen inside a per-arming time window. When
|
|
36
|
+
* the window closes the held frame is published as final through `onCapture`.
|
|
37
|
+
*/
|
|
38
|
+
export function useSingleCapture(opts) {
|
|
39
|
+
const videoRef = useRef(null);
|
|
40
|
+
const overlayRef = useRef(null);
|
|
41
|
+
const [ready, setReady] = useState(false);
|
|
42
|
+
const [error, setError] = useState(null);
|
|
43
|
+
const [state, setState] = useState("idle");
|
|
44
|
+
const [bbox, setBbox] = useState(null);
|
|
45
|
+
const [captureProgress, setCaptureProgress] = useState(0);
|
|
46
|
+
const [faceSize, setFaceSize] = useState(0);
|
|
47
|
+
const [frontalness, setFrontalness] = useState(0);
|
|
48
|
+
const [score, setScore] = useState(0);
|
|
49
|
+
const [result, setResult] = useState(null);
|
|
50
|
+
const [locked, setLocked] = useState(false);
|
|
51
|
+
// Mutable settings read on every frame — the slider contract of the site
|
|
52
|
+
// helper is preserved so the same gate values can be live-tuned without a
|
|
53
|
+
// re-render.
|
|
54
|
+
const settingsRef = useRef({
|
|
55
|
+
minDetectionScore: Math.max(MIN_SCORE_FLOOR, opts.minDetectionScore ?? DEFAULT_MIN_SCORE),
|
|
56
|
+
minFaceSize: opts.minFaceSize ?? DEFAULT_MIN_FACE_SIZE,
|
|
57
|
+
minFrontalness: opts.minFrontalness ?? DEFAULT_MIN_FRONTALNESS,
|
|
58
|
+
captureWindowMs: Math.max(MIN_WINDOW_MS, Math.min(MAX_WINDOW_MS, opts.captureWindowMs ?? DEFAULT_CAPTURE_WINDOW_MS)),
|
|
59
|
+
});
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
settingsRef.current = {
|
|
62
|
+
minDetectionScore: Math.max(MIN_SCORE_FLOOR, opts.minDetectionScore ?? DEFAULT_MIN_SCORE),
|
|
63
|
+
minFaceSize: opts.minFaceSize ?? DEFAULT_MIN_FACE_SIZE,
|
|
64
|
+
minFrontalness: opts.minFrontalness ?? DEFAULT_MIN_FRONTALNESS,
|
|
65
|
+
captureWindowMs: Math.max(MIN_WINDOW_MS, Math.min(MAX_WINDOW_MS, opts.captureWindowMs ?? DEFAULT_CAPTURE_WINDOW_MS)),
|
|
66
|
+
};
|
|
67
|
+
}, [
|
|
68
|
+
opts.minDetectionScore,
|
|
69
|
+
opts.minFaceSize,
|
|
70
|
+
opts.minFrontalness,
|
|
71
|
+
opts.captureWindowMs,
|
|
72
|
+
]);
|
|
73
|
+
const onCaptureRef = useRef(opts.onCapture);
|
|
74
|
+
useEffect(() => {
|
|
75
|
+
onCaptureRef.current = opts.onCapture;
|
|
76
|
+
}, [opts.onCapture]);
|
|
77
|
+
// Per-arming state. Refs so the detect loop can mutate without re-rendering.
|
|
78
|
+
const armedAtRef = useRef(performance.now());
|
|
79
|
+
const bestRef = useRef(null);
|
|
80
|
+
const bestQualityRef = useRef(-Infinity);
|
|
81
|
+
const windowElapsedRef = useRef(0);
|
|
82
|
+
const lastTrackedAtRef = useRef(null);
|
|
83
|
+
const lockedRef = useRef(false);
|
|
84
|
+
const targetTrackIdRef = useRef(null);
|
|
85
|
+
const confirmedTrackIdRef = useRef(null);
|
|
86
|
+
const confirmedFramesRef = useRef(0);
|
|
87
|
+
const sessionRef = useRef(null);
|
|
88
|
+
// Reset per-arming state. Session is left alive on rearm so the subject
|
|
89
|
+
// already in frame does not have to serve another TRACK_CONFIRM_MS before
|
|
90
|
+
// becoming capturable again.
|
|
91
|
+
const resetArming = () => {
|
|
92
|
+
bestRef.current = null;
|
|
93
|
+
bestQualityRef.current = -Infinity;
|
|
94
|
+
windowElapsedRef.current = 0;
|
|
95
|
+
lastTrackedAtRef.current = null;
|
|
96
|
+
lockedRef.current = false;
|
|
97
|
+
armedAtRef.current = performance.now();
|
|
98
|
+
setLocked(false);
|
|
99
|
+
setResult(null);
|
|
100
|
+
setCaptureProgress(0);
|
|
101
|
+
};
|
|
102
|
+
useEffect(() => {
|
|
103
|
+
let loop = null;
|
|
104
|
+
let detector = null;
|
|
105
|
+
let cancelled = false;
|
|
106
|
+
async function start() {
|
|
107
|
+
try {
|
|
108
|
+
const video = videoRef.current;
|
|
109
|
+
if (!video)
|
|
110
|
+
return;
|
|
111
|
+
detector = await MediapipeDetector.create({
|
|
112
|
+
wasmUrl: opts.mediapipeWasmUrl,
|
|
113
|
+
minConfidence: MIN_SCORE_FLOOR,
|
|
114
|
+
});
|
|
115
|
+
// Tracking only: session owns track identity and staleness, we handle
|
|
116
|
+
// the peak-picking ourselves. `minDetectionScore: 0` keeps the session
|
|
117
|
+
// from filtering twice.
|
|
118
|
+
const session = new FaceCaptureSession({
|
|
119
|
+
sessionType: "interactive",
|
|
120
|
+
minDetectionScore: 0,
|
|
121
|
+
});
|
|
122
|
+
sessionRef.current = session;
|
|
123
|
+
loop = new CameraLoop(video, detector, {
|
|
124
|
+
onFrame: (detections, frame) => {
|
|
125
|
+
if (cancelled)
|
|
126
|
+
return;
|
|
127
|
+
processFrame(detections, frame, session);
|
|
128
|
+
},
|
|
129
|
+
onTick: () => {
|
|
130
|
+
if (cancelled)
|
|
131
|
+
return;
|
|
132
|
+
session.tick();
|
|
133
|
+
},
|
|
134
|
+
});
|
|
135
|
+
await loop.start(opts.deviceId, opts.facingMode ?? "user");
|
|
136
|
+
if (cancelled)
|
|
137
|
+
return;
|
|
138
|
+
setReady(true);
|
|
139
|
+
}
|
|
140
|
+
catch (err) {
|
|
141
|
+
if (cancelled)
|
|
142
|
+
return;
|
|
143
|
+
setError(err instanceof Error ? err.message : "Camera failed to start");
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
function processFrame(detections, frame, session) {
|
|
147
|
+
const s = settingsRef.current;
|
|
148
|
+
const accurate = detections.filter((d) => d.score >= s.minDetectionScore);
|
|
149
|
+
const bigEnough = accurate.filter((d) => d.boundingBox.height >= s.minFaceSize);
|
|
150
|
+
const candidates = bigEnough.filter((d) => captureQuality(d) >= s.minFrontalness);
|
|
151
|
+
candidates.sort((a, b) => b.boundingBox.width * b.boundingBox.height -
|
|
152
|
+
a.boundingBox.width * a.boundingBox.height);
|
|
153
|
+
const target = candidates[0] ?? null;
|
|
154
|
+
const subject = target ??
|
|
155
|
+
largest(bigEnough) ??
|
|
156
|
+
largest(accurate) ??
|
|
157
|
+
largest(detections);
|
|
158
|
+
if (target) {
|
|
159
|
+
session.processDetections([target], frame);
|
|
160
|
+
}
|
|
161
|
+
// Track resolution: with one detection fed per frame, the active track
|
|
162
|
+
// nearest the detection centre is the one it landed on.
|
|
163
|
+
const targetTrack = target
|
|
164
|
+
? session.activeTracks.reduce((nearest, track) => {
|
|
165
|
+
const box = target.boundingBox;
|
|
166
|
+
const dist = Math.hypot(box.originX + box.width / 2 - track.cx, box.originY + box.height / 2 - track.cy);
|
|
167
|
+
return nearest && nearest.dist <= dist
|
|
168
|
+
? nearest
|
|
169
|
+
: { id: track.id, createdAt: track.createdAt, dist };
|
|
170
|
+
}, null)
|
|
171
|
+
: null;
|
|
172
|
+
targetTrackIdRef.current = targetTrack?.id ?? null;
|
|
173
|
+
// Confirm counter resets on target switch so a face that steals the
|
|
174
|
+
// target cannot be captured on its first frame.
|
|
175
|
+
if (targetTrackIdRef.current !== confirmedTrackIdRef.current) {
|
|
176
|
+
confirmedTrackIdRef.current = targetTrackIdRef.current;
|
|
177
|
+
confirmedFramesRef.current = 0;
|
|
178
|
+
}
|
|
179
|
+
confirmedFramesRef.current = target ? confirmedFramesRef.current + 1 : 0;
|
|
180
|
+
// Capture window. While a gated target is tracked, every frame that
|
|
181
|
+
// beats the held quality replaces it and is published provisional. When
|
|
182
|
+
// the window elapses the held frame is published final.
|
|
183
|
+
const targetQuality = target ? captureQuality(target) : 0;
|
|
184
|
+
if (lockedRef.current || !target || !targetTrack) {
|
|
185
|
+
lastTrackedAtRef.current = null;
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
const now = performance.now();
|
|
189
|
+
windowElapsedRef.current +=
|
|
190
|
+
lastTrackedAtRef.current === null
|
|
191
|
+
? 0
|
|
192
|
+
: Math.min(now - lastTrackedAtRef.current, WINDOW_RESUME_GAP_MS);
|
|
193
|
+
lastTrackedAtRef.current = now;
|
|
194
|
+
const qualified = Date.now() - targetTrack.createdAt >= TRACK_CONFIRM_MS &&
|
|
195
|
+
confirmedFramesRef.current >= MIN_PENDING_CONFIRMED_FRAMES;
|
|
196
|
+
if (qualified && targetQuality > bestQualityRef.current) {
|
|
197
|
+
const box = target.boundingBox;
|
|
198
|
+
const crop = frame.cropFaceJpeg(box.originX + box.width / 2, box.originY + box.height / 2, box.width, box.height);
|
|
199
|
+
if (crop) {
|
|
200
|
+
bestQualityRef.current = targetQuality;
|
|
201
|
+
bestRef.current = {
|
|
202
|
+
dataUrl: crop,
|
|
203
|
+
fullCircleDataUrl: null,
|
|
204
|
+
frontalness: Math.round(targetQuality),
|
|
205
|
+
elapsedMs: Math.round(now - armedAtRef.current),
|
|
206
|
+
final: false,
|
|
207
|
+
};
|
|
208
|
+
setResult(bestRef.current);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
if (bestRef.current && windowElapsedRef.current >= s.captureWindowMs) {
|
|
212
|
+
lockedRef.current = true;
|
|
213
|
+
const final = {
|
|
214
|
+
...bestRef.current,
|
|
215
|
+
fullCircleDataUrl: null,
|
|
216
|
+
final: true,
|
|
217
|
+
};
|
|
218
|
+
bestRef.current = final;
|
|
219
|
+
setResult(final);
|
|
220
|
+
setLocked(true);
|
|
221
|
+
setState("done");
|
|
222
|
+
const faceSz = target.boundingBox.height;
|
|
223
|
+
const scoreVal = target.score;
|
|
224
|
+
void Promise.resolve(onCaptureRef.current?.(final.dataUrl, "", {
|
|
225
|
+
frontalness: final.frontalness,
|
|
226
|
+
faceSize: faceSz,
|
|
227
|
+
score: scoreVal,
|
|
228
|
+
}));
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
// Live subject metrics drive the overlay (bars, direction, state).
|
|
233
|
+
if (subject) {
|
|
234
|
+
const dir = getFaceDirection(subject.keypoints, subject.boundingBox.width);
|
|
235
|
+
setBbox({
|
|
236
|
+
x: subject.boundingBox.originX,
|
|
237
|
+
y: subject.boundingBox.originY,
|
|
238
|
+
w: subject.boundingBox.width,
|
|
239
|
+
h: subject.boundingBox.height,
|
|
240
|
+
});
|
|
241
|
+
setFaceSize(subject.boundingBox.height);
|
|
242
|
+
setScore(subject.score);
|
|
243
|
+
setFrontalness(Math.round(captureQuality(subject, dir)));
|
|
244
|
+
}
|
|
245
|
+
else {
|
|
246
|
+
setBbox(null);
|
|
247
|
+
setFaceSize(0);
|
|
248
|
+
setScore(0);
|
|
249
|
+
setFrontalness(0);
|
|
250
|
+
}
|
|
251
|
+
// State drives the overlay copy ("move closer", "turn to camera", …).
|
|
252
|
+
const nextState = lockedRef.current
|
|
253
|
+
? "done"
|
|
254
|
+
: target
|
|
255
|
+
? "tracking"
|
|
256
|
+
: detections.length === 0
|
|
257
|
+
? "searching"
|
|
258
|
+
: accurate.length === 0
|
|
259
|
+
? "low-score"
|
|
260
|
+
: bigEnough.length === 0
|
|
261
|
+
? "too-small"
|
|
262
|
+
: "not-straight";
|
|
263
|
+
setState((prev) => (prev === nextState ? prev : nextState));
|
|
264
|
+
setCaptureProgress(Math.min(1, windowElapsedRef.current / s.captureWindowMs));
|
|
265
|
+
}
|
|
266
|
+
void start();
|
|
267
|
+
return () => {
|
|
268
|
+
cancelled = true;
|
|
269
|
+
loop?.stop();
|
|
270
|
+
detector?.dispose();
|
|
271
|
+
sessionRef.current?.dispose();
|
|
272
|
+
sessionRef.current = null;
|
|
273
|
+
setReady(false);
|
|
274
|
+
setState("idle");
|
|
275
|
+
setBbox(null);
|
|
276
|
+
setCaptureProgress(0);
|
|
277
|
+
setFaceSize(0);
|
|
278
|
+
setFrontalness(0);
|
|
279
|
+
setScore(0);
|
|
280
|
+
setResult(null);
|
|
281
|
+
setLocked(false);
|
|
282
|
+
bestRef.current = null;
|
|
283
|
+
bestQualityRef.current = -Infinity;
|
|
284
|
+
windowElapsedRef.current = 0;
|
|
285
|
+
lastTrackedAtRef.current = null;
|
|
286
|
+
lockedRef.current = false;
|
|
287
|
+
confirmedTrackIdRef.current = null;
|
|
288
|
+
confirmedFramesRef.current = 0;
|
|
289
|
+
};
|
|
290
|
+
// Restart the camera when the input device or facing changes.
|
|
291
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
292
|
+
}, [opts.deviceId, opts.facingMode]);
|
|
293
|
+
const rearm = () => {
|
|
294
|
+
resetArming();
|
|
295
|
+
setState("searching");
|
|
296
|
+
};
|
|
297
|
+
const trigger = () => {
|
|
298
|
+
if (lockedRef.current || !bestRef.current)
|
|
299
|
+
return;
|
|
300
|
+
// Force the window to its ceiling so the next tick commits.
|
|
301
|
+
windowElapsedRef.current = settingsRef.current.captureWindowMs;
|
|
302
|
+
};
|
|
303
|
+
const isAligned = state === "tracking";
|
|
304
|
+
return {
|
|
305
|
+
videoRef,
|
|
306
|
+
overlayRef,
|
|
307
|
+
ready,
|
|
308
|
+
error,
|
|
309
|
+
state,
|
|
310
|
+
bbox,
|
|
311
|
+
isAligned,
|
|
312
|
+
captureProgress,
|
|
313
|
+
faceSize,
|
|
314
|
+
frontalness,
|
|
315
|
+
score,
|
|
316
|
+
result,
|
|
317
|
+
locked,
|
|
318
|
+
rearm,
|
|
319
|
+
trigger,
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
function largest(detections) {
|
|
323
|
+
let best = null;
|
|
324
|
+
let bestArea = 0;
|
|
325
|
+
for (const d of detections) {
|
|
326
|
+
const area = d.boundingBox.width * d.boundingBox.height;
|
|
327
|
+
if (area > bestArea) {
|
|
328
|
+
bestArea = area;
|
|
329
|
+
best = d;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
return best;
|
|
333
|
+
}
|
|
334
|
+
//# sourceMappingURL=useSingleCapture.js.map
|
|
@@ -0,0 +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AAQ,GAAG,IAAI,CAAC;YAChB,IAAI,GAAG,CAAC,CAAC;QACX,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/llms.txt
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# @meeeetup/camera-web
|
|
2
|
+
|
|
3
|
+
> Web half of the Meeeetup camera SDK: MediaPipe BlazeFace detection plus a React provider, hooks and components over `@meeeetup/camera-core`. Transport is yours by default; pass the opt-in `autoUpload` prop and the SDK posts captures itself.
|
|
4
|
+
|
|
5
|
+
Install: `pnpm add @meeeetup/camera-web`
|
|
6
|
+
|
|
7
|
+
## Docs
|
|
8
|
+
|
|
9
|
+
- [Quick start (React)](https://id.meeeetup.com/en/docs/quickstart-react): a working camera in about twenty lines, the configuration-object form, and the live state `useMeeeetUpCam()` returns.
|
|
10
|
+
- [Configuration](https://id.meeeetup.com/en/docs/configuration): every capture gate and its default.
|
|
11
|
+
- [Types and schema](https://id.meeeetup.com/en/docs/types): provider props, context state, and the core types underneath.
|
|
12
|
+
- [Playground](https://id.meeeetup.com/en/demo): the pipeline running in a browser with the thresholds on sliders.
|
|
13
|
+
- [Everything in one file](https://id.meeeetup.com/llms-full.txt)
|
|
14
|
+
|
|
15
|
+
## Shape
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import { MeeeetUpCamProvider, CameraViewport, FaceGrid } from "@meeeetup/camera-web";
|
|
19
|
+
|
|
20
|
+
const conf = {
|
|
21
|
+
mode: "passive", // or "interactive" for the alignment ring
|
|
22
|
+
minFaceHeight: 0.18,
|
|
23
|
+
minFrontalness: 55,
|
|
24
|
+
captureWindowMs: 2_000,
|
|
25
|
+
onBatchCapture: send,
|
|
26
|
+
} as const;
|
|
27
|
+
|
|
28
|
+
<MeeeetUpCamProvider {...conf}>
|
|
29
|
+
<CameraViewport />
|
|
30
|
+
<FaceGrid />
|
|
31
|
+
</MeeeetUpCamProvider>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Opt-in transport — the provider uploads, so no capture callback is needed:
|
|
35
|
+
|
|
36
|
+
```tsx
|
|
37
|
+
<MeeeetUpCamProvider mode="passive" autoUpload={{ captureKey }}>
|
|
38
|
+
<CameraViewport />
|
|
39
|
+
<FaceGrid />
|
|
40
|
+
</MeeeetUpCamProvider>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Notes
|
|
44
|
+
|
|
45
|
+
- Exports: `MeeeetUpCamProvider`, `useMeeeetUpCam`, `CameraViewport`, `FaceGrid`, `FaceCounter`, `DevicePicker`, `CameraToggle`, `AlignmentRing`, `CaptureButton`.
|
|
46
|
+
- Transport re-exports from core, for consumers driving `usePassiveCamera` / `useSingleCapture` directly: `createAutoUploader`, `CaptureUploadError`, `DEFAULT_CAPTURE_ENDPOINT`, and the types `AutoUploader`, `AutoUploadOptions`, `AutoUploadResult`, `CaptureFetch`, `CaptureImage`.
|
|
47
|
+
- `autoUpload?: AutoUploadOptions` is a provider prop in all three modes (`passive`, `single`, `interactive`). Set it and captures are POSTed to `endpoint` (default `https://api.meeeetup.com/capture`) with `Authorization: Bearer <captureKey>`, body `{ images: [{ image, capturedAt }], channelId? }`; omit it and the SDK uploads nothing and holds no credential. Options: `captureKey`, `endpoint`, `channelId`, `maxRetries` (default 2), `retryDelayMs` (default 1000), `fetch`, `onUploaded`, `onError`.
|
|
48
|
+
- With `autoUpload` set, `onBatchCapture` / `onCapture` become optional observers: fired without being awaited, so they cannot delay or fail the upload, and their rejections surface on `autoUpload.onError`. Without it, the callback is the only output path and a rejection requeues the batch.
|
|
49
|
+
- In `single` / `interactive` mode only the face crop is uploaded — `fullCircleImage` never leaves the device.
|
|
50
|
+
- Uploads retry on 5xx / 429 / 408 / transport failure and fail immediately on other 4xx; once attempts are exhausted a `CaptureUploadError` (`status`, `retryable`, `attempts`, `cause`) is thrown and retryable batches are requeued.
|
|
51
|
+
- `useMeeeetUpCam()` is a union discriminated on `mode`; narrow before reading mode-specific fields.
|
|
52
|
+
- The capture gates are passive-mode props: interactive capture is decided by the alignment ring, not the tracker's selection pipeline.
|
|
53
|
+
- Components take no props — they read the provider through context. For a custom layout, attach `videoRef` / `overlayRef` yourself.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meeeetup/camera-web",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Web SDK for meeeetup-cam — MediaPipe BlazeFace + React hooks",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
"files": [
|
|
17
17
|
"dist",
|
|
18
18
|
"README.md",
|
|
19
|
-
"LICENSE"
|
|
19
|
+
"LICENSE",
|
|
20
|
+
"llms.txt"
|
|
20
21
|
],
|
|
21
22
|
"license": "SEE LICENSE IN LICENSE",
|
|
22
23
|
"sideEffects": [
|
|
@@ -30,7 +31,7 @@
|
|
|
30
31
|
"dependencies": {
|
|
31
32
|
"@mediapipe/tasks-vision": "^0.10.22",
|
|
32
33
|
"lucide-react": "^1.17.0",
|
|
33
|
-
"@meeeetup/camera-core": "0.
|
|
34
|
+
"@meeeetup/camera-core": "0.8.0"
|
|
34
35
|
},
|
|
35
36
|
"peerDependencies": {
|
|
36
37
|
"react": "^18 || ^19",
|