🩹(frontend) add conditional stopProcessor call for cross-browser compat

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.
This commit is contained in:
lebaudantoine
2025-04-30 14:05:16 +02:00
committed by aleb_the_flash
parent 0aa47fcd1e
commit 551207ab86
2 changed files with 11 additions and 0 deletions

View File

@@ -32,6 +32,10 @@ export enum ProcessorType {
}
export class BackgroundProcessorFactory {
static hasModernApiSupport() {
return ProcessorWrapper.hasModernApiSupport
}
static isSupported() {
return (
ProcessorWrapper.isSupported ||

View File

@@ -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 {