Commit 663537e9 authored by lazorfuzz's avatar lazorfuzz
Browse files

Only send ping when constraints are valid

parent 9794e9a9
......@@ -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
{
......
......@@ -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();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment