Conflict between microphone and speaker on the IOS device.
In IOS when permission is granted to the microphone, the device's audio goes to the upper speaker and the sound becomes low because that speaker serves for the purpose of call. Please, anybody can help me?
@igor-nm @wenkesj I am seeing this as well. When playing audio, and including Voice, the phone ear speaker is used instead of the body speakers. I don't think this was happening a couple weeks ago. I think there might have been a ios change. Any ideas?
@wenkesj
@ohtangza Pulling you in here since I have seen you active in other issues.
Any idea what is going on here? Check out this thread for a little more context: https://github.com/ak1394/react-native-tts/issues/61
Right now I am trying to figure out how I can just destroy / undo everything a Voice.start()does (after I am done with it) in order to have the case speakers used again instead of the ear speaker.
I have noticed a couple things while tinkering. Right now no matter what I do, I always get a 203 retrywhen calling the destroy method. I am pretty sure this is a error coming from [self.recognitionTask cancel] in teardown.
However even if I remove
[self.recognitionRequest endAudio];
[self.recognitionTask cancel];
from the teardown method (which gets rid of the 203) I still am seeing the audio move to the ear speaker.
I should clarify further. Audio comes out of the case speakers up until the point Voice.start() is called. Not sure if that is a IOS bug or an issue with this library. In either case. I think the destroy method should literally destroy everything that Voice.start() did.
Could use some help on this. I don't really use Objective C much.
@dalinarkholin I see this is a problem.
That endAudio method should be invoked to stop adding to the underlying buffer, before calling cancel on the task to avoid overflow (which is most definitely causing an error, somewhere).
I believe the underlying problem may be due to the AVAudioSession in the tts module.
From what I can tell, this particular use-case, session setCategory:AVAudioSessionCategoryPlayback will cause issues when attempting to record on a session that is trying to playback.
This seems to be the root of the problem and explains it pretty throughly. The question is iOS related and would probably involve fixing on the tts end.
Hi guys, everything fine? I would like to thank you guys for looking at this problem, do you guys think we can find a solution to this, or is it really an iOS problem? I do ever not developing in Objective-C so I can not help them much with this. Sorry me. :(
@wenkesj Thanks for taking a look.
I ended up forking both this module and the react-native-tts module. There were changes needed on both ends. Basically I just switch the AVAudioSession Category and mode on start of both modules. That seemed to at least solve the issue of getting audio back to the case speakers.
Hello guys, everyone ok? The solution of @dalinarkholin is successfully. I going mark this topical as resolved. I would like to ask you @dalinarkholin to make a pull request with this project, and too for project react-native-tts, so that help everyone of in the community.
@wenkesj @ak1394
I'll leave it up to you guys to debate on this. I have done little testing and am not confident enough to say that nothing broke.
Hi guays, news on this subject? Do you think there is a better way to solve the problem? @wenkesj @ak1394 @dalinarkholin
@wenkesj I was able to simplify my solution by handling the change of AVSession mode / category in teardown of this module.
guys what was the solution here? it seems that this bug is still exists
use master, it should be fixed
Some issue. @idan6189 does it works?
use this when initialising audiosession
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:AVAudioSessionCategoryOptionDefaultToSpeaker error: nil];
this solved the issue for me