@stream-io/video-react-sdk 0.6.14 → 0.6.16
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 +13 -0
- package/dist/index.cjs.js +26 -15
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +27 -16
- package/dist/index.es.js.map +1 -1
- package/package.json +3 -3
- package/src/components/BackgroundFilters/BackgroundFilters.tsx +35 -24
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
### [0.6.16](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-sdk-0.6.15...@stream-io/video-react-sdk-0.6.16) (2024-05-02)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* synchronize background filter canvas capturing ([#1334](https://github.com/GetStream/stream-video-js/issues/1334)) ([eaead81](https://github.com/GetStream/stream-video-js/commit/eaead818f9f404cf647efdbc11707fc3b58b2459))
|
|
11
|
+
|
|
12
|
+
### [0.6.15](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-sdk-0.6.14...@stream-io/video-react-sdk-0.6.15) (2024-04-30)
|
|
13
|
+
|
|
14
|
+
### Dependency Updates
|
|
15
|
+
|
|
16
|
+
* `@stream-io/video-client` updated to version `0.7.10`
|
|
17
|
+
* `@stream-io/video-react-bindings` updated to version `0.4.21`
|
|
5
18
|
### [0.6.14](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-sdk-0.6.13...@stream-io/video-react-sdk-0.6.14) (2024-04-26)
|
|
6
19
|
|
|
7
20
|
### Dependency Updates
|
package/dist/index.cjs.js
CHANGED
|
@@ -138,45 +138,56 @@ const BackgroundFilters = (props) => {
|
|
|
138
138
|
return;
|
|
139
139
|
const register = (unregister.current || Promise.resolve()).then(() => call.camera.registerFilter(async (ms) => {
|
|
140
140
|
return new Promise((resolve) => {
|
|
141
|
-
setMediaStream(ms);
|
|
142
141
|
signalFilterReadyRef.current = resolve;
|
|
142
|
+
setMediaStream(ms);
|
|
143
143
|
});
|
|
144
144
|
}));
|
|
145
145
|
return () => {
|
|
146
146
|
unregister.current = register
|
|
147
147
|
.then((unregisterFilter) => unregisterFilter())
|
|
148
|
+
.then(() => (signalFilterReadyRef.current = undefined))
|
|
148
149
|
.then(() => setMediaStream(undefined))
|
|
149
150
|
.catch((err) => console.error('Failed to unregister filter', err));
|
|
150
151
|
};
|
|
151
152
|
}, [backgroundFilter, call]);
|
|
153
|
+
const [isPlaying, setIsPlaying] = react.useState(false);
|
|
152
154
|
react.useEffect(() => {
|
|
153
|
-
if (!mediaStream || !videoRef
|
|
155
|
+
if (!mediaStream || !videoRef)
|
|
154
156
|
return;
|
|
155
157
|
const handleOnPlay = () => {
|
|
156
158
|
const [track] = mediaStream.getVideoTracks();
|
|
157
|
-
if (track)
|
|
158
|
-
const { width: w = 0, height: h = 0 } = track.getSettings();
|
|
159
|
-
setWidth(w);
|
|
160
|
-
setHeight(h);
|
|
161
|
-
}
|
|
162
|
-
const resolveFilter = signalFilterReadyRef.current;
|
|
163
|
-
if (!resolveFilter)
|
|
159
|
+
if (!track)
|
|
164
160
|
return;
|
|
165
|
-
const
|
|
166
|
-
|
|
161
|
+
const { width: w = 0, height: h = 0 } = track.getSettings();
|
|
162
|
+
setWidth(w);
|
|
163
|
+
setHeight(h);
|
|
164
|
+
setIsPlaying(true);
|
|
167
165
|
};
|
|
168
166
|
videoRef.addEventListener('play', handleOnPlay);
|
|
169
167
|
videoRef.srcObject = mediaStream;
|
|
170
|
-
videoRef.play().catch((err) =>
|
|
168
|
+
videoRef.play().catch((err) => {
|
|
169
|
+
console.error('Failed to play video', err);
|
|
170
|
+
});
|
|
171
171
|
return () => {
|
|
172
172
|
videoRef.removeEventListener('play', handleOnPlay);
|
|
173
173
|
videoRef.srcObject = null;
|
|
174
|
+
setIsPlaying(false);
|
|
175
|
+
};
|
|
176
|
+
}, [mediaStream, videoRef]);
|
|
177
|
+
react.useEffect(() => {
|
|
178
|
+
const resolveFilter = signalFilterReadyRef.current;
|
|
179
|
+
if (!canvasRef || !resolveFilter)
|
|
180
|
+
return;
|
|
181
|
+
const filter = canvasRef.captureStream();
|
|
182
|
+
resolveFilter(filter);
|
|
183
|
+
return () => {
|
|
184
|
+
videoClient.disposeOfMediaStream(filter);
|
|
174
185
|
};
|
|
175
|
-
}, [canvasRef
|
|
186
|
+
}, [canvasRef]);
|
|
176
187
|
return (jsxRuntime.jsxs("div", { className: "str-video__background-filters", style: {
|
|
177
188
|
width: `${width}px`,
|
|
178
189
|
height: `${height}px`,
|
|
179
|
-
}, children: [mediaStream && (jsxRuntime.jsx(RenderPipeline, { tfLite: tfLite, videoRef: videoRef, canvasRef: canvasRef, backgroundImageRef: bgImageRef })), jsxRuntime.jsx("video", { className: clsx('str-video__background-filters__video', height > width && 'str-video__background-filters__video--tall'), ref: setVideoRef, autoPlay: true, playsInline: true, controls: false, width: width, height: height, muted: true, loop: true }), backgroundImage && (jsxRuntime.jsx("img", { className: "str-video__background-filters__background-image", alt: "Background", ref: setBgImageRef, src: backgroundImage, width: width, height: height }, backgroundImage)), jsxRuntime.jsx("canvas", { className: "str-video__background-filters__target-canvas", width: width, height: height, ref: setCanvasRef }
|
|
190
|
+
}, children: [mediaStream && isPlaying && (jsxRuntime.jsx(RenderPipeline, { tfLite: tfLite, videoRef: videoRef, canvasRef: canvasRef, backgroundImageRef: bgImageRef })), jsxRuntime.jsx("video", { className: clsx('str-video__background-filters__video', height > width && 'str-video__background-filters__video--tall'), ref: setVideoRef, autoPlay: true, playsInline: true, controls: false, width: width, height: height, muted: true, loop: true }), backgroundImage && (jsxRuntime.jsx("img", { className: "str-video__background-filters__background-image", alt: "Background", ref: setBgImageRef, src: backgroundImage, width: width, height: height }, backgroundImage)), isPlaying && (jsxRuntime.jsx("canvas", { className: "str-video__background-filters__target-canvas", width: width, height: height, ref: setCanvasRef }))] }));
|
|
180
191
|
};
|
|
181
192
|
const RenderPipeline = (props) => {
|
|
182
193
|
const { tfLite, videoRef, canvasRef, backgroundImageRef } = props;
|
|
@@ -2497,7 +2508,7 @@ const VerticalScrollButtons = ({ scrollWrapper, }) => {
|
|
|
2497
2508
|
};
|
|
2498
2509
|
const hasScreenShare = (p) => !!p?.publishedTracks.includes(videoClient.SfuModels.TrackType.SCREEN_SHARE);
|
|
2499
2510
|
|
|
2500
|
-
const [major, minor, patch] = ("0.6.
|
|
2511
|
+
const [major, minor, patch] = ("0.6.16" ).split('.');
|
|
2501
2512
|
videoClient.setSdkInfo({
|
|
2502
2513
|
type: videoClient.SfuModels.SdkType.REACT,
|
|
2503
2514
|
major,
|