@stream-io/video-filters-web 0.4.0 → 0.5.0

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.
Files changed (49) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +27 -24
  3. package/dist/index.cjs.js +1099 -6
  4. package/dist/index.cjs.js.map +1 -1
  5. package/dist/index.d.ts +6 -3
  6. package/dist/index.es.js +1096 -7
  7. package/dist/index.es.js.map +1 -1
  8. package/dist/src/FallbackGenerator.d.ts +17 -0
  9. package/dist/src/FallbackProcessor.d.ts +38 -0
  10. package/dist/src/VirtualBackground.d.ts +42 -0
  11. package/dist/src/WebGLRenderer.d.ts +80 -0
  12. package/dist/src/compatibility.d.ts +5 -0
  13. package/dist/src/{createRenderer.d.ts → legacy/createRenderer.d.ts} +1 -2
  14. package/dist/src/{webgl2 → legacy/webgl2}/backgroundBlurStage.d.ts +1 -1
  15. package/dist/src/{webgl2 → legacy/webgl2}/webgl2Pipeline.d.ts +1 -1
  16. package/dist/src/mediapipe.d.ts +4 -0
  17. package/dist/src/types.d.ts +45 -0
  18. package/index.ts +6 -3
  19. package/mediapipe/models/selfie_segmenter.tflite +0 -0
  20. package/mediapipe/wasm/vision_wasm_internal.js +20 -0
  21. package/mediapipe/wasm/vision_wasm_internal.wasm +0 -0
  22. package/mediapipe/wasm/vision_wasm_nosimd_internal.js +20 -0
  23. package/mediapipe/wasm/vision_wasm_nosimd_internal.wasm +0 -0
  24. package/package.json +4 -1
  25. package/src/FallbackGenerator.ts +90 -0
  26. package/src/FallbackProcessor.ts +132 -0
  27. package/src/VirtualBackground.ts +276 -0
  28. package/src/WebGLRenderer.ts +1187 -0
  29. package/src/compatibility.ts +22 -0
  30. package/src/{createRenderer.ts → legacy/createRenderer.ts} +1 -2
  31. package/src/{tflite.ts → legacy/tflite.ts} +1 -1
  32. package/src/{webgl2 → legacy/webgl2}/backgroundBlurStage.ts +1 -1
  33. package/src/{webgl2 → legacy/webgl2}/webgl2Pipeline.ts +1 -1
  34. package/src/mediapipe.ts +25 -0
  35. package/src/types.ts +62 -0
  36. /package/dist/src/{helpers → legacy/helpers}/webglHelper.d.ts +0 -0
  37. /package/dist/src/{segmentation.d.ts → legacy/segmentation.d.ts} +0 -0
  38. /package/dist/src/{tflite.d.ts → legacy/tflite.d.ts} +0 -0
  39. /package/dist/src/{webgl2 → legacy/webgl2}/backgroundImageStage.d.ts +0 -0
  40. /package/dist/src/{webgl2 → legacy/webgl2}/jointBilateralFilterStage.d.ts +0 -0
  41. /package/dist/src/{webgl2 → legacy/webgl2}/resizingStage.d.ts +0 -0
  42. /package/dist/src/{webgl2 → legacy/webgl2}/softmaxStage.d.ts +0 -0
  43. /package/src/{helpers → legacy/helpers}/webglHelper.ts +0 -0
  44. /package/src/{segmentation.ts → legacy/segmentation.ts} +0 -0
  45. /package/src/{tflite-simd.js → legacy/tflite-simd.js} +0 -0
  46. /package/src/{webgl2 → legacy/webgl2}/backgroundImageStage.ts +0 -0
  47. /package/src/{webgl2 → legacy/webgl2}/jointBilateralFilterStage.ts +0 -0
  48. /package/src/{webgl2 → legacy/webgl2}/resizingStage.ts +0 -0
  49. /package/src/{webgl2 → legacy/webgl2}/softmaxStage.ts +0 -0
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.5.0](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-filters-web-0.4.0...@stream-io/video-filters-web-0.5.0) (2025-11-17)
6
+
7
+ ### Features
8
+
9
+ - **react:** Improved Video Filters ([#1977](https://github.com/GetStream/stream-video-js/issues/1977)) ([f8831f1](https://github.com/GetStream/stream-video-js/commit/f8831f152a716ebf4e9656f32a8f83b707db779f))
10
+
5
11
  ## [0.4.0](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-filters-web-0.3.0...@stream-io/video-filters-web-0.4.0) (2025-10-30)
6
12
 
7
13
  ### Features
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # @stream-io/video-filters-web
2
2
 
3
- A helper library for that provides the core functionality for video filters in the [Stream Video SDK](https://getstream.io/video/sdk/react/).
3
+ A helper library that provides the core functionality for video filters in the [Stream Video SDK](https://getstream.io/video/sdk/react/).
4
4
 
5
- This library borrows a lot of code and concepts from the amazing [virtual-background](https://github.com/Volcomix/virtual-background) library.
5
+ This library borrows a lot of code and concepts from the amazing [virtual-background](https://github.com/vpalmisano/virtual-background) library.
6
6
 
7
7
  ## Installation
8
8
 
@@ -14,34 +14,37 @@ yarn add @stream-io/video-filters-web
14
14
 
15
15
  ```typescript
16
16
  import {
17
- isPlatformSupported,
18
- loadTfLite,
19
- createRenderer,
17
+ isMediaPipePlatformSupported,
18
+ loadMediaPipe,
19
+ VirtualBackground,
20
20
  } from '@stream-io/video-filters-web';
21
21
 
22
- // 1. check if the platform is supported
23
- const isSupported = await isPlatformSupported();
22
+ // 1. Check if the platform is supported
23
+ const isSupported = await isMediaPipePlatformSupported();
24
24
  if (!isSupported) {
25
25
  throw new Error('Platform not supported');
26
26
  }
27
27
 
28
- // 2. get reference to the source video, background image and target canvas elements
29
- const sourceVideo = document.getElementById('source-video');
30
- const targetCanvas = document.getElementById('target-canvas');
31
- const backgroundImage = document.getElementById('background-image');
32
-
33
- // 3. load the TensorFlow Lite
34
- const tfLite = await loadTfLite();
35
-
36
- // 4. create the renderer
37
- const renderer = createRenderer(tfLite, sourceVideo, targetCanvas, {
38
- backgroundFilter: 'image', // or 'blur'
39
- backgroundImage: backgroundImage,
40
- fps: 30,
41
- });
42
-
43
- // 5. Dispose the renderer when done
44
- renderer.dispose();
28
+ // 2. Load the MediaPipe model
29
+ const mediaPipeModel = await loadMediaPipe();
30
+
31
+ // 3. Create the processor
32
+ const processor = new VirtualBackground(
33
+ track,
34
+ {
35
+ modelPath: mediaPipeModel.modelPath,
36
+ backgroundBlurLevel: blurLevel, // 'low' | 'medium' | 'high' | number
37
+ backgroundImage: backgroundImage, // string (URL or data URI)
38
+ backgroundFilter: 'image', // or 'blur'
39
+ },
40
+ { onError, onStats },
41
+ );
42
+
43
+ // 4. Start the processor and use the processed track
44
+ const processedTrack = await processor.start();
45
+
46
+ // 5. Stop the processor
47
+ processor.stop();
45
48
  ```
46
49
 
47
50
  ## Known limitations