vitallens.js is the official JavaScript client for the VitalLens API, a service for estimating physiological vital signs like heart rate, respiratory rate, and heart rate variability (HRV) from facial video.
The library provides:
- High-Fidelity Accuracy: A simple interface to the VitalLens API for state-of-the-art estimation (heart rate, respiratory rate, HRV).
- Universal Support: Works seamlessly in the Browser and Node.js with support for real-time webcam streams and files.
- Web Components: Drop-in UI widgets for instant integration into your web application.
- Local Fallbacks: Implementations of classic rPPG algorithms (
pos,chrom,g) for local, API-free processing. - Fast Face Detection: Integrated rapid face detection with support for global ROI skipping to maximize performance.
Using a different language or platform? We also have a Python client and iOS SDK.
To use the library or web components directly in the browser without a build step:
<script type="module" src="https://cdn.jsdelivr.net/npm/vitallens/dist/vitallens.browser.js"></script>npm install vitallens
# or
yarn add vitallensThe fastest way to add vitals scanning to your app.
<script type="module" src="https://cdn.jsdelivr.net/npm/vitallens/dist/vitallens.browser.js"></script>
<vitallens-scan api-key="YOUR_API_KEY"></vitallens-scan>For custom logic and data handling.
import { VitalLens } from 'vitallens';
// Initialize
const vl = new VitalLens({
method: 'vitallens',
apiKey: 'YOUR_API_KEY'
});
// Process a file
const result = await vl.processVideoFile(myFile);
console.log("Heart Rate:", result.vitals.heart_rate.value);Full documentation, including the API Reference, Web Component guide, Code examples, and Proxy configuration, is available at docs.rouast.com/js.
- Chrome Security: If testing locally (
file://), Chrome may block video processing. Use a local server (e.g.,npx serve) instead.
vitallens provides vital sign estimates for general wellness purposes only. It is not intended for medical use. Always consult with your doctor for any health concerns or for medically precise measurement.
See also our Terms of Service for the VitalLens API and our Privacy Policy.
This project is licensed under the MIT License.
