@reactoo/watchtogether-sdk-js 2.6.49 → 2.6.50

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.50",
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('ws 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);
@@ -1715,6 +1719,14 @@ class RoomSession {
1715
1719
  return;
1716
1720
  }
1717
1721
  var config = handle.webrtcStuff;
1722
+
1723
+ // Already restarting;
1724
+ if (config.isIceRestarting) {
1725
+ return;
1726
+ }
1727
+
1728
+ config.isIceRestarting = true;
1729
+
1718
1730
  if (this.handleId === handleId) {
1719
1731
  this._log('Performing local ICE restart');
1720
1732
  let hasAudio = !!(config.stream && config.stream.getAudioTracks().length > 0);
@@ -1730,9 +1742,11 @@ class RoomSession {
1730
1742
  }, false, false, 5);
1731
1743
  })
1732
1744
  .then(r => {
1745
+ config.isIceRestarting = false;
1733
1746
  this._log('ICE restart success');
1734
1747
  })
1735
1748
  .catch((e) => {
1749
+ config.isIceRestarting = false;
1736
1750
  this.emit('error', {type: 'warning', id: 28, message: 'iceRestart failed', data: e});
1737
1751
  });
1738
1752
  } else {
@@ -1740,7 +1754,12 @@ class RoomSession {
1740
1754
  return this.sendMessage(handleId, {
1741
1755
  body: {"request": "configure", "restart": true}
1742
1756
  }, false, false, 5).then(() => {
1743
- }).catch(() => {});
1757
+ }).then(() => {
1758
+ config.isIceRestarting = false;
1759
+ this._log('ICE restart success');
1760
+ }).catch(() => {
1761
+ config.isIceRestarting = false;
1762
+ });
1744
1763
  }
1745
1764
 
1746
1765
  }
@@ -1880,6 +1899,13 @@ class RoomSession {
1880
1899
  "sdp": response.sdp
1881
1900
  };
1882
1901
 
1902
+ if(response.e2ee)
1903
+ jsep.e2ee = true;
1904
+ if(response.rid_order === "hml" || response.rid_order === "lmh")
1905
+ jsep.rid_order = response.rid_order;
1906
+ if(response.force_relay)
1907
+ jsep.force_relay = true;
1908
+
1883
1909
  return _p.then(() => jsep)
1884
1910
  }, (e) => {
1885
1911
  return Promise.reject({type: 'warning', id: 25, message: methodName, data: [handleId, e]})