♻️(front) add clone method to processors

We need to make new processor instance between pre join and room
in order to apply effects.
This commit is contained in:
Nathan Vasse
2025-01-20 17:59:17 +01:00
committed by NathanVss
parent 4ae3d965f9
commit d45880ab5c
3 changed files with 14 additions and 0 deletions

View File

@@ -278,4 +278,8 @@ export class BackgroundBlurCustomProcessor
this.timerWorker?.terminate()
this.imageSegmenter?.close()
}
clone() {
return new BackgroundBlurCustomProcessor(this.options)
}
}

View File

@@ -18,8 +18,11 @@ export class BackgroundBlurTrackProcessorJsWrapper
processor: ProcessorWrapper<BackgroundOptions>
opts: BackgroundOptions
constructor(opts: BackgroundOptions) {
this.processor = BackgroundBlur(opts.blurRadius)
this.opts = opts
}
async init(opts: ProcessorOptions<Track.Kind>) {
@@ -45,4 +48,10 @@ export class BackgroundBlurTrackProcessorJsWrapper
get options() {
return (this.processor.transformer as BackgroundTransformer).options
}
clone() {
return new BackgroundBlurTrackProcessorJsWrapper({
blurRadius: this.options!.blurRadius,
})
}
}

View File

@@ -11,6 +11,7 @@ export interface BackgroundBlurProcessorInterface
extends TrackProcessor<Track.Kind> {
update(opts: BackgroundOptions): void
options: BackgroundOptions
clone(): BackgroundBlurProcessorInterface
}
export class BackgroundBlurFactory {