This documentation is for version 1 of Shen.ai SDK. To view the in-progress documentation for upcoming version 2, see docs-beta.shen.ai
Video measurement
/
Preparation

Measurement preparation

After successfully installing and initializing the SDK, your app should be ready to start the video measurement.

Before starting the measurement, the user should be instructed to keep a stable position without talking and changing the facial expression.

Initial conditions

After initialization, the SDK will start to analyze the video stream from the camera.

In order for the measurement to begin, the user needs to locate their face in the middle of the screen, in good lighting conditions. You can provide feedback to the user about their face position and lighting conditions by using the getFaceState() and getLightingConditions() methods.

final faceState = ShenaiSdk.getFaceState();
final lightingConditions = ShenaiSdk.getLightingConditions();

The calls return the following enums accordingly:

enum FacePos {
  ok,
  notCentered,
  tooClose,
  tooFar,
  unstable,
  invalid,
}

enum LightingCond {
  ok,
  dark,
  tooDark,
  tooBrightBackground,
  tooBrightFace,
  invalid,
}

You can check if the conditions are satisfied by calling the isReadyForMeasurement() method. If the face is located properly you should be able to start the measurement.

Starting the measurement

To start the measurement, use the beginMeasurement() call which returns an enum informing if the measurement has successfully started or the reason of failure:

enum BeginMeasurementStatus {
  started,            // Measurement started
  resumed,            // Measurement resumed after being paused
  notStartedCamera,   // Measurement not started because of camera problem
  notStartedFace,     // Measurement not started because of wrong face position
  notStartedLighting, // Measurement not started because of wrong lighting conditions
  invalid             // Measurement not started because of internal error
}

You can also check if the measurement is in progress with the isMeasuring() method. If you want to abort the measurement at any point, call abortMeasurement().