Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow join unmuted in widget mode #2848

Open
wants to merge 13 commits into
base: livekit
Choose a base branch
from
6 changes: 0 additions & 6 deletions src/room/MuteStates.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,6 @@

it("skipLobby mutes inputs on SPA", () => {
mockConfig();
vi.mock("../widget", () => {
return {
widget: null,
ElementWidgetActions: {},
};
});

render(
<MemoryRouter initialEntries={["/room/?skipLobby=true"]}>
Expand Down Expand Up @@ -199,7 +193,7 @@
</MediaDevicesContext.Provider>
</MemoryRouter>,
);
expect(screen.getByTestId("audio-enabled").textContent).toBe("true");

Check failure on line 196 in src/room/MuteStates.test.tsx

View workflow job for this annotation

GitHub Actions / Run vitest tests

src/room/MuteStates.test.tsx > useMuteStates > skipLobby does not mute inputs in widget mode

AssertionError: expected 'false' to be 'true' // Object.is equality Expected: "true" Received: "false" ❯ src/room/MuteStates.test.tsx:196:61
expect(screen.getByTestId("video-enabled").textContent).toBe("true");
});
});
4 changes: 2 additions & 2 deletions src/room/MuteStates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export function useMuteStates(): MuteStates {

const { skipLobby } = useUrlParams();
// In SPA without lobby we need to protect from unmuted joins (Privacy).
const allowStartUnmuted = !skipLobby || !!widget;
const allowStartUnmuted = !skipLobby || !widget;
toger5 marked this conversation as resolved.
Show resolved Hide resolved
const audio = useMuteState(devices.audioInput, () => {
return Config.get().media_devices.enable_audio && allowStartUnmuted;
});
Expand All @@ -91,7 +91,7 @@ export function useMuteStates(): MuteStates {
video_enabled: video.enabled,
})
.catch((e) =>
logger.warn("Could not send DeviceMute action to widget", e),
logger.warn("Could not send DeviceMute action to widget host", e),
);
}, [audio, video]);

Expand Down
Loading