AnsweredAssumed Answered

iOS sdk, earphone (top speaker iphone)

Question asked by sberbank_ua on Jun 5, 2016
Latest reply on Nov 23, 2016 by sberbank_ua



I want to change audio route to earspeacker (top speaker ipone), when proximity changed. But call audio session still working from speaker.

Call create

ACBClientCall* call = [ createCallToAddress:@"dialed number" audio:YES video:NO delegate:self];

How can I do that? (I use a version of sdk rem_iOS_SDK-




bug is very similar to 2.1.15 Fusion Client SDK

BugID 6787 "iOS audio-only call outputs audio to speakerphone, not receiver"



- (void)viewDidLoad {

    [super viewDidLoad];

    // Do any additional setup after loading the view, typically from a nib.


    audioSession = [AVAudioSession sharedInstance];

    [audioSession setCategory:AVAudioSessionCategoryPlayAndRecord error:nil];

    [audioSession setActive:YES error:nil];


    AVAudioSessionPortDescription *routePort = audioSession.currentRoute.outputs.firstObject;

    NSString *portType = routePort.portType;


    NSLog(@"PortType %@", portType);


    if ([portType isEqualToString:@"Receiver"]) {

        [audioSession  overrideOutputAudioPort:AVAudioSessionPortOverrideSpeaker error:nil];



    [UIDevice currentDevice].proximityMonitoringEnabled = YES;


    if ([UIDevice currentDevice].proximityMonitoringEnabled == YES) {

        [[NSNotificationCenter defaultCenter] addObserver:self



                                                   object:[UIDevice currentDevice]];




- (void) proximityChangedNSNotification *)notification {

    UIDevice *device = [notification object];

    NSLog(@"In proximity: %i", device.proximityState);


    if(device.proximityState == 0){

        [audioSession  overrideOutputAudioPort:AVAudioSessionPortOverrideSpeaker error:nil];



        [audioSession  overrideOutputAudioPort:AVAudioSessionPortOverrideNone error:nil];




Сообщение отредактировано: Michael Mulesa