Closed piotrbalut closed 3 years ago
I resolved this using:
void SetAudioSettings()
{
NSError error = AVFoundation.AVAudioSession.SharedInstance().SetCategory(AVFoundation.AVAudioSessionCategory.PlayAndRecord, AVFoundation.AVAudioSessionCategoryOptions.DefaultToSpeaker);
if (error == null)
{
if (AVFoundation.AVAudioSession.SharedInstance().SetMode(AVFoundation.AVAudioSession.ModeSpokenAudio, out error))
{
if (AVFoundation.AVAudioSession.SharedInstance().OverrideOutputAudioPort(AVFoundation.AVAudioSessionPortOverride.Speaker, out error))
{
error = AVFoundation.AVAudioSession.SharedInstance().SetActive(true);
if (error != null)
{
Logger.Log(new Exception(error?.LocalizedDescription ?? "Cannot set active"));
}
}
else
{
Logger.Log(new Exception(error?.LocalizedDescription ?? "Cannot override output audio port"));
}
}
else
{
Logger.Log(new Exception("Cannot set mode"));
}
}
else
{
Logger.Log(new Exception(error?.LocalizedDescription ?? "Cannot set category"));
}
}
I have a problem with volume on iOS - it's too low. On Android everything work great. I tried something like this in AppDelegate, but the error still exists.
Any idea?