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

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/dist/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { SfuModels, CallingState, OwnCapability, name, VisibilityState, Browsers, paginatedLayoutSortPreset, combineComparators, screenSharing, speakerLayoutSortPreset, CallTypes, defaultSortPreset, setSdkInfo } from '@stream-io/video-client';
1
+ import { SfuModels, CallingState, OwnCapability, name, NoiseCancellationSettingsModeEnum, VisibilityState, Browsers, paginatedLayoutSortPreset, combineComparators, screenSharing, speakerLayoutSortPreset, CallTypes, defaultSortPreset, setSdkInfo } from '@stream-io/video-client';
2
2
  export * from '@stream-io/video-client';
3
3
  import { useCall, useCallStateHooks, useI18n, Restricted, useConnectedUser, StreamCallProvider, StreamVideoProvider } from '@stream-io/video-react-bindings';
4
4
  export * from '@stream-io/video-react-bindings';
@@ -1547,6 +1547,67 @@ const CallRecordingList = ({ callRecordings, CallRecordingListHeader: CallRecord
1547
1547
  return (jsxs("div", { className: "str-video__call-recording-list", children: [jsx(CallRecordingListHeader$1, { callRecordings: callRecordings, onRefresh: onRefresh }), jsx("div", { className: "str-video__call-recording-list__listing", children: loading ? (jsx(LoadingCallRecordingList, { callRecordings: callRecordings })) : callRecordings.length ? (jsxs(Fragment, { children: [jsx("ul", { className: "str-video__call-recording-list__list", children: jsxs("li", { className: "str-video__call-recording-list__item", children: [jsx("div", { className: "str-video__call-recording-list__filename", children: "Name" }), jsx("div", { className: "str-video__call-recording-list__time", children: "Start time" }), jsx("div", { className: "str-video__call-recording-list__time", children: "End time" }), jsx("div", { className: "str-video__call-recording-list__download" })] }) }), jsx("ul", { className: "str-video__call-recording-list__list", children: callRecordings.map((recording) => (jsx(CallRecordingListItem$1, { recording: recording }, recording.filename))) })] })) : (jsx(EmptyCallRecordingList, {})) })] }));
1548
1548
  };
1549
1549
 
1550
+ const NoiseCancellationContext = createContext(null);
1551
+ /**
1552
+ * Exposes the NoiseCancellation API.
1553
+ * Throws an error if used outside <NoiseCancellationProvider />.
1554
+ */
1555
+ const useNoiseCancellation = () => {
1556
+ const context = 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 = useCall();
1565
+ const { useCallSettings, useHasPermissions } = useCallStateHooks();
1566
+ const settings = useCallSettings();
1567
+ const noiseCancellationAllowed = !!(settings &&
1568
+ settings.audio.noise_cancellation &&
1569
+ settings.audio.noise_cancellation.mode !==
1570
+ NoiseCancellationSettingsModeEnum.DISABLED);
1571
+ const hasCapability = useHasPermissions(OwnCapability.ENABLE_NOISE_CANCELLATION);
1572
+ const isSupported = hasCapability &&
1573
+ noiseCancellationAllowed &&
1574
+ noiseCancellation.isSupported();
1575
+ const [isEnabled, setIsEnabled] = useState(false);
1576
+ const deinit = useRef();
1577
+ 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 (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 = useCall();
1552
1613
  const { useCallCallingState } = useCallStateHooks();
@@ -2436,7 +2497,7 @@ const VerticalScrollButtons = ({ scrollWrapper, }) => {
2436
2497
  };
2437
2498
  const hasScreenShare = (p) => !!p?.publishedTracks.includes(SfuModels.TrackType.SCREEN_SHARE);
2438
2499
 
2439
- const [major, minor, patch] = ("0.6.11" ).split('.');
2500
+ const [major, minor, patch] = ("0.6.13" ).split('.');
2440
2501
  setSdkInfo({
2441
2502
  type: SfuModels.SdkType.REACT,
2442
2503
  major,
@@ -2444,5 +2505,5 @@ setSdkInfo({
2444
2505
  patch,
2445
2506
  });
2446
2507
 
2447
- export { AcceptCallButton, Audio, Avatar, AvatarFallback, BackgroundFiltersProvider, BaseVideo, CallControls, CallParticipantListing, CallParticipantListingItem, CallParticipantsList, CallPreview, CallRecordingList, CallRecordingListHeader, CallRecordingListItem, CallStats, CallStatsButton, CallStatsLatencyChart, CancelCallButton, CancelCallConfirmButton, CompositeButton, DefaultParticipantViewUI, DefaultReactionsMenu, DefaultScreenShareOverlay, DefaultVideoPlaceholder, DeviceSelector, DeviceSelectorAudioInput, DeviceSelectorAudioOutput, DeviceSelectorVideo, DeviceSettings, DropDownSelect, DropDownSelectOption, EmptyCallRecordingListing, GenericMenu, GenericMenuButtonItem, Icon, IconButton, LivestreamLayout, LoadingCallRecordingListing, LoadingIndicator, MenuToggle, MenuVisualType, Notification, PaginatedGridLayout, ParticipantActionsContextMenu, ParticipantDetails, ParticipantView, ParticipantViewContext, ParticipantsAudio, PermissionNotification, PermissionRequestList, PermissionRequests, ReactionsButton, RecordCallButton, RecordCallConfirmationButton, RecordingInProgressNotification, RingingCall, RingingCallControls, ScreenShareButton, SearchInput, SearchResults, SpeakerLayout, SpeakingWhileMutedNotification, SpeechIndicator, StatCard, StatCardExplanation, StatsTag, Statuses, StreamCall, StreamTheme, StreamVideo, TextButton, ToggleAudioOutputButton, ToggleAudioPreviewButton, ToggleAudioPublishingButton, ToggleVideoPreviewButton, ToggleVideoPublishingButton, Tooltip, Video$1 as Video, VideoPreview, WithTooltip, defaultReactions, translations, useBackgroundFilters, useHorizontalScrollPosition, useMenuContext, useParticipantViewContext, usePersistedDevicePreferences, useRequestPermission, useTrackElementVisibility, useVerticalScrollPosition };
2508
+ export { AcceptCallButton, Audio, Avatar, AvatarFallback, BackgroundFiltersProvider, BaseVideo, CallControls, CallParticipantListing, CallParticipantListingItem, CallParticipantsList, CallPreview, CallRecordingList, CallRecordingListHeader, CallRecordingListItem, CallStats, CallStatsButton, CallStatsLatencyChart, CancelCallButton, CancelCallConfirmButton, CompositeButton, DefaultParticipantViewUI, DefaultReactionsMenu, DefaultScreenShareOverlay, DefaultVideoPlaceholder, DeviceSelector, DeviceSelectorAudioInput, DeviceSelectorAudioOutput, DeviceSelectorVideo, DeviceSettings, DropDownSelect, DropDownSelectOption, EmptyCallRecordingListing, GenericMenu, GenericMenuButtonItem, Icon, IconButton, LivestreamLayout, LoadingCallRecordingListing, LoadingIndicator, MenuToggle, MenuVisualType, NoiseCancellationProvider, Notification, PaginatedGridLayout, ParticipantActionsContextMenu, ParticipantDetails, ParticipantView, ParticipantViewContext, ParticipantsAudio, PermissionNotification, PermissionRequestList, PermissionRequests, ReactionsButton, RecordCallButton, RecordCallConfirmationButton, RecordingInProgressNotification, RingingCall, RingingCallControls, ScreenShareButton, SearchInput, SearchResults, SpeakerLayout, SpeakingWhileMutedNotification, SpeechIndicator, StatCard, StatCardExplanation, StatsTag, Statuses, StreamCall, StreamTheme, StreamVideo, TextButton, ToggleAudioOutputButton, ToggleAudioPreviewButton, ToggleAudioPublishingButton, ToggleVideoPreviewButton, ToggleVideoPublishingButton, Tooltip, Video$1 as Video, VideoPreview, WithTooltip, defaultReactions, translations, useBackgroundFilters, useHorizontalScrollPosition, useMenuContext, useNoiseCancellation, useParticipantViewContext, usePersistedDevicePreferences, useRequestPermission, useTrackElementVisibility, useVerticalScrollPosition };
2448
2509
  //# sourceMappingURL=index.es.js.map