【问题标题】:How to know if FaceTime is already in use如何知道 FaceTime 是否已在使用中
【发布时间】:2020-04-05 21:02:40
【问题描述】:

我使用以下方式从我的应用发起 FaceTime 通话:

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

当我调用这个方法时,有没有办法知道 FaceTime 是否已经在使用或者 URL 已经打开?

或者是否有可能知道我打开 URL 后何时返回我的应用程序?

【问题讨论】:

  • canOpenURL: 返回什么?
  • 嗨,canOpenURL: 即使 FaceTime 已经在使用中,也会返回 true。我的愿望是检查我是否已经在使用 FaceTime 通话。我猜 canOpenURL: 只检查设备中是否有 FaceTime。

标签: ios iphone url openurl facetime


【解决方案1】:

所以,我要知道 FaceTime 是否已经在使用/忙于另一个通话,我所做的是检查我的设备上是否正在播放其他音频,从另一个问题中获取这个想法: 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");
}

我想这并不能确保它是 FaceTime 在我的应用程序之外播放音频,但它可以很好地实现我必须实现的目标。

【讨论】:

    猜你喜欢
    • 2017-09-29
    • 2021-06-22
    • 2012-06-28
    • 1970-01-01
    • 1970-01-01
    • 2011-12-04
    • 1970-01-01
    • 1970-01-01
    • 2016-09-23
    相关资源
    最近更新 更多