@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,162 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
AggregatedStatsReport,
|
|
4
|
+
CallStatsReport,
|
|
5
|
+
} from '@stream-io/video-client';
|
|
6
|
+
import { useCurrentCallStatsReport } from '@stream-io/video-react-bindings';
|
|
7
|
+
import { CallStatsLatencyChart } from './CallStatsLatencyChart';
|
|
8
|
+
|
|
9
|
+
export const CallStats = () => {
|
|
10
|
+
const [latencyBuffer, setLatencyBuffer] = useState<
|
|
11
|
+
Array<{ x: number; y: number }>
|
|
12
|
+
>(() => {
|
|
13
|
+
const now = Date.now();
|
|
14
|
+
return Array.from({ length: 20 }, (_, i) => ({ x: now + i, y: 0 }));
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const [publishBitrate, setPublishBitrate] = useState('-');
|
|
18
|
+
const [subscribeBitrate, setSubscribeBitrate] = useState('-');
|
|
19
|
+
const previousStats = useRef<CallStatsReport>();
|
|
20
|
+
const callStatsReport = useCurrentCallStatsReport();
|
|
21
|
+
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (!callStatsReport) return;
|
|
24
|
+
if (!previousStats.current) {
|
|
25
|
+
previousStats.current = callStatsReport;
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const previousCallStatsReport = previousStats.current;
|
|
29
|
+
setPublishBitrate(() => {
|
|
30
|
+
return calculatePublishBitrate(previousCallStatsReport, callStatsReport);
|
|
31
|
+
});
|
|
32
|
+
setSubscribeBitrate(() => {
|
|
33
|
+
return calculateSubscribeBitrate(
|
|
34
|
+
previousCallStatsReport,
|
|
35
|
+
callStatsReport,
|
|
36
|
+
);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
setLatencyBuffer((latencyBuf) => {
|
|
40
|
+
const newLatencyBuffer = latencyBuf.slice(-19);
|
|
41
|
+
newLatencyBuffer.push({
|
|
42
|
+
x: callStatsReport.timestamp,
|
|
43
|
+
y: callStatsReport.publisherStats.averageRoundTripTimeInMs,
|
|
44
|
+
});
|
|
45
|
+
return newLatencyBuffer;
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
previousStats.current = callStatsReport;
|
|
49
|
+
}, [callStatsReport]);
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<div className="str-video__call-stats">
|
|
53
|
+
{callStatsReport && (
|
|
54
|
+
<>
|
|
55
|
+
<h3>Call Latency</h3>
|
|
56
|
+
<CallStatsLatencyChart values={latencyBuffer} />
|
|
57
|
+
|
|
58
|
+
<h3>Call performance</h3>
|
|
59
|
+
<div className="str-video__call-stats__card-container">
|
|
60
|
+
<StatCard label="Region" value={callStatsReport.datacenter} />
|
|
61
|
+
<StatCard
|
|
62
|
+
label="Latency"
|
|
63
|
+
value={`${callStatsReport.publisherStats.averageRoundTripTimeInMs} ms.`}
|
|
64
|
+
/>
|
|
65
|
+
<StatCard
|
|
66
|
+
label="Receive jitter"
|
|
67
|
+
value={`${callStatsReport.subscriberStats.averageJitterInMs} ms.`}
|
|
68
|
+
/>
|
|
69
|
+
<StatCard
|
|
70
|
+
label="Publish jitter"
|
|
71
|
+
value={`${callStatsReport.publisherStats.averageJitterInMs} ms.`}
|
|
72
|
+
/>
|
|
73
|
+
<StatCard
|
|
74
|
+
label="Publish resolution"
|
|
75
|
+
value={toFrameSize(callStatsReport.publisherStats)}
|
|
76
|
+
/>
|
|
77
|
+
<StatCard
|
|
78
|
+
label="Publish quality drop reason"
|
|
79
|
+
value={callStatsReport.publisherStats.qualityLimitationReasons}
|
|
80
|
+
/>
|
|
81
|
+
<StatCard
|
|
82
|
+
label="Receiving resolution"
|
|
83
|
+
value={toFrameSize(callStatsReport.subscriberStats)}
|
|
84
|
+
/>
|
|
85
|
+
<StatCard
|
|
86
|
+
label="Receive quality drop reason"
|
|
87
|
+
value={callStatsReport.subscriberStats.qualityLimitationReasons}
|
|
88
|
+
/>
|
|
89
|
+
<StatCard label="Publish bitrate" value={publishBitrate} />
|
|
90
|
+
<StatCard label="Receiving bitrate" value={subscribeBitrate} />
|
|
91
|
+
</div>
|
|
92
|
+
</>
|
|
93
|
+
)}
|
|
94
|
+
</div>
|
|
95
|
+
);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const StatCard = (props: { label: string; value: string }) => {
|
|
99
|
+
const { label, value } = props;
|
|
100
|
+
return (
|
|
101
|
+
<div className="str-video__call-stats__card">
|
|
102
|
+
<div className="str-video__call-stats__card_label">{label}</div>
|
|
103
|
+
<div className="str-video__call-stats__card_value">{value}</div>
|
|
104
|
+
</div>
|
|
105
|
+
);
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const toFrameSize = (stats: AggregatedStatsReport) => {
|
|
109
|
+
const {
|
|
110
|
+
highestFrameWidth: w,
|
|
111
|
+
highestFrameHeight: h,
|
|
112
|
+
highestFramesPerSecond: fps,
|
|
113
|
+
} = stats;
|
|
114
|
+
let size = `-`;
|
|
115
|
+
if (w && h) {
|
|
116
|
+
size = `${w}x${h}`;
|
|
117
|
+
if (fps) {
|
|
118
|
+
size += `@${fps}fps.`;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return size;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
const calculatePublishBitrate = (
|
|
125
|
+
previousCallStatsReport: CallStatsReport,
|
|
126
|
+
callStatsReport: CallStatsReport,
|
|
127
|
+
) => {
|
|
128
|
+
const {
|
|
129
|
+
publisherStats: {
|
|
130
|
+
totalBytesSent: previousTotalBytesSent,
|
|
131
|
+
timestamp: previousTimestamp,
|
|
132
|
+
},
|
|
133
|
+
} = previousCallStatsReport;
|
|
134
|
+
|
|
135
|
+
const {
|
|
136
|
+
publisherStats: { totalBytesSent, timestamp },
|
|
137
|
+
} = callStatsReport;
|
|
138
|
+
|
|
139
|
+
const bytesSent = totalBytesSent - previousTotalBytesSent;
|
|
140
|
+
const timeElapsed = timestamp - previousTimestamp;
|
|
141
|
+
return `${((bytesSent * 8) / timeElapsed).toFixed(2)} kbps`;
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
const calculateSubscribeBitrate = (
|
|
145
|
+
previousCallStatsReport: CallStatsReport,
|
|
146
|
+
callStatsReport: CallStatsReport,
|
|
147
|
+
) => {
|
|
148
|
+
const {
|
|
149
|
+
subscriberStats: {
|
|
150
|
+
totalBytesReceived: previousTotalBytesReceived,
|
|
151
|
+
timestamp: previousTimestamp,
|
|
152
|
+
},
|
|
153
|
+
} = previousCallStatsReport;
|
|
154
|
+
|
|
155
|
+
const {
|
|
156
|
+
subscriberStats: { totalBytesReceived, timestamp },
|
|
157
|
+
} = callStatsReport;
|
|
158
|
+
|
|
159
|
+
const bytesReceived = totalBytesReceived - previousTotalBytesReceived;
|
|
160
|
+
const timeElapsed = timestamp - previousTimestamp;
|
|
161
|
+
return `${((bytesReceived * 8) / timeElapsed).toFixed(2)} kbps`;
|
|
162
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { ResponsiveLine } from '@nivo/line';
|
|
2
|
+
|
|
3
|
+
export const CallStatsLatencyChart = (props: {
|
|
4
|
+
values: Array<{ x: number; y: number }>;
|
|
5
|
+
}) => {
|
|
6
|
+
const { values } = props;
|
|
7
|
+
let max = 0;
|
|
8
|
+
const data = values.map((point) => {
|
|
9
|
+
const { y } = point;
|
|
10
|
+
max = Math.max(max, y);
|
|
11
|
+
return point;
|
|
12
|
+
});
|
|
13
|
+
return (
|
|
14
|
+
<div className="str-video__call-stats-line-chart-container">
|
|
15
|
+
<ResponsiveLine
|
|
16
|
+
colors={{ scheme: 'blues' }}
|
|
17
|
+
data={[
|
|
18
|
+
{
|
|
19
|
+
id: 'Latency',
|
|
20
|
+
data: data,
|
|
21
|
+
},
|
|
22
|
+
]}
|
|
23
|
+
animate={false}
|
|
24
|
+
margin={{ top: 10, right: 5, bottom: 5, left: 30 }}
|
|
25
|
+
enablePoints
|
|
26
|
+
enableGridX={false}
|
|
27
|
+
enableGridY
|
|
28
|
+
enableSlices="x"
|
|
29
|
+
isInteractive
|
|
30
|
+
useMesh={false}
|
|
31
|
+
xScale={{ type: 'point' }}
|
|
32
|
+
yScale={{
|
|
33
|
+
type: 'linear',
|
|
34
|
+
min: 0,
|
|
35
|
+
max: max < 220 ? 220 : max + 30,
|
|
36
|
+
nice: true,
|
|
37
|
+
}}
|
|
38
|
+
theme={{
|
|
39
|
+
axis: {
|
|
40
|
+
ticks: {
|
|
41
|
+
text: {
|
|
42
|
+
fill: '#FCFCFD',
|
|
43
|
+
},
|
|
44
|
+
line: {
|
|
45
|
+
stroke: '#FCFCFD',
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
grid: {
|
|
50
|
+
line: {
|
|
51
|
+
strokeWidth: 0.1,
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
}}
|
|
55
|
+
/>
|
|
56
|
+
</div>
|
|
57
|
+
);
|
|
58
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Call } from '@stream-io/video-client';
|
|
2
|
+
import { useHasOngoingScreenShare } from '@stream-io/video-react-bindings';
|
|
3
|
+
|
|
4
|
+
import { CallParticipantsView } from './CallParticipantsView';
|
|
5
|
+
import { CallParticipantsScreenView } from './CallParticipantsScreenView';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated
|
|
9
|
+
*/
|
|
10
|
+
export const Stage = (props: { call: Call }) => {
|
|
11
|
+
const { call } = props;
|
|
12
|
+
const hasScreenShare = useHasOngoingScreenShare();
|
|
13
|
+
return (
|
|
14
|
+
<div className="str-video__stage">
|
|
15
|
+
{hasScreenShare ? (
|
|
16
|
+
<CallParticipantsScreenView call={call} />
|
|
17
|
+
) : (
|
|
18
|
+
<CallParticipantsView call={call} />
|
|
19
|
+
)}
|
|
20
|
+
</div>
|
|
21
|
+
);
|
|
22
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useScrollPosition';
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
const SCROLL_TRESHOLD = 10;
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Hook which observes element's scroll position and returns text value based on the
|
|
7
|
+
* position of the scrollbar (`top`, `bottom`, `between` and `null` if no scrollbar is available)
|
|
8
|
+
*/
|
|
9
|
+
export const useVerticalScrollPosition = (
|
|
10
|
+
scrollElement: HTMLElement | null,
|
|
11
|
+
treshold: number = SCROLL_TRESHOLD,
|
|
12
|
+
) => {
|
|
13
|
+
const [scrollPosition, setScrollPosition] = useState<
|
|
14
|
+
'top' | 'bottom' | 'between' | null
|
|
15
|
+
>(null);
|
|
16
|
+
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
if (!scrollElement) return;
|
|
19
|
+
|
|
20
|
+
const scrollHandler = () => {
|
|
21
|
+
const element = scrollElement;
|
|
22
|
+
|
|
23
|
+
const hasVerticalScrollbar = element.scrollHeight > element.clientHeight;
|
|
24
|
+
|
|
25
|
+
if (!hasVerticalScrollbar) return setScrollPosition(null);
|
|
26
|
+
|
|
27
|
+
const isAtTheTop = element.scrollTop <= treshold;
|
|
28
|
+
if (isAtTheTop) return setScrollPosition('top');
|
|
29
|
+
|
|
30
|
+
const isAtTheBottom =
|
|
31
|
+
Math.abs(
|
|
32
|
+
element.scrollHeight - element.scrollTop - element.clientHeight,
|
|
33
|
+
) <= treshold;
|
|
34
|
+
|
|
35
|
+
if (isAtTheBottom) return setScrollPosition('bottom');
|
|
36
|
+
|
|
37
|
+
setScrollPosition('between');
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const resizeObserver = new ResizeObserver(scrollHandler);
|
|
41
|
+
resizeObserver.observe(scrollElement);
|
|
42
|
+
|
|
43
|
+
scrollElement.addEventListener('scroll', scrollHandler);
|
|
44
|
+
return () => {
|
|
45
|
+
scrollElement.removeEventListener('scroll', scrollHandler);
|
|
46
|
+
resizeObserver.disconnect();
|
|
47
|
+
};
|
|
48
|
+
}, [scrollElement, treshold]);
|
|
49
|
+
|
|
50
|
+
return scrollPosition;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export const useHorizontalScrollPosition = (
|
|
54
|
+
scrollElement: HTMLElement | null,
|
|
55
|
+
treshold: number = SCROLL_TRESHOLD,
|
|
56
|
+
) => {
|
|
57
|
+
const [scrollPosition, setScrollPosition] = useState<
|
|
58
|
+
'start' | 'end' | 'between' | null
|
|
59
|
+
>(null);
|
|
60
|
+
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
if (!scrollElement) return;
|
|
63
|
+
|
|
64
|
+
const scrollHandler = () => {
|
|
65
|
+
const element = scrollElement;
|
|
66
|
+
|
|
67
|
+
const hasHorizontalScrollbar = element.scrollWidth > element.clientWidth;
|
|
68
|
+
|
|
69
|
+
if (!hasHorizontalScrollbar) return setScrollPosition(null);
|
|
70
|
+
|
|
71
|
+
const isAtTheStart = element.scrollLeft <= treshold;
|
|
72
|
+
if (isAtTheStart) return setScrollPosition('start');
|
|
73
|
+
|
|
74
|
+
const isAtTheEnd =
|
|
75
|
+
Math.abs(
|
|
76
|
+
element.scrollWidth - element.scrollLeft - element.clientWidth,
|
|
77
|
+
) <= treshold;
|
|
78
|
+
|
|
79
|
+
if (isAtTheEnd) return setScrollPosition('end');
|
|
80
|
+
|
|
81
|
+
setScrollPosition('between');
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
const resizeObserver = new ResizeObserver(scrollHandler);
|
|
85
|
+
resizeObserver.observe(scrollElement);
|
|
86
|
+
|
|
87
|
+
scrollElement.addEventListener('scroll', scrollHandler);
|
|
88
|
+
return () => {
|
|
89
|
+
scrollElement.removeEventListener('scroll', scrollHandler);
|
|
90
|
+
resizeObserver.disconnect();
|
|
91
|
+
};
|
|
92
|
+
}, [scrollElement, treshold]);
|
|
93
|
+
|
|
94
|
+
return scrollPosition;
|
|
95
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { PropsWithChildren, useEffect, useState } from 'react';
|
|
2
|
+
import { Call, CallingState, JoinCallRequest } from '@stream-io/video-client';
|
|
3
|
+
import {
|
|
4
|
+
StreamCallProvider,
|
|
5
|
+
useStreamVideoClient,
|
|
6
|
+
} from '@stream-io/video-react-bindings';
|
|
7
|
+
import { MediaDevicesProvider, MediaDevicesProviderProps } from '../../core';
|
|
8
|
+
|
|
9
|
+
type InitWithCallCID = {
|
|
10
|
+
callId: string;
|
|
11
|
+
callType: string;
|
|
12
|
+
call?: never;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
type InitWithCallInstance = {
|
|
16
|
+
call: Call | undefined;
|
|
17
|
+
callId?: never;
|
|
18
|
+
callType?: never;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
type InitStreamMeeting = InitWithCallCID | InitWithCallInstance;
|
|
22
|
+
|
|
23
|
+
export type StreamMeetingProps = InitStreamMeeting & {
|
|
24
|
+
/**
|
|
25
|
+
* If true, the call will be joined automatically.
|
|
26
|
+
* Usually, in the "ring" scenario, this flag should be set to false as
|
|
27
|
+
* the callee should decide whether to join the call or not.
|
|
28
|
+
*
|
|
29
|
+
* @default true.
|
|
30
|
+
*/
|
|
31
|
+
autoJoin?: boolean;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* An optional data to pass when joining the call.
|
|
35
|
+
*/
|
|
36
|
+
data?: JoinCallRequest;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* An optional props to pass to the `MediaDevicesProvider`.
|
|
40
|
+
*/
|
|
41
|
+
mediaDevicesProviderProps?: MediaDevicesProviderProps;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const StreamMeeting = ({
|
|
45
|
+
children,
|
|
46
|
+
callId,
|
|
47
|
+
callType,
|
|
48
|
+
call,
|
|
49
|
+
autoJoin = true,
|
|
50
|
+
data,
|
|
51
|
+
mediaDevicesProviderProps,
|
|
52
|
+
}: PropsWithChildren<StreamMeetingProps>) => {
|
|
53
|
+
const client = useStreamVideoClient();
|
|
54
|
+
const [activeCall, setActiveCall] = useState<Call | undefined>(call);
|
|
55
|
+
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
if (!client) return;
|
|
58
|
+
|
|
59
|
+
if (callId && callType && !activeCall) {
|
|
60
|
+
const newCall = client.call(callType, callId);
|
|
61
|
+
setActiveCall(newCall);
|
|
62
|
+
}
|
|
63
|
+
}, [activeCall, callId, callType, client]);
|
|
64
|
+
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
if (autoJoin && activeCall?.state.callingState === CallingState.IDLE) {
|
|
67
|
+
activeCall.join(data).catch((err) => {
|
|
68
|
+
console.error(`Failed to join call`, err);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}, [activeCall, autoJoin, data]);
|
|
72
|
+
|
|
73
|
+
return (
|
|
74
|
+
<StreamCallProvider call={activeCall}>
|
|
75
|
+
<MediaDevicesProvider {...mediaDevicesProviderProps}>
|
|
76
|
+
{children}
|
|
77
|
+
</MediaDevicesProvider>
|
|
78
|
+
</StreamCallProvider>
|
|
79
|
+
);
|
|
80
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './StreamMeeting';
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { PropsWithChildren, useEffect } from 'react';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { useFloatingUIPreset } from '../../hooks';
|
|
4
|
+
import { Placement } from '@floating-ui/react';
|
|
5
|
+
|
|
6
|
+
export type TooltipProps<T extends HTMLElement> = PropsWithChildren<{
|
|
7
|
+
/** Reference element to which the tooltip should attach to */
|
|
8
|
+
referenceElement: T | null;
|
|
9
|
+
/** Additional class applied to the tooltip root element */
|
|
10
|
+
tooltipClassName?: string;
|
|
11
|
+
/** Popper's modifier (offset) property - [xAxis offset, yAxis offset], default [0, 10] */
|
|
12
|
+
offset?: [number, number];
|
|
13
|
+
/** Popper's placement property defining default position of the tooltip, default 'top' */
|
|
14
|
+
tooltipPlacement?: Placement;
|
|
15
|
+
/** Tells component whether to render its contents */
|
|
16
|
+
visible?: boolean;
|
|
17
|
+
}>;
|
|
18
|
+
|
|
19
|
+
export const Tooltip = <T extends HTMLElement>({
|
|
20
|
+
children,
|
|
21
|
+
referenceElement,
|
|
22
|
+
tooltipClassName,
|
|
23
|
+
tooltipPlacement = 'top',
|
|
24
|
+
visible = false,
|
|
25
|
+
}: TooltipProps<T>) => {
|
|
26
|
+
const { refs, x, y, strategy } = useFloatingUIPreset({
|
|
27
|
+
placement: tooltipPlacement,
|
|
28
|
+
strategy: 'absolute',
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
refs.setReference(referenceElement);
|
|
33
|
+
}, [referenceElement, refs]);
|
|
34
|
+
|
|
35
|
+
if (!visible) return null;
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<div
|
|
39
|
+
className={clsx('str-video__tooltip', tooltipClassName)}
|
|
40
|
+
ref={refs.setFloating}
|
|
41
|
+
style={{
|
|
42
|
+
position: strategy,
|
|
43
|
+
top: y ?? 0,
|
|
44
|
+
left: x ?? 0,
|
|
45
|
+
overflowY: 'auto',
|
|
46
|
+
}}
|
|
47
|
+
>
|
|
48
|
+
{children}
|
|
49
|
+
</div>
|
|
50
|
+
);
|
|
51
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React, { ComponentProps, useState } from 'react';
|
|
2
|
+
import { Tooltip, TooltipProps } from './Tooltip';
|
|
3
|
+
import { useEnterLeaveHandlers } from './hooks';
|
|
4
|
+
|
|
5
|
+
type WithPopupProps = ComponentProps<'div'> &
|
|
6
|
+
Omit<TooltipProps<HTMLDivElement>, 'referenceElement'>;
|
|
7
|
+
|
|
8
|
+
// todo: duplicate of CallParticipantList.tsx#MediaIndicator - refactor to a single component
|
|
9
|
+
export const WithTooltip = ({
|
|
10
|
+
title,
|
|
11
|
+
tooltipClassName,
|
|
12
|
+
tooltipPlacement,
|
|
13
|
+
...props
|
|
14
|
+
}: WithPopupProps) => {
|
|
15
|
+
const { handleMouseEnter, handleMouseLeave, tooltipVisible } =
|
|
16
|
+
useEnterLeaveHandlers<HTMLDivElement>();
|
|
17
|
+
const [tooltipAnchor, setTooltipAnchor] = useState<HTMLDivElement | null>(
|
|
18
|
+
null,
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<>
|
|
23
|
+
<Tooltip
|
|
24
|
+
referenceElement={tooltipAnchor}
|
|
25
|
+
visible={tooltipVisible}
|
|
26
|
+
tooltipClassName={tooltipClassName}
|
|
27
|
+
tooltipPlacement={tooltipPlacement}
|
|
28
|
+
>
|
|
29
|
+
{title || ''}
|
|
30
|
+
</Tooltip>
|
|
31
|
+
<div
|
|
32
|
+
ref={setTooltipAnchor}
|
|
33
|
+
onMouseEnter={handleMouseEnter}
|
|
34
|
+
onMouseLeave={handleMouseLeave}
|
|
35
|
+
{...props}
|
|
36
|
+
/>
|
|
37
|
+
</>
|
|
38
|
+
);
|
|
39
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useEnterLeaveHandlers';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { MouseEventHandler, useCallback, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
export const useEnterLeaveHandlers = <T extends HTMLElement>({
|
|
4
|
+
onMouseEnter,
|
|
5
|
+
onMouseLeave,
|
|
6
|
+
}: Partial<
|
|
7
|
+
Record<'onMouseEnter' | 'onMouseLeave', MouseEventHandler<T>>
|
|
8
|
+
> = {}) => {
|
|
9
|
+
const [tooltipVisible, setTooltipVisible] = useState(false);
|
|
10
|
+
|
|
11
|
+
const handleMouseEnter: MouseEventHandler<T> = useCallback(
|
|
12
|
+
(e) => {
|
|
13
|
+
setTooltipVisible(true);
|
|
14
|
+
onMouseEnter?.(e);
|
|
15
|
+
},
|
|
16
|
+
[onMouseEnter],
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
const handleMouseLeave: MouseEventHandler<T> = useCallback(
|
|
20
|
+
(e) => {
|
|
21
|
+
setTooltipVisible(false);
|
|
22
|
+
onMouseLeave?.(e);
|
|
23
|
+
},
|
|
24
|
+
[onMouseLeave],
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
return { handleMouseEnter, handleMouseLeave, tooltipVisible };
|
|
28
|
+
};
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ComponentType,
|
|
3
|
+
ReactEventHandler,
|
|
4
|
+
useCallback,
|
|
5
|
+
useEffect,
|
|
6
|
+
useState,
|
|
7
|
+
} from 'react';
|
|
8
|
+
import clsx from 'clsx';
|
|
9
|
+
import { disposeOfMediaStream } from '@stream-io/video-client';
|
|
10
|
+
import { BaseVideo } from '../../core/components/Video/BaseVideo';
|
|
11
|
+
import { DEVICE_STATE, useMediaDevices } from '../../core/contexts';
|
|
12
|
+
import { LoadingIndicator } from '../LoadingIndicator';
|
|
13
|
+
|
|
14
|
+
const DefaultDisabledVideoPreview = () => {
|
|
15
|
+
return <div>Video is disabled</div>;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const DefaultNoCameraPreview = () => {
|
|
19
|
+
return <div>No camera found</div>;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
type VideoErrorPreviewProps = {
|
|
23
|
+
message?: string;
|
|
24
|
+
};
|
|
25
|
+
const DefaultVideoErrorPreview = ({ message }: VideoErrorPreviewProps) => {
|
|
26
|
+
return (
|
|
27
|
+
<>
|
|
28
|
+
<div>Error:</div>
|
|
29
|
+
<p>{message || 'Unexpected error happened'}</p>
|
|
30
|
+
</>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export type VideoPreviewProps = {
|
|
35
|
+
mirror?: boolean;
|
|
36
|
+
DisabledVideoPreview?: ComponentType;
|
|
37
|
+
NoCameraPreview?: ComponentType;
|
|
38
|
+
StartingCameraPreview?: ComponentType;
|
|
39
|
+
VideoErrorPreview?: ComponentType<VideoErrorPreviewProps>;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const VideoPreview = ({
|
|
43
|
+
mirror = true,
|
|
44
|
+
DisabledVideoPreview = DefaultDisabledVideoPreview,
|
|
45
|
+
NoCameraPreview = DefaultNoCameraPreview,
|
|
46
|
+
StartingCameraPreview = LoadingIndicator,
|
|
47
|
+
VideoErrorPreview = DefaultVideoErrorPreview,
|
|
48
|
+
}: VideoPreviewProps) => {
|
|
49
|
+
const [stream, setStream] = useState<MediaStream>();
|
|
50
|
+
|
|
51
|
+
const {
|
|
52
|
+
videoDevices,
|
|
53
|
+
selectedVideoDeviceId,
|
|
54
|
+
getVideoStream,
|
|
55
|
+
initialVideoState,
|
|
56
|
+
setInitialVideoState,
|
|
57
|
+
} = useMediaDevices();
|
|
58
|
+
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
if (!initialVideoState.enabled || videoDevices.length === 0) return;
|
|
61
|
+
|
|
62
|
+
getVideoStream(selectedVideoDeviceId)
|
|
63
|
+
.then((s) => {
|
|
64
|
+
setStream((previousStream) => {
|
|
65
|
+
if (previousStream) {
|
|
66
|
+
disposeOfMediaStream(previousStream);
|
|
67
|
+
}
|
|
68
|
+
return s;
|
|
69
|
+
});
|
|
70
|
+
})
|
|
71
|
+
.catch((e) =>
|
|
72
|
+
setInitialVideoState({
|
|
73
|
+
...DEVICE_STATE.error,
|
|
74
|
+
message: (e as Error).message,
|
|
75
|
+
}),
|
|
76
|
+
);
|
|
77
|
+
return () => {
|
|
78
|
+
setStream(undefined);
|
|
79
|
+
};
|
|
80
|
+
}, [
|
|
81
|
+
initialVideoState,
|
|
82
|
+
getVideoStream,
|
|
83
|
+
selectedVideoDeviceId,
|
|
84
|
+
setInitialVideoState,
|
|
85
|
+
videoDevices.length,
|
|
86
|
+
]);
|
|
87
|
+
|
|
88
|
+
useEffect(() => {
|
|
89
|
+
if (initialVideoState.type === 'stopped') {
|
|
90
|
+
setStream(undefined);
|
|
91
|
+
}
|
|
92
|
+
}, [initialVideoState]);
|
|
93
|
+
|
|
94
|
+
const handleOnPlay: ReactEventHandler<HTMLVideoElement> = useCallback(() => {
|
|
95
|
+
setInitialVideoState(DEVICE_STATE.playing);
|
|
96
|
+
}, [setInitialVideoState]);
|
|
97
|
+
|
|
98
|
+
let contents;
|
|
99
|
+
if (initialVideoState.type === 'error') {
|
|
100
|
+
contents = <VideoErrorPreview />;
|
|
101
|
+
} else if (initialVideoState.type === 'stopped' && !videoDevices.length) {
|
|
102
|
+
contents = <NoCameraPreview />;
|
|
103
|
+
} else if (initialVideoState.enabled) {
|
|
104
|
+
const loading = initialVideoState.type === 'starting';
|
|
105
|
+
contents = (
|
|
106
|
+
<>
|
|
107
|
+
{stream && (
|
|
108
|
+
<BaseVideo
|
|
109
|
+
stream={stream}
|
|
110
|
+
className={clsx('str-video__video-preview', {
|
|
111
|
+
'str-video__video-preview--mirror': mirror,
|
|
112
|
+
'str-video__video-preview--loading': loading,
|
|
113
|
+
})}
|
|
114
|
+
onPlay={handleOnPlay}
|
|
115
|
+
/>
|
|
116
|
+
)}
|
|
117
|
+
{loading && <StartingCameraPreview />}
|
|
118
|
+
</>
|
|
119
|
+
);
|
|
120
|
+
} else {
|
|
121
|
+
contents = <DisabledVideoPreview />;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
return (
|
|
125
|
+
<div className={clsx('str-video__video-preview-container')}>{contents}</div>
|
|
126
|
+
);
|
|
127
|
+
};
|