Skip to content

Commit

Permalink
Make spotlight reactivity more fine-grained
Browse files Browse the repository at this point in the history
  • Loading branch information
robintown committed Jun 7, 2024
1 parent a727cf9 commit 3e519e9
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/state/CallViewModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -453,15 +453,17 @@ export class CallViewModel extends ViewModel {
}),
);

private readonly spotlight: Observable<MediaViewModel[]> = combineLatest(
[this.screenShares, this.spotlightSpeaker],
(screenShares, spotlightSpeaker): MediaViewModel[] =>
screenShares.length > 0
? screenShares.map((m) => m.vm)
: spotlightSpeaker === null
? []
: [spotlightSpeaker.vm],
);
private readonly spotlight: Observable<MediaViewModel[]> =
this.screenShares.pipe(
switchMap((screenShares) =>
screenShares.length > 0
? of(screenShares.map((m) => m.vm))
: this.spotlightSpeaker.pipe(
map((speaker) => (speaker === null ? [] : [speaker.vm])),
),
),
shareReplay(1),
);

// TODO: Make this react to changes in window dimensions and screen
// orientation
Expand Down

0 comments on commit 3e519e9

Please sign in to comment.