Today i tried to use a combination of both technologies; when i first started the app, TTS was working. When i used speechrecognition, all further TTS outputs were surpressed, but i didnt get any error.
My speaker was also not muted, other apps worked just fine. Any ideas?
I made a sample, but now i can see a crash by running Speech.Startrecording(True); maybe this is a step to the solution.
New version of sample included - code corrected, but problem exists further.
Speak button works for me, as long i dont use 'start recording'.
there are two big mistakes in your code:
The Speech & ActivityIndicator objects were not initilaized.
Change this and check whether the SetLanguage method of Speech returns true or false.
as Erel already guess, there is a problem with the audio session setting. You need to change the category of the shared audio session before using TTS/STT:
B4X:
'When using TTS use SetCategory(False)
Sub SetCategory(Record As Boolean)
Dim NaObj As NativeObject = Me
NaObj.RunMethod("setCategory:",Array(Record))
#If OBJC
-(void)setCategory:(BOOL)B{
AVAudioSession* AS = [AVAudioSession sharedInstance];
if (B){
[AS setCategory:AVAudioSessionCategoryRecord error:nil];
[AS setMode:AVAudioSessionModeMeasurement error:nil];
[AS setActive:true withOptions:AVAudioSessionSetActiveOptionNotifyOthersOnDeactivation error:nil];
}else{
[AS setCategory:AVAudioSessionCategoryPlayback error:nil];
[AS setMode:AVAudioSessionModeDefault error:nil];
}
}
#End If
End Sub