@reactoo/watchtogether-sdk-js 2.8.40 → 2.8.41
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
|
@@ -253,7 +253,6 @@ class RoomSession {
|
|
|
253
253
|
this.simulcastSettings = null;
|
|
254
254
|
this.useWebsockets = null;
|
|
255
255
|
|
|
256
|
-
|
|
257
256
|
this.defaultSimulcastSettings = {
|
|
258
257
|
"default" : {
|
|
259
258
|
mode: "controlled", // controlled, manual, browserControlled
|
|
@@ -662,7 +661,11 @@ class RoomSession {
|
|
|
662
661
|
|
|
663
662
|
async #updateSubscriptions() {
|
|
664
663
|
|
|
665
|
-
|
|
664
|
+
|
|
665
|
+
// added sanity check
|
|
666
|
+
await this.#availablePublishersSanityCheck();
|
|
667
|
+
|
|
668
|
+
// no subscription yet, we create one and subscribe to relevant participants
|
|
666
669
|
|
|
667
670
|
if(!this.#subscriberJoinPromise) {
|
|
668
671
|
await this.#joinAsSubscriber(this.roomId, this.pin, this.userId);
|
|
@@ -818,6 +821,43 @@ class RoomSession {
|
|
|
818
821
|
}
|
|
819
822
|
}
|
|
820
823
|
|
|
824
|
+
async #availablePublishersSanityCheck() {
|
|
825
|
+
const list = await this.sendMessage(this.handleId, {body: {request: 'listparticipants', room: this.roomId}})
|
|
826
|
+
const participants = list.participants || [];
|
|
827
|
+
const availablePublishers = [...(this.#subscriberHandle?.webrtcStuff?.availablePublishers ?? [])];
|
|
828
|
+
|
|
829
|
+
availablePublishers.forEach(publisher => {
|
|
830
|
+
|
|
831
|
+
const checkedParticipant = participants.find(p => p.id === publisher.id);
|
|
832
|
+
if(!checkedParticipant) {
|
|
833
|
+
// this publisher is not in the list, we need to remove it
|
|
834
|
+
this._log('Sanity check - Removing publisher', publisher.id, 'from availablePublishers');
|
|
835
|
+
this.#updateAvailablePublishersTrackData([], publisher.id);
|
|
836
|
+
this.#emitRemoteFeedUpdate(null, {feedRemoval: true, attendee: {id: publisher.id}});
|
|
837
|
+
this.#removeAttendeeFromCache(publisher.id);
|
|
838
|
+
this.emit('error', {
|
|
839
|
+
type: 'warning',
|
|
840
|
+
id: 50,
|
|
841
|
+
message: 'sanity check - removing publisher from availablePublishers',
|
|
842
|
+
data: publisher.id
|
|
843
|
+
});
|
|
844
|
+
}
|
|
845
|
+
else if(checkedParticipant.publisher === false) {
|
|
846
|
+
// this publisher is not in the list, we need to remove it
|
|
847
|
+
this._log('Sanity check - Removing publisher', publisher.id, 'from availablePublishers');
|
|
848
|
+
this.#updateAvailablePublishersTrackData([], publisher.id);
|
|
849
|
+
this.#emitRemoteFeedUpdate(null, {feedRemoval: true, attendee: {id: publisher.id}});
|
|
850
|
+
this.emit('error', {
|
|
851
|
+
type: 'warning',
|
|
852
|
+
id: 51,
|
|
853
|
+
message: 'sanity check - removing publisher from availablePublishers',
|
|
854
|
+
data: publisher.id
|
|
855
|
+
});
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
});
|
|
859
|
+
}
|
|
860
|
+
|
|
821
861
|
#getTransceiverDataByMid(mid) {
|
|
822
862
|
return this.#subscriberHandle.webrtcStuff.transceiverMap.find(t => t.mid === mid);
|
|
823
863
|
}
|