khanhuitse05 / speech-and-text-unity-ios-android

Speed to text in Unity iOS use Native Speech Recognition
MIT License
288 stars 124 forks source link

iOS: pressing record btn in SampleScene freezes scene/game for 0.5s - 1s on actual device #34

Open calvma opened 3 years ago

calvma commented 3 years ago

When i press the record btn to start talking on my iphone 6s, everything in the scene freezes for 0.5 - 1s. When I run this same scene in the xcode simulator, there is no timeout/delay.

It looks like creating an AVAudioSession every time we startRecording is causing the issue

AVAudioSession *session = [AVAudioSession sharedInstance]; [session setCategory:AVAudioSessionCategoryPlayAndRecord mode:AVAudioSessionModeMeasurement options:AVAudioSessionCategoryOptionDefaultToSpeaker error:nil]; [session setActive:TRUE withOptions:AVAudioSessionSetActiveOptionNotifyOthersOnDeactivation error:nil];

ti-hardikshah commented 3 years ago

I am facing the same issue , is there any solution ?