Simplify speaking observer

This commit is contained in:
Hugh Nimmo-Smith
2024-11-20 10:09:56 +00:00
parent 8f59f087cc
commit 256a65a119

View File

@@ -335,19 +335,14 @@ abstract class BaseUserMediaViewModel extends BaseMediaViewModel {
* Whether the participant is speaking.
*/
public readonly speaking = this.participant.pipe(
switchMap((p) => {
if (p) {
return observeParticipantEvents(
p,
ParticipantEvent.IsSpeakingChanged,
).pipe(
map((p) => p.isSpeaking),
this.scope.state(),
);
} else {
return of(false);
}
}),
switchMap((p) =>
p
? observeParticipantEvents(p, ParticipantEvent.IsSpeakingChanged).pipe(
map((p) => p.isSpeaking),
)
: of(false),
),
this.scope.state(),
);
/**