Amazon polly not playing multiple text inputs

113 views Asked by At

I have integrated amazon polly to one of my project in swift and asking it to TTS multiple set of text strings. Certainly I am using there below set of instructions to play sound:

    builder.continueOnSuccessWith { (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()

      return nil
    }

While debug I found that replaceCurrentItem is adding a new item to play and ignoring the previous. I would like to have some suggestions as how the polly handle such multiple calls within its framework.

Any help appreciated! Thanks

1

There are 1 answers

0
Tarun On

I could able to make this work by inserting each operation to AVQueuePlayer and playing at last, but I am keen to know how amazon handle's multiple file play in polly