startFaceLivenessSession method

Future<StartFaceLivenessSessionResponse> startFaceLivenessSession({
  1. required String challengeVersions,
  2. required String sessionId,
  3. required String videoHeight,
  4. required String videoWidth,
  5. LivenessRequestStream? livenessRequestStream,
})

Starts a Face Liveness video stream and liveness detection process for a given session.

Requires sessionId, ChallengeVersions, VideoWidth, VideoHeight and a RequestEventStream as input. The event stream contains information about different events for the session, including the challenge information used for verification.

The maximum video size for Face Liveness is 10 MB. Face Liveness throws a ValidationException if the video does not match the necessary formatting and size parameters.

May throw AccessDeniedException. May throw InternalServerException. May throw ServiceQuotaExceededException. May throw ServiceUnavailableException. May throw SessionNotFoundException. May throw ThrottlingException. May throw ValidationException.

Parameter challengeVersions : String containing comma separated list of challenge versions supported by client.

Parameter sessionId : A unique 128-bit UUID. Used to uniquely identify the session and also acta as an idempotency token for all operations associated with the session.

Parameter videoHeight : The height of the video object included in a request to start a Face Liveness session.

Parameter videoWidth : The width of the video object included in a request to start a Face Liveness session.

Parameter livenessRequestStream : Information regarding the request stream for a Face Liveness session.

Implementation

Future<StartFaceLivenessSessionResponse> startFaceLivenessSession({
  required String challengeVersions,
  required String sessionId,
  required String videoHeight,
  required String videoWidth,
  LivenessRequestStream? livenessRequestStream,
}) async {
  final headers = <String, String>{
    'x-amz-rekognition-streaming-liveness-challenge-versions':
        challengeVersions.toString(),
    'x-amz-rekognition-streaming-liveness-session-id': sessionId.toString(),
    'x-amz-rekognition-streaming-liveness-video-height':
        videoHeight.toString(),
    'x-amz-rekognition-streaming-liveness-video-width': videoWidth.toString(),
  };
  final response = await _protocol.sendRaw(
    payload: livenessRequestStream,
    method: 'POST',
    requestUri: '/start-face-liveness-session',
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
  final $json = await _s.jsonFromResponse(response);
  return StartFaceLivenessSessionResponse(
    livenessResponseStream: LivenessResponseStream.fromJson($json),
    sessionId: _s.extractHeaderStringValue(
        response.headers, 'x-amz-rekognition-streaming-liveness-session-id')!,
  );
}