@stream-io/video-react-sdk 0.0.1-alpha.9
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 +183 -0
- package/LICENSE +219 -0
- package/README.md +5 -0
- package/dist/css/styles.css +2351 -0
- package/dist/css/styles.css.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/src/components/Avatar/Avatar.d.ts +14 -0
- package/dist/src/components/Avatar/Avatar.js +11 -0
- package/dist/src/components/Avatar/Avatar.js.map +1 -0
- package/dist/src/components/Avatar/index.d.ts +1 -0
- package/dist/src/components/Avatar/index.js +2 -0
- package/dist/src/components/Avatar/index.js.map +1 -0
- package/dist/src/components/Button/CompositeButton.d.ts +16 -0
- package/dist/src/components/Button/CompositeButton.js +15 -0
- package/dist/src/components/Button/CompositeButton.js.map +1 -0
- package/dist/src/components/Button/CopyToClipboardButton.d.ts +27 -0
- package/dist/src/components/Button/CopyToClipboardButton.js +54 -0
- package/dist/src/components/Button/CopyToClipboardButton.js.map +1 -0
- package/dist/src/components/Button/IconButton.d.ts +7 -0
- package/dist/src/components/Button/IconButton.js +26 -0
- package/dist/src/components/Button/IconButton.js.map +1 -0
- package/dist/src/components/Button/TextButton.d.ts +2 -0
- package/dist/src/components/Button/TextButton.js +17 -0
- package/dist/src/components/Button/TextButton.js.map +1 -0
- package/dist/src/components/Button/index.d.ts +4 -0
- package/dist/src/components/Button/index.js +5 -0
- package/dist/src/components/Button/index.js.map +1 -0
- package/dist/src/components/CallControls/CallControls.d.ts +7 -0
- package/dist/src/components/CallControls/CallControls.js +8 -0
- package/dist/src/components/CallControls/CallControls.js.map +1 -0
- package/dist/src/components/CallControls/CallStatsButton.d.ts +6 -0
- package/dist/src/components/CallControls/CallStatsButton.js +10 -0
- package/dist/src/components/CallControls/CallStatsButton.js.map +1 -0
- package/dist/src/components/CallControls/CancelCallButton.d.ts +8 -0
- package/dist/src/components/CallControls/CancelCallButton.js +25 -0
- package/dist/src/components/CallControls/CancelCallButton.js.map +1 -0
- package/dist/src/components/CallControls/ReactionsButton.d.ts +11 -0
- package/dist/src/components/CallControls/ReactionsButton.js +33 -0
- package/dist/src/components/CallControls/ReactionsButton.js.map +1 -0
- package/dist/src/components/CallControls/RecordCallButton.d.ts +7 -0
- package/dist/src/components/CallControls/RecordCallButton.js +51 -0
- package/dist/src/components/CallControls/RecordCallButton.js.map +1 -0
- package/dist/src/components/CallControls/ScreenShareButton.d.ts +7 -0
- package/dist/src/components/CallControls/ScreenShareButton.js +54 -0
- package/dist/src/components/CallControls/ScreenShareButton.js.map +1 -0
- package/dist/src/components/CallControls/ToggleAudioButton.d.ts +9 -0
- package/dist/src/components/CallControls/ToggleAudioButton.js +66 -0
- package/dist/src/components/CallControls/ToggleAudioButton.js.map +1 -0
- package/dist/src/components/CallControls/ToggleAudioOutputButton.d.ts +5 -0
- package/dist/src/components/CallControls/ToggleAudioOutputButton.js +9 -0
- package/dist/src/components/CallControls/ToggleAudioOutputButton.js.map +1 -0
- package/dist/src/components/CallControls/ToggleCameraButton.d.ts +10 -0
- package/dist/src/components/CallControls/ToggleCameraButton.js +64 -0
- package/dist/src/components/CallControls/ToggleCameraButton.js.map +1 -0
- package/dist/src/components/CallControls/ToggleParticipantListButton.d.ts +6 -0
- package/dist/src/components/CallControls/ToggleParticipantListButton.js +7 -0
- package/dist/src/components/CallControls/ToggleParticipantListButton.js.map +1 -0
- package/dist/src/components/CallControls/index.d.ts +10 -0
- package/dist/src/components/CallControls/index.js +11 -0
- package/dist/src/components/CallControls/index.js.map +1 -0
- package/dist/src/components/CallParticipantsList/BlockedUserListing.d.ts +4 -0
- package/dist/src/components/CallParticipantsList/BlockedUserListing.js +19 -0
- package/dist/src/components/CallParticipantsList/BlockedUserListing.js.map +1 -0
- package/dist/src/components/CallParticipantsList/CallParticipantListHeader.d.ts +6 -0
- package/dist/src/components/CallParticipantsList/CallParticipantListHeader.js +7 -0
- package/dist/src/components/CallParticipantsList/CallParticipantListHeader.js.map +1 -0
- package/dist/src/components/CallParticipantsList/CallParticipantListing.d.ts +8 -0
- package/dist/src/components/CallParticipantsList/CallParticipantListing.js +4 -0
- package/dist/src/components/CallParticipantsList/CallParticipantListing.js.map +1 -0
- package/dist/src/components/CallParticipantsList/CallParticipantListingItem.d.ts +15 -0
- package/dist/src/components/CallParticipantsList/CallParticipantListingItem.js +77 -0
- package/dist/src/components/CallParticipantsList/CallParticipantListingItem.js.map +1 -0
- package/dist/src/components/CallParticipantsList/CallParticipantsList.d.ts +15 -0
- package/dist/src/components/CallParticipantsList/CallParticipantsList.js +82 -0
- package/dist/src/components/CallParticipantsList/CallParticipantsList.js.map +1 -0
- package/dist/src/components/CallParticipantsList/EmptyParticipantSearchList.d.ts +2 -0
- package/dist/src/components/CallParticipantsList/EmptyParticipantSearchList.js +5 -0
- package/dist/src/components/CallParticipantsList/EmptyParticipantSearchList.js.map +1 -0
- package/dist/src/components/CallParticipantsList/index.d.ts +3 -0
- package/dist/src/components/CallParticipantsList/index.js +4 -0
- package/dist/src/components/CallParticipantsList/index.js.map +1 -0
- package/dist/src/components/CallRecordingList/CallRecordingList.d.ts +20 -0
- package/dist/src/components/CallRecordingList/CallRecordingList.js +9 -0
- package/dist/src/components/CallRecordingList/CallRecordingList.js.map +1 -0
- package/dist/src/components/CallRecordingList/CallRecordingListHeader.d.ts +7 -0
- package/dist/src/components/CallRecordingList/CallRecordingListHeader.js +8 -0
- package/dist/src/components/CallRecordingList/CallRecordingListHeader.js.map +1 -0
- package/dist/src/components/CallRecordingList/CallRecordingListItem.d.ts +7 -0
- package/dist/src/components/CallRecordingList/CallRecordingListItem.js +11 -0
- package/dist/src/components/CallRecordingList/CallRecordingListItem.js.map +1 -0
- package/dist/src/components/CallRecordingList/EmptyCallRecordingListing.d.ts +2 -0
- package/dist/src/components/CallRecordingList/EmptyCallRecordingListing.js +5 -0
- package/dist/src/components/CallRecordingList/EmptyCallRecordingListing.js.map +1 -0
- package/dist/src/components/CallRecordingList/LoadingCallRecordingListing.d.ts +7 -0
- package/dist/src/components/CallRecordingList/LoadingCallRecordingListing.js +7 -0
- package/dist/src/components/CallRecordingList/LoadingCallRecordingListing.js.map +1 -0
- package/dist/src/components/CallRecordingList/index.d.ts +5 -0
- package/dist/src/components/CallRecordingList/index.js +6 -0
- package/dist/src/components/CallRecordingList/index.js.map +1 -0
- package/dist/src/components/Debug/DebugParticipantPublishQuality.d.ts +6 -0
- package/dist/src/components/Debug/DebugParticipantPublishQuality.js +46 -0
- package/dist/src/components/Debug/DebugParticipantPublishQuality.js.map +1 -0
- package/dist/src/components/Debug/DebugStatsView.d.ts +7 -0
- package/dist/src/components/Debug/DebugStatsView.js +26 -0
- package/dist/src/components/Debug/DebugStatsView.js.map +1 -0
- package/dist/src/components/Debug/useIsDebugMode.d.ts +5 -0
- package/dist/src/components/Debug/useIsDebugMode.js +18 -0
- package/dist/src/components/Debug/useIsDebugMode.js.map +1 -0
- package/dist/src/components/DeviceSettings/DeviceSelector.d.ts +7 -0
- package/dist/src/components/DeviceSettings/DeviceSelector.js +26 -0
- package/dist/src/components/DeviceSettings/DeviceSelector.js.map +1 -0
- package/dist/src/components/DeviceSettings/DeviceSelectorAudio.d.ts +9 -0
- package/dist/src/components/DeviceSettings/DeviceSelectorAudio.js +18 -0
- package/dist/src/components/DeviceSettings/DeviceSelectorAudio.js.map +1 -0
- package/dist/src/components/DeviceSettings/DeviceSelectorVideo.d.ts +5 -0
- package/dist/src/components/DeviceSettings/DeviceSelectorVideo.js +10 -0
- package/dist/src/components/DeviceSettings/DeviceSelectorVideo.js.map +1 -0
- package/dist/src/components/DeviceSettings/DeviceSettings.d.ts +2 -0
- package/dist/src/components/DeviceSettings/DeviceSettings.js +15 -0
- package/dist/src/components/DeviceSettings/DeviceSettings.js.map +1 -0
- package/dist/src/components/DeviceSettings/index.d.ts +4 -0
- package/dist/src/components/DeviceSettings/index.js +5 -0
- package/dist/src/components/DeviceSettings/index.js.map +1 -0
- package/dist/src/components/Icon/Icon.d.ts +5 -0
- package/dist/src/components/Icon/Icon.js +4 -0
- package/dist/src/components/Icon/Icon.js.map +1 -0
- package/dist/src/components/Icon/index.d.ts +1 -0
- package/dist/src/components/Icon/index.js +2 -0
- package/dist/src/components/Icon/index.js.map +1 -0
- package/dist/src/components/LoadingIndicator/LoadingIndicator.d.ts +11 -0
- package/dist/src/components/LoadingIndicator/LoadingIndicator.js +6 -0
- package/dist/src/components/LoadingIndicator/LoadingIndicator.js.map +1 -0
- package/dist/src/components/LoadingIndicator/index.d.ts +1 -0
- package/dist/src/components/LoadingIndicator/index.js +2 -0
- package/dist/src/components/LoadingIndicator/index.js.map +1 -0
- package/dist/src/components/Menu/GenericMenu.d.ts +3 -0
- package/dist/src/components/Menu/GenericMenu.js +20 -0
- package/dist/src/components/Menu/GenericMenu.js.map +1 -0
- package/dist/src/components/Menu/MenuToggle.d.ts +12 -0
- package/dist/src/components/Menu/MenuToggle.js +40 -0
- package/dist/src/components/Menu/MenuToggle.js.map +1 -0
- package/dist/src/components/Menu/index.d.ts +2 -0
- package/dist/src/components/Menu/index.js +3 -0
- package/dist/src/components/Menu/index.js.map +1 -0
- package/dist/src/components/Moderation/Restricted.d.ts +19 -0
- package/dist/src/components/Moderation/Restricted.js +13 -0
- package/dist/src/components/Moderation/Restricted.js.map +1 -0
- package/dist/src/components/Moderation/index.d.ts +1 -0
- package/dist/src/components/Moderation/index.js +2 -0
- package/dist/src/components/Moderation/index.js.map +1 -0
- package/dist/src/components/Notification/Notification.d.ts +11 -0
- package/dist/src/components/Notification/Notification.js +25 -0
- package/dist/src/components/Notification/Notification.js.map +1 -0
- package/dist/src/components/Notification/PermissionNotification.d.ts +33 -0
- package/dist/src/components/Notification/PermissionNotification.js +26 -0
- package/dist/src/components/Notification/PermissionNotification.js.map +1 -0
- package/dist/src/components/Notification/SpeakingWhileMutedNotification.d.ts +3 -0
- package/dist/src/components/Notification/SpeakingWhileMutedNotification.js +45 -0
- package/dist/src/components/Notification/SpeakingWhileMutedNotification.js.map +1 -0
- package/dist/src/components/Notification/index.d.ts +3 -0
- package/dist/src/components/Notification/index.js +4 -0
- package/dist/src/components/Notification/index.js.map +1 -0
- package/dist/src/components/Permissions/PermissionRequests.d.ts +8 -0
- package/dist/src/components/Permissions/PermissionRequests.js +109 -0
- package/dist/src/components/Permissions/PermissionRequests.js.map +1 -0
- package/dist/src/components/Permissions/index.d.ts +1 -0
- package/dist/src/components/Permissions/index.js +2 -0
- package/dist/src/components/Permissions/index.js.map +1 -0
- package/dist/src/components/Reaction/Reaction.d.ts +10 -0
- package/dist/src/components/Reaction/Reaction.js +28 -0
- package/dist/src/components/Reaction/Reaction.js.map +1 -0
- package/dist/src/components/Reaction/index.d.ts +1 -0
- package/dist/src/components/Reaction/index.js +2 -0
- package/dist/src/components/Reaction/index.js.map +1 -0
- package/dist/src/components/Search/SearchInput.d.ts +14 -0
- package/dist/src/components/Search/SearchInput.js +34 -0
- package/dist/src/components/Search/SearchInput.js.map +1 -0
- package/dist/src/components/Search/SearchResults.d.ts +14 -0
- package/dist/src/components/Search/SearchResults.js +12 -0
- package/dist/src/components/Search/SearchResults.js.map +1 -0
- package/dist/src/components/Search/hooks/index.d.ts +1 -0
- package/dist/src/components/Search/hooks/index.js +2 -0
- package/dist/src/components/Search/hooks/index.js.map +1 -0
- package/dist/src/components/Search/hooks/useSearch.d.ts +15 -0
- package/dist/src/components/Search/hooks/useSearch.js +39 -0
- package/dist/src/components/Search/hooks/useSearch.js.map +1 -0
- package/dist/src/components/Search/index.d.ts +2 -0
- package/dist/src/components/Search/index.js +3 -0
- package/dist/src/components/Search/index.js.map +1 -0
- package/dist/src/components/StreamCall/CallParticipantsScreenView.d.ts +5 -0
- package/dist/src/components/StreamCall/CallParticipantsScreenView.js +34 -0
- package/dist/src/components/StreamCall/CallParticipantsScreenView.js.map +1 -0
- package/dist/src/components/StreamCall/CallParticipantsView.d.ts +5 -0
- package/dist/src/components/StreamCall/CallParticipantsView.js +11 -0
- package/dist/src/components/StreamCall/CallParticipantsView.js.map +1 -0
- package/dist/src/components/StreamCall/CallStats.d.ts +2 -0
- package/dist/src/components/StreamCall/CallStats.js +69 -0
- package/dist/src/components/StreamCall/CallStats.js.map +1 -0
- package/dist/src/components/StreamCall/CallStatsLatencyChart.d.ts +7 -0
- package/dist/src/components/StreamCall/CallStatsLatencyChart.js +39 -0
- package/dist/src/components/StreamCall/CallStatsLatencyChart.js.map +1 -0
- package/dist/src/components/StreamCall/Stage.d.ts +8 -0
- package/dist/src/components/StreamCall/Stage.js +13 -0
- package/dist/src/components/StreamCall/Stage.js.map +1 -0
- package/dist/src/components/StreamCall/hooks/index.d.ts +1 -0
- package/dist/src/components/StreamCall/hooks/index.js +2 -0
- package/dist/src/components/StreamCall/hooks/index.js.map +1 -0
- package/dist/src/components/StreamCall/hooks/useScrollPosition.d.ts +6 -0
- package/dist/src/components/StreamCall/hooks/useScrollPosition.js +63 -0
- package/dist/src/components/StreamCall/hooks/useScrollPosition.js.map +1 -0
- package/dist/src/components/StreamCall/index.d.ts +3 -0
- package/dist/src/components/StreamCall/index.js +4 -0
- package/dist/src/components/StreamCall/index.js.map +1 -0
- package/dist/src/components/StreamMeeting/StreamMeeting.d.ts +34 -0
- package/dist/src/components/StreamMeeting/StreamMeeting.js +26 -0
- package/dist/src/components/StreamMeeting/StreamMeeting.js.map +1 -0
- package/dist/src/components/StreamMeeting/index.d.ts +1 -0
- package/dist/src/components/StreamMeeting/index.js +2 -0
- package/dist/src/components/StreamMeeting/index.js.map +1 -0
- package/dist/src/components/Tooltip/Tooltip.d.ts +15 -0
- package/dist/src/components/Tooltip/Tooltip.js +22 -0
- package/dist/src/components/Tooltip/Tooltip.js.map +1 -0
- package/dist/src/components/Tooltip/WithTooltip.d.ts +5 -0
- package/dist/src/components/Tooltip/WithTooltip.js +23 -0
- package/dist/src/components/Tooltip/WithTooltip.js.map +1 -0
- package/dist/src/components/Tooltip/hooks/index.d.ts +1 -0
- package/dist/src/components/Tooltip/hooks/index.js +2 -0
- package/dist/src/components/Tooltip/hooks/index.js.map +1 -0
- package/dist/src/components/Tooltip/hooks/useEnterLeaveHandlers.d.ts +6 -0
- package/dist/src/components/Tooltip/hooks/useEnterLeaveHandlers.js +14 -0
- package/dist/src/components/Tooltip/hooks/useEnterLeaveHandlers.js.map +1 -0
- package/dist/src/components/Tooltip/index.d.ts +2 -0
- package/dist/src/components/Tooltip/index.js +3 -0
- package/dist/src/components/Tooltip/index.js.map +1 -0
- package/dist/src/components/Video/VideoPreview.d.ts +13 -0
- package/dist/src/components/Video/VideoPreview.js +70 -0
- package/dist/src/components/Video/VideoPreview.js.map +1 -0
- package/dist/src/components/Video/index.d.ts +4 -0
- package/dist/src/components/Video/index.js +5 -0
- package/dist/src/components/Video/index.js.map +1 -0
- package/dist/src/components/index.d.ts +16 -0
- package/dist/src/components/index.js +17 -0
- package/dist/src/components/index.js.map +1 -0
- package/dist/src/core/components/Audio/Audio.d.ts +6 -0
- package/dist/src/core/components/Audio/Audio.js +39 -0
- package/dist/src/core/components/Audio/Audio.js.map +1 -0
- package/dist/src/core/components/Audio/index.d.ts +1 -0
- package/dist/src/core/components/Audio/index.js +2 -0
- package/dist/src/core/components/Audio/index.js.map +1 -0
- package/dist/src/core/components/CallLayout/PaginatedGridLayout.d.ts +21 -0
- package/dist/src/core/components/CallLayout/PaginatedGridLayout.js +39 -0
- package/dist/src/core/components/CallLayout/PaginatedGridLayout.js.map +1 -0
- package/dist/src/core/components/CallLayout/SpeakerLayout.d.ts +2 -0
- package/dist/src/core/components/CallLayout/SpeakerLayout.js +52 -0
- package/dist/src/core/components/CallLayout/SpeakerLayout.js.map +1 -0
- package/dist/src/core/components/CallLayout/index.d.ts +2 -0
- package/dist/src/core/components/CallLayout/index.js +3 -0
- package/dist/src/core/components/CallLayout/index.js.map +1 -0
- package/dist/src/core/components/ParticipantBox/ParticipantBox.d.ts +48 -0
- package/dist/src/core/components/ParticipantBox/ParticipantBox.js +58 -0
- package/dist/src/core/components/ParticipantBox/ParticipantBox.js.map +1 -0
- package/dist/src/core/components/ParticipantBox/index.d.ts +1 -0
- package/dist/src/core/components/ParticipantBox/index.js +2 -0
- package/dist/src/core/components/ParticipantBox/index.js.map +1 -0
- package/dist/src/core/components/Video/BaseVideo.d.ts +9 -0
- package/dist/src/core/components/Video/BaseVideo.js +54 -0
- package/dist/src/core/components/Video/BaseVideo.js.map +1 -0
- package/dist/src/core/components/Video/Video.d.ts +8 -0
- package/dist/src/core/components/Video/Video.js +151 -0
- package/dist/src/core/components/Video/Video.js.map +1 -0
- package/dist/src/core/components/Video/VideoPlaceholder.d.ts +6 -0
- package/dist/src/core/components/Video/VideoPlaceholder.js +12 -0
- package/dist/src/core/components/Video/VideoPlaceholder.js.map +1 -0
- package/dist/src/core/components/Video/index.d.ts +2 -0
- package/dist/src/core/components/Video/index.js +3 -0
- package/dist/src/core/components/Video/index.js.map +1 -0
- package/dist/src/core/components/index.d.ts +5 -0
- package/dist/src/core/components/index.js +5 -0
- package/dist/src/core/components/index.js.map +1 -0
- package/dist/src/core/contexts/MediaDevicesContext.d.ts +82 -0
- package/dist/src/core/contexts/MediaDevicesContext.js +215 -0
- package/dist/src/core/contexts/MediaDevicesContext.js.map +1 -0
- package/dist/src/core/contexts/index.d.ts +1 -0
- package/dist/src/core/contexts/index.js +2 -0
- package/dist/src/core/contexts/index.js.map +1 -0
- package/dist/src/core/hooks/index.d.ts +2 -0
- package/dist/src/core/hooks/index.js +3 -0
- package/dist/src/core/hooks/index.js.map +1 -0
- package/dist/src/core/hooks/useAudioPublisher.d.ts +12 -0
- package/dist/src/core/hooks/useAudioPublisher.js +89 -0
- package/dist/src/core/hooks/useAudioPublisher.js.map +1 -0
- package/dist/src/core/hooks/useVideoPublisher.d.ts +12 -0
- package/dist/src/core/hooks/useVideoPublisher.js +91 -0
- package/dist/src/core/hooks/useVideoPublisher.js.map +1 -0
- package/dist/src/core/index.d.ts +3 -0
- package/dist/src/core/index.js +4 -0
- package/dist/src/core/index.js.map +1 -0
- package/dist/src/hooks/index.d.ts +2 -0
- package/dist/src/hooks/index.js +3 -0
- package/dist/src/hooks/index.js.map +1 -0
- package/dist/src/hooks/useFloatingUIPreset.d.ts +9 -0
- package/dist/src/hooks/useFloatingUIPreset.js +29 -0
- package/dist/src/hooks/useFloatingUIPreset.js.map +1 -0
- package/dist/src/hooks/useRtcStats.d.ts +11 -0
- package/dist/src/hooks/useRtcStats.js +39 -0
- package/dist/src/hooks/useRtcStats.js.map +1 -0
- package/dist/src/types/components.d.ts +7 -0
- package/dist/src/types/components.js +2 -0
- package/dist/src/types/components.js.map +1 -0
- package/dist/src/types/index.d.ts +1 -0
- package/dist/src/types/index.js +2 -0
- package/dist/src/types/index.js.map +1 -0
- package/index.ts +18 -0
- package/package.json +49 -0
- package/src/components/Avatar/Avatar.tsx +45 -0
- package/src/components/Avatar/index.ts +1 -0
- package/src/components/Button/CompositeButton.tsx +59 -0
- package/src/components/Button/CopyToClipboardButton.tsx +129 -0
- package/src/components/Button/IconButton.tsx +32 -0
- package/src/components/Button/TextButton.tsx +12 -0
- package/src/components/Button/index.ts +4 -0
- package/src/components/CallControls/CallControls.tsx +32 -0
- package/src/components/CallControls/CallStatsButton.tsx +28 -0
- package/src/components/CallControls/CancelCallButton.tsx +28 -0
- package/src/components/CallControls/ReactionsButton.tsx +75 -0
- package/src/components/CallControls/RecordCallButton.tsx +68 -0
- package/src/components/CallControls/ScreenShareButton.tsx +85 -0
- package/src/components/CallControls/ToggleAudioButton.tsx +112 -0
- package/src/components/CallControls/ToggleAudioOutputButton.tsx +21 -0
- package/src/components/CallControls/ToggleCameraButton.tsx +109 -0
- package/src/components/CallControls/ToggleParticipantListButton.tsx +17 -0
- package/src/components/CallControls/index.ts +10 -0
- package/src/components/CallParticipantsList/BlockedUserListing.tsx +38 -0
- package/src/components/CallParticipantsList/CallParticipantListHeader.tsx +29 -0
- package/src/components/CallParticipantsList/CallParticipantListing.tsx +22 -0
- package/src/components/CallParticipantsList/CallParticipantListingItem.tsx +249 -0
- package/src/components/CallParticipantsList/CallParticipantsList.tsx +255 -0
- package/src/components/CallParticipantsList/EmptyParticipantSearchList.tsx +7 -0
- package/src/components/CallParticipantsList/index.ts +3 -0
- package/src/components/CallRecordingList/CallRecordingList.tsx +60 -0
- package/src/components/CallRecordingList/CallRecordingListHeader.tsx +29 -0
- package/src/components/CallRecordingList/CallRecordingListItem.tsx +67 -0
- package/src/components/CallRecordingList/EmptyCallRecordingListing.tsx +11 -0
- package/src/components/CallRecordingList/LoadingCallRecordingListing.tsx +21 -0
- package/src/components/CallRecordingList/index.ts +5 -0
- package/src/components/Debug/DebugParticipantPublishQuality.tsx +62 -0
- package/src/components/Debug/DebugStatsView.tsx +55 -0
- package/src/components/Debug/useIsDebugMode.ts +24 -0
- package/src/components/DeviceSettings/DeviceSelector.tsx +106 -0
- package/src/components/DeviceSettings/DeviceSelectorAudio.tsx +52 -0
- package/src/components/DeviceSettings/DeviceSelectorVideo.tsx +22 -0
- package/src/components/DeviceSettings/DeviceSettings.tsx +39 -0
- package/src/components/DeviceSettings/index.ts +4 -0
- package/src/components/Icon/Icon.tsx +11 -0
- package/src/components/Icon/index.ts +1 -0
- package/src/components/LoadingIndicator/LoadingIndicator.tsx +28 -0
- package/src/components/LoadingIndicator/index.ts +1 -0
- package/src/components/Menu/GenericMenu.tsx +16 -0
- package/src/components/Menu/MenuToggle.tsx +81 -0
- package/src/components/Menu/index.ts +2 -0
- package/src/components/Moderation/Restricted.tsx +38 -0
- package/src/components/Moderation/index.ts +1 -0
- package/src/components/Notification/Notification.tsx +61 -0
- package/src/components/Notification/PermissionNotification.tsx +97 -0
- package/src/components/Notification/SpeakingWhileMutedNotification.tsx +60 -0
- package/src/components/Notification/index.ts +3 -0
- package/src/components/Permissions/PermissionRequests.tsx +182 -0
- package/src/components/Permissions/index.ts +1 -0
- package/src/components/Reaction/Reaction.tsx +48 -0
- package/src/components/Reaction/index.ts +1 -0
- package/src/components/Search/SearchInput.tsx +56 -0
- package/src/components/Search/SearchResults.tsx +40 -0
- package/src/components/Search/hooks/index.ts +1 -0
- package/src/components/Search/hooks/useSearch.ts +52 -0
- package/src/components/Search/index.ts +2 -0
- package/src/components/StreamCall/CallParticipantsScreenView.tsx +126 -0
- package/src/components/StreamCall/CallParticipantsView.tsx +25 -0
- package/src/components/StreamCall/CallStats.tsx +162 -0
- package/src/components/StreamCall/CallStatsLatencyChart.tsx +58 -0
- package/src/components/StreamCall/Stage.tsx +22 -0
- package/src/components/StreamCall/hooks/index.ts +1 -0
- package/src/components/StreamCall/hooks/useScrollPosition.ts +95 -0
- package/src/components/StreamCall/index.ts +4 -0
- package/src/components/StreamMeeting/StreamMeeting.tsx +80 -0
- package/src/components/StreamMeeting/index.ts +1 -0
- package/src/components/Tooltip/Tooltip.tsx +51 -0
- package/src/components/Tooltip/WithTooltip.tsx +39 -0
- package/src/components/Tooltip/hooks/index.ts +1 -0
- package/src/components/Tooltip/hooks/useEnterLeaveHandlers.ts +28 -0
- package/src/components/Tooltip/index.ts +2 -0
- package/src/components/Video/VideoPreview.tsx +127 -0
- package/src/components/Video/index.ts +4 -0
- package/src/components/index.ts +16 -0
- package/src/core/components/Audio/Audio.tsx +42 -0
- package/src/core/components/Audio/index.ts +1 -0
- package/src/core/components/CallLayout/PaginatedGridLayout.tsx +163 -0
- package/src/core/components/CallLayout/SpeakerLayout.tsx +145 -0
- package/src/core/components/CallLayout/index.ts +2 -0
- package/src/core/components/ParticipantBox/ParticipantBox.tsx +248 -0
- package/src/core/components/ParticipantBox/index.ts +1 -0
- package/src/core/components/Video/BaseVideo.tsx +68 -0
- package/src/core/components/Video/Video.tsx +238 -0
- package/src/core/components/Video/VideoPlaceholder.tsx +40 -0
- package/src/core/components/Video/index.ts +2 -0
- package/src/core/components/index.ts +7 -0
- package/src/core/contexts/MediaDevicesContext.tsx +373 -0
- package/src/core/contexts/index.ts +1 -0
- package/src/core/hooks/index.ts +2 -0
- package/src/core/hooks/useAudioPublisher.ts +118 -0
- package/src/core/hooks/useVideoPublisher.ts +120 -0
- package/src/core/index.ts +3 -0
- package/src/hooks/index.ts +2 -0
- package/src/hooks/useFloatingUIPreset.ts +48 -0
- package/src/hooks/useRtcStats.ts +36 -0
- package/src/types/components.ts +7 -0
- package/src/types/index.ts +1 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { useCallback, useEffect } from 'react';
|
|
11
|
+
import { map } from 'rxjs';
|
|
12
|
+
import { CallingState, getAudioStream, OwnCapability, SfuModels, watchForAddedDefaultAudioDevice, watchForDisconnectedAudioDevice, } from '@stream-io/video-client';
|
|
13
|
+
import { useCall, useCallCallingState, useCallState, useLocalParticipant, } from '@stream-io/video-react-bindings';
|
|
14
|
+
/**
|
|
15
|
+
* @internal
|
|
16
|
+
* @category Device Management
|
|
17
|
+
*/
|
|
18
|
+
export const useAudioPublisher = ({ initialAudioMuted, audioDeviceId, }) => {
|
|
19
|
+
const call = useCall();
|
|
20
|
+
const callState = useCallState();
|
|
21
|
+
const callingState = useCallCallingState();
|
|
22
|
+
const participant = useLocalParticipant();
|
|
23
|
+
const { localParticipant$ } = callState;
|
|
24
|
+
const isPublishingAudio = participant === null || participant === void 0 ? void 0 : participant.publishedTracks.includes(SfuModels.TrackType.AUDIO);
|
|
25
|
+
const publishAudioStream = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
26
|
+
if (!call)
|
|
27
|
+
return;
|
|
28
|
+
if (!call.permissionsContext.hasPermission(OwnCapability.SEND_AUDIO)) {
|
|
29
|
+
throw new Error(`No permission to publish audio`);
|
|
30
|
+
}
|
|
31
|
+
try {
|
|
32
|
+
const audioStream = yield getAudioStream(audioDeviceId);
|
|
33
|
+
yield call.publishAudioStream(audioStream);
|
|
34
|
+
}
|
|
35
|
+
catch (e) {
|
|
36
|
+
console.log('Failed to publish audio stream', e);
|
|
37
|
+
}
|
|
38
|
+
}), [audioDeviceId, call]);
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
if (callingState === CallingState.JOINED && !initialAudioMuted) {
|
|
41
|
+
publishAudioStream().catch((e) => {
|
|
42
|
+
console.error('Failed to publish audio stream', e);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}, [callingState, initialAudioMuted, publishAudioStream]);
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
if (!localParticipant$)
|
|
48
|
+
return;
|
|
49
|
+
const subscription = watchForDisconnectedAudioDevice(localParticipant$.pipe(map((p) => p === null || p === void 0 ? void 0 : p.audioDeviceId))).subscribe(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
50
|
+
if (!call)
|
|
51
|
+
return;
|
|
52
|
+
call.setAudioDevice(undefined);
|
|
53
|
+
yield call.stopPublish(SfuModels.TrackType.AUDIO);
|
|
54
|
+
}));
|
|
55
|
+
return () => {
|
|
56
|
+
subscription.unsubscribe();
|
|
57
|
+
};
|
|
58
|
+
}, [localParticipant$, call]);
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
if (!(participant === null || participant === void 0 ? void 0 : participant.audioStream) || !call || !isPublishingAudio)
|
|
61
|
+
return;
|
|
62
|
+
const [track] = participant.audioStream.getAudioTracks();
|
|
63
|
+
const selectedAudioDeviceId = track.getSettings().deviceId;
|
|
64
|
+
const republishDefaultDevice = watchForAddedDefaultAudioDevice().subscribe(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
65
|
+
if (!(call &&
|
|
66
|
+
participant.audioStream &&
|
|
67
|
+
selectedAudioDeviceId === 'default'))
|
|
68
|
+
return;
|
|
69
|
+
// We need to stop the original track first in order
|
|
70
|
+
// we can retrieve the new default device stream
|
|
71
|
+
track.stop();
|
|
72
|
+
const audioStream = yield getAudioStream('default');
|
|
73
|
+
yield call.publishAudioStream(audioStream);
|
|
74
|
+
}));
|
|
75
|
+
const handleTrackEnded = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
76
|
+
if (selectedAudioDeviceId === audioDeviceId) {
|
|
77
|
+
const audioStream = yield getAudioStream(audioDeviceId);
|
|
78
|
+
yield call.publishAudioStream(audioStream);
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
track.addEventListener('ended', handleTrackEnded);
|
|
82
|
+
return () => {
|
|
83
|
+
track.removeEventListener('ended', handleTrackEnded);
|
|
84
|
+
republishDefaultDevice.unsubscribe();
|
|
85
|
+
};
|
|
86
|
+
}, [audioDeviceId, call, participant === null || participant === void 0 ? void 0 : participant.audioStream, isPublishingAudio]);
|
|
87
|
+
return publishAudioStream;
|
|
88
|
+
};
|
|
89
|
+
//# sourceMappingURL=useAudioPublisher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAudioPublisher.js","sourceRoot":"","sources":["../../../../src/core/hooks/useAudioPublisher.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAC3B,OAAO,EACL,YAAY,EACZ,cAAc,EACd,aAAa,EACb,SAAS,EACT,+BAA+B,EAC/B,+BAA+B,GAChC,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,OAAO,EACP,mBAAmB,EACnB,YAAY,EACZ,mBAAmB,GACpB,MAAM,iCAAiC,CAAC;AAUzC;;;GAG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AAM,cAAc,CAAC,SAAS,CAAC,CAAC;YACpD,MAAM,IAAI,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC;QAC7C,CAAC,CAAA,CACF,CAAC;QAEF,MAAM,gBAAgB,GAAG,GAAS,EAAE;YAClC,IAAI,qBAAqB,KAAK,aAAa,EAAE;gBAC3C,MAAM,WAAW,GAAG,MAAM,cAAc,CAAC,aAAa,CAAC,CAAC;gBACxD,MAAM,IAAI,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC;aAC5C;QACH,CAAC,CAAA,CAAC;QAEF,KAAK,CAAC,gBAAgB,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;QAClD,OAAO,GAAG,EAAE;YACV,KAAK,CAAC,mBAAmB,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;YACrD,sBAAsB,CAAC,WAAW,EAAE,CAAC;QACvC,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,aAAa,EAAE,IAAI,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,WAAW,EAAE,iBAAiB,CAAC,CAAC,CAAC;IAEvE,OAAO,kBAAkB,CAAC;AAC5B,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @internal
|
|
3
|
+
*/
|
|
4
|
+
export type VideoPublisherInit = {
|
|
5
|
+
initialVideoMuted?: boolean;
|
|
6
|
+
videoDeviceId?: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* @internal
|
|
10
|
+
* @category Device Management
|
|
11
|
+
*/
|
|
12
|
+
export declare const useVideoPublisher: ({ initialVideoMuted, videoDeviceId, }: VideoPublisherInit) => () => Promise<void>;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { useCallback, useEffect } from 'react';
|
|
11
|
+
import { map } from 'rxjs';
|
|
12
|
+
import { CallingState, getVideoStream, OwnCapability, SfuModels, watchForAddedDefaultVideoDevice, watchForDisconnectedVideoDevice, } from '@stream-io/video-client';
|
|
13
|
+
import { useCall, useCallCallingState, useCallState, useLocalParticipant, } from '@stream-io/video-react-bindings';
|
|
14
|
+
import { useDebugPreferredVideoCodec } from '../../components/Debug/useIsDebugMode';
|
|
15
|
+
/**
|
|
16
|
+
* @internal
|
|
17
|
+
* @category Device Management
|
|
18
|
+
*/
|
|
19
|
+
export const useVideoPublisher = ({ initialVideoMuted, videoDeviceId, }) => {
|
|
20
|
+
const call = useCall();
|
|
21
|
+
const callState = useCallState();
|
|
22
|
+
const callingState = useCallCallingState();
|
|
23
|
+
const participant = useLocalParticipant();
|
|
24
|
+
const { localParticipant$ } = callState;
|
|
25
|
+
const preferredCodec = useDebugPreferredVideoCodec();
|
|
26
|
+
const isPublishingVideo = participant === null || participant === void 0 ? void 0 : participant.publishedTracks.includes(SfuModels.TrackType.VIDEO);
|
|
27
|
+
const publishVideoStream = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
28
|
+
if (!call)
|
|
29
|
+
return;
|
|
30
|
+
if (!call.permissionsContext.hasPermission(OwnCapability.SEND_VIDEO)) {
|
|
31
|
+
throw new Error(`No permission to publish video`);
|
|
32
|
+
}
|
|
33
|
+
try {
|
|
34
|
+
const videoStream = yield getVideoStream(videoDeviceId);
|
|
35
|
+
yield call.publishVideoStream(videoStream, { preferredCodec });
|
|
36
|
+
}
|
|
37
|
+
catch (e) {
|
|
38
|
+
console.log('Failed to publish video stream', e);
|
|
39
|
+
}
|
|
40
|
+
}), [call, preferredCodec, videoDeviceId]);
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
if (callingState === CallingState.JOINED && !initialVideoMuted) {
|
|
43
|
+
publishVideoStream().catch((e) => {
|
|
44
|
+
console.error('Failed to publish video stream', e);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}, [callingState, initialVideoMuted, publishVideoStream]);
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
if (!localParticipant$)
|
|
50
|
+
return;
|
|
51
|
+
const subscription = watchForDisconnectedVideoDevice(localParticipant$.pipe(map((p) => p === null || p === void 0 ? void 0 : p.videoDeviceId))).subscribe(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
52
|
+
if (!call)
|
|
53
|
+
return;
|
|
54
|
+
call.setVideoDevice(undefined);
|
|
55
|
+
yield call.stopPublish(SfuModels.TrackType.VIDEO);
|
|
56
|
+
}));
|
|
57
|
+
return () => {
|
|
58
|
+
subscription.unsubscribe();
|
|
59
|
+
};
|
|
60
|
+
}, [localParticipant$, call]);
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
if (!(participant === null || participant === void 0 ? void 0 : participant.videoStream) || !call || !isPublishingVideo)
|
|
63
|
+
return;
|
|
64
|
+
const [track] = participant.videoStream.getVideoTracks();
|
|
65
|
+
const selectedVideoDeviceId = track.getSettings().deviceId;
|
|
66
|
+
const republishDefaultDevice = watchForAddedDefaultVideoDevice().subscribe(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
67
|
+
if (!(call &&
|
|
68
|
+
participant.videoStream &&
|
|
69
|
+
selectedVideoDeviceId === 'default'))
|
|
70
|
+
return;
|
|
71
|
+
// We need to stop the original track first in order
|
|
72
|
+
// we can retrieve the new default device stream
|
|
73
|
+
track.stop();
|
|
74
|
+
const videoStream = yield getVideoStream('default');
|
|
75
|
+
yield call.publishVideoStream(videoStream);
|
|
76
|
+
}));
|
|
77
|
+
const handleTrackEnded = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
78
|
+
if (selectedVideoDeviceId === videoDeviceId) {
|
|
79
|
+
const videoStream = yield getVideoStream(videoDeviceId);
|
|
80
|
+
yield call.publishVideoStream(videoStream);
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
track.addEventListener('ended', handleTrackEnded);
|
|
84
|
+
return () => {
|
|
85
|
+
track.removeEventListener('ended', handleTrackEnded);
|
|
86
|
+
republishDefaultDevice.unsubscribe();
|
|
87
|
+
};
|
|
88
|
+
}, [videoDeviceId, call, participant === null || participant === void 0 ? void 0 : participant.videoStream, isPublishingVideo]);
|
|
89
|
+
return publishVideoStream;
|
|
90
|
+
};
|
|
91
|
+
//# sourceMappingURL=useVideoPublisher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useVideoPublisher.js","sourceRoot":"","sources":["../../../../src/core/hooks/useVideoPublisher.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAC3B,OAAO,EACL,YAAY,EACZ,cAAc,EACd,aAAa,EACb,SAAS,EACT,+BAA+B,EAC/B,+BAA+B,GAChC,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,OAAO,EACP,mBAAmB,EACnB,YAAY,EACZ,mBAAmB,GACpB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,2BAA2B,EAAE,MAAM,uCAAuC,CAAC;AAUpF;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,EAChC,iBAAiB,EACjB,aAAa,GACM,EAAE,EAAE;IACvB,MAAM,IAAI,GAAG,OAAO,EAAE,CAAC;IACvB,MAAM,SAAS,GAAG,YAAY,EAAE,CAAC;IACjC,MAAM,YAAY,GAAG,mBAAmB,EAAE,CA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BAAgB,GAAG,GAAS,EAAE;YAClC,IAAI,qBAAqB,KAAK,aAAa,EAAE;gBAC3C,MAAM,WAAW,GAAG,MAAM,cAAc,CAAC,aAAa,CAAC,CAAC;gBACxD,MAAM,IAAI,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC;aAC5C;QACH,CAAC,CAAA,CAAC;QAEF,KAAK,CAAC,gBAAgB,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;QAClD,OAAO,GAAG,EAAE;YACV,KAAK,CAAC,mBAAmB,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;YACrD,sBAAsB,CAAC,WAAW,EAAE,CAAC;QACvC,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,aAAa,EAAE,IAAI,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,WAAW,EAAE,iBAAiB,CAAC,CAAC,CAAC;IAEvE,OAAO,kBAAkB,CAAC;AAC5B,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { UseFloatingProps } from '@floating-ui/react';
|
|
2
|
+
export declare const useFloatingUIPreset: ({ placement, strategy, }: Pick<UseFloatingProps, 'placement' | 'strategy'>) => {
|
|
3
|
+
refs: import("@floating-ui/react").ExtendedRefs<import("@floating-ui/react").ReferenceType>;
|
|
4
|
+
x: number | null;
|
|
5
|
+
y: number | null;
|
|
6
|
+
domReference: Element | null;
|
|
7
|
+
floating: HTMLElement | null;
|
|
8
|
+
strategy: import("@floating-ui/react").Strategy;
|
|
9
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { offset, autoUpdate, size, useFloating, shift, } from '@floating-ui/react';
|
|
3
|
+
export const useFloatingUIPreset = ({ placement, strategy, }) => {
|
|
4
|
+
const { refs, x, y, update, elements: { domReference, floating }, } = useFloating({
|
|
5
|
+
placement,
|
|
6
|
+
strategy,
|
|
7
|
+
middleware: [
|
|
8
|
+
offset(10),
|
|
9
|
+
shift(),
|
|
10
|
+
size({
|
|
11
|
+
padding: 10,
|
|
12
|
+
apply({ availableHeight, elements }) {
|
|
13
|
+
Object.assign(elements.floating.style, {
|
|
14
|
+
maxHeight: `${availableHeight}px`,
|
|
15
|
+
});
|
|
16
|
+
},
|
|
17
|
+
}),
|
|
18
|
+
],
|
|
19
|
+
});
|
|
20
|
+
// handle window resizing
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
if (!domReference || !floating)
|
|
23
|
+
return;
|
|
24
|
+
const cleanup = autoUpdate(domReference, floating, update);
|
|
25
|
+
return () => cleanup();
|
|
26
|
+
}, [domReference, floating, update]);
|
|
27
|
+
return { refs, x, y, domReference, floating, strategy };
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=useFloatingUIPreset.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFloatingUIPreset.js","sourceRoot":"","sources":["../../../src/hooks/useFloatingUIPreset.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EACL,MAAM,EACN,UAAU,EACV,IAAI,EACJ,WAAW,EACX,KAAK,GACN,MAAM,oBAAoB,CAAC;AAG5B,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,EAClC,SAAS,EACT,QAAQ,GACyC,EAAE,EAAE;IACrD,MAAM,EACJ,IAAI,EACJ,CAAC,EACD,CAAC,EACD,MAAM,EACN,QAAQ,EAAE,EAAE,YAAY,EAAE,QAAQ,EAAE,GACrC,GAAG,WAAW,CAAC;QACd,SAAS;QACT,QAAQ;QACR,UAAU,EAAE;YACV,MAAM,CAAC,EAAE,CAAC;YACV,KAAK,EAAE;YACP,IAAI,CAAC;gBACH,OAAO,EAAE,EAAE;gBACX,KAAK,CAAC,EAAE,eAAe,EAAE,QAAQ,EAAE;oBACjC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,EAAE;wBACrC,SAAS,EAAE,GAAG,eAAe,IAAI;qBAClC,CAAC,CAAC;gBACL,CAAC;aACF,CAAC;SACH;KACF,CAAC,CAAC;IAEH,yBAAyB;IACzB,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,YAAY,IAAI,CAAC,QAAQ;YAAE,OAAO;QAEvC,MAAM,OAAO,GAAG,UAAU,CAAC,YAAY,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;QAE3D,OAAO,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC;IACzB,CAAC,EAAE,CAAC,YAAY,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;IAErC,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;AAC1D,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Call } from '@stream-io/video-client';
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @param call
|
|
5
|
+
* @param kind
|
|
6
|
+
* @param mediaStream
|
|
7
|
+
* @returns
|
|
8
|
+
*
|
|
9
|
+
* @category Call State
|
|
10
|
+
*/
|
|
11
|
+
export declare const useRtcStats: (call: Call, kind: 'subscriber' | 'publisher', mediaStream?: MediaStream) => Record<string, string> | undefined;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { useEffect, useState } from 'react';
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
* @param call
|
|
14
|
+
* @param kind
|
|
15
|
+
* @param mediaStream
|
|
16
|
+
* @returns
|
|
17
|
+
*
|
|
18
|
+
* @category Call State
|
|
19
|
+
*/
|
|
20
|
+
export const useRtcStats = (call, kind, mediaStream) => {
|
|
21
|
+
const [stats, setStats] = useState();
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
const intervalId = setInterval(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
24
|
+
var _a;
|
|
25
|
+
const [track] = (_a = mediaStream === null || mediaStream === void 0 ? void 0 : mediaStream.getVideoTracks()) !== null && _a !== void 0 ? _a : [];
|
|
26
|
+
const rawStats = yield call.getStats(kind, track);
|
|
27
|
+
const decodedStats = {};
|
|
28
|
+
rawStats === null || rawStats === void 0 ? void 0 : rawStats.forEach((s) => {
|
|
29
|
+
decodedStats[s.id] = s;
|
|
30
|
+
});
|
|
31
|
+
setStats(decodedStats);
|
|
32
|
+
}), 1500);
|
|
33
|
+
return () => {
|
|
34
|
+
clearInterval(intervalId);
|
|
35
|
+
};
|
|
36
|
+
}, [call, kind, mediaStream]);
|
|
37
|
+
return stats;
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=useRtcStats.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRtcStats.js","sourceRoot":"","sources":["../../../src/hooks/useRtcStats.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAG5C;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CACzB,IAAU,EACV,IAAgC,EAChC,WAAyB,EACzB,EAAE;IACF,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,EAA0B,CAAC;IAC7D,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,UAAU,GAAG,WAAW,CAAC,GAAS,EAAE;;YACxC,MAAM,CAAC,KAAK,CAAC,GAAG,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,cAAc,EAAE,mCAAI,EAAE,CAAC;YACpD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;YAClD,MAAM,YAAY,GAA2B,EAAE,CAAC;YAChD,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;gBACtB,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;YACzB,CAAC,CAAC,CAAC;YACH,QAAQ,CAAC,YAAY,CAAC,CAAC;QACzB,CAAC,CAAA,EAAE,IAAI,CAAC,CAAC;QAET,OAAO,GAAG,EAAE;YACV,aAAa,CAAC,UAAU,CAAC,CAAC;QAC5B,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC;IAE9B,OAAO,KAAK,CAAC;AACf,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components.js","sourceRoot":"","sources":["../../../src/types/components.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
|
package/index.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { setSdkInfo, SfuModels } from '@stream-io/video-client';
|
|
2
|
+
|
|
3
|
+
export * from '@stream-io/video-client';
|
|
4
|
+
export * from '@stream-io/video-react-bindings';
|
|
5
|
+
export * from '@stream-io/i18n';
|
|
6
|
+
|
|
7
|
+
export * from './src/core';
|
|
8
|
+
|
|
9
|
+
export * from './src/components';
|
|
10
|
+
export * from './src/types';
|
|
11
|
+
|
|
12
|
+
// TODO: set valid version
|
|
13
|
+
setSdkInfo({
|
|
14
|
+
type: SfuModels.SdkType.REACT,
|
|
15
|
+
major: '0',
|
|
16
|
+
minor: '0',
|
|
17
|
+
patch: '0',
|
|
18
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@stream-io/video-react-sdk",
|
|
3
|
+
"packageManager": "yarn@3.2.4",
|
|
4
|
+
"main": "./dist/index.js",
|
|
5
|
+
"types": "./dist/index.d.ts",
|
|
6
|
+
"license": "See license in LICENSE",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"clean": "rimraf dist",
|
|
9
|
+
"start": "tsc --project tsconfig.json --watch",
|
|
10
|
+
"build": "tsc --project tsconfig.production.json",
|
|
11
|
+
"copy-css": "cp -r ../../node_modules/@stream-io/video-styling/dist/ dist",
|
|
12
|
+
"generate-docs": "../../scripts/generate-docs.sh React @stream-io/video-react-sdk react-sdk",
|
|
13
|
+
"start:docs": "npx stream-chat-docusaurus -s"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"src",
|
|
18
|
+
"index.ts",
|
|
19
|
+
"package.json",
|
|
20
|
+
"README.md",
|
|
21
|
+
"LICENSE",
|
|
22
|
+
"CHANGELOG.md"
|
|
23
|
+
],
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@floating-ui/react": "^0.22.0",
|
|
26
|
+
"@nivo/core": "^0.80.0",
|
|
27
|
+
"@nivo/line": "^0.80.0",
|
|
28
|
+
"@stream-io/i18n": "^0.0.1-alpha.5",
|
|
29
|
+
"@stream-io/video-client": "^0.0.1-alpha.124",
|
|
30
|
+
"@stream-io/video-react-bindings": "^0.0.1-alpha.8",
|
|
31
|
+
"clsx": "^1.2.1",
|
|
32
|
+
"rxjs": "~7.5.7"
|
|
33
|
+
},
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"react": "^18.0.0",
|
|
36
|
+
"react-dom": "^18.0.0"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@stream-io/video-styling": "^0.0.1-alpha.3",
|
|
40
|
+
"@types/rimraf": "^3.0.2",
|
|
41
|
+
"react": "^18.2.0",
|
|
42
|
+
"react-dom": "^18.2.0",
|
|
43
|
+
"replace-in-file": "^6.3.5",
|
|
44
|
+
"rimraf": "^3.0.2",
|
|
45
|
+
"typedoc": "^0.23.24",
|
|
46
|
+
"typescript": "^4.9.5"
|
|
47
|
+
},
|
|
48
|
+
"version": "0.0.1-alpha.9"
|
|
49
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { CSSProperties, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
export type AvatarData = {
|
|
4
|
+
imageSrc?: string;
|
|
5
|
+
name?: string;
|
|
6
|
+
style?: CSSProperties & Record<string, string | number>;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export type AvatarProps = AvatarData;
|
|
10
|
+
|
|
11
|
+
export const Avatar = ({ imageSrc, name, style }: AvatarProps) => {
|
|
12
|
+
const [error, setError] = useState(false);
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<>
|
|
16
|
+
{(!imageSrc || error) && name && (
|
|
17
|
+
<AvatarFallback style={style} names={[name]} />
|
|
18
|
+
)}
|
|
19
|
+
{imageSrc && !error && (
|
|
20
|
+
<img
|
|
21
|
+
onError={() => setError(true)}
|
|
22
|
+
alt="avatar"
|
|
23
|
+
className="str-video__avatar"
|
|
24
|
+
src={imageSrc}
|
|
25
|
+
style={style}
|
|
26
|
+
/>
|
|
27
|
+
)}
|
|
28
|
+
</>
|
|
29
|
+
);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
type AvatarFallbackProps = {
|
|
33
|
+
names: string[];
|
|
34
|
+
style?: CSSProperties & Record<string, string | number>;
|
|
35
|
+
};
|
|
36
|
+
export const AvatarFallback = ({ names, style }: AvatarFallbackProps) => {
|
|
37
|
+
return (
|
|
38
|
+
<div className="str-video__avatar--initials-fallback" style={style}>
|
|
39
|
+
<div>
|
|
40
|
+
{names[0][0]}
|
|
41
|
+
{names[1]?.[0]}
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
);
|
|
45
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Avatar';
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import clsx from 'clsx';
|
|
2
|
+
import { MenuToggle, ToggleMenuButtonProps } from '../Menu';
|
|
3
|
+
import {
|
|
4
|
+
ComponentType,
|
|
5
|
+
forwardRef,
|
|
6
|
+
isValidElement,
|
|
7
|
+
PropsWithChildren,
|
|
8
|
+
} from 'react';
|
|
9
|
+
import { IconButton } from './IconButton';
|
|
10
|
+
import { Placement } from '@floating-ui/react';
|
|
11
|
+
|
|
12
|
+
export type IconButtonWithMenuProps = PropsWithChildren<{
|
|
13
|
+
active?: boolean;
|
|
14
|
+
Menu?: ComponentType | JSX.Element;
|
|
15
|
+
caption?: string;
|
|
16
|
+
menuPlacement?: Placement;
|
|
17
|
+
}>;
|
|
18
|
+
|
|
19
|
+
const isComponentType = (
|
|
20
|
+
elementOrComponent: ComponentType | JSX.Element,
|
|
21
|
+
): elementOrComponent is ComponentType => {
|
|
22
|
+
return !isValidElement(elementOrComponent);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const CompositeButton = forwardRef<
|
|
26
|
+
HTMLDivElement,
|
|
27
|
+
IconButtonWithMenuProps
|
|
28
|
+
>(({ caption, children, active, Menu, menuPlacement }, ref) => {
|
|
29
|
+
return (
|
|
30
|
+
<div className="str-video__composite-button" ref={ref}>
|
|
31
|
+
<div
|
|
32
|
+
className={clsx('str-video__composite-button__button-group', {
|
|
33
|
+
'str-video__composite-button__button-group--active': active,
|
|
34
|
+
})}
|
|
35
|
+
>
|
|
36
|
+
{children}
|
|
37
|
+
{Menu && (
|
|
38
|
+
<MenuToggle placement={menuPlacement} ToggleButton={ToggleMenuButton}>
|
|
39
|
+
{isComponentType(Menu) ? <Menu /> : Menu}
|
|
40
|
+
</MenuToggle>
|
|
41
|
+
)}
|
|
42
|
+
</div>
|
|
43
|
+
{caption && (
|
|
44
|
+
<div className="str-video__composite-button__caption">{caption}</div>
|
|
45
|
+
)}
|
|
46
|
+
</div>
|
|
47
|
+
);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const ToggleMenuButton = forwardRef<HTMLButtonElement, ToggleMenuButtonProps>(
|
|
51
|
+
({ menuShown }, ref) => (
|
|
52
|
+
<IconButton
|
|
53
|
+
className={'str-video__menu-toggle-button'}
|
|
54
|
+
icon={menuShown ? 'caret-down' : 'caret-up'}
|
|
55
|
+
title="Toggle device menu"
|
|
56
|
+
ref={ref}
|
|
57
|
+
/>
|
|
58
|
+
),
|
|
59
|
+
);
|