mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
add ice candidates adter accepting remote description.
This commit is contained in:
parent
46c2625f1c
commit
0aef325c5b
@ -82,15 +82,6 @@ export class NekoWebRTC extends EventEmitter<NekoWebRTCEvents> {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.candidates.length > 0) {
|
|
||||||
for (const candidate of this.candidates) {
|
|
||||||
this._peer.addIceCandidate(candidate)
|
|
||||||
}
|
|
||||||
|
|
||||||
this._log.debug(`added ${this.candidates.length} remote ICE candidates`, this.candidates)
|
|
||||||
this.candidates = []
|
|
||||||
}
|
|
||||||
|
|
||||||
this._peer.onconnectionstatechange = (event) => {
|
this._peer.onconnectionstatechange = (event) => {
|
||||||
this._log.debug(`peer connection state changed`, this._peer ? this._peer.connectionState : undefined)
|
this._log.debug(`peer connection state changed`, this._peer ? this._peer.connectionState : undefined)
|
||||||
}
|
}
|
||||||
@ -139,6 +130,15 @@ export class NekoWebRTC extends EventEmitter<NekoWebRTCEvents> {
|
|||||||
|
|
||||||
this._peer.setRemoteDescription({ type: 'offer', sdp })
|
this._peer.setRemoteDescription({ type: 'offer', sdp })
|
||||||
|
|
||||||
|
if (this.candidates.length > 0) {
|
||||||
|
for (const candidate of this.candidates) {
|
||||||
|
this._peer.addIceCandidate(candidate)
|
||||||
|
}
|
||||||
|
|
||||||
|
this._log.debug(`added ${this.candidates.length} remote ICE candidates`, this.candidates)
|
||||||
|
this.candidates = []
|
||||||
|
}
|
||||||
|
|
||||||
const answer = await this._peer.createAnswer()
|
const answer = await this._peer.createAnswer()
|
||||||
this._peer!.setLocalDescription(answer)
|
this._peer!.setLocalDescription(answer)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user