JavaScript SDK 2.3.1
Sample Code
The quickest and simplest way to kickstart your journey with the JavaScript SDK is by downloading and experimenting with our full-featured sample code:
- Download JavaScript Plain HTML project
- Download JavaScript NodeJS project
- Download TypeScript NodeJS project
IMPORTANT
In the above sample codes, the strings __YOUR_USER_ID__ and __YOUR_API_KEY__ should be replaced by your own User ID and API Key repectively. Please contact us to obtain your User ID and API Key.
Installation
SDK file installation
In your NodeJS project, install the SDK with the npm install or yarn add commands:
npm install "https://sdk.panoptic.ai/npm/ts-vital-sign-camera-2.3.1.tgz"yarn add "https://sdk.panoptic.ai/npm/ts-vital-sign-camera-2.3.1.tgz"TIP
If you are using Yarn v2 or later, you might need to include the package name in the command, such as yarn add vital-sign-camera@"https://sdk.panoptic.ai/npm/ts-vital-sign-camera-2.3.1.tgz".
Alternatively, if you are not using NodeJS, you can install the SDK by adding the following line to your main HTML file:
<script src="vital-sign-camera.umd-2.3.1.js">The file vital-sign-camera.umd-2.3.1.js is included in this sample project.
Vite Configuration
If you are using Vite as your build tool, you need to exclude ts-vital-sign-camera from dependency optimization to ensure proper functionality:
// vite.config.js
export default defineConfig({
optimizeDeps: {
exclude: ['ts-vital-sign-camera'],
},
});Deployment Notes
NOTE
If the project is deployed to Google Cloud, some web servers, such as serve, might not function correctly, causing the facial skin age feature to fail. To prevent this issue, use http-server instead.
What's new
2.3.1 (28-Oct-2026)
- Fixed the server wake-up failure at camera start: a failed wake-up request no longer surfaces as
Uncaught (in promise) TypeError: Failed to fetch at wakeUpServer. The SDK now handles the error and reports it through the existingonErrorcallback asWake-up request failed: <reason>, so it can be caught and logged by the host application. - The wake-up request remains best-effort: scanning is unaffected and proceeds even if the wake-up fails, and real server failures still surface through the normal scan error path.
- No breaking API changes.
2.3.0 (09-Oct-2026)
- Real-time estimation:
enableRealtimeEstimationandrealtimeEstimationConfigproduce on-device HR/RR estimates during the scan, withestimatorType(Panoptic— default — orMeRppg),signalQualityDelay,minSamples,scanDuration, andvisualSignalType. See the realtime estimators guide. - Scanning sequence visualization:
visualizationOptions.scanningSequenceorchestrates the face mesh, bounding box, and thermal mask through an animated scan sequence (horizontal → vertical → ripple sweeps, then a thermal step), with configurablesweepColor,sweepLineWidth,staticLineWidth,staticColor,stepDurations,animationDelay, and anidleStageconfiguration shown between scans. - Thermal mask:
visualizationOptions.thermalMaskadds a thermal-style overlay tracked to the face ROI, withopacityandcolorScheme('thermal'|'grayscale'). - Heatmap visualization: configurable heatmap rendering with built-in colormaps and presets.
- Face mesh options: new
'ripple'animation direction andsimplifyFaceMeshto remove the outer perimeter and surrounding zigzag connections. - Age estimation: added
AgeEstimationConfig.timeout(default 15 s), plus reliability fixes (age inference in a Web Worker, FaceApi readiness handling). - Signal visualizer: respiratory-rate extraction,
signalColors, variadicupdateSignal, and confidence-based HR colors. - Breaking changes:
RealtimeEstimatorType.Fdarenamed toRealtimeEstimatorType.Panoptic; creation proprealtimeEstimationrenamed toenableRealtimeEstimation;minDurationrenamed tosignalQualityDelay(with unusedearlyEstimation/minConfidencefields removed from the realtime estimation config). See the V1 → V2 migration guide if you are upgrading from V1.