iOS : For audio only call , audio gets routed to loud speaker, instead of earphone


#1

In my iOS app, I have started audio-only call by using
[jitsiMeetView loadURLObject:@{
@“config”: @{
@“startWithAudioMuted”: NO,
@“startWithVideoMuted”: YES,
},
@“url”: urlStr
}];

call starts as audio only, but audio gets routed to speaker, instead of earphone, and i press on select the sound device, i only get the option of "Speaker.

Can anybody give suggestion how to stop loudspeaker?

After joining to jitsi, i have tried even
AVAudioSession *session = [AVAudioSession sharedInstance];
[session setCategory:AVAudioSessionCategoryPlayAndRecord
error:&error];
[session setMode:AVAudioSessionModeVoiceChat error:&error];

[session overrideOutputAudioPort:AVAudioSessionPortOverrideNone error:&error];

but it not works.

if i log audio route output using

NSLog(@“route=%@”,session.currentRoute.outputs);

it shows type = Receiver; name = Receiver; UID = Built-In Receiver; selectedDataSource = (null) after setting for one time but again it shows

type = Speaker; name = Speaker; UID = Speaker; selectedDataSource = (null)

i am using jitsi-meet old SDK downloaded at August,2018 not the latest SDK