livekit / track-processors-js

Pre-built track processors for background images, blur, etc for use with the LiveKit JS Client SDK
https://livekit.io
Apache License 2.0
34 stars 15 forks source link

Updating transform options issue #37

Closed nejcm closed 6 months ago

nejcm commented 6 months ago

https://github.com/livekit/track-processors-js/blob/964dd5911ef38ef346f7d5e857d51565d03f0979/src/transformers/BackgroundTransformer.ts#L111

I believe the update function is a bit problematic because the if conditions will prevent updates in case we wish to set certain values to undefined or to 0. Let's say we have a blur filter on and with the radius of 10 and now we wish to turn it off and set the background image instead. Now setting it to undefined or 0 will not enter the if condition as in both cases that evaluates to false. The same goes for the image.

So I guess the update function might need to be expanded to account for the time the user wishes to reset these values/disable certain things.

Or is the best practice approach here to stop the previous processor and create a new one?

nejcm commented 6 months ago

Closing this as per example it's better to create a new processor in this case.