How to know if FaceTime is already in use

Davide Bracaglia picture Davide Bracaglia · Jun 22, 2015 · Viewed 12.3k times · Source

I start a FaceTime call from my app using:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[@"facetime://" stringByAppendingString:appleID]]]

Is there a way to know if FaceTime is already in use or the URL is already open when i call this method?

Or is it possible to know when i come back into my app after opening the URL?

Answer

Davide Bracaglia picture Davide Bracaglia · Mar 3, 2016

So, what I did to know if FaceTime was already in use/busy on another call is to check if other audio is playing on my device, taking the idea from this other question: Detecting active AVAudioSessions on iOS device.

// check if other audio is playing
BOOL isPlayingWithOthers = [[AVAudioSession sharedInstance] isOtherAudioPlaying];

if(isPlayingWithOthers){
    NSLog(@"other audio is playing - FaceTime could be in use");
    //do nothing
}else{
    NSLog(@"no other audio is playing - FaceTime not in use");
}

I guess this does not ensure that it is FaceTime playing audio outside my app but it works fine for the goal i had to achieve.