Question

Does anyone know how to stop the iphone muting the speaker output whilst a phone call is taking place?

I'm developing an app where I need to be able to play audio through the phone speakers whilst there's a phonecall..

Hope someone can help!

Was it helpful?

Solution 2

I don't believe Apple allows other audio to mix with the audio during a phone call. Apple wants to ensure that poorly written apps won't interfere with a user's ability to perform important functions, such as making phone calls, on their phone. So your app is basically forced to comply.

OTHER TIPS

I know there's an accepted answer but I don't think that it's completely correct. Some navigation apps (Waze for instance) are able to give audio directions during phone calls. If you use AVAudioPlayer you can handle interruptions (i.e. phone calls) by responding to the audioPlayerBeginInterruption: delegate (you can read more about it here).

While I didn't have too much time to look into it I did manage to play a short sound file while initiating a phone call or playing a song by using the following code:

-(void)audioPlayerBeginInterruption:(AVAudioPlayer *)player
{
    NSString *path = [[NSBundle mainBundle] pathForResource:@"mySound" ofType:@"mp3"];
    SystemSoundID soundFileObject;
    NSURL *pathURL = [NSURL fileURLWithPath : path];
    CFURLRef soundFileURLRef = (CFURLRef)CFBridgingRetain(pathURL);
    AudioServicesCreateSystemSoundID(soundFileURLRef, &soundFileObject);
    AudioServicesPlaySystemSound(soundFileObject);
}

Keep in mind that when an interruption comes in your app might be backgrounded or suspended which will also affect your ability to play sounds (or run any other code for that matter).

I do not think this is possible and I hope it's not, because personally, I do not want any app recoding my phone calls or interrupting important calls with prank sounds.

I also think this would be a very risky thing to allow if you think about it from a security standpoint.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top