diff --git a/playwright/create-call.spec.ts b/playwright/create-call.spec.ts index b71f39ad..01dd8163 100644 --- a/playwright/create-call.spec.ts +++ b/playwright/create-call.spec.ts @@ -58,3 +58,38 @@ test("Start a new call then leave and show the feedback screen", async ({ page.getByRole("link", { name: "Not now, return to home screen" }), ).toBeVisible(); }); + +test("BugFix: When unmuting in lobby, you had to click twice to unmute in call", async ({ + page, +}) => { + await page.goto("/"); + + await page.getByTestId("home_callName").click(); + await page.getByTestId("home_callName").fill("DoubleUnMute"); + await page.getByTestId("home_displayName").click(); + await page.getByTestId("home_displayName").fill("me"); + await page.getByTestId("home_go").click(); + + const microphoneButton = page.getByTestId("incall_mute"); + const cameraButton = page.getByTestId("incall_videomute"); + + await microphoneButton.click(); + await cameraButton.click(); + + // Should be muted now + await expect(microphoneButton).toHaveAccessibleName("Unmute microphone"); + await expect(cameraButton).toHaveAccessibleName("Start video"); + + // Create the call and join + await page.getByTestId("lobby_joinCall").click(); + + // Give sometime for the all to be connected + // Check the number of participants + await expect(page.locator("div").filter({ hasText: /^1$/ })).toBeVisible(); + + // Click again on the mute button. it should unmute + await microphoneButton.click(); + await expect(microphoneButton).toHaveAccessibleName("Mute microphone"); + await cameraButton.click(); + await expect(cameraButton).toHaveAccessibleName("Stop video"); +}); diff --git a/src/state/CallViewModel/localMember/Publisher.ts b/src/state/CallViewModel/localMember/Publisher.ts index b7841c49..a6435212 100644 --- a/src/state/CallViewModel/localMember/Publisher.ts +++ b/src/state/CallViewModel/localMember/Publisher.ts @@ -379,10 +379,11 @@ export class Publisher { if (!this.shouldPublish && enable) { await this.pauseUpstreams(lkRoom, [Track.Source.Microphone]); } + return enable; } catch (e) { this.logger.error("Failed to update LiveKit audio input mute state", e); + return lkRoom.localParticipant.isMicrophoneEnabled; } - return lkRoom.localParticipant.isMicrophoneEnabled; }); this.muteStates.video.setHandler(async (enable) => { try { @@ -393,10 +394,11 @@ export class Publisher { if (!this.shouldPublish && enable) { await this.pauseUpstreams(lkRoom, [Track.Source.Camera]); } + return enable; } catch (e) { this.logger.error("Failed to update LiveKit video input mute state", e); + return lkRoom.localParticipant.isCameraEnabled; } - return lkRoom.localParticipant.isCameraEnabled; }); }