MCPcopy Create free account
hub / github.com/ShouChenICU/FastSend / setRemoteSDP

Method setRemoteSDP

app/utils/PeerDataChannel.ts:179–192  ·  view source on GitHub ↗

* 设置远程 SDP * @param sdp SDP描述

(sdp: RTCSessionDescriptionInit)

Source from the content-addressed store, hash-verified

177 * @param sdp SDP描述
178 */
179 public async setRemoteSDP(sdp: RTCSessionDescriptionInit): Promise<void> {
180 try {
181 await this.pc.setRemoteDescription(sdp)
182 if (sdp.type === 'offer') {
183 const answer = await this.pc.createAnswer()
184 await this.pc.setLocalDescription(answer)
185 this.onSDP(answer)
186 }
187 } catch (e) {
188 console.error(e)
189 this.onError(e instanceof Error ? e : new Error('Error setting remote SDP'))
190 this.dispose()
191 }
192 }
193
194 /**
195 * 添加一个 ICE candidate

Callers 2

initializeFunction · 0.80
initializeFunction · 0.80

Calls 1

disposeMethod · 0.95

Tested by

no test coverage detected