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,20 +335,15 @@ abstract class BaseUserMediaViewModel extends BaseMediaViewModel {
* Whether the participant is speaking. * Whether the participant is speaking.
*/ */
public readonly speaking = this.participant.pipe( public readonly speaking = this.participant.pipe(
switchMap((p) => { switchMap((p) =>
if (p) { p
return observeParticipantEvents( ? observeParticipantEvents(p, ParticipantEvent.IsSpeakingChanged).pipe(
p,
ParticipantEvent.IsSpeakingChanged,
).pipe(
map((p) => p.isSpeaking), map((p) => p.isSpeaking),
)
: of(false),
),
this.scope.state(), this.scope.state(),
); );
} else {
return of(false);
}
}),
);
/** /**
* Whether this participant is sending audio (i.e. is unmuted on their side). * Whether this participant is sending audio (i.e. is unmuted on their side).