From b74eae69adedeed814e1fad09073ac2c431de49c Mon Sep 17 00:00:00 2001 From: David Zhao Date: Fri, 16 Sep 2022 22:32:43 -0700 Subject: [PATCH] Sync state settings should use desired instead of subscribed (#440) * Sync state settings should use desired instead of subscribed * better variable name, handle undefined connOptions. * changeset --- .changeset/cold-moles-accept.md | 5 +++++ src/room/Room.ts | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 .changeset/cold-moles-accept.md diff --git a/.changeset/cold-moles-accept.md b/.changeset/cold-moles-accept.md new file mode 100644 index 0000000000..13f92d3ecb --- /dev/null +++ b/.changeset/cold-moles-accept.md @@ -0,0 +1,5 @@ +--- +'livekit-client': patch +--- + +Improve handling of connection resume failures diff --git a/src/room/Room.ts b/src/room/Room.ts index a49ea1f11e..a3ad36f56a 100644 --- a/src/room/Room.ts +++ b/src/room/Room.ts @@ -1061,11 +1061,11 @@ class Room extends (EventEmitter as new () => TypedEmitter) subscribe pc and unsub special tracks from it. 2. autosubscribe off, we send subscribed tracks. */ - const sendUnsub = this.connOptions?.autoSubscribe || false; + const autoSubscribe = this.connOptions?.autoSubscribe ?? true; const trackSids = new Array(); this.participants.forEach((participant) => { participant.tracks.forEach((track) => { - if (track.isSubscribed !== sendUnsub) { + if (track.isDesired !== autoSubscribe) { trackSids.push(track.trackSid); } }); @@ -1084,7 +1084,7 @@ class Room extends (EventEmitter as new () => TypedEmitter) : undefined, subscription: { trackSids, - subscribe: !sendUnsub, + subscribe: !autoSubscribe, participantTracks: [], }, publishTracks: this.localParticipant.publishedTracksInfo(),