@stream-io/video-react-sdk 1.33.3 → 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.
@@ -1151,7 +1151,7 @@ const SpeakerTest = (props) => {
1151
1151
  const audioElementRef = useRef(null);
1152
1152
  const [isPlaying, setIsPlaying] = useState(false);
1153
1153
  const { t } = useI18n();
1154
- const { audioUrl = `https://unpkg.com/${"@stream-io/video-react-sdk"}@${"1.33.3"}/assets/piano.mp3`, } = props;
1154
+ const { audioUrl = `https://unpkg.com/${"@stream-io/video-react-sdk"}@${"1.33.4"}/assets/piano.mp3`, } = props;
1155
1155
  // Update audio output device when selection changes
1156
1156
  useEffect(() => {
1157
1157
  const audio = audioElementRef.current;
@@ -1570,6 +1570,7 @@ const NoiseCancellationProvider = (props) => {
1570
1570
  }, [noiseCancellation]);
1571
1571
  const isSupported = isSupportedByBrowser && hasCapability && noiseCancellationAllowed;
1572
1572
  const [isEnabled, setIsEnabled] = useState(false);
1573
+ const [isReady, setIsReady] = useState(false);
1573
1574
  const deinit = useRef(undefined);
1574
1575
  useEffect(() => {
1575
1576
  if (!call || !isSupported)
@@ -1578,17 +1579,23 @@ const NoiseCancellationProvider = (props) => {
1578
1579
  const unsubscribe = noiseCancellation.on('change', (v) => setIsEnabled(v));
1579
1580
  const init = (deinit.current || Promise.resolve())
1580
1581
  .then(() => noiseCancellation.init({ tracer: call.tracer }))
1581
- .then(() => call.microphone.enableNoiseCancellation(noiseCancellation))
1582
+ .then(() => {
1583
+ setIsReady(true);
1584
+ return call.microphone.enableNoiseCancellation(noiseCancellation);
1585
+ })
1582
1586
  .catch((e) => console.error(`Can't initialize noise cancellation`, e));
1583
1587
  return () => {
1584
1588
  deinit.current = init
1585
1589
  .then(() => call.microphone.disableNoiseCancellation())
1586
1590
  .then(() => noiseCancellation.dispose())
1587
- .then(() => unsubscribe());
1591
+ .then(() => unsubscribe())
1592
+ .catch((e) => console.error("Can't clean up noise cancellation", e))
1593
+ .finally(() => setIsReady(false));
1588
1594
  };
1589
1595
  }, [call, isSupported, noiseCancellation]);
1590
1596
  const contextValue = useMemo(() => ({
1591
1597
  isSupported,
1598
+ isReady,
1592
1599
  isEnabled,
1593
1600
  setSuppressionLevel: (level) => {
1594
1601
  if (!noiseCancellation)
@@ -1612,7 +1619,7 @@ const NoiseCancellationProvider = (props) => {
1612
1619
  });
1613
1620
  }
1614
1621
  },
1615
- }), [isEnabled, isSupported, noiseCancellation]);
1622
+ }), [isEnabled, isReady, isSupported, noiseCancellation]);
1616
1623
  return (jsx(NoiseCancellationContext.Provider, { value: contextValue, children: children }));
1617
1624
  };
1618
1625