diff --git a/src/components/CallFooterViewModel.test.ts b/src/components/CallFooterViewModel.test.ts index e6a42d30f..6f353e540 100644 --- a/src/components/CallFooterViewModel.test.ts +++ b/src/components/CallFooterViewModel.test.ts @@ -238,9 +238,9 @@ describe("createCallFooterViewModel", () => { ); } - it("offers them on a phone whose browser can run them", () => { + it("offers nothing on a phone, where the pipeline would refuse them", () => { sdkSupportMock.mockReturnValue(true); - expect(lobbyOn("ios").toggleBlur$.value).toBeDefined(); + expect(lobbyOn("ios").toggleBlur$.value).toBeUndefined(); }); it("offers them where the pipeline will honour them", () => { diff --git a/src/tracks/TrackProcessorContext.test.ts b/src/tracks/TrackProcessorContext.test.ts index dfaa3e3ef..cf6ede33a 100644 --- a/src/tracks/TrackProcessorContext.test.ts +++ b/src/tracks/TrackProcessorContext.test.ts @@ -53,8 +53,8 @@ vi.mock("@livekit/track-processors", () => ({ }), supportsBackgroundProcessors: (): boolean => true, })); -// A phone: the pipeline must not ask. -vi.mock("../Platform", () => ({ platform: "ios" })); +const platformMock = vi.hoisted(() => ({ platform: "desktop" })); +vi.mock("../Platform", () => platformMock); vi.mock("./BackgroundEffectTransformer", () => ({ BackgroundEffectTransformer: vi.fn(), })); @@ -222,6 +222,7 @@ describe("ProcessorProvider", () => { pipelines.built = 0; pipelines.destroyed = 0; pipelines.switches = []; + platformMock.platform = "desktop"; backgroundBlur.setValue(false); }); afterEach(() => backgroundBlur.setValue(false)); @@ -240,15 +241,14 @@ describe("ProcessorProvider", () => { expect(track.stopProcessor).not.toHaveBeenCalled(); }); - it("runs on a phone whose browser can run it", async () => { + it("does not run on a phone, even where its browser could", async () => { + platformMock.platform = "ios"; const track = cameraTrack(); render(surfaces(track)); await blur(true); - expect(latest().supported).toBe(true); - expect(track.setProcessor).toHaveBeenCalledWith( - convertToLivekitProcessor(latest().processor!), - ); + expect(latest().supported).toBe(false); + expect(track.setProcessor).not.toHaveBeenCalled(); }); it("preview and call share one pipeline", async () => { diff --git a/src/tracks/backgroundProcessing.ts b/src/tracks/backgroundProcessing.ts index 3dc32e5ec..8b6168dad 100644 --- a/src/tracks/backgroundProcessing.ts +++ b/src/tracks/backgroundProcessing.ts @@ -7,10 +7,9 @@ Please see LICENSE in the repository root for full details. import { supportsBackgroundProcessors as supportsBackgroundProcessorsLivekitSdk } from "@livekit/track-processors"; -/** - * Whether this browser can run background effects: the one answer for the - * controls and the pipeline, so nothing is offered that the pipeline refuses. - */ +import { platform } from "../Platform"; + +/** One answer for the controls and the pipeline, so neither offers what the other refuses. */ export function supportsBackgroundProcessors(): boolean { - return supportsBackgroundProcessorsLivekitSdk(); + return supportsBackgroundProcessorsLivekitSdk() && platform === "desktop"; }