mirror of
https://github.com/vector-im/element-call.git
synced 2026-03-31 07:00:26 +00:00
Simplify speaking observer
This commit is contained in:
@@ -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(),
|
||||
);
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user