Add a developer option to duplicate tiles

This is useful for testing how the UI behaves with different numbers of participants.
This commit is contained in:
Robin
2024-05-08 16:00:42 -04:00
parent a534356dd9
commit fdc6d4a1b6
4 changed files with 48 additions and 14 deletions

View File

@@ -67,6 +67,7 @@ import {
} from "./MediaViewModel";
import { finalizeValue } from "../observable-utils";
import { ObservableScope } from "./ObservableScope";
import { duplicateTiles } from "../settings/settings";
// How long we wait after a focus switch before showing the real participant
// list again
@@ -308,11 +309,16 @@ export class CallViewModel extends ViewModel {
combineLatest([
this.remoteParticipants,
observeParticipantMedia(this.livekitRoom.localParticipant),
duplicateTiles.value,
]).pipe(
scan(
(
prevItems,
[remoteParticipants, { participant: localParticipant }],
[
remoteParticipants,
{ participant: localParticipant },
duplicateTiles,
],
) => {
let allGhosts = true;
@@ -330,20 +336,29 @@ export class CallViewModel extends ViewModel {
);
}
const userMediaId = p.identity;
yield [
userMediaId,
prevItems.get(userMediaId) ??
new UserMedia(userMediaId, member, p, this.encrypted),
];
if (p.isScreenShareEnabled) {
const screenShareId = `${userMediaId}:screen-share`;
// Create as many tiles for this participant as called for by
// the duplicateTiles option
for (let i = 0; i < 1 + duplicateTiles; i++) {
const userMediaId = `${p.identity}:${i}`;
yield [
screenShareId,
prevItems.get(screenShareId) ??
new ScreenShare(screenShareId, member, p, this.encrypted),
userMediaId,
prevItems.get(userMediaId) ??
new UserMedia(userMediaId, member, p, this.encrypted),
];
if (p.isScreenShareEnabled) {
const screenShareId = `${userMediaId}:screen-share`;
yield [
screenShareId,
prevItems.get(screenShareId) ??
new ScreenShare(
screenShareId,
member,
p,
this.encrypted,
),
];
}
}
}
}.bind(this)(),