mirror of
https://github.com/vector-im/element-call.git
synced 2026-03-28 06:50:26 +00:00
Compute the 'waiting for media' state less implicitly
On second glance, the way that we determined a media tile to be 'waiting for media' was too implicit for my taste. It would appear on a surface reading to depend on whether a participant was currently publishing any video. But in reality, the 'video' object was always defined as long as a LiveKit participant existed, so in reality it depended on just the participant. We should show this relationship more explicitly by moving the computation into the view model, where it can depend on the participant directly.
This commit is contained in:
@@ -319,12 +319,12 @@ export function mockLocalParticipant(
|
||||
}
|
||||
|
||||
export function createLocalMedia(
|
||||
localRtcMember: CallMembership,
|
||||
rtcMember: CallMembership,
|
||||
roomMember: Partial<RoomMember>,
|
||||
localParticipant: LocalParticipant,
|
||||
mediaDevices: MediaDevices,
|
||||
): LocalUserMediaViewModel {
|
||||
const member = mockMatrixRoomMember(localRtcMember, roomMember);
|
||||
const member = mockMatrixRoomMember(rtcMember, roomMember);
|
||||
return new LocalUserMediaViewModel(
|
||||
testScope(),
|
||||
"local",
|
||||
@@ -359,22 +359,26 @@ export function mockRemoteParticipant(
|
||||
}
|
||||
|
||||
export function createRemoteMedia(
|
||||
localRtcMember: CallMembership,
|
||||
rtcMember: CallMembership,
|
||||
roomMember: Partial<RoomMember>,
|
||||
participant: Partial<RemoteParticipant>,
|
||||
participant: RemoteParticipant | null,
|
||||
): RemoteUserMediaViewModel {
|
||||
const member = mockMatrixRoomMember(localRtcMember, roomMember);
|
||||
const remoteParticipant = mockRemoteParticipant(participant);
|
||||
const member = mockMatrixRoomMember(rtcMember, roomMember);
|
||||
return new RemoteUserMediaViewModel(
|
||||
testScope(),
|
||||
"remote",
|
||||
member.userId,
|
||||
of(remoteParticipant),
|
||||
constant(participant),
|
||||
{
|
||||
kind: E2eeType.PER_PARTICIPANT,
|
||||
},
|
||||
constant(
|
||||
mockLivekitRoom({}, { remoteParticipants$: of([remoteParticipant]) }),
|
||||
mockLivekitRoom(
|
||||
{},
|
||||
{
|
||||
remoteParticipants$: of(participant ? [participant] : []),
|
||||
},
|
||||
),
|
||||
),
|
||||
constant("https://rtc-example.org"),
|
||||
constant(false),
|
||||
|
||||
Reference in New Issue
Block a user