@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.
package/package.json
CHANGED
|
@@ -406,6 +406,13 @@ class RoomSession {
|
|
|
406
406
|
}
|
|
407
407
|
}
|
|
408
408
|
|
|
409
|
+
#hasAttendeeInCache(id) {
|
|
410
|
+
if(this.#subscriberHandle) {
|
|
411
|
+
return !!this.#subscriberHandle.webrtcStuff.userIdToDisplay[id];
|
|
412
|
+
}
|
|
413
|
+
return false
|
|
414
|
+
}
|
|
415
|
+
|
|
409
416
|
#getCachedAttendeeIds() {
|
|
410
417
|
return Object.keys(this.#subscriberHandle?.webrtcStuff?.userIdToDisplay || {});
|
|
411
418
|
}
|
|
@@ -448,7 +455,7 @@ class RoomSession {
|
|
|
448
455
|
});
|
|
449
456
|
}
|
|
450
457
|
|
|
451
|
-
#emitRemoteFeedUpdate(mid, {feedRemoval = false, addingTrack = false, removingTrack = false, track = null, source = null, attendee = null} = {}) {
|
|
458
|
+
#emitRemoteFeedUpdate(mid, {forceEmit = false,feedRemoval = false, addingTrack = false, removingTrack = false, track = null, source = null, attendee = null} = {}) {
|
|
452
459
|
|
|
453
460
|
const transceiverData = this.#getTransceiverDataByMid(mid);
|
|
454
461
|
|
|
@@ -462,7 +469,7 @@ class RoomSession {
|
|
|
462
469
|
description = JSON.parse(transceiverData.feed_description);
|
|
463
470
|
} catch (e) {}
|
|
464
471
|
|
|
465
|
-
if(!this.#shouldEmitFeedUpdate(parsedDisplay)) {
|
|
472
|
+
if(!this.#shouldEmitFeedUpdate(parsedDisplay) && !forceEmit && !removingTrack) {
|
|
466
473
|
this._log('Not emitting feed update for', display, 'because of subscription rules');
|
|
467
474
|
// we don't want to emit this event
|
|
468
475
|
return;
|
|
@@ -513,7 +520,8 @@ class RoomSession {
|
|
|
513
520
|
const display = this.#getDisplayById(id);
|
|
514
521
|
const parsedDisplay = decodeJanusDisplay(display);
|
|
515
522
|
|
|
516
|
-
|
|
523
|
+
// we sometimes need to force emit, or emit when we unsubscribed and we're removing tracks
|
|
524
|
+
if(!this.#shouldEmitFeedUpdate(parsedDisplay, id) && !forceEmit && !removingTrack) {
|
|
517
525
|
this._log('Not emitting feed update for', display, 'because of subscription rules');
|
|
518
526
|
// we don't want to emit this event
|
|
519
527
|
return;
|
|
@@ -654,6 +662,7 @@ class RoomSession {
|
|
|
654
662
|
const subscribe = [];
|
|
655
663
|
const unsubscribe = [];
|
|
656
664
|
const flatSourceMap = [];
|
|
665
|
+
const forceEmitFeedRemoval = []
|
|
657
666
|
|
|
658
667
|
for (let index in publishers) {
|
|
659
668
|
if(publishers[index]["dummy"])
|
|
@@ -692,6 +701,10 @@ class RoomSession {
|
|
|
692
701
|
if(isSubscribed) {
|
|
693
702
|
unsubscribe.push({feed: id, mid: mid});
|
|
694
703
|
this.#removeFromSubscribeMap(id, mid);
|
|
704
|
+
// we need to get rid of feed if we we're subscribed to it
|
|
705
|
+
if(forceEmitFeedRemoval.indexOf(id) === -1) {
|
|
706
|
+
forceEmitFeedRemoval.push(id);
|
|
707
|
+
}
|
|
695
708
|
}
|
|
696
709
|
continue;
|
|
697
710
|
}
|
|
@@ -703,6 +716,9 @@ class RoomSession {
|
|
|
703
716
|
}
|
|
704
717
|
}
|
|
705
718
|
|
|
719
|
+
// we need to get rid of feed if we we're subscribed to it
|
|
720
|
+
forceEmitFeedRemoval.forEach(id => this.#emitRemoteFeedUpdate(null, {feedRemoval: true, forceEmit: true, attendee: {id:id}}))
|
|
721
|
+
|
|
706
722
|
// check if we're subscribed to any mid that is no longer available in sources
|
|
707
723
|
|
|
708
724
|
Object.keys(subscribedTo).forEach(id => {
|