mirror of
https://github.com/vector-im/element-call.git
synced 2026-03-31 07:00:26 +00:00
allow join unmuted in widget mode
This commit is contained in:
@@ -156,8 +156,14 @@ describe("useMuteStates", () => {
|
||||
expect(screen.getByTestId("video-enabled").textContent).toBe("false");
|
||||
});
|
||||
|
||||
it("skipLobby mutes inputs", () => {
|
||||
it("skipLobby mutes inputs on SPA", () => {
|
||||
mockConfig();
|
||||
vi.mock("../widget", () => {
|
||||
return {
|
||||
widget: null,
|
||||
ElementWidgetActions: {},
|
||||
};
|
||||
});
|
||||
|
||||
render(
|
||||
<MemoryRouter initialEntries={["/room/?skipLobby=true"]}>
|
||||
@@ -169,4 +175,31 @@ describe("useMuteStates", () => {
|
||||
expect(screen.getByTestId("audio-enabled").textContent).toBe("false");
|
||||
expect(screen.getByTestId("video-enabled").textContent).toBe("false");
|
||||
});
|
||||
|
||||
it("skipLobby does not mute inputs in widget mode", () => {
|
||||
mockConfig();
|
||||
vi.mock("../widget", () => {
|
||||
return {
|
||||
widget: {
|
||||
api: {
|
||||
transport: {
|
||||
send: async (): Promise<void> => new Promise((r) => r()),
|
||||
},
|
||||
},
|
||||
lazyActions: { on: vi.fn(), off: vi.fn() },
|
||||
},
|
||||
ElementWidgetActions: {},
|
||||
};
|
||||
});
|
||||
|
||||
render(
|
||||
<MemoryRouter initialEntries={["/room/?skipLobby=true"]}>
|
||||
<MediaDevicesContext.Provider value={mockMediaDevices()}>
|
||||
<TestComponent />
|
||||
</MediaDevicesContext.Provider>
|
||||
</MemoryRouter>,
|
||||
);
|
||||
expect(screen.getByTestId("audio-enabled").textContent).toBe("true");
|
||||
expect(screen.getByTestId("video-enabled").textContent).toBe("true");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -74,13 +74,14 @@ export function useMuteStates(): MuteStates {
|
||||
const devices = useMediaDevices();
|
||||
|
||||
const { skipLobby } = useUrlParams();
|
||||
|
||||
// In SPA without lobby we need to protect from unmuted joins (Privacy).
|
||||
const allowStartUnmuted = !skipLobby || widget !== null;
|
||||
const audio = useMuteState(devices.audioInput, () => {
|
||||
return Config.get().media_devices.enable_audio && !skipLobby;
|
||||
return Config.get().media_devices.enable_audio && allowStartUnmuted;
|
||||
});
|
||||
const video = useMuteState(
|
||||
devices.videoInput,
|
||||
() => Config.get().media_devices.enable_video && !skipLobby,
|
||||
() => Config.get().media_devices.enable_video && allowStartUnmuted,
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
Reference in New Issue
Block a user