|
@@ -80,7 +80,15 @@ export default class JitsiStreamBackgroundEffect {
|
80
|
80
|
this._outputCanvasCtx.globalCompositeOperation = 'copy';
|
81
|
81
|
|
82
|
82
|
// Draw segmentation mask.
|
83
|
|
- this._outputCanvasCtx.filter = `blur(${blurValue})`;
|
|
83
|
+ //
|
|
84
|
+
|
|
85
|
+ // Smooth out the edges.
|
|
86
|
+ if (this._options.virtualBackground.isVirtualBackground) {
|
|
87
|
+ this._outputCanvasCtx.filter = 'blur(4px)';
|
|
88
|
+ } else {
|
|
89
|
+ this._outputCanvasCtx.filter = 'blur(8px)';
|
|
90
|
+ }
|
|
91
|
+
|
84
|
92
|
this._outputCanvasCtx.drawImage(
|
85
|
93
|
this._segmentationMaskCanvas,
|
86
|
94
|
0,
|
|
@@ -92,11 +100,17 @@ export default class JitsiStreamBackgroundEffect {
|
92
|
100
|
this._inputVideoElement.width,
|
93
|
101
|
this._inputVideoElement.height
|
94
|
102
|
);
|
95
|
|
-
|
96
|
103
|
this._outputCanvasCtx.globalCompositeOperation = 'source-in';
|
97
|
104
|
this._outputCanvasCtx.filter = 'none';
|
|
105
|
+
|
|
106
|
+ // Draw the foreground video.
|
|
107
|
+ //
|
|
108
|
+
|
98
|
109
|
this._outputCanvasCtx.drawImage(this._inputVideoElement, 0, 0);
|
99
|
110
|
|
|
111
|
+ // Draw the background.
|
|
112
|
+ //
|
|
113
|
+
|
100
|
114
|
this._outputCanvasCtx.globalCompositeOperation = 'destination-over';
|
101
|
115
|
if (this._options.virtualBackground.isVirtualBackground) {
|
102
|
116
|
this._outputCanvasCtx.drawImage(this.virtualImage, 0, 0);
|