@stream-io/video-react-sdk 1.33.2 → 1.33.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.
@@ -15,6 +15,10 @@ export type NoiseCancellationAPI = {
15
15
  * are supported on this platform and for the current user.
16
16
  */
17
17
  isSupported: boolean | undefined;
18
+ /**
19
+ * Provides information whether Noise Cancellation is initialized and ready.
20
+ */
21
+ isReady: boolean;
18
22
  /**
19
23
  * Provides information whether Noise Cancellation is active or not.
20
24
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stream-io/video-react-sdk",
3
- "version": "1.33.2",
3
+ "version": "1.33.4",
4
4
  "main": "./dist/index.cjs.js",
5
5
  "module": "./dist/index.es.js",
6
6
  "types": "./dist/index.d.ts",
@@ -45,9 +45,9 @@
45
45
  ],
46
46
  "dependencies": {
47
47
  "@floating-ui/react": "^0.27.6",
48
- "@stream-io/video-client": "1.44.2",
48
+ "@stream-io/video-client": "1.44.3",
49
49
  "@stream-io/video-filters-web": "0.7.2",
50
- "@stream-io/video-react-bindings": "1.13.11",
50
+ "@stream-io/video-react-bindings": "1.13.12",
51
51
  "chart.js": "^4.4.4",
52
52
  "clsx": "^2.0.0",
53
53
  "react-chartjs-2": "^5.3.0"
@@ -60,7 +60,7 @@
60
60
  "@rollup/plugin-json": "^6.1.0",
61
61
  "@rollup/plugin-replace": "^6.0.2",
62
62
  "@rollup/plugin-typescript": "^12.1.4",
63
- "@stream-io/audio-filters-web": "^0.7.2",
63
+ "@stream-io/audio-filters-web": "^0.7.3",
64
64
  "@stream-io/video-styling": "^1.11.0",
65
65
  "@types/react": "~19.1.17",
66
66
  "@types/react-dom": "~19.1.11",
@@ -30,6 +30,10 @@ export type NoiseCancellationAPI = {
30
30
  * are supported on this platform and for the current user.
31
31
  */
32
32
  isSupported: boolean | undefined;
33
+ /**
34
+ * Provides information whether Noise Cancellation is initialized and ready.
35
+ */
36
+ isReady: boolean;
33
37
  /**
34
38
  * Provides information whether Noise Cancellation is active or not.
35
39
  */
@@ -105,6 +109,8 @@ export const NoiseCancellationProvider = (
105
109
  isSupportedByBrowser && hasCapability && noiseCancellationAllowed;
106
110
 
107
111
  const [isEnabled, setIsEnabled] = useState(false);
112
+ const [isReady, setIsReady] = useState(false);
113
+
108
114
  const deinit = useRef<Promise<void>>(undefined);
109
115
  useEffect(() => {
110
116
  if (!call || !isSupported) return;
@@ -112,20 +118,26 @@ export const NoiseCancellationProvider = (
112
118
  const unsubscribe = noiseCancellation.on('change', (v) => setIsEnabled(v));
113
119
  const init = (deinit.current || Promise.resolve())
114
120
  .then(() => noiseCancellation.init({ tracer: call.tracer }))
115
- .then(() => call.microphone.enableNoiseCancellation(noiseCancellation))
121
+ .then(() => {
122
+ setIsReady(true);
123
+ return call.microphone.enableNoiseCancellation(noiseCancellation);
124
+ })
116
125
  .catch((e) => console.error(`Can't initialize noise cancellation`, e));
117
126
 
118
127
  return () => {
119
128
  deinit.current = init
120
129
  .then(() => call.microphone.disableNoiseCancellation())
121
130
  .then(() => noiseCancellation.dispose())
122
- .then(() => unsubscribe());
131
+ .then(() => unsubscribe())
132
+ .catch((e) => console.error("Can't clean up noise cancellation", e))
133
+ .finally(() => setIsReady(false));
123
134
  };
124
135
  }, [call, isSupported, noiseCancellation]);
125
136
 
126
137
  const contextValue = useMemo<NoiseCancellationAPI>(
127
138
  () => ({
128
139
  isSupported,
140
+ isReady,
129
141
  isEnabled,
130
142
  setSuppressionLevel: (level) => {
131
143
  if (!noiseCancellation) return;
@@ -148,7 +160,7 @@ export const NoiseCancellationProvider = (
148
160
  }
149
161
  },
150
162
  }),
151
- [isEnabled, isSupported, noiseCancellation],
163
+ [isEnabled, isReady, isSupported, noiseCancellation],
152
164
  );
153
165
  return (
154
166
  <NoiseCancellationContext.Provider value={contextValue}>