Skip to content

Commit

Permalink
Sync state settings should use desired instead of subscribed (#440)
Browse files Browse the repository at this point in the history
* Sync state settings should use desired instead of subscribed

* better variable name, handle undefined connOptions.

* changeset
  • Loading branch information
davidzhao authored Sep 17, 2022
1 parent b56c3c4 commit b74eae6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/cold-moles-accept.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'livekit-client': patch
---

Improve handling of connection resume failures
6 changes: 3 additions & 3 deletions src/room/Room.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1061,11 +1061,11 @@ class Room extends (EventEmitter as new () => TypedEmitter<RoomEventCallbacks>)
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<string>();
this.participants.forEach((participant) => {
participant.tracks.forEach((track) => {
if (track.isSubscribed !== sendUnsub) {
if (track.isDesired !== autoSubscribe) {
trackSids.push(track.trackSid);
}
});
Expand All @@ -1084,7 +1084,7 @@ class Room extends (EventEmitter as new () => TypedEmitter<RoomEventCallbacks>)
: undefined,
subscription: {
trackSids,
subscribe: !sendUnsub,
subscribe: !autoSubscribe,
participantTracks: [],
},
publishTracks: this.localParticipant.publishedTracksInfo(),
Expand Down

0 comments on commit b74eae6

Please sign in to comment.