@reactoo/watchtogether-sdk-js 2.8.0-beta.3 → 2.8.0-beta.4

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.
@@ -54718,6 +54718,12 @@ function _removeAttendeeFromCache(id) {
54718
54718
  delete _classPrivateFieldGet(_subscriberHandle, this).webrtcStuff.userIdToDisplay[id];
54719
54719
  }
54720
54720
  }
54721
+ function _hasAttendeeInCache(id) {
54722
+ if (_classPrivateFieldGet(_subscriberHandle, this)) {
54723
+ return !!_classPrivateFieldGet(_subscriberHandle, this).webrtcStuff.userIdToDisplay[id];
54724
+ }
54725
+ return false;
54726
+ }
54721
54727
  function _getCachedAttendeeIds() {
54722
54728
  var _classPrivateFieldGet4, _classPrivateFieldGet5;
54723
54729
  return Object.keys(((_classPrivateFieldGet4 = _classPrivateFieldGet(_subscriberHandle, this)) === null || _classPrivateFieldGet4 === void 0 ? void 0 : (_classPrivateFieldGet5 = _classPrivateFieldGet4.webrtcStuff) === null || _classPrivateFieldGet5 === void 0 ? void 0 : _classPrivateFieldGet5.userIdToDisplay) || {});
@@ -54764,6 +54770,7 @@ function _emitLocalFeedUpdate() {
54764
54770
  }
54765
54771
  function _emitRemoteFeedUpdate(mid) {
54766
54772
  let {
54773
+ forceEmit = false,
54767
54774
  feedRemoval = false,
54768
54775
  addingTrack = false,
54769
54776
  removingTrack = false,
@@ -54781,7 +54788,7 @@ function _emitRemoteFeedUpdate(mid) {
54781
54788
  try {
54782
54789
  description = JSON.parse(transceiverData.feed_description);
54783
54790
  } catch (e) {}
54784
- if (!_assertClassBrand(_RoomSession_brand, this, _shouldEmitFeedUpdate).call(this, parsedDisplay)) {
54791
+ if (!_assertClassBrand(_RoomSession_brand, this, _shouldEmitFeedUpdate).call(this, parsedDisplay) && !forceEmit && !removingTrack) {
54785
54792
  this._log('Not emitting feed update for', display, 'because of subscription rules');
54786
54793
  // we don't want to emit this event
54787
54794
  return;
@@ -54823,7 +54830,9 @@ function _emitRemoteFeedUpdate(mid) {
54823
54830
  const id = attendee.id;
54824
54831
  const display = _assertClassBrand(_RoomSession_brand, this, _getDisplayById).call(this, id);
54825
54832
  const parsedDisplay = (0,_models_utils__WEBPACK_IMPORTED_MODULE_2__.decodeJanusDisplay)(display);
54826
- if (!_assertClassBrand(_RoomSession_brand, this, _shouldEmitFeedUpdate).call(this, parsedDisplay)) {
54833
+
54834
+ // we sometimes need to force emit, or emit when we unsubscribed and we're removing tracks
54835
+ if (!_assertClassBrand(_RoomSession_brand, this, _shouldEmitFeedUpdate).call(this, parsedDisplay, id) && !forceEmit && !removingTrack) {
54827
54836
  this._log('Not emitting feed update for', display, 'because of subscription rules');
54828
54837
  // we don't want to emit this event
54829
54838
  return;
@@ -54949,6 +54958,7 @@ async function _updateSubscriptions() {
54949
54958
  const subscribe = [];
54950
54959
  const unsubscribe = [];
54951
54960
  const flatSourceMap = [];
54961
+ const forceEmitFeedRemoval = [];
54952
54962
  for (let index in publishers) {
54953
54963
  if (publishers[index]["dummy"]) continue;
54954
54964
  let userId = publishers[index]["display"];
@@ -54988,6 +54998,10 @@ async function _updateSubscriptions() {
54988
54998
  mid: mid
54989
54999
  });
54990
55000
  _assertClassBrand(_RoomSession_brand, this, _removeFromSubscribeMap).call(this, id, mid);
55001
+ // we need to get rid of feed if we we're subscribed to it
55002
+ if (forceEmitFeedRemoval.indexOf(id) === -1) {
55003
+ forceEmitFeedRemoval.push(id);
55004
+ }
54991
55005
  }
54992
55006
  continue;
54993
55007
  }
@@ -55001,6 +55015,15 @@ async function _updateSubscriptions() {
55001
55015
  }
55002
55016
  }
55003
55017
 
55018
+ // we need to get rid of feed if we we're subscribed to it
55019
+ forceEmitFeedRemoval.forEach(id => _assertClassBrand(_RoomSession_brand, this, _emitRemoteFeedUpdate).call(this, null, {
55020
+ feedRemoval: true,
55021
+ forceEmit: true,
55022
+ attendee: {
55023
+ id: id
55024
+ }
55025
+ }));
55026
+
55004
55027
  // check if we're subscribed to any mid that is no longer available in sources
55005
55028
 
55006
55029
  Object.keys(subscribedTo).forEach(id => {