Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(virtual-background): keep V2 processor alive across mute/unmute

Jaya Allamsettyd873c6914e97
diff --git a/react/features/stream-effects/virtual-background/JitsiStreamBackgroundEffect.ts b/react/features/stream-effects/virtual-background/JitsiStreamBackgroundEffect.ts
index 22803cf368..3a03221e2e 100644
--- a/react/features/stream-effects/virtual-background/JitsiStreamBackgroundEffect.ts
+++ b/react/features/stream-effects/virtual-background/JitsiStreamBackgroundEffect.ts
@@ -216,7 +216,9 @@ export default class JitsiStreamBackgroundEffect {
}
/**
- * Stops the effect and releases all resources.
+ * Stops the frame pipeline. Keeps the V2 processor + backend alive so the next
+ * startEffect (e.g. on unmute) can process frames immediately without a re-init
+ * window in which raw camera frames would be passed through.
*
* @returns {void}
*/
@@ -228,11 +230,6 @@ export default class JitsiStreamBackgroundEffect {
this._inputVideoElement.onloadeddata = null;
this._inputVideoElement.srcObject = null;
}
-
- if (this._enableV2) {
- this._processor?.dispose();
- this._backend?.stop().catch(() => undefined);
- }
}
/**
@@ -268,6 +265,9 @@ export default class JitsiStreamBackgroundEffect {
this._inputVideoElement.autoplay = true;
this._inputVideoElement.srcObject = stream;
+ // autoplay is unreliable for out-of-DOM elements on srcObject reassignment.
+ this._inputVideoElement.play().catch(() => undefined);
+
return this._outputCanvasElement.captureStream(parseInt(String(frameRate), 10));
}