diff --git a/README.md b/README.md index aa4830ede886ed7c9c42e89665f71fd2bfab2a6b..69de190c30c0187a9817687d905c1d8d244e294b 100644 --- a/README.md +++ b/README.md @@ -272,7 +272,7 @@ export default Party; muted: true // mute local video stream to prevent echo } ``` - - `object network` - *optional* options for setting minimum and maximum peers to connect to. + - `object constraints` - *optional* options for setting minimum and maximum peers to connect to. Defaults to ```javascript { diff --git a/src/liowebrtc.js b/src/liowebrtc.js index 3ffdced4d1a9f014275257e2ff4b1291f3705425..3780aa7ff1f1ba18fdbea6ab73c6995d28feecd2 100644 --- a/src/liowebrtc.js +++ b/src/liowebrtc.js @@ -82,7 +82,7 @@ class LioWebRTC extends WildEmitter { sharemyscreen: message.roomType === 'screen' && !message.broadcaster, broadcaster: message.roomType === 'screen' && !message.broadcaster ? self.connection.getSessionid() : null, }); - if (this.config.dataOnly) { + if (this.config.dataOnly || this.config.constraints.maxPeers > 0) { this.sendPing(peer, peer.id, true); } else { peer.start(); @@ -425,7 +425,7 @@ class LioWebRTC extends WildEmitter { offerToReceiveVideo: !this.config.dataOnly && self.config.receiveMedia.offerToReceiveVideo ? 1 : 0, }, }); - if (this.config.dataOnly) { + if (this.config.dataOnly || this.config.constraints.maxPeers > 0) { this.sendPing(peer, peer.id, true); } else { peer.start(); @@ -479,9 +479,7 @@ class LioWebRTC extends WildEmitter { testReadiness() { const self = this; if (this.sessionReady) { - if (this.config.dataOnly || (!this.config.media.video && !this.config.media.audio)) { - self.emit('ready', self.connection.getSessionid()); - } else if (this.webrtc.localStreams.length > 0) { + if (this.config.dataOnly || (!this.config.media.video && !this.config.media.audio) || this.webrtc.localStreams.length > 0) { self.emit('ready', self.connection.getSessionid()); } } @@ -505,7 +503,7 @@ class LioWebRTC extends WildEmitter { offerToReceiveVideo: !this.config.dataOnly && this.config.receiveMedia.offerToReceiveVideo ? 1 : 0, }, }); - if (this.config.dataOnly) { + if (this.config.dataOnly || this.config.constraints.maxPeers > 0) { this.sendPing(peer, peerId, true); } else { peer.start();