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

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/dist/index.es.js CHANGED
@@ -1559,7 +1559,7 @@ const createTFLiteSIMDModule = (__Module) => {
1559
1559
  return __Module.ready;
1560
1560
  };
1561
1561
 
1562
- const version = "0.7.2";
1562
+ const version = "0.7.4";
1563
1563
  const packageName = "@stream-io/video-filters-web";
1564
1564
 
1565
1565
  // @ts-expect-error - module is not declared
@@ -2107,9 +2107,9 @@ class WebGLRenderer {
2107
2107
  gl.activeTexture(gl.TEXTURE2);
2108
2108
  gl.bindTexture(gl.TEXTURE_2D, prevStateTexture);
2109
2109
  gl.uniform1i(stateUpdateLocations.prevStateTexture, 2);
2110
- gl.uniform1f(stateUpdateLocations.smoothingFactor, 0.8);
2111
- gl.uniform1f(stateUpdateLocations.smoothstepMin, 0.6);
2112
- gl.uniform1f(stateUpdateLocations.smoothstepMax, 0.9);
2110
+ gl.uniform1f(stateUpdateLocations.smoothingFactor, options.segmentationOptions?.smoothingFactor ?? 0.8);
2111
+ gl.uniform1f(stateUpdateLocations.smoothstepMin, options.segmentationOptions?.smoothstepMin ?? 0.6);
2112
+ gl.uniform1f(stateUpdateLocations.smoothstepMax, options.segmentationOptions?.smoothstepMax ?? 0.9);
2113
2113
  gl.uniform1i(stateUpdateLocations.selfieModel, options.isSelfieMode ? 1 : 0);
2114
2114
  gl.enableVertexAttribArray(stateUpdateLocations.position);
2115
2115
  gl.bindBuffer(gl.ARRAY_BUFFER, this.positionBuffer);
@@ -2581,8 +2581,9 @@ class VirtualBackground extends BaseVideoProcessor {
2581
2581
  this.isSegmenterReady = true;
2582
2582
  }
2583
2583
  catch (error) {
2584
- console.error('[virtual-background] Segmenter init failed:', error);
2585
2584
  this.isSegmenterReady = false;
2585
+ this.hooks.onError?.(error);
2586
+ throw error;
2586
2587
  }
2587
2588
  }
2588
2589
  async transform(frame) {
@@ -2630,6 +2631,7 @@ class VirtualBackground extends BaseVideoProcessor {
2630
2631
  bgBlur: 0,
2631
2632
  bgBlurRadius: 0,
2632
2633
  isSelfieMode,
2634
+ segmentationOptions: this.options.segmentationOptions,
2633
2635
  };
2634
2636
  }
2635
2637
  const blurLevel = this.options.backgroundBlurLevel;
@@ -2641,14 +2643,16 @@ class VirtualBackground extends BaseVideoProcessor {
2641
2643
  bgBlur: Math.min(strength * 1.5, 20),
2642
2644
  bgBlurRadius: Math.min(strength, 10),
2643
2645
  isSelfieMode,
2646
+ segmentationOptions: this.options.segmentationOptions,
2644
2647
  };
2645
2648
  }
2646
2649
  async loadBackground(url) {
2647
2650
  if (!url)
2648
2651
  return null;
2649
- const result = await fetch(url);
2650
- if (!result.ok)
2651
- return null;
2652
+ const result = await fetch(url, { signal: this.abortController.signal });
2653
+ if (!result.ok) {
2654
+ throw new Error(`[virtual-background] Failed to load background image: ${result.status} ${result.statusText}`);
2655
+ }
2652
2656
  return {
2653
2657
  type: 'image',
2654
2658
  media: await createImageBitmap(await result.blob()),