Reply To: OpenEars / AVPlayer Issue

Home Forums OpenEars OpenEars / AVPlayer Issue Reply To: OpenEars / AVPlayer Issue

#1017372
josh
Participant

Hi,
I am doing something very similar to you. I start the recognition then suspend it to be able to do other things with the microphone and speaker which requires a completely different audio session config and sample rate.
Before I resume the recognition I call startAudioSession which re-initializes the audio session again.
Example code:

[[AudioSessionManager sharedAudioSessionManager] startAudioSession];
[self.pocketsphinxController resumeRecognition];

I have also found that after you suspend the recognition you need to delay a little before you re-configure the audio session to how you want it, otherwise pocket sphinx can crash. You will also need to give a little time for the audio session to be re-configured before you play your mp3/movie otherwise I’ve found the first part of the audio can be cut off.
Example code:

[self.pocketsphinxController suspendRecognition];
[self performSelector:@selector(reconfigureAudioForPlayingMovie) withObject:nil afterDelay: 1.0];
[self performSelector:@selector(playMovie) withObject:nil afterDelay: 2.0];

This works for me. Hope it helps!

Josh