just-ai / aimybox-ios-sdk

Voice assistant SDK for iOS devices written in Swift
https://aimybox.com
Apache License 2.0
18 stars 7 forks source link

Fix stop speaking in YandexTextToSpeech #20

Closed ZharaOo closed 3 years ago

ZharaOo commented 3 years ago

There is a problem, when you call YandexTextToSpeech and an audio isn't playing, then application crashes. Also when you call AVAudioPlayer.stop the .AVPlayerItemDidPlayToEndTime notification isn't called and YandexTextToSpeech freezes. That's why we decided to use AVPlayer, which is safer and more flexible.

In AimyboxConcrete I replaced setting speaking state to the speechSequenceStarted event, because there is a little delay between calling Aimybox.speak and speechSequenceStarted.

I added public init to YandexSynthesisConfig to be able to configure my own configuration with different voice etc.