import { Mimic } from ' @vidrip/mimic-web ' ;
Loads the face tracker. Doesn’t open the camera. Returns Promise<Mimic>.
Option
Type
Default
modelUrl
string
required
URL of face_landmarker.task
wasm
{ simd, nosimd }
required
{ loader, binary } URLs for each WebAssembly build
preview
HTMLVideoElement
none
Shows the camera, mirrored
blendshapes
boolean
false
Run the expression network (needed for eyes.up, expression.match)
delegate
'auto' | 'GPU' | 'CPU'
'auto'
'auto' tries the GPU, then the CPU
constraints
MediaTrackConstraints
640×480 on phones, 1280×720 on laptops, front camera
Passed to getUserMedia
profile
CalibrationProfile
none
A stored profile; skips calibration
spec
'auto' | 'phone' | 'laptop' | overrides
'auto'
Threshold set; see Providers
gestures
GestureId[]
all supported
Arm only these
on
{ [pattern]: handler }
none
Handlers to attach now
invert
{ head?, eyes? }
none
Flip left/right if a camera reports it backwards
log
(msg) => void
none
Diagnostic messages (delegate chosen, fallbacks)
Member
start(): Promise<void>
Open the camera and begin feeding frames. Call from a user gesture on iOS.
stop()
Release the camera. The engine and profile survive; start() again to resume.
destroy()
stop() and free the tracker.
running: boolean
Whether the camera is on
fps: number
Frames processed in the last second
Member
on(pattern, handler): () => void
Subscribe; returns the unsubscribe function. See patterns .
isActive(id): boolean
Whether a gesture is held now
armed / unsupported
What the provider can feed, and what it can’t (with the missing capabilities)
latest: FrameFeatures | null
The last frame’s measurements (eye openness, gaze, mouth, brows, pose), for HUDs
setExpressionTarget(scores)
Set the target for expression.match
readImage(image)
Expression scores from a still image, e.g. a target photo
Member
calibrate(): Promise<{ profile, status }>
Calibrate on the live stream (starts the camera if needed). profile is null on failure.
calibration: CalibrationStatus
{ active, progress, quality, blinks, done, failure }, updated every frame
cancelCalibration()
Stop calibrating
profile / setProfile(p)
The installed profile
@vidrip/mimic-core exports MimicEngine (push your own samples), loadSpec(...) and the types. toFaceSample(result, options) from @vidrip/mimic-web converts a raw tracker result into a sample if you run the tracker yourself.