0

我是 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)")
    }
}

}

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

4

0 回答 0