Record and replay ppg-js sessions
Export ppg-js debug recordings and replay them offline through the same signal engine.
Debug recording and replay
Every session records per-frame channel means and timestamps, camera capabilities and settings, applied constraints, dropped-frame counts, peak and interval decisions, and per-window quality records.
Export a recording
Use getDebugLog() on PPGMonitor, or export through the PPG facade:
const json = ppg.exportDebugLog();
ppg.downloadDebugLog('my-session');Nothing is written to localStorage unless debug.persistLastSession is enabled. User-agent capture is disabled unless debug.includeUserAgent is enabled.
Replay offline
In the ppg-js repository:
npm run replay -- path/to/ppg-debug.jsonReplay runs the recording through the same PpgEngine used in the live camera path. It prints state transitions, per-window quality, the heart-rate timeline with the RMSSD floor, every interval decision, respiration, and a comparison with peaks recorded live on the phone.
The repository's test/live-parity.test.js verifies that a recorded session replays to identical windows.
Why replay matters
A debug file separates capture from analysis. You can reproduce a device-specific failure without repeatedly using the camera, compare algorithm changes against the same input, and attach one recording to a regression test.