@stream-io/video-filters-web 0.1.2 → 0.1.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/CHANGELOG.md +14 -0
- package/dist/index.cjs.js +15 -8
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +15 -8
- package/dist/index.es.js.map +1 -1
- package/dist/src/createRenderer.d.ts +1 -1
- package/dist/src/tflite.d.ts +0 -1
- package/package.json +6 -5
- package/src/createRenderer.ts +8 -3
- package/src/webgl2/webgl2Pipeline.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [0.1.4](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-filters-web-0.1.3...@stream-io/video-filters-web-0.1.4) (2024-09-19)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* React SDK cold-start optimizations ([#1488](https://github.com/GetStream/stream-video-js/issues/1488)) ([972e579](https://github.com/GetStream/stream-video-js/commit/972e5792b5a131a212b1031ade76dcb383897a46))
|
|
11
|
+
|
|
12
|
+
### [0.1.3](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-filters-web-0.1.2...@stream-io/video-filters-web-0.1.3) (2024-07-02)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* refactor background filters ([#1415](https://github.com/GetStream/stream-video-js/issues/1415)) ([deb6da2](https://github.com/GetStream/stream-video-js/commit/deb6da238f541c733451e84b198434671da8dceb))
|
|
18
|
+
|
|
5
19
|
### [0.1.2](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-filters-web-0.1.1...@stream-io/video-filters-web-0.1.2) (2024-06-12)
|
|
6
20
|
|
|
7
21
|
|
package/dist/index.cjs.js
CHANGED
|
@@ -675,6 +675,8 @@ function buildWebGL2Pipeline(videoSource, backgroundImage, blurLevel, background
|
|
|
675
675
|
const gl = canvas.getContext('webgl2');
|
|
676
676
|
if (!gl)
|
|
677
677
|
throw new Error('WebGL2 is not supported');
|
|
678
|
+
if (gl.isContextLost())
|
|
679
|
+
throw new Error('WebGL2 context was lost');
|
|
678
680
|
const { width: frameWidth, height: frameHeight } = videoSource;
|
|
679
681
|
const { width: segmentationWidth, height: segmentationHeight } = segmentationConfig;
|
|
680
682
|
const vertexShaderSource = glsl `#version 300 es
|
|
@@ -777,16 +779,21 @@ const getSegmentationParams = (level) => {
|
|
|
777
779
|
return { width: 160, height: 96 };
|
|
778
780
|
};
|
|
779
781
|
|
|
780
|
-
function createRenderer(tflite, videoSource, targetCanvas, options) {
|
|
782
|
+
function createRenderer(tflite, videoSource, targetCanvas, options, onError) {
|
|
781
783
|
const { backgroundFilter, backgroundImage, backgroundBlurLevel, segmentationLevel = exports.SegmentationLevel.HIGH, fps = 30, } = options;
|
|
782
784
|
if (backgroundFilter === 'image' && !backgroundImage) {
|
|
783
785
|
throw new Error(`backgroundImage element is required when backgroundFilter is image`);
|
|
784
786
|
}
|
|
785
787
|
const pipeline = buildWebGL2Pipeline(videoSource, backgroundImage, backgroundBlurLevel, backgroundFilter, targetCanvas, tflite, getSegmentationParams(segmentationLevel));
|
|
786
788
|
const id = setInterval(() => {
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
789
|
+
try {
|
|
790
|
+
pipeline.render();
|
|
791
|
+
if (backgroundFilter === 'image') {
|
|
792
|
+
pipeline.updatePostProcessingConfig();
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
catch (error) {
|
|
796
|
+
onError?.(error);
|
|
790
797
|
}
|
|
791
798
|
}, 1000 / (fps <= 0 ? 30 : fps));
|
|
792
799
|
return {
|
|
@@ -1024,7 +1031,7 @@ const createTFLiteSIMDModule = (__Module) => {
|
|
|
1024
1031
|
}
|
|
1025
1032
|
|
|
1026
1033
|
function getBinaryPromise() {
|
|
1027
|
-
if (!wasmBinary && (ENVIRONMENT_IS_WEB
|
|
1034
|
+
if (!wasmBinary && (ENVIRONMENT_IS_WEB)) {
|
|
1028
1035
|
if (typeof fetch == 'function') {
|
|
1029
1036
|
return fetch(wasmBinaryFile, { credentials: 'same-origin' })
|
|
1030
1037
|
.then(function (response) {
|
|
@@ -1252,7 +1259,7 @@ const createTFLiteSIMDModule = (__Module) => {
|
|
|
1252
1259
|
for (var i = 0; i < str.length; ++i) {
|
|
1253
1260
|
HEAP8[buffer++ >> 0] = str.charCodeAt(i);
|
|
1254
1261
|
}
|
|
1255
|
-
|
|
1262
|
+
HEAP8[buffer >> 0] = 0;
|
|
1256
1263
|
}
|
|
1257
1264
|
|
|
1258
1265
|
function _environ_get(__environ, environ_buf) {
|
|
@@ -1531,8 +1538,8 @@ const createTFLiteSIMDModule = (__Module) => {
|
|
|
1531
1538
|
return __Module.ready;
|
|
1532
1539
|
};
|
|
1533
1540
|
|
|
1534
|
-
const version = "0.1.
|
|
1535
|
-
const packageName = "@stream-io/video-filters-web"
|
|
1541
|
+
const version = "0.1.4";
|
|
1542
|
+
const packageName = "@stream-io/video-filters-web";
|
|
1536
1543
|
|
|
1537
1544
|
// @ts-expect-error - module is not declared
|
|
1538
1545
|
// This is a WebAssembly module compiled from the TensorFlow Lite C++ library.
|