Skip to content

Get the Scan Status

For a good user experience and to let users know the scan progress, you should visualize the scan status on your user interface. Vitals™ SDK provides the scanning stage and remaining time (in the unit of seconds) through the onVideoFrameProcessed callback function. You could observe the changes there and update your user interface correspondingly.

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, ScanResult, and GetHealthStage.

To get the scan status, including the scanning stage and remaining time:

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 })

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

        /* Add this to print the scan status. */
        console.log(`Scanning Stage=${event.healthResult?.stage}, Remaining Seconds=${event.healthResult?.remainingTime}`);
    }
}
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 })

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

        /* Add this to print the scan status. */
        console.log(`Scanning Stage=${event.healthResult?.stage}, Remaining Seconds=${event.healthResult?.remainingTime}`);
    }
}