cordova-plugin-speechrecognition icon indicating copy to clipboard operation
cordova-plugin-speechrecognition copied to clipboard

Volume of TTS decreases after recognition on IOS

Open neoffer opened this issue 5 years ago • 3 comments

I'm developing chatbot with Ionic.

We need a property in this plugin which automatically stops recognition after speech end like Android. And a solution for realtime text displays of recognition on iOS.

The problem: After recognition I send the text to the server and get response audio file from server. I play this audio file, but the volume decreases. And when using headset the volume play on the speaker of phone by default.

neoffer avatar Sep 19 '19 08:09 neoffer

Same issue confirmed

jackie-d avatar Oct 14 '19 21:10 jackie-d

I faced the same issue and fixed it by changing thee lines of "SpeechRecognition.m" file

First of all as I see, the problem was fixed in new version of plugin (v1.2.0). In my case Im using cordova-plugin-speechrecognition 1.1.2 "Speech Recognition" so I changed these lines:

 AVAudioSession *audioSession = [AVAudioSession sharedInstance];
        [audioSession setCategory:AVAudioSessionCategoryPlayAndRecord error:nil];
        [audioSession setMode:AVAudioSessionModeMeasurement error:nil];
        [audioSession setActive:YES withOptions:AVAudioSessionSetActiveOptionNotifyOthersOnDeactivation error:nil];

To

AVAudioSession *audioSession = [AVAudioSession sharedInstance];
              [audioSession setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:AVAudioSessionCategoryOptionDefaultToSpeaker error:nil];
              [audioSession setMode:AVAudioSessionModeDefault error:nil];
              [audioSession setActive:YES withOptions:AVAudioSessionSetActiveOptionNotifyOthersOnDeactivation error:nil];

hiunkim avatar Apr 11 '20 20:04 hiunkim

I am using v1.2.0 but some of my Testers are getting the issue on iOS 13+.

hostenvoy avatar May 06 '20 01:05 hostenvoy