@yz-social/webrtc 0.1.8 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +2 -2
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -162,14 +162,14 @@ export class WebRTC {
162
162
  this.settingRemote = true;
163
163
  try {
164
164
  await this.pc.setRemoteDescription(description)
165
- .catch(e => this.log(this.name, 'ignoring error in setRemoteDescription while in state', this.pc.signalingState, e));
165
+ .catch(e => this.log(this.name, 'ignoring error in setRemoteDescription while in state', this.pc?.signalingState, e));
166
166
  if (offerCollision) this.rolledBack = true;
167
167
  } finally {
168
168
  this.settingRemote = false;
169
169
  }
170
170
  }
171
171
 
172
- if (description.type === "offer" && this.pc) {
172
+ if (description.type === "offer" && this.pc && ['have-remote-offer', 'have-local-pranswer'].includes(this.pc.signalingState)) {
173
173
  const answer = await this.pc.createAnswer();
174
174
  await this.pc.setLocalDescription(answer)
175
175
  .catch(e => this.log(this.name, 'ignoring error setLocalDescription of answer', e));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yz-social/webrtc",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "Streamlined portable webrtc management of p2p and client2server.",
5
5
  "keywords": [
6
6
  "webrtc",