@stream-io/video-filters-web 0.7.0 → 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,18 @@
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
+
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)
12
+
13
+ ### Bug Fixes
14
+
15
+ - **react:** switch selfie segmentation default to landscape model ([#2100](https://github.com/GetStream/stream-video-js/issues/2100)) ([7c5d74d](https://github.com/GetStream/stream-video-js/commit/7c5d74d79ba1eb2f5a04a60a953ea0bd46633f4a))
16
+
5
17
  ## [0.7.0](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-filters-web-0.6.0...@stream-io/video-filters-web-0.7.0) (2025-12-23)
6
18
 
7
19
  ### Features
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.0";
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
@@ -1593,7 +1593,7 @@ const fetchModel = async (modelFilePath) => {
1593
1593
  let lastModelFilePath = '';
1594
1594
  let modelFileCache;
1595
1595
  const loadMediaPipe = async (options = {}) => {
1596
- const { basePath = `https://unpkg.com/${packageName}@${version}/mediapipe`, modelPath = `${basePath}/models/selfie_segmenter.tflite`, } = options;
1596
+ const { basePath = `https://unpkg.com/${packageName}@${version}/mediapipe`, modelPath = `${basePath}/models/selfie_segmenter_landscape.tflite`, } = options;
1597
1597
  const model = modelPath === lastModelFilePath && modelFileCache
1598
1598
  ? modelFileCache
1599
1599
  : await fetch(modelPath).then((r) => r.arrayBuffer());
@@ -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);
@@ -2580,7 +2570,8 @@ class VirtualBackground extends BaseVideoProcessor {
2580
2570
  this.opts = await this.initializeSegmenterOptions();
2581
2571
  const basePath = this.options.basePath ||
2582
2572
  `https://unpkg.com/${packageName}@${version}/mediapipe`;
2583
- const model = this.options.modelPath || `${basePath}/models/selfie_segmenter.tflite`;
2573
+ const model = this.options.modelPath ||
2574
+ `${basePath}/models/selfie_segmenter_landscape.tflite`;
2584
2575
  const fileset = await tasksVision.FilesetResolver.forVisionTasks(`${basePath}/wasm`);
2585
2576
  this.segmenter = await tasksVision.ImageSegmenter.createFromOptions(fileset, {
2586
2577
  baseOptions: { modelAssetPath: model, delegate: 'GPU' },
@@ -2598,11 +2589,13 @@ class VirtualBackground extends BaseVideoProcessor {
2598
2589
  }
2599
2590
  async transform(frame) {
2600
2591
  const currentTime = frame.timestamp;
2601
- const hasNewFrame = currentTime !== this.lastFrameTime;
2592
+ const hasNewFrame = currentTime - this.lastFrameTime > 1000;
2602
2593
  this.lastFrameTime = currentTime;
2603
2594
  if (hasNewFrame && this.isSegmenterReady && this.segmenter) {
2595
+ const start = performance.now();
2604
2596
  await this.runSegmentation(frame);
2605
2597
  this.webGlRenderer.render(frame, this.opts, this.latestCategoryMask, this.latestConfidenceMask);
2598
+ this.updateStats(performance.now() - start);
2606
2599
  }
2607
2600
  return new VideoFrame(this.canvas, { timestamp: frame.timestamp });
2608
2601
  }
@@ -2642,18 +2635,13 @@ class VirtualBackground extends BaseVideoProcessor {
2642
2635
  };
2643
2636
  }
2644
2637
  const blurLevel = this.options.backgroundBlurLevel;
2645
- if (typeof blurLevel === 'string') {
2646
- return {
2647
- ...BACKGROUND_BLUR_MAP[blurLevel],
2648
- backgroundSource: undefined,
2649
- isSelfieMode,
2650
- };
2651
- }
2652
- const numeric = blurLevel ?? 5;
2638
+ const strength = typeof blurLevel === 'string'
2639
+ ? BACKGROUND_BLUR_MAP[blurLevel]
2640
+ : Math.round(blurLevel ?? 5);
2653
2641
  return {
2654
2642
  backgroundSource: undefined,
2655
- bgBlur: Math.min(numeric * 3, 30),
2656
- bgBlurRadius: Math.min(numeric, 10),
2643
+ bgBlur: Math.min(strength * 1.5, 20),
2644
+ bgBlurRadius: Math.min(strength, 10),
2657
2645
  isSelfieMode,
2658
2646
  };
2659
2647
  }