Skip to content

GetSpeechSynthesisTask

Source: src/AWS/Polly/GetSpeechSynthesisTask.ts

Runtime binding for polly:GetSpeechSynthesisTask — retrieve the status (and output S3 URI) of an asynchronous synthesis task by its TaskId.

The binding takes no arguments and grants the function polly:GetSpeechSynthesisTask. Provide the implementation with Effect.provide(AWS.Polly.GetSpeechSynthesisTaskHttp).

// init
const getSpeechSynthesisTask = yield* AWS.Polly.GetSpeechSynthesisTask();
// runtime — bounded poll until the task leaves the queue
const task = yield* getSpeechSynthesisTask({ TaskId: taskId }).pipe(
Effect.repeat({
schedule: Schedule.spaced("2 seconds"),
until: (r): boolean =>
r.SynthesisTask?.TaskStatus === "completed" ||
r.SynthesisTask?.TaskStatus === "failed",
times: 25,
}),
);