mirror of
https://github.com/vector-im/element-call.git
synced 2026-08-29 21:15:19 +00:00
Refactor spotlightAndPip into spotlight and pip
This commit is contained in:
@@ -630,21 +630,24 @@ export class CallViewModel extends ViewModel {
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
private readonly spotlightAndPip: Observable<{
|
private readonly spotlight: Observable<MediaViewModel[]> =
|
||||||
spotlight: Observable<MediaViewModel[]>;
|
this.screenShares.pipe(
|
||||||
pip: Observable<UserMediaViewModel | null>;
|
switchMap((screenShares) =>
|
||||||
}> = this.screenShares.pipe(
|
screenShares.length > 0
|
||||||
map((screenShares) =>
|
? of(screenShares.map((m) => m.vm))
|
||||||
screenShares.length > 0
|
: this.spotlightSpeaker.pipe(
|
||||||
? {
|
|
||||||
spotlight: of(screenShares.map((m) => m.vm)),
|
|
||||||
pip: this.spotlightSpeaker,
|
|
||||||
}
|
|
||||||
: {
|
|
||||||
spotlight: this.spotlightSpeaker.pipe(
|
|
||||||
map((speaker) => (speaker ? [speaker] : [])),
|
map((speaker) => (speaker ? [speaker] : [])),
|
||||||
),
|
),
|
||||||
pip: this.spotlightSpeaker.pipe(
|
),
|
||||||
|
this.scope.state(),
|
||||||
|
);
|
||||||
|
|
||||||
|
private readonly pip: Observable<UserMediaViewModel | null> =
|
||||||
|
this.screenShares.pipe(
|
||||||
|
switchMap((screenShares) =>
|
||||||
|
screenShares.length > 0
|
||||||
|
? this.spotlightSpeaker
|
||||||
|
: this.spotlightSpeaker.pipe(
|
||||||
switchMap((speaker) =>
|
switchMap((speaker) =>
|
||||||
speaker
|
speaker
|
||||||
? speaker.local
|
? speaker.local
|
||||||
@@ -671,13 +674,7 @@ export class CallViewModel extends ViewModel {
|
|||||||
: of(null),
|
: of(null),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
},
|
),
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
private readonly spotlight: Observable<MediaViewModel[]> =
|
|
||||||
this.spotlightAndPip.pipe(
|
|
||||||
switchMap(({ spotlight }) => spotlight),
|
|
||||||
this.scope.state(),
|
this.scope.state(),
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -689,9 +686,6 @@ export class CallViewModel extends ViewModel {
|
|||||||
distinctUntilChanged(),
|
distinctUntilChanged(),
|
||||||
);
|
);
|
||||||
|
|
||||||
private readonly pip: Observable<UserMediaViewModel | null> =
|
|
||||||
this.spotlightAndPip.pipe(switchMap(({ pip }) => pip));
|
|
||||||
|
|
||||||
private readonly pipEnabled: Observable<boolean> = setPipEnabled.pipe(
|
private readonly pipEnabled: Observable<boolean> = setPipEnabled.pipe(
|
||||||
startWith(false),
|
startWith(false),
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user