From 551207ab86e7644b1283a3dbd458f74b3a67051a Mon Sep 17 00:00:00 2001 From: lebaudantoine Date: Wed, 30 Apr 2025 14:05:16 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=A9=B9(frontend)=20add=20conditional=20st?= =?UTF-8?q?opProcessor=20call=20for=20cross-browser=20compat?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implement browser detection to explicitly stop processors in Firefox and other browsers that lack full support for modern web APIs, before switching from one processor to another. This issue was introduced by recent upgrade of track processor. An issue has been opened. --- .../src/features/rooms/livekit/components/blur/index.ts | 4 ++++ .../livekit/components/effects/EffectsConfiguration.tsx | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/src/frontend/src/features/rooms/livekit/components/blur/index.ts b/src/frontend/src/features/rooms/livekit/components/blur/index.ts index 568098bc..4700c520 100644 --- a/src/frontend/src/features/rooms/livekit/components/blur/index.ts +++ b/src/frontend/src/features/rooms/livekit/components/blur/index.ts @@ -32,6 +32,10 @@ export enum ProcessorType { } export class BackgroundProcessorFactory { + static hasModernApiSupport() { + return ProcessorWrapper.hasModernApiSupport + } + static isSupported() { return ( ProcessorWrapper.isSupported || diff --git a/src/frontend/src/features/rooms/livekit/components/effects/EffectsConfiguration.tsx b/src/frontend/src/features/rooms/livekit/components/effects/EffectsConfiguration.tsx index 6a1c7026..4584e52c 100644 --- a/src/frontend/src/features/rooms/livekit/components/effects/EffectsConfiguration.tsx +++ b/src/frontend/src/features/rooms/livekit/components/effects/EffectsConfiguration.tsx @@ -114,6 +114,13 @@ export const EffectsConfiguration = ({ type, options )! + // IMPORTANT: Must explicitly stop previous processor before setting a new one + // in browsers without modern API support to prevent UI crashes. + // This workaround is needed until this issue is resolved: + // https://github.com/livekit/track-processors-js/issues/85 + if (!BackgroundProcessorFactory.hasModernApiSupport()) { + await videoTrack.stopProcessor() + } await videoTrack.setProcessor(newProcessor) onSubmit?.(newProcessor) } else {