Skip to content

Get Conditions Check Results

Target SDK

JavaScript
React
Vue
Flutter
ReactNative
Android
iOS

TIP

You can refer to the sample code and the API Reference for more details. Most related API(s) include: VideoFrameProcessedEvent and ScanConditions.

To obtain the conditions check results for each frame, access the event.scanConditions variable through the onVideoFrameProcessed callback function. This callback function delivers processing results at a rate of 30Hz per second (The rate depends on the frame rate of the camera).

typescript
/* Update the onload event handler function */
window.onload = () => {
    /* A reference of the camera that should have been created in the "Camera Setup" step. */
    const cam = createVitalSignCamera({ isActive: true, config, userInfo })
    
    // ...

    /* Add or Update the onVideoFrameProcessed callback function */
    cam.onVideoFrameProcessed = (event: VideoFrameProcessedEvent) => {
        // ...

        /* Get and log the conditions check result to the console */
        const conditions = event.scanConditions;
        console.log(`Centered=${conditions?.centered}, Face Position Condition=${conditions?.facePositionCondition}`);
        console.log(`Distance=${conditions?.distance}, Distance Condition=${conditions?.distanceCondition}`);
        console.log(`Lighting=${conditions?.lighting}`);
        console.log(`Movement=${conditions?.movement}`);
        console.log(`Frame Rate=${conditions?.frameRate}, FPS=${conditions?.fps}`);
        console.log(`Server Ready=${conditions?.serverReady}`);
    }
}
js
/* Update the onload event handler function */
window.onload = () => {
    /* A reference of the camera that should have been created in the "Camera Setup" step. */
    const cam = createVitalSignCamera({ isActive: true, config, userInfo })
    
    // ...

    /* Add or Update the onVideoFrameProcessed callback function */
    cam.onVideoFrameProcessed = (event) => {
        // ...

        /* Get and log the conditions check result to the console */
        const conditions = event.scanConditions;
        console.log(`Centered=${conditions.centered}, Face Position Condition=${conditions.facePositionCondition}`);
        console.log(`Distance=${conditions.distance}, Distance Condition=${conditions.distanceCondition}`);
        console.log(`Lighting=${conditions.lighting}`);
        console.log(`Movement=${conditions.movement}`);
        console.log(`Frame Rate=${conditions.frameRate}, FPS=${conditions.fps}`);
        console.log(`Server Ready=${conditions.serverReady}`);
    }
}

TIP

For a good user experience and to ensure accurate measurements, it is recommended to visualize the scan conditions on screen realtime, at least, before initiating the Vitals™ scan. In this way, if some conditions are not met, the user can react immediately (e.g. by adjusting the head position) to fulfill the conditions. Please refer to the sample code for a reference implementation.