mirror of
https://github.com/vector-im/element-call.git
synced 2026-03-28 06:50:26 +00:00
Simplify type of audio participants exposed from CallViewModel
This commit is contained in:
@@ -14,7 +14,7 @@ import {
|
||||
type Room as LivekitRoom,
|
||||
type LocalParticipant,
|
||||
ParticipantEvent,
|
||||
type RemoteParticipant,
|
||||
RemoteParticipant,
|
||||
type Participant,
|
||||
} from "livekit-client";
|
||||
import E2EEWorker from "livekit-client/e2ee-worker?worker";
|
||||
@@ -793,7 +793,7 @@ export class CallViewModel extends ViewModel {
|
||||
* Lists, for each LiveKit room, the LiveKit participants whose media should
|
||||
* be presented.
|
||||
*/
|
||||
public readonly participantsByRoom$ = this.scope.behavior<
|
||||
private readonly participantsByRoom$ = this.scope.behavior<
|
||||
{
|
||||
livekitRoom: LivekitRoom;
|
||||
url: string;
|
||||
@@ -861,6 +861,25 @@ export class CallViewModel extends ViewModel {
|
||||
.pipe(startWith([]), pauseWhen(this.pretendToBeDisconnected$)),
|
||||
);
|
||||
|
||||
/**
|
||||
* Lists, for each LiveKit room, the LiveKit participants whose audio should
|
||||
* be rendered.
|
||||
*/
|
||||
// (This is effectively just participantsByRoom$ with a stricter type)
|
||||
public readonly audioParticipants$ = this.scope.behavior(
|
||||
this.participantsByRoom$.pipe(
|
||||
map((data) =>
|
||||
data.map(({ livekitRoom, url, participants }) => ({
|
||||
livekitRoom,
|
||||
url,
|
||||
participants: participants.flatMap(({ participant }) =>
|
||||
participant instanceof RemoteParticipant ? [participant] : [],
|
||||
),
|
||||
})),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* Displaynames for each member of the call. This will disambiguate
|
||||
* any displaynames that clashes with another member. Only members
|
||||
|
||||
Reference in New Issue
Block a user