@reactoo/watchtogether-sdk-js 2.6.49 → 2.6.51

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reactoo/watchtogether-sdk-js",
3
- "version": "2.6.49",
3
+ "version": "2.6.51",
4
4
  "description": "Javascript SDK for Reactoo",
5
5
  "main": "src/index.js",
6
6
  "unpkg": "dist/watchtogether-sdk.min.js",
@@ -487,10 +487,10 @@ class RoomSession {
487
487
  } else if (type === "webrtcup") {
488
488
  //none universal
489
489
  } else if (type === "hangup") {
490
- this._log('hangup on', handle.handleId);
490
+ this._log('hangup on', handle.handleId, handle.handleId === this.handleId, json);
491
491
  this._removeParticipant(handle.handleId, null, false);
492
492
  } else if (type === "detached") {
493
- this._log('detached on', handle.handleId);
493
+ this._log('detached on', handle.handleId, handle.handleId === this.handleId, json);
494
494
  this._removeParticipant(handle.handleId, null, true);
495
495
  } else if (type === "media") {
496
496
  this._log('Media event:', handle.handleId, json["type"], json["receiving"], json["mid"]);
@@ -499,6 +499,7 @@ class RoomSession {
499
499
  } else if (type === "event") {
500
500
  //none universal
501
501
  } else if (type === 'timeout') {
502
+ this._log('WebSockets Gateway timeout', json);
502
503
  this.ws.close(3504, "Gateway timeout");
503
504
  } else if (type === 'success' || type === 'error') {
504
505
  // we're capturing those elsewhere
@@ -706,6 +707,7 @@ class RoomSession {
706
707
 
707
708
  if (jsep !== undefined && jsep !== null) {
708
709
 
710
+ console.log(msg)
709
711
  if (this.sessiontype === 'reactooroom') {
710
712
  this._webrtcPeer(this.handleId, jsep)
711
713
  .catch(err => {
@@ -904,6 +906,7 @@ class RoomSession {
904
906
  dtmfSender: null,
905
907
  trickle: true,
906
908
  iceDone: false,
909
+ isIceRestarting: false
907
910
  };
908
911
 
909
912
  if (handleId === this.handleId) {
@@ -954,6 +957,7 @@ class RoomSession {
954
957
  dtmfSender: null,
955
958
  trickle: true,
956
959
  iceDone: false,
960
+ isIceRestarting: false
957
961
  }
958
962
  };
959
963
  this._participants.push(handle);
@@ -1678,10 +1682,6 @@ class RoomSession {
1678
1682
  return Promise.resolve(null);
1679
1683
  }
1680
1684
 
1681
- if(config.pc.signalingState === 'stable') {
1682
- //TODO
1683
- }
1684
-
1685
1685
  return config.pc.setRemoteDescription(jsep)
1686
1686
  .then(() => {
1687
1687
  config.remoteSdp = jsep.sdp;
@@ -1715,6 +1715,14 @@ class RoomSession {
1715
1715
  return;
1716
1716
  }
1717
1717
  var config = handle.webrtcStuff;
1718
+
1719
+ // Already restarting;
1720
+ if (config.isIceRestarting) {
1721
+ return;
1722
+ }
1723
+
1724
+ config.isIceRestarting = true;
1725
+
1718
1726
  if (this.handleId === handleId) {
1719
1727
  this._log('Performing local ICE restart');
1720
1728
  let hasAudio = !!(config.stream && config.stream.getAudioTracks().length > 0);
@@ -1730,9 +1738,11 @@ class RoomSession {
1730
1738
  }, false, false, 5);
1731
1739
  })
1732
1740
  .then(r => {
1741
+ config.isIceRestarting = false;
1733
1742
  this._log('ICE restart success');
1734
1743
  })
1735
1744
  .catch((e) => {
1745
+ config.isIceRestarting = false;
1736
1746
  this.emit('error', {type: 'warning', id: 28, message: 'iceRestart failed', data: e});
1737
1747
  });
1738
1748
  } else {
@@ -1740,7 +1750,12 @@ class RoomSession {
1740
1750
  return this.sendMessage(handleId, {
1741
1751
  body: {"request": "configure", "restart": true}
1742
1752
  }, false, false, 5).then(() => {
1743
- }).catch(() => {});
1753
+ }).then(() => {
1754
+ config.isIceRestarting = false;
1755
+ this._log('ICE restart success');
1756
+ }).catch(() => {
1757
+ config.isIceRestarting = false;
1758
+ });
1744
1759
  }
1745
1760
 
1746
1761
  }
@@ -1880,6 +1895,13 @@ class RoomSession {
1880
1895
  "sdp": response.sdp
1881
1896
  };
1882
1897
 
1898
+ if(response.e2ee)
1899
+ jsep.e2ee = true;
1900
+ if(response.rid_order === "hml" || response.rid_order === "lmh")
1901
+ jsep.rid_order = response.rid_order;
1902
+ if(response.force_relay)
1903
+ jsep.force_relay = true;
1904
+
1883
1905
  return _p.then(() => jsep)
1884
1906
  }, (e) => {
1885
1907
  return Promise.reject({type: 'warning', id: 25, message: methodName, data: [handleId, e]})