Sinch iOS 应用程序:识别应用程序是否接收视频或语音呼叫

Sinch iOS app : Identifying if the app receives video or voice call

我在 swift 项目的 sinch 中集成了视频通话和语音通话。但问题是,在 appDelegate 中我有一个函数 didReceiveIncomingCall。我如何在此函数中放入一些代码来确定呼叫是语音呼叫以显示 voiceCallVC 还是视频呼叫以显示 VideoVC.

  func client(_ client: SINCallClient!, didReceiveIncomingCall call: SINCall!) {


        var top = self.window?.rootViewController

        while (top?.presentedViewController != nil) {
            top = top?.presentedViewController
        }

        let videoVC = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "videoVC") as! VideoCallVC
        videoVC._call = call
        top?.present(videoVC, animated: true, completion: nil)

        let callVC = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "CallVC") as! VoiceCallVC
        callVC._call = call
        top?.present(callVC, animated: true, completion: nil)
    }

您可以检查布尔值 'call.details.isVideoOffered'

这是代码

    func client(_ client: SINCallClient!, didReceiveIncomingCall call: SINCall!) {

     var top = self.window?.rootViewController

     while (top?.presentedViewController != nil) {
        top = top?.presentedViewController
       }
        if (call.details.isVideoOffered)
        {
            let videoVC = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "videoVC") as! VideoCallVC
            videoVC._call = call
            top?.present(videoVC, animated: true, completion: nil)
        }
        else{
            let callVC = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "CallVC") as! VoiceCallVC
           callVC._call = call
           top?.present(callVC, animated: true, completion: nil)
        }

  }