How to know if FaceTime is already in use

12.3k views Asked by At

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?

1

There are 1 answers

0
Davide Bracaglia On BEST ANSWER

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.