DEBUG: ICE 连接状态
This commit is contained in:
parent
8829a6cbb2
commit
caadd67b68
@ -95,18 +95,18 @@ export default class ClientList {
|
|||||||
option.onmessage(event, client)
|
option.onmessage(event, client)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//channel.onclose = event => {
|
channel.onclose = event => {
|
||||||
// console.debug('对方关闭', channel.label, '数据通道')
|
console.debug('对方关闭', channel.label, '数据通道')
|
||||||
// if (option && option.onclose) {
|
if (option && option.onclose) {
|
||||||
// option.onclose(event, client)
|
option.onclose(event, client)
|
||||||
// }
|
}
|
||||||
//}
|
}
|
||||||
//channel.onerror = event => {
|
channel.onerror = event => {
|
||||||
// console.error(data.name, '通道', channel.label, '发生错误')
|
console.error(data.name, '通道', channel.label, '发生错误')
|
||||||
// if (option && option.onerror) {
|
if (option && option.onerror) {
|
||||||
// option.onerror(event, client)
|
option.onerror(event, client)
|
||||||
// }
|
}
|
||||||
//}
|
}
|
||||||
}
|
}
|
||||||
webrtc.onicecandidate = event => {
|
webrtc.onicecandidate = event => {
|
||||||
if (event.candidate) {
|
if (event.candidate) {
|
||||||
@ -118,9 +118,10 @@ export default class ClientList {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
webrtc.oniceconnectionstatechange = async event => {
|
webrtc.oniceconnectionstatechange = async event => {
|
||||||
|
console.log(data.name, 'ICE 连接状态:', webrtc.iceConnectionState)
|
||||||
if (webrtc.iceConnectionState === 'disconnected' || webrtc.iceConnectionState === 'failed') {
|
if (webrtc.iceConnectionState === 'disconnected' || webrtc.iceConnectionState === 'failed') {
|
||||||
const client = this.clientlist.find(x => x.id === data.id) ?? {}
|
const client = this.clientlist.find(x => x.id === data.id) ?? {}
|
||||||
console.error(data.name, '需要添加新的 candidate', client.online)
|
console.error(data.name, '需要添加新的 candidate', webrtc.iceConnectionState, client.online)
|
||||||
// 添加新的 candidate
|
// 添加新的 candidate
|
||||||
} else if (webrtc.iceConnectionState === 'connected' || webrtc.iceConnectionState === 'completed') {
|
} else if (webrtc.iceConnectionState === 'connected' || webrtc.iceConnectionState === 'completed') {
|
||||||
//console.debug(data.name, 'WebRTC 连接已经建立成功')
|
//console.debug(data.name, 'WebRTC 连接已经建立成功')
|
||||||
|
Loading…
Reference in New Issue
Block a user