swift - 使用 Amazon Chime SDK 创建的视频通话没有互联网时,如何检测和显示警报框

问题描述

我是 iOS swift 的新开发人员,目前正在创建视频通话功能。我已经完成了大部分视频通话功能。但是,当我在没有互联网部分的情况下尝试重新连接时,我陷入了困境。我不知道在会议模型中的何处放置警报框,以及如何在使用 Amazon Chime SDK 创建的会议模型中显示警报框。我目前正在处理的代码如下所示。

extension MeetingModel: AudioVideoObserver {
func connectionDidRecover() {
    notifyHandler?("Connection quality has recovered")
    logWithFunctionName()
}

func connectionDidBecomePoor() {
    notifyHandler?("Connection quality has become poor")
    logWithFunctionName()
}

func videoSessionDidStopWithStatus(sessionStatus: MeetingSessionStatus) {
    logWithFunctionName(message: "\(sessionStatus.statusCode)")
    
}

func audioSessionDidStartConnecting(reconnecting: Bool) {
    notifyHandler?("Establishing connection to call")
    logWithFunctionName(message: "reconnecting \(reconnecting)")
    if !reconnecting {
        call?.isConnectingHandler?()
    }
}

func audioSessionDidStart(reconnecting: Bool) {
    notifyHandler?("Successfully connected to call")
    logWithFunctionName(message: "reconnecting \(reconnecting)")
    if !reconnecting {
        call?.isConnectedHandler?()
    }
}

func audioSessionDidDrop() {
    notifyHandler?("There is a connection problem2")
    logWithFunctionName()
}

func clear(){
    videoModel.clear()
    rosterModel.clear()
    chatModel.clear()
}

func stop(){
    currentMeetingSession.audioVideo.stop()
    removeAudioVideoFacadeObservers()
}

func audioSessionDidStopWithStatus(sessionStatus: MeetingSessionStatus) {
    logWithFunctionName(message: "\(sessionStatus.statusCode)")
    notifyHandler?("There is a connection problem1")
    removeAudioVideoFacadeObservers()
    if sessionStatus.statusCode != .ok{
 
    }
    if let call = call {
        switch sessionStatus.statusCode {
        case .ok:
            if call.isOnHold {
                return
            }
        case .audioCallEnded,.audioServerHungup:
            CallKitManager.shared().reportCallEndedFromRemote(with: call,reason: .remoteEnded)
        case .audioJoinedFromAnotherDevice:
            CallKitManager.shared().reportCallEndedFromRemote(with: call,reason: .answeredElsewhere)
        case .audioDisconnectAudio:
            CallKitManager.shared().reportCallEndedFromRemote(with: call,reason: .declinedElsewhere)
        default:
            CallKitManager.shared().reportCallEndedFromRemote(with: call,reason: .failed)
        }
    }
}

func audioSessionDidCancelReconnect() {
    logWithFunctionName()
}

func videoSessionDidStartConnecting() {
    logWithFunctionName()
}

func videoSessionDidStartWithStatus(sessionStatus: MeetingSessionStatus) {
    switch sessionStatus.statusCode {
    case .videoAtCapacityViewOnly:
        notifyHandler?("Maximum concurrent video limit reached! Failed to start local video")
        logWithFunctionName(message: "\(sessionStatus.statusCode)")
    default:
        logWithFunctionName(message: "\(sessionStatus.statusCode)")
    }
}

}

希望能得到这方面的帮助,因为已经在这里停留了几天。提前谢谢你!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...