我已将 amazon polly 快速集成到我的一个项目中,并要求它 TTS 多组文本字符串。当然,我正在使用下面的一组指令来播放声音:
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
}
在调试时我发现 replaceCurrentItem 正在添加一个新项目来播放并忽略以前的项目。我想就 polly 如何在其框架内处理此类多次调用提出一些建议。
任何帮助表示赞赏!谢谢