Skip to content

JavaScript SDK 1.5.2

Sample Code

The quickest and simplest way to kickstart your journey with the JavaScript SDK is by downloading and experimenting with our full-featured sample code:

IMPORTANT

In the above sample codes, the strings __YOUR_USER_ID__ and __YOUR_API_KEY__ should be replaced by your own User ID and API Key repectively. Please contact us to obtain your User ID and API Key.

Installation

SDK file installation

In your NodeJS project, install the SDK with the npm install or yarn add commands:

bash
npm install "https://sdk.panoptic.ai/npm/ts-vital-sign-camera-1.5.2.tgz"
bash
yarn add "https://sdk.panoptic.ai/npm/ts-vital-sign-camera-1.5.2.tgz"

TIP

If you are using Yarn v2 or later, you might need to include the package name in the command, such as yarn add vital-sign-camera@"https://sdk.panoptic.ai/npm/ts-vital-sign-camera-1.5.2.tgz".

Alternatively, if you are not using NodeJS, you can install the SDK by adding the following line to your main HTML file:

html
<script src="vital-sign-camera.umd-1.5.2.js">

The file vital-sign-camera.umd-1.5.2.js is included in this sample project.

Model file installation

Copy the models folder to the root of the web hosting directory. The models files is included in the above sample projects.

IMPORTANT

Please use Webpack as the bundler for your production code. Other web bundling tool such as Vite is not supported yet.

What's new

1.5.2 (3-May-2024)

  • Features
    • Added property faceDetectionModelLocation for specifying model download location.
  • Bug fixes
    • Fixed the problem that the bounding box and face mesh are always on top.

1.5.1 (26-April-2024)

  • Features
    • Support typeing in UMD sample project.
    • Support percentage in FaceDetectionRegion.
  • Bug fixes
    • Improved the reliability of age estimation.
    • Fixed wrong position of the face detection region UI in example 3 and example 5.

1.5.0 (23-April-2024)

  • Features

    • Added the propery faceDetectionRegion for setting the face detection region. For example:

      javascript
      camera.faceDetectionRegion = {
        x: 100, y: 100, width: 100, height: 200
      }
    • Added the property customConditionRange for customizing the condition checking range. For example:

      javascript
      camera.customConditionRange = {
        distanceRange: {min: 0.4, max: 0.6}
      }
    • Supports percentage as line width of the face mesh.

    • Supports UMD module so that the SDK can be loaded with the script tag. For example:

      html
      <script src="vital-sign-camera.umd-1.5.0.js">
    • Condition checker now also returns the frame rate.

    • Supports updating presetFormat property.

  • Bug fixes

    • Fixed the wrong position of face mesh and bounding box if the page is scrolled.
  • Other changes

    • The SDK no longer depends on 'vital-sign-engine-plugin'.