@stream-io/video-filters-web 0.7.1 → 0.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [0.7.3](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-filters-web-0.7.2...@stream-io/video-filters-web-0.7.3) (2026-03-27)
6
+
7
+ ### Bug Fixes
8
+
9
+ - **react:** expose segmentation smoothing options and add model picker in video effects settings ([#2176](https://github.com/GetStream/stream-video-js/issues/2176)) ([edee6bf](https://github.com/GetStream/stream-video-js/commit/edee6bf8d9aacdfb2ae49fb202ba7f7d1140063f))
10
+
11
+ ## [0.7.2](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-filters-web-0.7.1...@stream-io/video-filters-web-0.7.2) (2026-01-30)
12
+
13
+ ### Bug Fixes
14
+
15
+ - **react:** improve logic for calculating the lower / upper threshold for video filter degradation ([#2094](https://github.com/GetStream/stream-video-js/issues/2094)) ([5cd2d5c](https://github.com/GetStream/stream-video-js/commit/5cd2d5cb34fc7bbdfaf9529eb9f8d33a40346cab))
16
+
5
17
  ## [0.7.1](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-filters-web-0.7.0...@stream-io/video-filters-web-0.7.1) (2026-01-27)
6
18
 
7
19
  ### Bug Fixes
package/dist/index.cjs.js CHANGED
@@ -1561,7 +1561,7 @@ const createTFLiteSIMDModule = (__Module) => {
1561
1561
  return __Module.ready;
1562
1562
  };
1563
1563
 
1564
- const version = "0.7.1";
1564
+ const version = "0.7.3";
1565
1565
  const packageName = "@stream-io/video-filters-web";
1566
1566
 
1567
1567
  // @ts-expect-error - module is not declared
@@ -1602,19 +1602,13 @@ const loadMediaPipe = async (options = {}) => {
1602
1602
  return model;
1603
1603
  };
1604
1604
 
1605
+ /**
1606
+ * Maps blur level to blur strength values.
1607
+ */
1605
1608
  const BACKGROUND_BLUR_MAP = {
1606
- low: {
1607
- bgBlur: 5,
1608
- bgBlurRadius: 3,
1609
- },
1610
- medium: {
1611
- bgBlur: 15,
1612
- bgBlurRadius: 4,
1613
- },
1614
- high: {
1615
- bgBlur: 30,
1616
- bgBlurRadius: 5,
1617
- },
1609
+ low: 3,
1610
+ medium: 5,
1611
+ high: 7,
1618
1612
  };
1619
1613
 
1620
1614
  class WebGLRenderer {
@@ -2115,9 +2109,9 @@ class WebGLRenderer {
2115
2109
  gl.activeTexture(gl.TEXTURE2);
2116
2110
  gl.bindTexture(gl.TEXTURE_2D, prevStateTexture);
2117
2111
  gl.uniform1i(stateUpdateLocations.prevStateTexture, 2);
2118
- gl.uniform1f(stateUpdateLocations.smoothingFactor, 0.8);
2119
- gl.uniform1f(stateUpdateLocations.smoothstepMin, 0.6);
2120
- gl.uniform1f(stateUpdateLocations.smoothstepMax, 0.9);
2112
+ gl.uniform1f(stateUpdateLocations.smoothingFactor, options.segmentationOptions?.smoothingFactor ?? 0.8);
2113
+ gl.uniform1f(stateUpdateLocations.smoothstepMin, options.segmentationOptions?.smoothstepMin ?? 0.6);
2114
+ gl.uniform1f(stateUpdateLocations.smoothstepMax, options.segmentationOptions?.smoothstepMax ?? 0.9);
2121
2115
  gl.uniform1i(stateUpdateLocations.selfieModel, options.isSelfieMode ? 1 : 0);
2122
2116
  gl.enableVertexAttribArray(stateUpdateLocations.position);
2123
2117
  gl.bindBuffer(gl.ARRAY_BUFFER, this.positionBuffer);
@@ -2500,10 +2494,7 @@ class BaseVideoProcessor {
2500
2494
  this.canvas.width = frame.displayWidth;
2501
2495
  this.canvas.height = frame.displayHeight;
2502
2496
  }
2503
- const start = performance.now();
2504
2497
  const processed = await this.transform(frame);
2505
- const delay = performance.now() - start;
2506
- this.updateStats(delay);
2507
2498
  controller.enqueue(processed);
2508
2499
  }
2509
2500
  catch (e) {
@@ -2569,7 +2560,6 @@ class VirtualBackground extends BaseVideoProcessor {
2569
2560
  this.latestCategoryMask = undefined;
2570
2561
  this.latestConfidenceMask = undefined;
2571
2562
  this.lastFrameTime = -1;
2572
- this.count = 0;
2573
2563
  }
2574
2564
  async initialize() {
2575
2565
  this.webGlRenderer = new WebGLRenderer(this.canvas);
@@ -2599,11 +2589,13 @@ class VirtualBackground extends BaseVideoProcessor {
2599
2589
  }
2600
2590
  async transform(frame) {
2601
2591
  const currentTime = frame.timestamp;
2602
- const hasNewFrame = currentTime !== this.lastFrameTime;
2592
+ const hasNewFrame = currentTime - this.lastFrameTime > 1000;
2603
2593
  this.lastFrameTime = currentTime;
2604
2594
  if (hasNewFrame && this.isSegmenterReady && this.segmenter) {
2595
+ const start = performance.now();
2605
2596
  await this.runSegmentation(frame);
2606
2597
  this.webGlRenderer.render(frame, this.opts, this.latestCategoryMask, this.latestConfidenceMask);
2598
+ this.updateStats(performance.now() - start);
2607
2599
  }
2608
2600
  return new VideoFrame(this.canvas, { timestamp: frame.timestamp });
2609
2601
  }
@@ -2640,22 +2632,19 @@ class VirtualBackground extends BaseVideoProcessor {
2640
2632
  bgBlur: 0,
2641
2633
  bgBlurRadius: 0,
2642
2634
  isSelfieMode,
2635
+ segmentationOptions: this.options.segmentationOptions,
2643
2636
  };
2644
2637
  }
2645
2638
  const blurLevel = this.options.backgroundBlurLevel;
2646
- if (typeof blurLevel === 'string') {
2647
- return {
2648
- ...BACKGROUND_BLUR_MAP[blurLevel],
2649
- backgroundSource: undefined,
2650
- isSelfieMode,
2651
- };
2652
- }
2653
- const numeric = blurLevel ?? 5;
2639
+ const strength = typeof blurLevel === 'string'
2640
+ ? BACKGROUND_BLUR_MAP[blurLevel]
2641
+ : Math.round(blurLevel ?? 5);
2654
2642
  return {
2655
2643
  backgroundSource: undefined,
2656
- bgBlur: Math.min(numeric * 3, 30),
2657
- bgBlurRadius: Math.min(numeric, 10),
2644
+ bgBlur: Math.min(strength * 1.5, 20),
2645
+ bgBlurRadius: Math.min(strength, 10),
2658
2646
  isSelfieMode,
2647
+ segmentationOptions: this.options.segmentationOptions,
2659
2648
  };
2660
2649
  }
2661
2650
  async loadBackground(url) {