I want to integrate the AWS polly service to my iOS application for text to speech purpose. I have setup the code that is available on GitHub as starter project. I have setup the CognitoIdentityPoolId in AWS console correctly.
This is the code that is use for getting the URL of inputed text but
the closure builder.continueOnSuccessWith that is responsible for getting url is not running or giving any error.
let input = AWSPollySynthesizeSpeechURLBuilderRequest()
// Text to synthesize
input.text = "Sample text"
// We expect the output in MP3 format
input.outputFormat = AWSPollyOutputFormat.mp3
// Choose the voice ID
input.voiceId = AWSPollyVoiceId.joanna
// Create an task to synthesize speech using the given synthesis input
let builder = AWSPollySynthesizeSpeechURLBuilder.default().getPreSignedURL(input)
// Request the URL for synthesis result
builder.continueOnSuccessWith(block: { (awsTask: AWSTask<NSURL>) -> Any? in
// The result of getPresignedURL task is NSURL.
// Again, we ignore the errors in the example.
let url = awsTask.result!
// Try playing the data using the system AVAudioPlayer
self.audioPlayer.replaceCurrentItem(with: AVPlayerItem(url: url as URL))
self.audioPlayer.play()
debugPrint("Player success")
return nil
})
I am not getting any error in console as well. How to debug where is the issue ??