@stream-io/video-react-sdk 0.6.11 → 0.6.12

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 CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ### [0.6.12](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-sdk-0.6.11...@stream-io/video-react-sdk-0.6.12) (2024-04-25)
6
+
7
+ ### Dependency Updates
8
+
9
+ * `@stream-io/video-client` updated to version `0.7.8`
10
+ * `@stream-io/video-react-bindings` updated to version `0.4.19`
11
+ * `@stream-io/audio-filters-web` updated to version `0.0.1`
12
+
13
+ ### Features
14
+
15
+ * Noise Cancellation ([#1321](https://github.com/GetStream/stream-video-js/issues/1321)) ([9144385](https://github.com/GetStream/stream-video-js/commit/91443852986ad7453d82efb900626266d8df0e96))
16
+
5
17
  ### [0.6.11](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-sdk-0.6.10...@stream-io/video-react-sdk-0.6.11) (2024-04-25)
6
18
 
7
19
 
package/dist/index.cjs.js CHANGED
@@ -1547,6 +1547,67 @@ const CallRecordingList = ({ callRecordings, CallRecordingListHeader: CallRecord
1547
1547
  return (jsxRuntime.jsxs("div", { className: "str-video__call-recording-list", children: [jsxRuntime.jsx(CallRecordingListHeader$1, { callRecordings: callRecordings, onRefresh: onRefresh }), jsxRuntime.jsx("div", { className: "str-video__call-recording-list__listing", children: loading ? (jsxRuntime.jsx(LoadingCallRecordingList, { callRecordings: callRecordings })) : callRecordings.length ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("ul", { className: "str-video__call-recording-list__list", children: jsxRuntime.jsxs("li", { className: "str-video__call-recording-list__item", children: [jsxRuntime.jsx("div", { className: "str-video__call-recording-list__filename", children: "Name" }), jsxRuntime.jsx("div", { className: "str-video__call-recording-list__time", children: "Start time" }), jsxRuntime.jsx("div", { className: "str-video__call-recording-list__time", children: "End time" }), jsxRuntime.jsx("div", { className: "str-video__call-recording-list__download" })] }) }), jsxRuntime.jsx("ul", { className: "str-video__call-recording-list__list", children: callRecordings.map((recording) => (jsxRuntime.jsx(CallRecordingListItem$1, { recording: recording }, recording.filename))) })] })) : (jsxRuntime.jsx(EmptyCallRecordingList, {})) })] }));
1548
1548
  };
1549
1549
 
1550
+ const NoiseCancellationContext = react.createContext(null);
1551
+ /**
1552
+ * Exposes the NoiseCancellation API.
1553
+ * Throws an error if used outside <NoiseCancellationProvider />.
1554
+ */
1555
+ const useNoiseCancellation = () => {
1556
+ const context = react.useContext(NoiseCancellationContext);
1557
+ if (!context) {
1558
+ throw new Error('useNoiseCancellation must be used within a NoiseCancellationProvider');
1559
+ }
1560
+ return context;
1561
+ };
1562
+ const NoiseCancellationProvider = (props) => {
1563
+ const { children, noiseCancellation } = props;
1564
+ const call = videoReactBindings.useCall();
1565
+ const { useCallSettings, useHasPermissions } = videoReactBindings.useCallStateHooks();
1566
+ const settings = useCallSettings();
1567
+ const noiseCancellationAllowed = !!(settings &&
1568
+ settings.audio.noise_cancellation &&
1569
+ settings.audio.noise_cancellation.mode !==
1570
+ videoClient.NoiseCancellationSettingsModeEnum.DISABLED);
1571
+ const hasCapability = useHasPermissions(videoClient.OwnCapability.ENABLE_NOISE_CANCELLATION);
1572
+ const isSupported = hasCapability &&
1573
+ noiseCancellationAllowed &&
1574
+ noiseCancellation.isSupported();
1575
+ const [isEnabled, setIsEnabled] = react.useState(false);
1576
+ const deinit = react.useRef();
1577
+ react.useEffect(() => {
1578
+ if (!call || !isSupported)
1579
+ return;
1580
+ const unsubscribe = noiseCancellation.on('change', (v) => setIsEnabled(v));
1581
+ const init = (deinit.current || Promise.resolve())
1582
+ .then(() => noiseCancellation.init())
1583
+ .then(() => call.microphone.enableNoiseCancellation(noiseCancellation))
1584
+ .catch((err) => console.error(`Can't initialize noise suppression`, err));
1585
+ return () => {
1586
+ deinit.current = init
1587
+ .then(() => call.microphone.disableNoiseCancellation())
1588
+ .then(() => noiseCancellation.dispose())
1589
+ .then(() => unsubscribe());
1590
+ };
1591
+ }, [call, isSupported, noiseCancellation]);
1592
+ return (jsxRuntime.jsx(NoiseCancellationContext.Provider, { value: {
1593
+ isSupported,
1594
+ isEnabled,
1595
+ setEnabled: (enabledOrSetter) => {
1596
+ if (!noiseCancellation)
1597
+ return;
1598
+ const enable = typeof enabledOrSetter === 'function'
1599
+ ? enabledOrSetter(isEnabled)
1600
+ : enabledOrSetter;
1601
+ if (enable) {
1602
+ noiseCancellation.enable();
1603
+ }
1604
+ else {
1605
+ noiseCancellation.disable();
1606
+ }
1607
+ },
1608
+ }, children: children }));
1609
+ };
1610
+
1550
1611
  const RingingCallControls = () => {
1551
1612
  const call = videoReactBindings.useCall();
1552
1613
  const { useCallCallingState } = videoReactBindings.useCallStateHooks();
@@ -2436,7 +2497,7 @@ const VerticalScrollButtons = ({ scrollWrapper, }) => {
2436
2497
  };
2437
2498
  const hasScreenShare = (p) => !!p?.publishedTracks.includes(videoClient.SfuModels.TrackType.SCREEN_SHARE);
2438
2499
 
2439
- const [major, minor, patch] = ("0.6.11" ).split('.');
2500
+ const [major, minor, patch] = ("0.6.12" ).split('.');
2440
2501
  videoClient.setSdkInfo({
2441
2502
  type: videoClient.SfuModels.SdkType.REACT,
2442
2503
  major,
@@ -2484,6 +2545,7 @@ exports.LivestreamLayout = LivestreamLayout;
2484
2545
  exports.LoadingCallRecordingListing = LoadingCallRecordingListing;
2485
2546
  exports.LoadingIndicator = LoadingIndicator;
2486
2547
  exports.MenuToggle = MenuToggle;
2548
+ exports.NoiseCancellationProvider = NoiseCancellationProvider;
2487
2549
  exports.Notification = Notification;
2488
2550
  exports.PaginatedGridLayout = PaginatedGridLayout;
2489
2551
  exports.ParticipantActionsContextMenu = ParticipantActionsContextMenu;
@@ -2527,6 +2589,7 @@ exports.translations = translations;
2527
2589
  exports.useBackgroundFilters = useBackgroundFilters;
2528
2590
  exports.useHorizontalScrollPosition = useHorizontalScrollPosition;
2529
2591
  exports.useMenuContext = useMenuContext;
2592
+ exports.useNoiseCancellation = useNoiseCancellation;
2530
2593
  exports.useParticipantViewContext = useParticipantViewContext;
2531
2594
  exports.usePersistedDevicePreferences = usePersistedDevicePreferences;
2532
2595
  exports.useRequestPermission = useRequestPermission;