Compare commits

...

2 Commits

Author SHA1 Message Date
8b20f898fe fix fmt 2025-02-21 14:48:38 +01:00
d7c5c3cf9d fix 2025-02-21 14:46:47 +01:00

View File

@ -589,7 +589,12 @@ class EngineConnection extends EventTarget {
} }
const initiateConnectingExclusive = () => { const initiateConnectingExclusive = () => {
if (that.triggeredStart) return if (!that.sdpAnswer) {
console.log('SDP answer is not yet available')
return false
}
if (that.triggeredStart) return false
that.triggeredStart = true that.triggeredStart = true
// Start connecting. // Start connecting.
@ -611,6 +616,7 @@ class EngineConnection extends EventTarget {
type: ConnectingType.SetRemoteDescription, type: ConnectingType.SetRemoteDescription,
}, },
} }
return true
} }
this.onIceCandidate = (event: RTCPeerConnectionIceEvent) => { this.onIceCandidate = (event: RTCPeerConnectionIceEvent) => {
@ -643,7 +649,9 @@ class EngineConnection extends EventTarget {
// Sometimes the remote end doesn't report the end of candidates. // Sometimes the remote end doesn't report the end of candidates.
// They have 3 seconds to. // They have 3 seconds to.
setTimeout(() => { setTimeout(() => {
initiateConnectingExclusive() if (initiateConnectingExclusive()) {
console.warn('connected after 3 second delay')
}
}, 3000) }, 3000)
} }
this.pc?.addEventListener?.('icecandidate', this.onIceCandidate) this.pc?.addEventListener?.('icecandidate', this.onIceCandidate)