@stream-io/video-client 1.36.1 → 1.37.1

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.
@@ -139,14 +139,20 @@ export class DynascaleManager {
139
139
 
140
140
  get trackSubscriptions() {
141
141
  const subscriptions: TrackSubscriptionDetails[] = [];
142
- for (const p of this.callState.remoteParticipants) {
142
+ // Use getParticipantsSnapshot() to bypass the observable pipeline
143
+ // and avoid stale data caused by shareReplay with no active subscribers
144
+ const participants = this.callState.getParticipantsSnapshot();
145
+ const videoTrackSubscriptionOverrides =
146
+ this.videoTrackSubscriptionOverridesSubject.getValue();
147
+ for (const p of participants) {
148
+ if (p.isLocalParticipant) continue;
143
149
  // NOTE: audio tracks don't have to be requested explicitly
144
150
  // as the SFU will implicitly subscribe us to all of them,
145
151
  // once they become available.
146
152
  if (p.videoDimension && hasVideo(p)) {
147
153
  const override =
148
- this.videoTrackSubscriptionOverrides[p.sessionId] ??
149
- this.videoTrackSubscriptionOverrides[globalOverrideKey];
154
+ videoTrackSubscriptionOverrides[p.sessionId] ??
155
+ videoTrackSubscriptionOverrides[globalOverrideKey];
150
156
 
151
157
  if (override?.enabled !== false) {
152
158
  subscriptions.push({
@@ -688,6 +688,18 @@ export class CallState {
688
688
  return this.getCurrentValue(this.rawParticipants$);
689
689
  }
690
690
 
691
+ /**
692
+ * Returns the current participants array directly from the BehaviorSubject.
693
+ * This bypasses the observable pipeline and is guaranteed to be synchronous.
694
+ * Use this when you need the absolute latest value without any potential
695
+ * timing issues from shareReplay/refCount.
696
+ *
697
+ * @internal
698
+ */
699
+ getParticipantsSnapshot = () => {
700
+ return this.participantsSubject.getValue();
701
+ };
702
+
691
703
  /**
692
704
  * Sets the list of participants in the current call.
693
705
  *