Merge pull request #2686 from robintown/keep-local-tile

Don't cause the local tile to disappear when joining
This commit is contained in:
Robin 2024-10-25 08:22:37 -04:00 committed by GitHub
commit bb95d9e414
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 9 deletions

View File

@ -199,7 +199,7 @@ test("participants are retained during a focus switch", () => {
a: { a: {
type: "grid", type: "grid",
spotlight: undefined, spotlight: undefined,
grid: [":0", `${aliceId}:0`, `${bobId}:0`], grid: ["local:0", `${aliceId}:0`, `${bobId}:0`],
}, },
}, },
); );
@ -243,12 +243,12 @@ test("screen sharing activates spotlight layout", () => {
a: { a: {
type: "grid", type: "grid",
spotlight: undefined, spotlight: undefined,
grid: [":0", `${aliceId}:0`, `${bobId}:0`], grid: ["local:0", `${aliceId}:0`, `${bobId}:0`],
}, },
b: { b: {
type: "spotlight-landscape", type: "spotlight-landscape",
spotlight: [`${aliceId}:0:screen-share`], spotlight: [`${aliceId}:0:screen-share`],
grid: [":0", `${aliceId}:0`, `${bobId}:0`], grid: ["local:0", `${aliceId}:0`, `${bobId}:0`],
}, },
c: { c: {
type: "spotlight-landscape", type: "spotlight-landscape",
@ -256,17 +256,17 @@ test("screen sharing activates spotlight layout", () => {
`${aliceId}:0:screen-share`, `${aliceId}:0:screen-share`,
`${bobId}:0:screen-share`, `${bobId}:0:screen-share`,
], ],
grid: [":0", `${aliceId}:0`, `${bobId}:0`], grid: ["local:0", `${aliceId}:0`, `${bobId}:0`],
}, },
d: { d: {
type: "spotlight-landscape", type: "spotlight-landscape",
spotlight: [`${bobId}:0:screen-share`], spotlight: [`${bobId}:0:screen-share`],
grid: [":0", `${aliceId}:0`, `${bobId}:0`], grid: ["local:0", `${aliceId}:0`, `${bobId}:0`],
}, },
e: { e: {
type: "spotlight-landscape", type: "spotlight-landscape",
spotlight: [`${aliceId}:0`], spotlight: [`${aliceId}:0`],
grid: [":0", `${aliceId}:0`, `${bobId}:0`], grid: ["local:0", `${aliceId}:0`, `${bobId}:0`],
}, },
}, },
); );

View File

@ -335,8 +335,8 @@ export class CallViewModel extends ViewModel {
const newItems = new Map( const newItems = new Map(
function* (this: CallViewModel): Iterable<[string, MediaItem]> { function* (this: CallViewModel): Iterable<[string, MediaItem]> {
for (const p of [localParticipant, ...remoteParticipants]) { for (const p of [localParticipant, ...remoteParticipants]) {
const userMediaId = p === localParticipant ? "local" : p.identity; const id = p === localParticipant ? "local" : p.identity;
const member = findMatrixMember(this.matrixRoom, userMediaId); const member = findMatrixMember(this.matrixRoom, id);
if (member === undefined) if (member === undefined)
logger.warn( logger.warn(
`Ruh, roh! No matrix member found for SFU participant '${p.identity}': creating g-g-g-ghost!`, `Ruh, roh! No matrix member found for SFU participant '${p.identity}': creating g-g-g-ghost!`,
@ -345,7 +345,7 @@ export class CallViewModel extends ViewModel {
// Create as many tiles for this participant as called for by // Create as many tiles for this participant as called for by
// the duplicateTiles option // the duplicateTiles option
for (let i = 0; i < 1 + duplicateTiles; i++) { for (let i = 0; i < 1 + duplicateTiles; i++) {
const userMediaId = `${p.identity}:${i}`; const userMediaId = `${id}:${i}`;
yield [ yield [
userMediaId, userMediaId,
prevItems.get(userMediaId) ?? prevItems.get(userMediaId) ??