kkkkoyo / UnitySpeakerFix

Forces audio to speaker while using the mic, on iPhone

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Update Unity has add Force iOS Speakers in PlayerSetting, you would try this.

WARNING

This is based on https://github.com/10people/UnitySpeakerFix, I have update code to use on iOS 15.0 with Unity 2021.2.17f1 (Apr, 2022)


Unity iPhone Speaker Fix

When using microphone input, Unity iPhone switches audio output to the earpiece speaker, instead of the usual speakerphone speaker. As a result, all the audio in game suddenly becomes very quiet, even at max volume. In particular, this is problematic for games which include voice-chat.

How-To

Simply install the Unity package, add a call to iPhoneSpeaker.CheckiOSPrepare() before you call Microphone.Start(). add a call to iPhoneSpeaker.ForceToSpeaker() before you call audio.Play().

Credit

Base code from these two SO threads:

About

Forces audio to speaker while using the mic, on iPhone


Languages

Language:Objective-C 53.7%Language:C# 46.3%