iOS - TwilioVideo - 无法与远程参与者通话
iOS - TwilioVideo - Unable to connect on call with remote participant
我正在开发具有视频通话功能的应用程序,为此我正在使用 Twilio Video。
目前使用TwilioVideo SDK v4.6.2和iOS版本14.x及以上
我无法连接到 TwilioVideo 房间
下面是我的代码:
func connect() {
guard let accessToken = self.accessToken, let roomName = self.roomName else {
return
}
prepareAudio()
prepareCamera()
let connectOptions = ConnectOptions(token: accessToken) { (builder) in
builder.isDominantSpeakerEnabled = true
builder.isNetworkQualityEnabled = true
if let localAudioTrack = self.localAudioTrack {
builder.audioTracks = [localAudioTrack]
}
if let localVideoTrack = self.localVideoTrack {
builder.videoTracks = [localVideoTrack]
}
if let preferredAudioCodec = TwiloVideoSettingsManager.shared.audioCodec {
builder.preferredAudioCodecs = [preferredAudioCodec]
}
if let preferredVideoCodec = TwiloVideoSettingsManager.shared.videoCodec {
builder.preferredVideoCodecs = [preferredVideoCodec]
}
if let encodingParameters = TwiloVideoSettingsManager.shared.getEncodingParameters() {
builder.encodingParameters = encodingParameters
}
builder.region = "gll"
builder.roomName = roomName
}
self.room = TwilioVideoSDK.connect(options: connectOptions, delegate: self)
UIApplication.shared.isIdleTimerDisabled = true
}
未通过以下任一方法从 Twilio 收到响应
func didConnect(to room: Room) {
NSLog("Room: \(room.name) SID: \(room.sid)")
if (room.remoteParticipants.count > 0) {
self.remoteParticipant = room.remoteParticipants[0]
self.remoteParticipant.delegate = self
}
self.delegate.videoServiceManagerDidConnectToRoom(name:room.name)
}
func roomDidFailToConnect(room: Room, error: Error) {
NSLog("Failed to connect to a Room: \(error).")
self.delegate.videoServiceManagerFailToConnectRoom(error: error.localizedDescription)
self.leaveRoom()
}
我每次都无法连接到房间,有时会出现以下错误:
Failed to connect to a Room: Error Domain=com.twilio.video Code=53000 "Signaling connection error" UserInfo={NSLocalizedDescription=Signaling connection error, NSLocalizedFailureReason=SIP error 408}.
当我在调试模式下检查 Twilio 日志时,我没有收到任何错误。
如果我的代码有任何错误,请指导我改正
这里是 Twilio 员工。错误 53000 有点模糊,可能由于不同的原因而发生:https://www.twilio.com/docs/api/errors/53000
我建议采取以下后续步骤:
尝试使用 iOS 快速启动应用程序 (https://github.com/twilio/video-quickstart-ios) 重现此错误
在有问题的设备上尝试 运行 我们的网络测试:https://www.networktest.twilio.com
我正在开发具有视频通话功能的应用程序,为此我正在使用 Twilio Video。
目前使用TwilioVideo SDK v4.6.2和iOS版本14.x及以上
我无法连接到 TwilioVideo 房间 下面是我的代码:
func connect() {
guard let accessToken = self.accessToken, let roomName = self.roomName else {
return
}
prepareAudio()
prepareCamera()
let connectOptions = ConnectOptions(token: accessToken) { (builder) in
builder.isDominantSpeakerEnabled = true
builder.isNetworkQualityEnabled = true
if let localAudioTrack = self.localAudioTrack {
builder.audioTracks = [localAudioTrack]
}
if let localVideoTrack = self.localVideoTrack {
builder.videoTracks = [localVideoTrack]
}
if let preferredAudioCodec = TwiloVideoSettingsManager.shared.audioCodec {
builder.preferredAudioCodecs = [preferredAudioCodec]
}
if let preferredVideoCodec = TwiloVideoSettingsManager.shared.videoCodec {
builder.preferredVideoCodecs = [preferredVideoCodec]
}
if let encodingParameters = TwiloVideoSettingsManager.shared.getEncodingParameters() {
builder.encodingParameters = encodingParameters
}
builder.region = "gll"
builder.roomName = roomName
}
self.room = TwilioVideoSDK.connect(options: connectOptions, delegate: self)
UIApplication.shared.isIdleTimerDisabled = true
}
未通过以下任一方法从 Twilio 收到响应
func didConnect(to room: Room) {
NSLog("Room: \(room.name) SID: \(room.sid)")
if (room.remoteParticipants.count > 0) {
self.remoteParticipant = room.remoteParticipants[0]
self.remoteParticipant.delegate = self
}
self.delegate.videoServiceManagerDidConnectToRoom(name:room.name)
}
func roomDidFailToConnect(room: Room, error: Error) {
NSLog("Failed to connect to a Room: \(error).")
self.delegate.videoServiceManagerFailToConnectRoom(error: error.localizedDescription)
self.leaveRoom()
}
我每次都无法连接到房间,有时会出现以下错误:
Failed to connect to a Room: Error Domain=com.twilio.video Code=53000 "Signaling connection error" UserInfo={NSLocalizedDescription=Signaling connection error, NSLocalizedFailureReason=SIP error 408}.
当我在调试模式下检查 Twilio 日志时,我没有收到任何错误。 如果我的代码有任何错误,请指导我改正
这里是 Twilio 员工。错误 53000 有点模糊,可能由于不同的原因而发生:https://www.twilio.com/docs/api/errors/53000
我建议采取以下后续步骤:
尝试使用 iOS 快速启动应用程序 (https://github.com/twilio/video-quickstart-ios) 重现此错误
在有问题的设备上尝试 运行 我们的网络测试:https://www.networktest.twilio.com