@stream-io/video-filters-web 0.7.5 → 0.8.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.
- package/CHANGELOG.md +10 -0
- package/dist/index.cjs.js +73 -27
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +73 -27
- package/dist/index.es.js.map +1 -1
- package/package.json +4 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [0.8.0](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-filters-web-0.7.5...@stream-io/video-filters-web-0.8.0) (2026-06-26)
|
|
6
|
+
|
|
7
|
+
### Dependency Updates
|
|
8
|
+
|
|
9
|
+
- `@stream-io/typescript-config` updated to version `0.1.0`
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
- upgrade to TypeScript 6.0.3, pin ES2022, raise supported-browser floors ([#2290](https://github.com/GetStream/stream-video-js/issues/2290)) ([d9ea158](https://github.com/GetStream/stream-video-js/commit/d9ea15846582fa8db86b3b873eca2afe92ae3593))
|
|
14
|
+
|
|
5
15
|
## [0.7.5](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-filters-web-0.7.4...@stream-io/video-filters-web-0.7.5) (2026-06-01)
|
|
6
16
|
|
|
7
17
|
## [0.7.4](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-filters-web-0.7.3...@stream-io/video-filters-web-0.7.4) (2026-04-09)
|
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.
|
|
1564
|
+
const version = "0.8.0";
|
|
1565
1565
|
const packageName = "@stream-io/video-filters-web";
|
|
1566
1566
|
|
|
1567
1567
|
// @ts-expect-error - module is not declared
|
|
@@ -1612,11 +1612,33 @@ const BACKGROUND_BLUR_MAP = {
|
|
|
1612
1612
|
};
|
|
1613
1613
|
|
|
1614
1614
|
class WebGLRenderer {
|
|
1615
|
+
canvas;
|
|
1616
|
+
gl;
|
|
1617
|
+
stateUpdateProgram;
|
|
1618
|
+
maskRefineProgram;
|
|
1619
|
+
blurProgram;
|
|
1620
|
+
blendProgram;
|
|
1621
|
+
stateUpdateLocations;
|
|
1622
|
+
maskRefineLocations;
|
|
1623
|
+
blurLocations;
|
|
1624
|
+
blendLocations;
|
|
1625
|
+
positionBuffer;
|
|
1626
|
+
texCoordBuffer;
|
|
1627
|
+
storedStateTextures;
|
|
1628
|
+
fbo;
|
|
1629
|
+
refineFbo;
|
|
1630
|
+
refinedMaskTexture;
|
|
1631
|
+
frameTexture;
|
|
1632
|
+
blurTexture1;
|
|
1633
|
+
blurTexture2;
|
|
1634
|
+
blurFbo1;
|
|
1635
|
+
blurFbo2;
|
|
1636
|
+
running = false;
|
|
1637
|
+
static DEFAULT_BG_COLOR = [33, 150, 243, 255];
|
|
1638
|
+
currentStateIndex = 0;
|
|
1639
|
+
backgroundRenderInfo = null;
|
|
1640
|
+
activeBackgroundSourceIdentifier = null;
|
|
1615
1641
|
constructor(canvas) {
|
|
1616
|
-
this.running = false;
|
|
1617
|
-
this.currentStateIndex = 0;
|
|
1618
|
-
this.backgroundRenderInfo = null;
|
|
1619
|
-
this.activeBackgroundSourceIdentifier = null;
|
|
1620
1642
|
this.canvas = canvas;
|
|
1621
1643
|
const gl = this.canvas.getContext('webgl2', {
|
|
1622
1644
|
alpha: false,
|
|
@@ -2309,7 +2331,6 @@ class WebGLRenderer {
|
|
|
2309
2331
|
this.activeBackgroundSourceIdentifier = null;
|
|
2310
2332
|
}
|
|
2311
2333
|
}
|
|
2312
|
-
WebGLRenderer.DEFAULT_BG_COLOR = [33, 150, 243, 255];
|
|
2313
2334
|
|
|
2314
2335
|
/**
|
|
2315
2336
|
* Fallback video processor for browsers that do not support MediaStreamTrackGenerator.
|
|
@@ -2375,13 +2396,10 @@ const TrackGenerator = typeof MediaStreamTrackGenerator !== 'undefined'
|
|
|
2375
2396
|
* into the canvas and update the underlying track automatically.
|
|
2376
2397
|
*/
|
|
2377
2398
|
class FallbackProcessor {
|
|
2399
|
+
readable;
|
|
2400
|
+
workerTimer;
|
|
2401
|
+
video;
|
|
2378
2402
|
constructor({ track }) {
|
|
2379
|
-
this.close = () => {
|
|
2380
|
-
this.video.pause();
|
|
2381
|
-
this.video.srcObject = null;
|
|
2382
|
-
this.video.src = '';
|
|
2383
|
-
this.workerTimer.destroy();
|
|
2384
|
-
};
|
|
2385
2403
|
if (!track)
|
|
2386
2404
|
throw new Error('MediaStreamTrack is required');
|
|
2387
2405
|
if (track.kind !== 'video') {
|
|
@@ -2444,6 +2462,12 @@ class FallbackProcessor {
|
|
|
2444
2462
|
},
|
|
2445
2463
|
});
|
|
2446
2464
|
}
|
|
2465
|
+
close = () => {
|
|
2466
|
+
this.video.pause();
|
|
2467
|
+
this.video.srcObject = null;
|
|
2468
|
+
this.video.src = '';
|
|
2469
|
+
this.workerTimer.destroy();
|
|
2470
|
+
};
|
|
2447
2471
|
}
|
|
2448
2472
|
const TrackProcessor = typeof MediaStreamTrackProcessor !== 'undefined'
|
|
2449
2473
|
? MediaStreamTrackProcessor
|
|
@@ -2462,15 +2486,20 @@ const TrackProcessor = typeof MediaStreamTrackProcessor !== 'undefined'
|
|
|
2462
2486
|
* `MediaStreamTrack` ready to use.
|
|
2463
2487
|
*/
|
|
2464
2488
|
class BaseVideoProcessor {
|
|
2489
|
+
track;
|
|
2490
|
+
processor;
|
|
2491
|
+
generator;
|
|
2492
|
+
hooks;
|
|
2493
|
+
abortController = new AbortController();
|
|
2494
|
+
canvas;
|
|
2495
|
+
frames = 0;
|
|
2496
|
+
delayTotal = 0;
|
|
2497
|
+
lastStatsTime = 0;
|
|
2465
2498
|
/**
|
|
2466
2499
|
* Constructs a new instance.
|
|
2467
2500
|
*/
|
|
2468
2501
|
constructor(track, hooks = {}) {
|
|
2469
2502
|
this.track = track;
|
|
2470
|
-
this.abortController = new AbortController();
|
|
2471
|
-
this.frames = 0;
|
|
2472
|
-
this.delayTotal = 0;
|
|
2473
|
-
this.lastStatsTime = 0;
|
|
2474
2503
|
this.processor = new TrackProcessor({ track });
|
|
2475
2504
|
this.generator = new TrackGenerator({
|
|
2476
2505
|
kind: 'video',
|
|
@@ -2552,14 +2581,17 @@ class BaseVideoProcessor {
|
|
|
2552
2581
|
* on a new MediaStreamVideoTrack for downstream consumption.
|
|
2553
2582
|
*/
|
|
2554
2583
|
class VirtualBackground extends BaseVideoProcessor {
|
|
2584
|
+
options;
|
|
2585
|
+
segmenter = null;
|
|
2586
|
+
isSegmenterReady = false;
|
|
2587
|
+
webGlRenderer;
|
|
2588
|
+
opts;
|
|
2589
|
+
latestCategoryMask = undefined;
|
|
2590
|
+
latestConfidenceMask = undefined;
|
|
2591
|
+
lastFrameTime = -1;
|
|
2555
2592
|
constructor(track, options = {}, hooks = {}) {
|
|
2556
2593
|
super(track, hooks);
|
|
2557
2594
|
this.options = options;
|
|
2558
|
-
this.segmenter = null;
|
|
2559
|
-
this.isSegmenterReady = false;
|
|
2560
|
-
this.latestCategoryMask = undefined;
|
|
2561
|
-
this.latestConfidenceMask = undefined;
|
|
2562
|
-
this.lastFrameTime = -1;
|
|
2563
2595
|
}
|
|
2564
2596
|
async initialize() {
|
|
2565
2597
|
this.webGlRenderer = new WebGLRenderer(this.canvas);
|
|
@@ -2590,7 +2622,7 @@ class VirtualBackground extends BaseVideoProcessor {
|
|
|
2590
2622
|
}
|
|
2591
2623
|
async transform(frame) {
|
|
2592
2624
|
const currentTime = frame.timestamp;
|
|
2593
|
-
const hasNewFrame = currentTime - this.lastFrameTime >
|
|
2625
|
+
const hasNewFrame = currentTime - this.lastFrameTime > 1_000;
|
|
2594
2626
|
this.lastFrameTime = currentTime;
|
|
2595
2627
|
if (hasNewFrame && this.isSegmenterReady && this.segmenter) {
|
|
2596
2628
|
const start = performance.now();
|
|
@@ -2685,12 +2717,24 @@ class VirtualBackground extends BaseVideoProcessor {
|
|
|
2685
2717
|
* and upscaling back to full resolution for output.
|
|
2686
2718
|
*/
|
|
2687
2719
|
class FullScreenBlurRenderer {
|
|
2720
|
+
canvas;
|
|
2721
|
+
gl;
|
|
2722
|
+
blurProgramHandle;
|
|
2723
|
+
blurLocations;
|
|
2724
|
+
passthroughProgramHandle;
|
|
2725
|
+
passthroughLocations;
|
|
2726
|
+
positionBuffer;
|
|
2727
|
+
texCoordBuffer;
|
|
2728
|
+
pingTexture;
|
|
2729
|
+
pongTexture;
|
|
2730
|
+
pingFbo;
|
|
2731
|
+
pongFbo;
|
|
2732
|
+
inputTexture = null;
|
|
2733
|
+
isRunning = false;
|
|
2734
|
+
targetWidth = 0;
|
|
2735
|
+
targetHeight = 0;
|
|
2736
|
+
weightCache = new Map();
|
|
2688
2737
|
constructor(canvas) {
|
|
2689
|
-
this.inputTexture = null;
|
|
2690
|
-
this.isRunning = false;
|
|
2691
|
-
this.targetWidth = 0;
|
|
2692
|
-
this.targetHeight = 0;
|
|
2693
|
-
this.weightCache = new Map();
|
|
2694
2738
|
this.canvas = canvas;
|
|
2695
2739
|
const gl = canvas.getContext('webgl2', {
|
|
2696
2740
|
alpha: false,
|
|
@@ -2948,6 +2992,8 @@ class FullScreenBlurRenderer {
|
|
|
2948
2992
|
* by the base processor.
|
|
2949
2993
|
*/
|
|
2950
2994
|
class FullScreenBlur extends BaseVideoProcessor {
|
|
2995
|
+
blurRenderer;
|
|
2996
|
+
blurRadius;
|
|
2951
2997
|
/**
|
|
2952
2998
|
* Creates a new full-screen blur processor for the given video track.
|
|
2953
2999
|
*
|