@meeeetup/camera-react-native 0.7.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 +80 -6
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/dist/useAutoUpload.d.ts +17 -0
- package/dist/useAutoUpload.d.ts.map +1 -0
- package/dist/useAutoUpload.js +51 -0
- package/dist/useAutoUpload.js.map +1 -0
- package/dist/useFaceCaptureSession.d.ts +12 -1
- package/dist/useFaceCaptureSession.d.ts.map +1 -1
- package/dist/useFaceCaptureSession.js +3 -1
- package/dist/useFaceCaptureSession.js.map +1 -1
- package/llms.txt +6 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -5,9 +5,11 @@ runs on the camera's worklet thread through a native Vision Camera frame
|
|
|
5
5
|
processor (ML Kit), and the results feed the shared tracking and
|
|
6
6
|
quality-selection pipeline.
|
|
7
7
|
|
|
8
|
-
**Transport is
|
|
9
|
-
credential: it calls `onBatchCapture` with base64 JPEG data URLs, and
|
|
10
|
-
them is your code.
|
|
8
|
+
**Transport is opt-in.** By default the SDK makes no network request and holds
|
|
9
|
+
no credential: it calls `onBatchCapture` with base64 JPEG data URLs, and
|
|
10
|
+
sending them is your code. Pass `autoUpload` and the SDK POSTs each batch to
|
|
11
|
+
the Meeeetup capture endpoint itself — that is the only case in which it opens
|
|
12
|
+
a connection. No pairing UI either way.
|
|
11
13
|
|
|
12
14
|
You own the `<Camera>` element and its ref; the hook owns the pipeline.
|
|
13
15
|
|
|
@@ -44,6 +46,9 @@ Permissions: `android.permission.CAMERA` in `AndroidManifest.xml`,
|
|
|
44
46
|
|
|
45
47
|
## Usage
|
|
46
48
|
|
|
49
|
+
This example brings its own transport. For the built-in one, see `autoUpload`
|
|
50
|
+
below.
|
|
51
|
+
|
|
47
52
|
```tsx
|
|
48
53
|
import { useRef } from "react";
|
|
49
54
|
import { useWindowDimensions } from "react-native";
|
|
@@ -106,12 +111,81 @@ call `flushBatch()` yourself. Either way, a flush only hands over faces whose
|
|
|
106
111
|
track has settled for more than 5 s, so a still-improving track is never sent
|
|
107
112
|
early.
|
|
108
113
|
|
|
114
|
+
## autoUpload
|
|
115
|
+
|
|
116
|
+
`useFaceCaptureSession` also accepts `autoUpload`. With it set the hook builds
|
|
117
|
+
its own uploader and POSTs every flushed batch, so no transport code is needed
|
|
118
|
+
and `onBatchCapture` can be dropped:
|
|
119
|
+
|
|
120
|
+
```tsx
|
|
121
|
+
const { ready, error, trackedCount, frameProcessor } = useFaceCaptureSession({
|
|
122
|
+
cameraRef: camera,
|
|
123
|
+
sessionType: "passive",
|
|
124
|
+
windowWidth: width,
|
|
125
|
+
windowHeight: height,
|
|
126
|
+
cameraFacing: "front",
|
|
127
|
+
autoUpload: { captureKey },
|
|
128
|
+
});
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
| Field | Type | Default | Meaning |
|
|
132
|
+
|---|---|---|---|
|
|
133
|
+
| `captureKey` | `string` | — | Required. Sent as `Authorization: Bearer <captureKey>` |
|
|
134
|
+
| `endpoint` | `string` | `DEFAULT_CAPTURE_ENDPOINT` | `https://api.meeeetup.com/capture` |
|
|
135
|
+
| `channelId` | `string` | — | Omitted from the body entirely when unset |
|
|
136
|
+
| `maxRetries` | `number` | `2` | Extra attempts after a transient failure |
|
|
137
|
+
| `retryDelayMs` | `number` | `1000` | Base backoff, doubled each attempt |
|
|
138
|
+
| `fetch` | `CaptureFetch` | global `fetch` | Override the HTTP client (tests, proxies) |
|
|
139
|
+
| `onUploaded` | `(result: AutoUploadResult) => void` | — | `{ count, status, attempts }` per request |
|
|
140
|
+
| `onError` | `(error: unknown) => void` | — | Upload failure, or an observer that threw |
|
|
141
|
+
|
|
142
|
+
The request is exactly the `POST /capture` contract of the Meeeetup face-ID
|
|
143
|
+
API: `Content-Type: application/json` and a body of
|
|
144
|
+
`{ images: [{ image, capturedAt }], channelId? }`, where `capturedAt` is each
|
|
145
|
+
face's `createdAt` as an ISO-8601 string. `channelId` is left out of the body
|
|
146
|
+
when unset, because the server schema is strict.
|
|
147
|
+
|
|
148
|
+
Batches reaching the uploader are already chunked to `maxFacesPerRequest`
|
|
149
|
+
(default 50); keep that at or below the key's `maxImagesPerRequest` from
|
|
150
|
+
`GET /capture/keys/me`.
|
|
151
|
+
|
|
152
|
+
### Observers
|
|
153
|
+
|
|
154
|
+
Passing `autoUpload` and `onBatchCapture` together is supported:
|
|
155
|
+
`onBatchCapture` becomes an observer. It is fired without being awaited, so it
|
|
156
|
+
can neither delay nor fail the upload, and anything it throws surfaces on
|
|
157
|
+
`autoUpload.onError` instead of requeueing the batch. Without `autoUpload`,
|
|
158
|
+
`onBatchCapture` keeps its original role — the only output path, and a
|
|
159
|
+
rejection requeues the batch.
|
|
160
|
+
|
|
161
|
+
### Retries
|
|
162
|
+
|
|
163
|
+
A failed request is resent with a byte-identical payload. 5xx, 429, 408 and
|
|
164
|
+
transport failures retry up to `maxRetries` with the backoff doubling each
|
|
165
|
+
attempt; any other 4xx fails immediately. Once attempts are exhausted the
|
|
166
|
+
uploader throws `CaptureUploadError`:
|
|
167
|
+
|
|
168
|
+
```ts
|
|
169
|
+
class CaptureUploadError extends Error {
|
|
170
|
+
status?: number; // absent when the request never completed
|
|
171
|
+
retryable: boolean; // 408/429/5xx/transport failure = true; other 4xx = false
|
|
172
|
+
attempts: number;
|
|
173
|
+
cause?: unknown;
|
|
174
|
+
}
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
`onError` receives it, and the session requeues the batch when `retryable` is
|
|
178
|
+
true and drops it when false.
|
|
179
|
+
|
|
109
180
|
## Exports
|
|
110
181
|
|
|
111
182
|
`useFaceCaptureSession`, `RNFrameBuffer`, `facesToDetections`,
|
|
112
|
-
`FaceCaptureSession`,
|
|
113
|
-
`
|
|
114
|
-
`
|
|
183
|
+
`FaceCaptureSession`, `createAutoUploader`, `CaptureUploadError` and
|
|
184
|
+
`DEFAULT_CAPTURE_ENDPOINT`, plus the `Detection`, `FrameBuffer`,
|
|
185
|
+
`SelectedFace`, `NoseLandmark`, `CameraLike`, `VisionCameraFace`,
|
|
186
|
+
`AutoUploader`, `AutoUploadOptions`, `AutoUploadResult`, `CaptureFetch`,
|
|
187
|
+
`CaptureImage`, `UseFaceCaptureSessionOptions` and
|
|
188
|
+
`UseFaceCaptureSessionReturn` types.
|
|
115
189
|
|
|
116
190
|
## Licence
|
|
117
191
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export type { Detection, FrameBuffer, SelectedFace, NoseLandmark } from "@meeeetup/camera-core";
|
|
2
2
|
export { FaceCaptureSession } from "@meeeetup/camera-core";
|
|
3
|
+
export { createAutoUploader, CaptureUploadError, DEFAULT_CAPTURE_ENDPOINT } from "@meeeetup/camera-core";
|
|
4
|
+
export type { AutoUploader, AutoUploadOptions, AutoUploadResult, CaptureFetch, CaptureImage, } from "@meeeetup/camera-core";
|
|
3
5
|
export { RNFrameBuffer } from "./frame-buffer";
|
|
4
6
|
export { facesToDetections, type VisionCameraFace } from "./detectors/vision-camera-detector";
|
|
5
7
|
export { useFaceCaptureSession, type UseFaceCaptureSessionOptions, type UseFaceCaptureSessionReturn, type CameraLike, } from "./useFaceCaptureSession";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAChG,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAChG,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAK3D,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AACzG,YAAY,EACV,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,EACZ,YAAY,GACb,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,KAAK,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAC9F,OAAO,EACL,qBAAqB,EACrB,KAAK,4BAA4B,EACjC,KAAK,2BAA2B,EAChC,KAAK,UAAU,GAChB,MAAM,yBAAyB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useFaceCaptureSession = exports.facesToDetections = exports.RNFrameBuffer = exports.FaceCaptureSession = void 0;
|
|
3
|
+
exports.useFaceCaptureSession = exports.facesToDetections = exports.RNFrameBuffer = exports.DEFAULT_CAPTURE_ENDPOINT = exports.CaptureUploadError = exports.createAutoUploader = exports.FaceCaptureSession = void 0;
|
|
4
4
|
var camera_core_1 = require("@meeeetup/camera-core");
|
|
5
5
|
Object.defineProperty(exports, "FaceCaptureSession", { enumerable: true, get: function () { return camera_core_1.FaceCaptureSession; } });
|
|
6
|
+
// ── Opt-in transport ──────────────────────────────────────────────────────────
|
|
7
|
+
// Pass `autoUpload` to `useFaceCaptureSession` and the SDK posts batches
|
|
8
|
+
// itself. Omit it and the SDK never touches the network.
|
|
9
|
+
var camera_core_2 = require("@meeeetup/camera-core");
|
|
10
|
+
Object.defineProperty(exports, "createAutoUploader", { enumerable: true, get: function () { return camera_core_2.createAutoUploader; } });
|
|
11
|
+
Object.defineProperty(exports, "CaptureUploadError", { enumerable: true, get: function () { return camera_core_2.CaptureUploadError; } });
|
|
12
|
+
Object.defineProperty(exports, "DEFAULT_CAPTURE_ENDPOINT", { enumerable: true, get: function () { return camera_core_2.DEFAULT_CAPTURE_ENDPOINT; } });
|
|
6
13
|
// React Native
|
|
7
14
|
var frame_buffer_1 = require("./frame-buffer");
|
|
8
15
|
Object.defineProperty(exports, "RNFrameBuffer", { enumerable: true, get: function () { return frame_buffer_1.RNFrameBuffer; } });
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAEA,qDAA2D;AAAlD,iHAAA,kBAAkB,OAAA;AAE3B,eAAe;AACf,+CAA+C;AAAtC,6GAAA,aAAa,OAAA;AACtB,6EAA8F;AAArF,2HAAA,iBAAiB,OAAA;AAC1B,iEAKiC;AAJ/B,8HAAA,qBAAqB,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAEA,qDAA2D;AAAlD,iHAAA,kBAAkB,OAAA;AAE3B,iFAAiF;AACjF,yEAAyE;AACzE,yDAAyD;AACzD,qDAAyG;AAAhG,iHAAA,kBAAkB,OAAA;AAAE,iHAAA,kBAAkB,OAAA;AAAE,uHAAA,wBAAwB,OAAA;AASzE,eAAe;AACf,+CAA+C;AAAtC,6GAAA,aAAa,OAAA;AACtB,6EAA8F;AAArF,2HAAA,iBAAiB,OAAA;AAC1B,iEAKiC;AAJ/B,8HAAA,qBAAqB,OAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type AutoUploadOptions, type SelectedFace } from "@meeeetup/camera-core";
|
|
2
|
+
/** The hook options this module reads — kept narrow so it stays testable. */
|
|
3
|
+
export interface AutoUploadSinkOptions {
|
|
4
|
+
autoUpload?: AutoUploadOptions;
|
|
5
|
+
onBatchCapture?: (faces: SelectedFace[]) => void | Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Compose the batch sink with the opt-in uploader.
|
|
9
|
+
*
|
|
10
|
+
* `FaceCaptureSession` is constructed once and reads the latest options through
|
|
11
|
+
* `optsRef`, so the sink must be stable for the hook's lifetime and resolve the
|
|
12
|
+
* uploader per batch. The uploader itself is rebuilt only when a transport
|
|
13
|
+
* field actually changes — consumers pass `autoUpload` as an inline literal, so
|
|
14
|
+
* object identity cannot serve as the cache key.
|
|
15
|
+
*/
|
|
16
|
+
export declare function useAutoUploadSink(optsRef: React.RefObject<AutoUploadSinkOptions>): (faces: SelectedFace[]) => void | Promise<void>;
|
|
17
|
+
//# sourceMappingURL=useAutoUpload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAutoUpload.d.ts","sourceRoot":"","sources":["../src/useAutoUpload.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,iBAAiB,EAEtB,KAAK,YAAY,EAClB,MAAM,uBAAuB,CAAC;AAE/B,6EAA6E;AAC7E,MAAM,WAAW,qBAAqB;IACpC,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,EAAE,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAClE;AAaD;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,qBAAqB,CAAC,GAC9C,CAAC,KAAK,EAAE,YAAY,EAAE,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAgCjD"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useAutoUploadSink = useAutoUploadSink;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const camera_core_1 = require("@meeeetup/camera-core");
|
|
6
|
+
/** Fields that change where a batch lands, as a cache key. */
|
|
7
|
+
function transportKey(config) {
|
|
8
|
+
return [
|
|
9
|
+
config.captureKey,
|
|
10
|
+
config.endpoint ?? "",
|
|
11
|
+
config.channelId ?? "",
|
|
12
|
+
config.maxRetries ?? "",
|
|
13
|
+
config.retryDelayMs ?? "",
|
|
14
|
+
].join("|");
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Compose the batch sink with the opt-in uploader.
|
|
18
|
+
*
|
|
19
|
+
* `FaceCaptureSession` is constructed once and reads the latest options through
|
|
20
|
+
* `optsRef`, so the sink must be stable for the hook's lifetime and resolve the
|
|
21
|
+
* uploader per batch. The uploader itself is rebuilt only when a transport
|
|
22
|
+
* field actually changes — consumers pass `autoUpload` as an inline literal, so
|
|
23
|
+
* object identity cannot serve as the cache key.
|
|
24
|
+
*/
|
|
25
|
+
function useAutoUploadSink(optsRef) {
|
|
26
|
+
const cache = (0, react_1.useRef)(null);
|
|
27
|
+
return (0, react_1.useCallback)((faces) => {
|
|
28
|
+
const opts = optsRef.current;
|
|
29
|
+
const config = opts.autoUpload;
|
|
30
|
+
if (!config?.captureKey)
|
|
31
|
+
return opts.onBatchCapture?.(faces);
|
|
32
|
+
const key = transportKey(config);
|
|
33
|
+
if (cache.current?.key !== key) {
|
|
34
|
+
cache.current = {
|
|
35
|
+
key,
|
|
36
|
+
uploader: (0, camera_core_1.createAutoUploader)({
|
|
37
|
+
captureKey: config.captureKey,
|
|
38
|
+
endpoint: config.endpoint,
|
|
39
|
+
channelId: config.channelId,
|
|
40
|
+
maxRetries: config.maxRetries,
|
|
41
|
+
retryDelayMs: config.retryDelayMs,
|
|
42
|
+
fetch: config.fetch,
|
|
43
|
+
onUploaded: (result) => optsRef.current.autoUpload?.onUploaded?.(result),
|
|
44
|
+
onError: (error) => optsRef.current.autoUpload?.onError?.(error),
|
|
45
|
+
}),
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
return (0, camera_core_1.composeBatchSink)(cache.current.uploader, opts.onBatchCapture, (error) => optsRef.current.autoUpload?.onError?.(error))(faces);
|
|
49
|
+
}, [optsRef]);
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=useAutoUpload.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAutoUpload.js","sourceRoot":"","sources":["../src/useAutoUpload.ts"],"names":[],"mappings":";;AAmCA,8CAkCC;AArED,iCAA4C;AAC5C,uDAM+B;AAQ/B,8DAA8D;AAC9D,SAAS,YAAY,CAAC,MAAyB;IAC7C,OAAO;QACL,MAAM,CAAC,UAAU;QACjB,MAAM,CAAC,QAAQ,IAAI,EAAE;QACrB,MAAM,CAAC,SAAS,IAAI,EAAE;QACtB,MAAM,CAAC,UAAU,IAAI,EAAE;QACvB,MAAM,CAAC,YAAY,IAAI,EAAE;KAC1B,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACd,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,iBAAiB,CAC/B,OAA+C;IAE/C,MAAM,KAAK,GAAG,IAAA,cAAM,EAAiD,IAAI,CAAC,CAAC;IAE3E,OAAO,IAAA,mBAAW,EAAC,CAAC,KAAqB,EAAE,EAAE;QAC3C,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC;QAC7B,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC;QAE/B,IAAI,CAAC,MAAM,EAAE,UAAU;YAAE,OAAO,IAAI,CAAC,cAAc,EAAE,CAAC,KAAK,CAAC,CAAC;QAE7D,MAAM,GAAG,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;QACjC,IAAI,KAAK,CAAC,OAAO,EAAE,GAAG,KAAK,GAAG,EAAE,CAAC;YAC/B,KAAK,CAAC,OAAO,GAAG;gBACd,GAAG;gBACH,QAAQ,EAAE,IAAA,gCAAkB,EAAC;oBAC3B,UAAU,EAAI,MAAM,CAAC,UAAU;oBAC/B,QAAQ,EAAM,MAAM,CAAC,QAAQ;oBAC7B,SAAS,EAAK,MAAM,CAAC,SAAS;oBAC9B,UAAU,EAAI,MAAM,CAAC,UAAU;oBAC/B,YAAY,EAAE,MAAM,CAAC,YAAY;oBACjC,KAAK,EAAS,MAAM,CAAC,KAAK;oBAC1B,UAAU,EAAI,CAAC,MAAM,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,UAAU,EAAE,CAAC,MAAM,CAAC;oBAC1E,OAAO,EAAO,CAAC,KAAK,EAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,OAAO,EAAE,CAAC,KAAK,CAAC;iBACvE,CAAC;aACH,CAAC;QACJ,CAAC;QAED,OAAO,IAAA,8BAAgB,EACrB,KAAK,CAAC,OAAO,CAAC,QAAQ,EACtB,IAAI,CAAC,cAAc,EACnB,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,OAAO,EAAE,CAAC,KAAK,CAAC,CACxD,CAAC,KAAK,CAAC,CAAC;IACX,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;AAChB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Detection, type FaceCaptureSessionOptions } from "@meeeetup/camera-core";
|
|
1
|
+
import { type AutoUploadOptions, type Detection, type FaceCaptureSessionOptions } from "@meeeetup/camera-core";
|
|
2
2
|
import { type ReadonlyFrameProcessor } from "react-native-vision-camera";
|
|
3
3
|
import { type Face } from "react-native-vision-camera-face-detector";
|
|
4
4
|
/**
|
|
@@ -65,6 +65,17 @@ export interface UseFaceCaptureSessionOptions extends Omit<FaceCaptureSessionOpt
|
|
|
65
65
|
* `autoMode`. Default: "front".
|
|
66
66
|
*/
|
|
67
67
|
cameraFacing?: "front" | "back" | "external";
|
|
68
|
+
/**
|
|
69
|
+
* Opt in to the SDK's own transport: each flushed batch is POSTed to the
|
|
70
|
+
* Meeeetup capture endpoint with this capture key, so no upload code is
|
|
71
|
+
* needed on your side. Omit it and the SDK makes no network call at all —
|
|
72
|
+
* `onBatchCapture` stays the only output path.
|
|
73
|
+
*
|
|
74
|
+
* With it set, `onBatchCapture` becomes an observer: it is fired without
|
|
75
|
+
* being awaited, so logging or previewing cannot delay or fail the upload.
|
|
76
|
+
* Observer failures surface on `autoUpload.onError`.
|
|
77
|
+
*/
|
|
78
|
+
autoUpload?: AutoUploadOptions;
|
|
68
79
|
}
|
|
69
80
|
export interface SnapshotInfo {
|
|
70
81
|
/** `file://` URI of the latest cached preview snapshot. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFaceCaptureSession.d.ts","sourceRoot":"","sources":["../src/useFaceCaptureSession.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,SAAS,EACd,KAAK,yBAAyB,EAC/B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAqC,KAAK,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAC5G,OAAO,EAAmB,KAAK,IAAI,EAAE,MAAM,0CAA0C,CAAC;
|
|
1
|
+
{"version":3,"file":"useFaceCaptureSession.d.ts","sourceRoot":"","sources":["../src/useFaceCaptureSession.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,KAAK,yBAAyB,EAC/B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAqC,KAAK,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAC5G,OAAO,EAAmB,KAAK,IAAI,EAAE,MAAM,0CAA0C,CAAC;AAatF;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,SAAS,CAAC,OAAO,CAAC,EAAE;QAClB,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,IAAI,CAAC;QAC9B,kBAAkB,CAAC,EAAE,OAAO,CAAC;KAC9B,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC7D;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,CAAC;IAClC;;;OAGG;IACH,WAAW,EAAE,eAAe,GAAG,IAAI,CAAC;IACpC,6DAA6D;IAC7D,cAAc,EAAE,sBAAsB,CAAC;IACvC,+DAA+D;IAC/D,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACjC;AAED,MAAM,WAAW,eAAe;IAC9B,yDAAyD;IACzD,QAAQ,EAAE,MAAM,CAAC;IACjB,iDAAiD;IACjD,QAAQ,EAAE,MAAM,CAAC;IACjB,qDAAqD;IACrD,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,4BAA4B,GACjC,2BAA2B,CA+M7B;AAID,YAAY,EAAE,IAAI,EAAE,CAAC"}
|
|
@@ -9,6 +9,7 @@ const react_native_worklets_core_1 = require("react-native-worklets-core");
|
|
|
9
9
|
const react_native_1 = require("react-native");
|
|
10
10
|
const frame_buffer_1 = require("./frame-buffer");
|
|
11
11
|
const vision_camera_detector_1 = require("./detectors/vision-camera-detector");
|
|
12
|
+
const useAutoUpload_1 = require("./useAutoUpload");
|
|
12
13
|
const RNFS = react_native_1.NativeModules.RNFSManager
|
|
13
14
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
14
15
|
? require("react-native-fs")
|
|
@@ -49,6 +50,7 @@ function useFaceCaptureSession(opts) {
|
|
|
49
50
|
(0, react_1.useEffect)(() => { optsRef.current = opts; }, [opts]);
|
|
50
51
|
const sessionRef = (0, react_1.useRef)(null);
|
|
51
52
|
const photoCacheRef = (0, react_1.useRef)(null);
|
|
53
|
+
const batchSink = (0, useAutoUpload_1.useAutoUploadSink)(optsRef);
|
|
52
54
|
// ── Session lifecycle ─────────────────────────────────────────────────────
|
|
53
55
|
(0, react_1.useEffect)(() => {
|
|
54
56
|
const session = new camera_core_1.FaceCaptureSession({
|
|
@@ -63,7 +65,7 @@ function useFaceCaptureSession(opts) {
|
|
|
63
65
|
onTrackRemoved: (id) => optsRef.current.onTrackRemoved?.(id),
|
|
64
66
|
onBatchSent: (n) => optsRef.current.onBatchSent?.(n),
|
|
65
67
|
onBatchError: (e) => optsRef.current.onBatchError?.(e),
|
|
66
|
-
onBatchCapture:
|
|
68
|
+
onBatchCapture: batchSink,
|
|
67
69
|
});
|
|
68
70
|
sessionRef.current = session;
|
|
69
71
|
setReady(true);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFaceCaptureSession.js","sourceRoot":"","sources":["../src/useFaceCaptureSession.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"useFaceCaptureSession.js","sourceRoot":"","sources":["../src/useFaceCaptureSession.ts"],"names":[],"mappings":";;AAyKA,sDAiNC;AA1XD,iCAA0E;AAC1E,uDAK+B;AAC/B,2EAA4G;AAC5G,uGAAsF;AACtF,2EAAsD;AACtD,+CAA6C;AAE7C,iDAA+C;AAC/C,+EAA8F;AAC9F,mDAAoD;AAEpD,MAAM,IAAI,GAAG,4BAAa,CAAC,WAAW;IACpC,iEAAiE;IACjE,CAAC,CAAE,OAAO,CAAC,iBAAiB,CAAsC;IAClE,CAAC,CAAC,IAAI,CAAC;AA8HT;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,SAAgB,qBAAqB,CACnC,IAAkC;IAElC,MAAM,CAAC,KAAK,EAAW,QAAQ,CAAC,GAAY,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAC5D,MAAM,CAAC,KAAK,EAAW,QAAQ,CAAC,GAAY,IAAA,gBAAQ,EAAgB,IAAI,CAAC,CAAC;IAC1E,MAAM,CAAC,YAAY,EAAI,eAAe,CAAC,GAAK,IAAA,gBAAQ,EAAC,CAAC,CAAC,CAAC;IACxD,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,IAAA,gBAAQ,EAAc,EAAE,CAAC,CAAC;IACtE,MAAM,CAAC,YAAY,EAA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C;IAIF,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,UAAU,EAAE,CAAC;AAC/G,CAAC"}
|
package/llms.txt
CHANGED
|
@@ -25,7 +25,8 @@ const { frameProcessor, trackedCount } = useFaceCaptureSession({
|
|
|
25
25
|
windowWidth: width, // enables autoMode: landmarks in window space
|
|
26
26
|
windowHeight: height,
|
|
27
27
|
cameraFacing: "front",
|
|
28
|
-
|
|
28
|
+
autoUpload: { captureKey }, // opt-in transport; omit it and the SDK sends nothing
|
|
29
|
+
onBatchCapture: async (faces) => { await upload(faces); }, // own transport, or an observer
|
|
29
30
|
});
|
|
30
31
|
|
|
31
32
|
<Camera ref={camera} device={device} isActive photo frameProcessor={frameProcessor} />
|
|
@@ -37,3 +38,7 @@ const { frameProcessor, trackedCount } = useFaceCaptureSession({
|
|
|
37
38
|
- Pass `windowWidth` / `windowHeight`, or coordinates stay in raw sensor space and overlays will not line up with the preview.
|
|
38
39
|
- `noseLandmark` is omitted on purpose: the hook pins it to `"noseBase"` because ML Kit has no nose tip, keeping scores comparable with MediaPipe on web.
|
|
39
40
|
- `takeSnapshot` is Android-only in Vision Camera 4; iOS falls back to `takePhoto()`, so raise `photoCadenceMs` there if frames drop.
|
|
41
|
+
- `autoUpload` is optional: `{ captureKey, endpoint?, channelId?, maxRetries?, retryDelayMs?, fetch?, onUploaded?, onError? }`. With it set the hook POSTs each batch itself (`Authorization: Bearer <captureKey>`, body `{ images: [{ image, capturedAt }], channelId? }` to `DEFAULT_CAPTURE_ENDPOINT`); without it the SDK makes no network request and `onBatchCapture` is the only output path.
|
|
42
|
+
- Passing both makes `onBatchCapture` an observer: fired without being awaited, so it cannot delay or fail the upload, and its failures surface on `autoUpload.onError`.
|
|
43
|
+
- Retries resend a byte-identical payload — 5xx/429/408/transport failure up to `maxRetries` (default 2, backoff `retryDelayMs` doubled each attempt), other 4xx fail at once. Exhaustion throws `CaptureUploadError { status?, retryable, attempts, cause? }`; the session requeues the batch when `retryable`, drops it otherwise.
|
|
44
|
+
- Re-exports for low-level use: `createAutoUploader`, `CaptureUploadError`, `DEFAULT_CAPTURE_ENDPOINT`, and the `AutoUploader` / `AutoUploadOptions` / `AutoUploadResult` / `CaptureFetch` / `CaptureImage` types.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meeeetup/camera-react-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "React Native SDK for meeeetup-cam — Vision Camera + native ML Kit frame processor",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"access": "public"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@meeeetup/camera-core": "0.
|
|
18
|
+
"@meeeetup/camera-core": "0.8.0"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
21
|
"react": "^18 || ^19",
|