mirror of
https://github.com/vector-im/element-call.git
synced 2026-07-15 18:49:21 +00:00
Merge pull request #4068 from element-hq/landscape-voice-call
Hide local tile from mobile voice calls in landscape orientation
This commit is contained in:
@@ -22,6 +22,7 @@ import { SyncState } from "matrix-js-sdk";
|
|||||||
import {
|
import {
|
||||||
ConnectionState,
|
ConnectionState,
|
||||||
type LocalTrackPublication,
|
type LocalTrackPublication,
|
||||||
|
type Participant,
|
||||||
type RemoteParticipant,
|
type RemoteParticipant,
|
||||||
} from "livekit-client";
|
} from "livekit-client";
|
||||||
import * as ComponentsCore from "@livekit/components-core";
|
import * as ComponentsCore from "@livekit/components-core";
|
||||||
@@ -1031,6 +1032,10 @@ describe.each([
|
|||||||
a: [localRtcMember],
|
a: [localRtcMember],
|
||||||
b: [localRtcMember, aliceRtcMember],
|
b: [localRtcMember, aliceRtcMember],
|
||||||
}),
|
}),
|
||||||
|
videoEnabled: new Map<Participant, Behavior<boolean>>([
|
||||||
|
[localParticipant, constant(true)],
|
||||||
|
[aliceParticipant, constant(true)],
|
||||||
|
]),
|
||||||
},
|
},
|
||||||
(vm) => {
|
(vm) => {
|
||||||
schedule(modeInputMarbles, {
|
schedule(modeInputMarbles, {
|
||||||
@@ -1060,6 +1065,33 @@ describe.each([
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("expanded spotlight layout hides PiP tile in one-on-one voice call", () => {
|
||||||
|
withTestScheduler(({ behavior, schedule, expectObservable }) => {
|
||||||
|
withCallViewModel(
|
||||||
|
{
|
||||||
|
remoteParticipants$: constant([aliceParticipant]),
|
||||||
|
roomMembers: [local, alice],
|
||||||
|
rtcMembers$: constant([localRtcMember, aliceRtcMember]),
|
||||||
|
videoEnabled: new Map<Participant, Behavior<boolean>>([
|
||||||
|
[localParticipant, constant(false)],
|
||||||
|
[aliceParticipant, constant(false)],
|
||||||
|
]),
|
||||||
|
windowSize$: constant({ width: 700, height: 380 }), // Mobile phone in landscape
|
||||||
|
},
|
||||||
|
(vm) => {
|
||||||
|
// Layout should show remote tile only
|
||||||
|
expectObservable(summarizeLayout$(vm.layout$)).toBe("a", {
|
||||||
|
a: {
|
||||||
|
type: "spotlight-expanded",
|
||||||
|
spotlight: [`${aliceId}:0`],
|
||||||
|
pip: undefined,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
test("spotlight remembers whether it's expanded", () => {
|
test("spotlight remembers whether it's expanded", () => {
|
||||||
withTestScheduler(({ schedule, expectObservable }) => {
|
withTestScheduler(({ schedule, expectObservable }) => {
|
||||||
// Start in spotlight mode, then switch to grid and back to spotlight a
|
// Start in spotlight mode, then switch to grid and back to spotlight a
|
||||||
@@ -1096,7 +1128,7 @@ describe.each([
|
|||||||
b: {
|
b: {
|
||||||
type: "spotlight-expanded",
|
type: "spotlight-expanded",
|
||||||
spotlight: [`${aliceId}:0`],
|
spotlight: [`${aliceId}:0`],
|
||||||
pip: `${localId}:0`,
|
pip: undefined,
|
||||||
},
|
},
|
||||||
c: {
|
c: {
|
||||||
type: "grid",
|
type: "grid",
|
||||||
|
|||||||
@@ -942,8 +942,8 @@ export function createCallViewModel$(
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Local user media suitable for displaying in a PiP (undefined if not found
|
* Local user media suitable for displaying in a PiP (undefined if not found,
|
||||||
* or if user prefers to not see themselves).
|
* video is muted, or if user prefers to not see themselves).
|
||||||
*/
|
*/
|
||||||
const localUserMediaForPip$ = scope.behavior<
|
const localUserMediaForPip$ = scope.behavior<
|
||||||
LocalUserMediaViewModel | undefined
|
LocalUserMediaViewModel | undefined
|
||||||
@@ -955,8 +955,10 @@ export function createCallViewModel$(
|
|||||||
m.type === "user" && m.local,
|
m.type === "user" && m.local,
|
||||||
);
|
);
|
||||||
if (!localUserMedia) return of(undefined);
|
if (!localUserMedia) return of(undefined);
|
||||||
return localUserMedia.alwaysShow$.pipe(
|
return combineLatest(
|
||||||
map((alwaysShow) => (alwaysShow ? localUserMedia : undefined)),
|
[localUserMedia.videoEnabled$, localUserMedia.alwaysShow$],
|
||||||
|
(videoEnabled, alwaysShow) =>
|
||||||
|
videoEnabled && alwaysShow ? localUserMedia : undefined,
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user