React SDK 2.4.3
Sample Code
The quickest and simplest way to kickstart your journey with the React SDK is by downloading and experimenting with our full-featured sample code:
Download React Sample CodeIMPORTANT
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
In your React project, install the SDK with the npm install or yarn add commands. Please note that different frameworks require different packages.
npm install "https://sdk.panoptic.ai/npm/react-vital-sign-camera-2.4.3.tgz"yarn add "https://sdk.panoptic.ai/npm/react-vital-sign-camera-2.4.3.tgz"IMPORTANT
Please use Webpack as the bundler for your production code. Other web bundling tool such as Vite is not supported yet.
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/react-vital-sign-camera-2.4.3.tgz".
Model file installation
Copy the models folder to the root of the web hosting directory. The models files is included in the above sample code.
NOTE
If the project is deployed to Google Cloud, some web servers, such as serve, might not function correctly, causing the facial skin age feature to fail. To prevent this issue, use http-server instead.
What's new
2.4.3 (28-Mar-2024)
- Fixed the redundant face mesh problem causing the home page scrollable.
2.4.2 (28-Mar-2024)
- Fixed the wrong bounding box and face mesh locations.
- Fixed the problem that the camera is turned on automatically when changing device.
- Fixed a crash in
drawImage.
2.4.1 (25-Mar-2024)
- Fixed the display problems of face mesh and bounding box.
- Use the front facing camera by default if
deviceorpreferredCamerais not set.
2.4.0 (2-Feb-2024)
- New feature
- Added
onErrorto observe and handle errors. - Added prop
VisualizationOptionsfor rendering bounding box or face mesh.
- Added
- Bug fixes
- Fixed the problem that face lost error can't be detected if the face is out of bound.