Skip to content

armgit / meet

Public Imported from GitHub
0

Open source video conferencing app powered by LiveKit. Built with Django and React.

♻️(frontend) simplify processor factory for transformer unification

lebaudantoinea8f1ee0530a6
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 3d59ba84..fa74ae44 100644
--- a/src/frontend/src/features/rooms/livekit/components/blur/index.ts
+++ b/src/frontend/src/features/rooms/livekit/components/blur/index.ts
@@ -41,21 +41,21 @@ export class BackgroundProcessorFactory {
type: ProcessorType,
opts: BackgroundOptions
): BackgroundProcessorInterface | undefined {
- if (type === ProcessorType.BLUR) {
- if (ProcessorWrapper.isSupported) {
- return new BackgroundBlurTrackProcessorJsWrapper(opts)
- }
- if (BackgroundCustomProcessor.isSupported) {
- return new BackgroundCustomProcessor(opts)
- }
- } else if (type === ProcessorType.VIRTUAL) {
- if (ProcessorWrapper.isSupported) {
- return new BackgroundVirtualTrackProcessorJsWrapper(opts)
- }
- if (BackgroundCustomProcessor.isSupported) {
- return new BackgroundCustomProcessor(opts)
- }
+ const isBlur = type === ProcessorType.BLUR
+ const isVirtual = type === ProcessorType.VIRTUAL
+
+ if (!isBlur && !isVirtual) return undefined
+
+ if (ProcessorWrapper.isSupported) {
+ return isBlur
+ ? new BackgroundBlurTrackProcessorJsWrapper(opts)
+ : new BackgroundVirtualTrackProcessorJsWrapper(opts)
}
+
+ if (BackgroundCustomProcessor.isSupported) {
+ return new BackgroundCustomProcessor(opts)
+ }
+
return undefined
}