I am having a problem with flite running on an app in the background.
As suggested by others, I tried setting AV Category to ‘AVAudioSessionCategoryPlayback’ with categoryOption to ‘AVAudioSessionCategoryOptionMixWithOthers’
However, the Flite controller always reset the audio session to PlayAndRecord.
As a result, it won’t do TTS when entering background thread.
This is running on an iPhone 5 with IOS6.
I also added the background modes ‘app play audio’ in plist.
[log output below]
the log output
// checking av session category
myAV session category in BG: AVAudioSessionCategoryPlayback
myAV session categoryOption in BG: 1
// flite logging
I’m running flite
Checking and resetting all audio session settings.
audioCategory is incorrect, we will change it.
audioCategory is now on the correct setting of kAudioSessionCategory_PlayAndRecord.
bluetoothInput is incorrect, we will change it.
bluetooth input is now on the correct setting of 1.
categoryDefaultToSpeaker is incorrect, we will change it.
CategoryDefaultToSpeaker is now on the correct setting of 1.
preferredBufferSize is correct, we will leave it as it is.
preferredSampleRateCheck is correct, we will leave it as it is.
I’m done running flite and it took 0.275146 seconds
Flite audio player was nil when referenced so attempting to allocate a new audio player.
Loading speech data for Flite concluded successfully.
// checking av session category after flite
myAV session category in BG after flite: AVAudioSessionCategoryPlayAndRecord
myAV session categoryOption in BG after flite: 12