-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[bug] iPhone sound comes from earpiece instead of the speakerphone #219
Comments
Unfortunately I don't think it's possible to fix this in Unity+iOS. Unity+iOS auto switches the audio output as soon as UnitySpeakerFix looks to be two years out of date, so is probably no longer a workable solution. It also only allows you to force to speakers at runtime, so suffers the same issue as the
StopCapture is called when Dissonance no longer wants mic input - i.e. when the player leaves the session. |
@martindevans thanks for the input. I think it is quite critical for this library to work correctly with headphones\speakers scenarios on iOS devices. This is what really required for acceptable game experience. And looks like I have found a way to make it working without changing Unity settings. However, I would appreciate your advice as this lib code owner\expert. I wrote a native script in Objective C that detects headphones and if they are not plugged in, it forces speakers. Do you know how can I force BasicMicrophoneCapture to 're-initialize'? As the workaround, I can detect this scenario and force Dissonance to re-initialize |
Ok, it seems that I have managed to fix all speaker\earpiece\headset related issues of Dissonance library that I found on iPhone. What I did to make voice chat experience smooth:
Going to test how things work on Android next week. Hope it will be more reliable than on iOS. |
You can call
Dissonance uses the Unity
Ouch, that's a bad bug! If this isn't being triggered it will definitely cause issues. How did you work around it in this case? |
+1 |
@vladbasin are you able to share the scripts and steps to fix this if it is working on iOS? Currently stuck on this issue and would be much appreciated!! |
I deleted Dissonance from project 2 years ago because of this bug. |
I'm not completely sure what the situation is on iOS right now - the problems were always an unfortunate confluence of Unity issues (e.g. not properly invoking the callback when devices change) and iOS issues (e.g. automatically using the call speaker when the mic is in use). FWIW I believe the situation should be much better - no one has contacted me with any issues regarding this for a long time. I'm also going to be working with a customer on their app (developing some custom features for them, specifically for iOS), so if there are any remaining issues I'll hopefully be able to work through them with them. |
We are having this issue right now on both iOS and Android. Our project has a voice chat feature using Dissonance, and when the user is muted, the audio comes from the speakerphone. When unmuted, the audio comes faintly from the earpiece. This behaviour has been consistent with different models of iPhones, iPad and Pixel phones. Things I've tried:
iOS workarounds are not working and I've heard absolutely nothing about a workaround for Android. This is quite problematic for us, everything else about Dissonance has been smooth except for this issue. Does anyone have any updated workaround or ideas? Using Unity 2021.3.19f1. |
Expected Behavior
During voice chat communication the sound must come from speakerphone (or headphones if they are present).
Actual Behavior
During voice chat communication the sound comes from earpiece.
Workaround
Toggle 'Force iOS Speaker while recording' on in unity player settings for iOS. This, however, makes headphones use impossible (the device always switches back to speaker). Which makes this workaround useless.
Your Environment
More notes
There was a fix suggestion by @martindevans in another thread: #131
This script does not fix the issue. The sound is still coming from the mic. After debugging I have discovered that for some reason, StopCapture() has never been called, therefore iPhoneSpeaker.ForceToSpeaker() is not called either.
StopCapture() is called only AFTER client is disconnected. Therefore, no iPhoneSpeaker.ForceToSpeaker() is called during the game (should be called after Microphone.Start(...)). Tried to call iPhoneSpeaker.ForceToSpeaker() in StartCapture() - no voice captured happens at all.
The text was updated successfully, but these errors were encountered: