Keep background effects to desktops until the menu says what they cost

- The one support check asks for a desktop again, as #4059 had the
  pipeline do: menu and pipeline still agree, so a phone is neither
  offered blur nor refused it.
- Lifting it moves to the PR that tells the user where effects run
  slowly, so it is their choice to make.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
fkwp
2026-10-08 12:22:34 +02:00
co-authored by Claude Opus 5.5
parent ce41fee6ff
commit cbb22a0094
3 changed files with 13 additions and 12 deletions
+2 -2
View File
@@ -243,9 +243,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); sdkSupportMock.mockReturnValue(true);
expect(lobbyOn("ios").toggleBlur$.value).toBeDefined(); expect(lobbyOn("ios").toggleBlur$.value).toBeUndefined();
}); });
it("offers them where the pipeline will honour them", () => { it("offers them where the pipeline will honour them", () => {
+7 -5
View File
@@ -48,8 +48,8 @@ vi.mock("@livekit/track-processors", () => ({
}), }),
supportsBackgroundProcessors: (): boolean => true, supportsBackgroundProcessors: (): boolean => true,
})); }));
// A phone: the pipeline must not ask. const platformMock = vi.hoisted(() => ({ platform: "desktop" }));
vi.mock("../Platform", () => ({ platform: "ios" })); vi.mock("../Platform", () => platformMock);
vi.mock("./BackgroundEffectTransformer", () => ({ vi.mock("./BackgroundEffectTransformer", () => ({
BackgroundEffectTransformer: vi.fn(), BackgroundEffectTransformer: vi.fn(),
})); }));
@@ -176,6 +176,7 @@ describe("ProcessorProvider", () => {
pipelines.built = 0; pipelines.built = 0;
pipelines.destroyed = 0; pipelines.destroyed = 0;
pipelines.switches = []; pipelines.switches = [];
platformMock.platform = "desktop";
backgroundBlur.setValue(false); backgroundBlur.setValue(false);
}); });
afterEach(() => backgroundBlur.setValue(false)); afterEach(() => backgroundBlur.setValue(false));
@@ -194,13 +195,14 @@ describe("ProcessorProvider", () => {
expect(track.stopProcessor).not.toHaveBeenCalled(); 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(); const track = cameraTrack();
render(surfaces(track)); render(surfaces(track));
await blur(true); await blur(true);
expect(latest().supported).toBe(true); expect(latest().supported).toBe(false);
expect(track.setProcessor).toHaveBeenCalledWith(latest().processor); expect(track.setProcessor).not.toHaveBeenCalled();
}); });
it("preview and call share one pipeline", async () => { it("preview and call share one pipeline", async () => {
+4 -5
View File
@@ -7,10 +7,9 @@ Please see LICENSE in the repository root for full details.
import { supportsBackgroundProcessors as supportsBackgroundProcessorsLivekitSdk } from "@livekit/track-processors"; import { supportsBackgroundProcessors as supportsBackgroundProcessorsLivekitSdk } from "@livekit/track-processors";
/** import { platform } from "../Platform";
* Whether this browser can run background effects: the one answer for the
* controls and the pipeline, so nothing is offered that the pipeline refuses. /** One answer for the controls and the pipeline, so neither offers what the other refuses. */
*/
export function supportsBackgroundProcessors(): boolean { export function supportsBackgroundProcessors(): boolean {
return supportsBackgroundProcessorsLivekitSdk(); return supportsBackgroundProcessorsLivekitSdk() && platform === "desktop";
} }