Skip to content

Initiate a Scan

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: VitalSignCameraInterface.

To initiate a scan, call the startScanning() API of the Vital Sign Camera component. For example, if you have a start button:

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

    /* A reference of the start button as an example */
    const startButton = document.querySelector('#startButton')!;

    /* Add the click event listener to start the Vitals™ scan */
    startButton.addEventListener('click', () => {
        cam.startScanning()
    })
}
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 })

    /* A reference of the start button as an example */
    const startButton = document.querySelector('#startButton');

    /* Add the click event listener to start the Vitals™ scan */
    startButton.addEventListener('click', () => {
        cam.startScanning()
    })
}

After calling the API, the component will start scanning the face from the camera for about 30 seconds. And vital signs will be returned upon successful scan.

TIP

In the user interface, it is highly recommended to avoid users restarting a scan when the scan is already in progress. If you have a start button, you should either disable the start button or hide it during the scan (i.e., when the scanning stage is GetHealthStage.Idle) for best practices.