startTextDetection method

Future<StartTextDetectionResponse> startTextDetection({
  1. required Video video,
  2. String? clientRequestToken,
  3. StartTextDetectionFilters? filters,
  4. String? jobTag,
  5. NotificationChannel? notificationChannel,
})

Starts asynchronous detection of text in a stored video.

Amazon Rekognition Video can detect text in a video stored in an Amazon S3 bucket. Use Video to specify the bucket name and the filename of the video. StartTextDetection returns a job identifier (JobId) which you use to get the results of the operation. When text detection is finished, Amazon Rekognition Video publishes a completion status to the Amazon Simple Notification Service topic that you specify in NotificationChannel.

To get the results of the text detection operation, first check that the status value published to the Amazon SNS topic is SUCCEEDED. if so, call GetTextDetection and pass the job identifier (JobId) from the initial call to StartTextDetection.

May throw AccessDeniedException. May throw IdempotentParameterMismatchException. May throw InvalidParameterException. May throw InvalidS3ObjectException. May throw InternalServerError. May throw VideoTooLargeException. May throw ProvisionedThroughputExceededException. May throw LimitExceededException. May throw ThrottlingException.

Parameter clientRequestToken : Idempotent token used to identify the start request. If you use the same token with multiple StartTextDetection requests, the same JobId is returned. Use ClientRequestToken to prevent the same job from being accidentaly started more than once.

Parameter filters : Optional parameters that let you set criteria the text must meet to be included in your response.

Parameter jobTag : An identifier returned in the completion status published by your Amazon Simple Notification Service topic. For example, you can use JobTag to group related jobs and identify them in the completion notification.

Implementation

Future<StartTextDetectionResponse> startTextDetection({
  required Video video,
  String? clientRequestToken,
  StartTextDetectionFilters? filters,
  String? jobTag,
  NotificationChannel? notificationChannel,
}) async {
  ArgumentError.checkNotNull(video, 'video');
  _s.validateStringLength(
    'clientRequestToken',
    clientRequestToken,
    1,
    64,
  );
  _s.validateStringLength(
    'jobTag',
    jobTag,
    1,
    256,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'RekognitionService.StartTextDetection'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Video': video,
      if (clientRequestToken != null)
        'ClientRequestToken': clientRequestToken,
      if (filters != null) 'Filters': filters,
      if (jobTag != null) 'JobTag': jobTag,
      if (notificationChannel != null)
        'NotificationChannel': notificationChannel,
    },
  );

  return StartTextDetectionResponse.fromJson(jsonResponse.body);
}