2

I'm working on AppRTC for Audio call, It's working fine when app is open. Audio call is not working when device is locked, If wI un-lock device while call and open app, It's start working normally but while it's locked it's not working. (Audio is not passing or playing).

I already added "App plays audio or streams audio/video using AirPlay" in "Required background modes" of plist.

Audio session is also configured. Please check code below.

- (void)configureAVAudioSession:(BOOL)isSpeakerOn
{
    // Get your app's audioSession singleton object
    AVAudioSession *session = [AVAudioSession sharedInstance];

    // Error handling
    BOOL success;
    NSError *error;

    // set the audioSession category.
    // Needs to be Record or PlayAndRecord to use audioRouteOverride:

    success = [session setCategory:AVAudioSessionCategoryPlayAndRecord
                             error:&error];

    if (!success) {
        NSLog(@"AVAudioSession error setting category:%@",error);
    }

    // Set the audioSession override
    success = [session overrideOutputAudioPort:isSpeakerOn?AVAudioSessionPortOverrideSpeaker:AVAudioSessionPortOverrideNone
                                         error:&error];
    if (!success) {
        NSLog(@"AVAudioSession error overrideOutputAudioPort:%@",error);
    }

    // Activate the audio session
    success = [session setActive:YES error:&error];
    if (!success) {
        NSLog(@"AVAudioSession error activating: %@",error);
    }
    else {
        NSLog(@"AudioSession active");
    }

}

Please let me know if anything is missing or i'd implemented wrongly.

Regards,

Sonu
  • 937
  • 1
  • 10
  • 39
  • I'm having the same issue and I'm using WebRTC as well. I have come to believe that this might be an issue with WebRTC. Have you had any luck in making this work? – NikosM Mar 16 '18 at 08:46
  • @NikosM No so far... – Sonu Mar 16 '18 at 14:10

0 Answers0