pollingLongRunningRecognize method

Future<LongRunningRequestResult> pollingLongRunningRecognize(
  1. RecognitionConfigBeta config,
  2. String audioGcsUri, {
  3. Duration pollInterval = const Duration(seconds: 1),
})

Implementation

Future<LongRunningRequestResult> pollingLongRunningRecognize(
    RecognitionConfigBeta config, String audioGcsUri,
    {Duration pollInterval = const Duration(seconds: 1)}) async {
  final client = SpeechClient(_channel, options: _options);

  // transform audio to RecognitionAudio
  final recognitionAudio = RecognitionAudio()..uri = audioGcsUri;

  // Create the request, which transmits the necessary
  // data to the Google Api.
  final request = (LongRunningRecognizeRequest()
    ..config = config.toConfig()
    ..audio = recognitionAudio);
  final operation = await client.longRunningRecognize(request);
  return _pollOperation(operation, pollInterval);
}