@xcelet/selfie-core
v0.1.0
Published
Framework-agnostic MediaPipe selfie capture SDK
Readme
@xcelet/selfie-core
Framework-independent TypeScript selfie capture powered by Google MediaPipe Face Landmarker. It contains camera management, validation, blink and pose detection, automatic capture, image encoding, typed events, and lifecycle state management.
Install
npm install @xcelet/selfie-core @mediapipe/tasks-visionUse
import { SelfieSDK } from '@xcelet/selfie-core';
const video = document.querySelector<HTMLVideoElement>('#selfie-video');
if (!video) throw new Error('Video element was not found');
const sdk = new SelfieSDK({
captureMode: 'smart',
countdown: 1,
quality: 0.85,
outputType: 'blob',
validation: { minSharpness: 3 }
});
sdk.on('status', status => console.log(status.message));
sdk.on('captured', result => console.log(result.blob));
sdk.on('error', error => console.error(error.message));
await sdk.start(video);
// Dispose when the view is removed.
sdk.stop();Camera access requires HTTPS or localhost. See the repository README for configuration, output formats, capture modes, asset hosting, lifecycle details, and troubleshooting.
