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

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,12 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [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)
6
+
7
+ ### Bug Fixes
8
+
9
+ - **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))
10
+
5
11
  ## [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
12
 
7
13
  ### 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.2";
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 {
@@ -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
  }
@@ -2643,18 +2635,13 @@ class VirtualBackground extends BaseVideoProcessor {
2643
2635
  };
2644
2636
  }
2645
2637
  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;
2638
+ const strength = typeof blurLevel === 'string'
2639
+ ? BACKGROUND_BLUR_MAP[blurLevel]
2640
+ : Math.round(blurLevel ?? 5);
2654
2641
  return {
2655
2642
  backgroundSource: undefined,
2656
- bgBlur: Math.min(numeric * 3, 30),
2657
- bgBlurRadius: Math.min(numeric, 10),
2643
+ bgBlur: Math.min(strength * 1.5, 20),
2644
+ bgBlurRadius: Math.min(strength, 10),
2658
2645
  isSelfieMode,
2659
2646
  };
2660
2647
  }