@stream-io/video-react-sdk 0.0.1-alpha.100
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 +101 -0
- package/LICENSE +219 -0
- package/README.md +5 -0
- package/dist/css/styles.css +2244 -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 +13 -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/AcceptCallButton.d.ts +7 -0
- package/dist/src/components/CallControls/AcceptCallButton.js +27 -0
- package/dist/src/components/CallControls/AcceptCallButton.js.map +1 -0
- package/dist/src/components/CallControls/CallControls.d.ts +5 -0
- package/dist/src/components/CallControls/CallControls.js +5 -0
- package/dist/src/components/CallControls/CallControls.js.map +1 -0
- package/dist/src/components/CallControls/CallStatsButton.d.ts +2 -0
- package/dist/src/components/CallControls/CallStatsButton.js +8 -0
- package/dist/src/components/CallControls/CallStatsButton.js.map +1 -0
- package/dist/src/components/CallControls/CancelCallButton.d.ts +7 -0
- package/dist/src/components/CallControls/CancelCallButton.js +27 -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 +32 -0
- package/dist/src/components/CallControls/ReactionsButton.js.map +1 -0
- package/dist/src/components/CallControls/RecordCallButton.d.ts +5 -0
- package/dist/src/components/CallControls/RecordCallButton.js +55 -0
- package/dist/src/components/CallControls/RecordCallButton.js.map +1 -0
- package/dist/src/components/CallControls/ScreenShareButton.d.ts +5 -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 +73 -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/ToggleVideoButton.d.ts +10 -0
- package/dist/src/components/CallControls/ToggleVideoButton.js +70 -0
- package/dist/src/components/CallControls/ToggleVideoButton.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 +18 -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 +16 -0
- package/dist/src/components/CallParticipantsList/CallParticipantListingItem.js +85 -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 +81 -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/CallStats/CallStats.d.ts +6 -0
- package/dist/src/components/CallStats/CallStats.js +69 -0
- package/dist/src/components/CallStats/CallStats.js.map +1 -0
- package/dist/src/components/CallStats/CallStatsLatencyChart.d.ts +7 -0
- package/dist/src/components/CallStats/CallStatsLatencyChart.js +39 -0
- package/dist/src/components/CallStats/CallStatsLatencyChart.js.map +1 -0
- package/dist/src/components/CallStats/index.d.ts +2 -0
- package/dist/src/components/CallStats/index.js +3 -0
- package/dist/src/components/CallStats/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 +51 -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 +20 -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 +11 -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/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 +47 -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/PendingCallPanel/PendingCallControls.d.ts +2 -0
- package/dist/src/components/PendingCallPanel/PendingCallControls.js +13 -0
- package/dist/src/components/PendingCallPanel/PendingCallControls.js.map +1 -0
- package/dist/src/components/PendingCallPanel/PendingCallPanel.d.ts +14 -0
- package/dist/src/components/PendingCallPanel/PendingCallPanel.js +43 -0
- package/dist/src/components/PendingCallPanel/PendingCallPanel.js.map +1 -0
- package/dist/src/components/PendingCallPanel/index.d.ts +2 -0
- package/dist/src/components/PendingCallPanel/index.js +3 -0
- package/dist/src/components/PendingCallPanel/index.js.map +1 -0
- package/dist/src/components/Permissions/PermissionRequests.d.ts +8 -0
- package/dist/src/components/Permissions/PermissionRequests.js +103 -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 +10 -0
- package/dist/src/components/StreamCall/CallParticipantsView.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/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/StreamTheme/StreamTheme.d.ts +5 -0
- package/dist/src/components/StreamTheme/StreamTheme.js +18 -0
- package/dist/src/components/StreamTheme/StreamTheme.js.map +1 -0
- package/dist/src/components/StreamTheme/index.d.ts +1 -0
- package/dist/src/components/StreamTheme/index.js +2 -0
- package/dist/src/components/StreamTheme/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 +28 -0
- package/dist/src/components/Video/VideoPreview.js +75 -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 +17 -0
- package/dist/src/core/components/CallLayout/PaginatedGridLayout.js +38 -0
- package/dist/src/core/components/CallLayout/PaginatedGridLayout.js.map +1 -0
- package/dist/src/core/components/CallLayout/SpeakerLayout.d.ts +8 -0
- package/dist/src/core/components/CallLayout/SpeakerLayout.js +74 -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/ParticipantView/DefaultParticipantViewUI.d.ts +18 -0
- package/dist/src/core/components/ParticipantView/DefaultParticipantViewUI.js +36 -0
- package/dist/src/core/components/ParticipantView/DefaultParticipantViewUI.js.map +1 -0
- package/dist/src/core/components/ParticipantView/ParticipantView.d.ts +79 -0
- package/dist/src/core/components/ParticipantView/ParticipantView.js +33 -0
- package/dist/src/core/components/ParticipantView/ParticipantView.js.map +1 -0
- package/dist/src/core/components/ParticipantView/index.d.ts +2 -0
- package/dist/src/core/components/ParticipantView/index.js +3 -0
- package/dist/src/core/components/ParticipantView/index.js.map +1 -0
- package/dist/src/core/components/StreamCall/StreamCall.d.ts +73 -0
- package/dist/src/core/components/StreamCall/StreamCall.js +60 -0
- package/dist/src/core/components/StreamCall/StreamCall.js.map +1 -0
- package/dist/src/core/components/StreamCall/index.d.ts +1 -0
- package/dist/src/core/components/StreamCall/index.js +2 -0
- package/dist/src/core/components/StreamCall/index.js.map +1 -0
- package/dist/src/core/components/Video/BaseVideo.d.ts +9 -0
- package/dist/src/core/components/Video/BaseVideo.js +48 -0
- package/dist/src/core/components/Video/BaseVideo.js.map +1 -0
- package/dist/src/core/components/Video/DefaultVideoPlaceholder.d.ts +6 -0
- package/dist/src/core/components/Video/DefaultVideoPlaceholder.js +9 -0
- package/dist/src/core/components/Video/DefaultVideoPlaceholder.js.map +1 -0
- package/dist/src/core/components/Video/Video.d.ts +13 -0
- package/dist/src/core/components/Video/Video.js +154 -0
- package/dist/src/core/components/Video/Video.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 +6 -0
- package/dist/src/core/components/index.js +6 -0
- package/dist/src/core/components/index.js.map +1 -0
- package/dist/src/core/contexts/MediaDevicesContext.d.ts +180 -0
- package/dist/src/core/contexts/MediaDevicesContext.js +177 -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 +4 -0
- package/dist/src/core/hooks/index.js +5 -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 +95 -0
- package/dist/src/core/hooks/useAudioPublisher.js.map +1 -0
- package/dist/src/core/hooks/useDevices.d.ts +80 -0
- package/dist/src/core/hooks/useDevices.js +113 -0
- package/dist/src/core/hooks/useDevices.js.map +1 -0
- package/dist/src/core/hooks/useTrackElementVisibility.d.ts +6 -0
- package/dist/src/core/hooks/useTrackElementVisibility.js +27 -0
- package/dist/src/core/hooks/useTrackElementVisibility.js.map +1 -0
- package/dist/src/core/hooks/useVideoPublisher.d.ts +12 -0
- package/dist/src/core/hooks/useVideoPublisher.js +120 -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 +30 -0
- package/dist/src/hooks/useFloatingUIPreset.js.map +1 -0
- package/dist/src/hooks/useScrollPosition.d.ts +6 -0
- package/dist/src/hooks/useScrollPosition.js +63 -0
- package/dist/src/hooks/useScrollPosition.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/dist/src/utilities/applyElementToRef.d.ts +2 -0
- package/dist/src/utilities/applyElementToRef.js +8 -0
- package/dist/src/utilities/applyElementToRef.js.map +1 -0
- package/dist/src/utilities/chunk.d.ts +1 -0
- package/dist/src/utilities/chunk.js +5 -0
- package/dist/src/utilities/chunk.js.map +1 -0
- package/dist/src/utilities/index.d.ts +3 -0
- package/dist/src/utilities/index.js +4 -0
- package/dist/src/utilities/index.js.map +1 -0
- package/dist/src/utilities/isComponentType.d.ts +2 -0
- package/dist/src/utilities/isComponentType.js +7 -0
- package/dist/src/utilities/isComponentType.js.map +1 -0
- package/index.ts +18 -0
- package/package.json +51 -0
- package/src/components/Avatar/Avatar.tsx +45 -0
- package/src/components/Avatar/index.ts +1 -0
- package/src/components/Button/CompositeButton.tsx +50 -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/AcceptCallButton.tsx +36 -0
- package/src/components/CallControls/CallControls.tsx +26 -0
- package/src/components/CallControls/CallStatsButton.tsx +20 -0
- package/src/components/CallControls/CancelCallButton.tsx +36 -0
- package/src/components/CallControls/ReactionsButton.tsx +74 -0
- package/src/components/CallControls/RecordCallButton.tsx +73 -0
- package/src/components/CallControls/ScreenShareButton.tsx +84 -0
- package/src/components/CallControls/ToggleAudioButton.tsx +123 -0
- package/src/components/CallControls/ToggleAudioOutputButton.tsx +21 -0
- package/src/components/CallControls/ToggleVideoButton.tsx +116 -0
- package/src/components/CallControls/index.ts +10 -0
- package/src/components/CallParticipantsList/BlockedUserListing.tsx +37 -0
- package/src/components/CallParticipantsList/CallParticipantListHeader.tsx +29 -0
- package/src/components/CallParticipantsList/CallParticipantListing.tsx +22 -0
- package/src/components/CallParticipantsList/CallParticipantListingItem.tsx +273 -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/CallStats/CallStats.tsx +162 -0
- package/src/components/CallStats/CallStatsLatencyChart.tsx +58 -0
- package/src/components/CallStats/index.ts +2 -0
- package/src/components/Debug/DebugParticipantPublishQuality.tsx +62 -0
- package/src/components/Debug/DebugStatsView.tsx +108 -0
- package/src/components/Debug/useIsDebugMode.ts +24 -0
- package/src/components/DeviceSettings/DeviceSelector.tsx +106 -0
- package/src/components/DeviceSettings/DeviceSelectorAudio.tsx +57 -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/Notification/Notification.tsx +61 -0
- package/src/components/Notification/PermissionNotification.tsx +97 -0
- package/src/components/Notification/SpeakingWhileMutedNotification.tsx +61 -0
- package/src/components/Notification/index.ts +3 -0
- package/src/components/PendingCallPanel/PendingCallControls.tsx +27 -0
- package/src/components/PendingCallPanel/PendingCallPanel.tsx +93 -0
- package/src/components/PendingCallPanel/index.ts +2 -0
- package/src/components/Permissions/PermissionRequests.tsx +176 -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 +125 -0
- package/src/components/StreamCall/CallParticipantsView.tsx +24 -0
- package/src/components/StreamCall/Stage.tsx +22 -0
- package/src/components/StreamCall/index.ts +4 -0
- package/src/components/StreamTheme/StreamTheme.tsx +19 -0
- package/src/components/StreamTheme/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 +152 -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 +159 -0
- package/src/core/components/CallLayout/SpeakerLayout.tsx +231 -0
- package/src/core/components/CallLayout/index.ts +2 -0
- package/src/core/components/ParticipantView/DefaultParticipantViewUI.tsx +160 -0
- package/src/core/components/ParticipantView/ParticipantView.tsx +156 -0
- package/src/core/components/ParticipantView/index.ts +2 -0
- package/src/core/components/StreamCall/StreamCall.tsx +157 -0
- package/src/core/components/StreamCall/index.ts +1 -0
- package/src/core/components/Video/BaseVideo.tsx +53 -0
- package/src/core/components/Video/DefaultVideoPlaceholder.tsx +36 -0
- package/src/core/components/Video/Video.tsx +252 -0
- package/src/core/components/Video/index.ts +2 -0
- package/src/core/components/index.ts +8 -0
- package/src/core/contexts/MediaDevicesContext.tsx +416 -0
- package/src/core/contexts/index.ts +1 -0
- package/src/core/hooks/index.ts +4 -0
- package/src/core/hooks/useAudioPublisher.ts +124 -0
- package/src/core/hooks/useDevices.ts +161 -0
- package/src/core/hooks/useTrackElementVisibility.ts +44 -0
- package/src/core/hooks/useVideoPublisher.ts +152 -0
- package/src/core/index.ts +3 -0
- package/src/hooks/index.ts +2 -0
- package/src/hooks/useFloatingUIPreset.ts +50 -0
- package/src/hooks/useScrollPosition.ts +95 -0
- package/src/types/components.ts +7 -0
- package/src/types/index.ts +1 -0
- package/src/utilities/applyElementToRef.ts +12 -0
- package/src/utilities/chunk.ts +8 -0
- package/src/utilities/index.ts +3 -0
- package/src/utilities/isComponentType.ts +9 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
import { Call, SfuModels } from '@stream-io/video-client';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
useLocalParticipant,
|
|
6
|
+
useParticipants,
|
|
7
|
+
} from '@stream-io/video-react-bindings';
|
|
8
|
+
import { ParticipantView, DefaultParticipantViewUI } from '../../core';
|
|
9
|
+
import { Video } from '../Video';
|
|
10
|
+
|
|
11
|
+
import { useVerticalScrollPosition } from '../../hooks';
|
|
12
|
+
import { IconButton } from '../Button';
|
|
13
|
+
|
|
14
|
+
export const CallParticipantsScreenView = (props: { call: Call }) => {
|
|
15
|
+
const { call } = props;
|
|
16
|
+
const localParticipant = useLocalParticipant();
|
|
17
|
+
const allParticipants = useParticipants();
|
|
18
|
+
const firstScreenSharingParticipant = allParticipants.find((p) =>
|
|
19
|
+
p.publishedTracks.includes(SfuModels.TrackType.SCREEN_SHARE),
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
const [scrollWrapper, setScrollWrapper] = useState<HTMLDivElement | null>(
|
|
23
|
+
null,
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
if (!scrollWrapper) return;
|
|
28
|
+
|
|
29
|
+
const cleanup = call.viewportTracker.setViewport(scrollWrapper);
|
|
30
|
+
|
|
31
|
+
return () => cleanup();
|
|
32
|
+
}, [scrollWrapper, call.viewportTracker]);
|
|
33
|
+
|
|
34
|
+
const scrollUpClickHandler = () => {
|
|
35
|
+
scrollWrapper?.scrollBy({ top: -150, behavior: 'smooth' });
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const scrollDownClickHandler = () => {
|
|
39
|
+
scrollWrapper?.scrollBy({ top: 150, behavior: 'smooth' });
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const scrollPosition = useVerticalScrollPosition(scrollWrapper);
|
|
43
|
+
|
|
44
|
+
const [overlayVisible, setOverlayVisible] = useState(
|
|
45
|
+
() =>
|
|
46
|
+
firstScreenSharingParticipant?.sessionId === localParticipant?.sessionId,
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<div className="str-video__call-participants-screen-view">
|
|
51
|
+
<div className="str-video__call-participants-screen-view__screen">
|
|
52
|
+
{firstScreenSharingParticipant && (
|
|
53
|
+
<>
|
|
54
|
+
<span className="str-video__call-participants-screen-view__screen__presenter">
|
|
55
|
+
{firstScreenSharingParticipant.name ||
|
|
56
|
+
firstScreenSharingParticipant.userId}{' '}
|
|
57
|
+
is presenting their screen.
|
|
58
|
+
</span>
|
|
59
|
+
<div className="str-video__call-participants-screen-view__wrapper">
|
|
60
|
+
<Video
|
|
61
|
+
className="str-video__screen-share"
|
|
62
|
+
participant={firstScreenSharingParticipant}
|
|
63
|
+
kind="screen"
|
|
64
|
+
autoPlay
|
|
65
|
+
muted
|
|
66
|
+
/>
|
|
67
|
+
{overlayVisible && (
|
|
68
|
+
<div className="str-video__call-participants-screen-view__overlay">
|
|
69
|
+
<div>
|
|
70
|
+
<div>
|
|
71
|
+
To avoid an infinity mirror, don't share your entire
|
|
72
|
+
screen or browser window.
|
|
73
|
+
</div>
|
|
74
|
+
<div>
|
|
75
|
+
Share just a single tab or a different window instead.
|
|
76
|
+
</div>
|
|
77
|
+
</div>
|
|
78
|
+
<button
|
|
79
|
+
type="button"
|
|
80
|
+
onClick={() => {
|
|
81
|
+
setOverlayVisible(false);
|
|
82
|
+
}}
|
|
83
|
+
>
|
|
84
|
+
Got it
|
|
85
|
+
</button>
|
|
86
|
+
</div>
|
|
87
|
+
)}
|
|
88
|
+
</div>
|
|
89
|
+
</>
|
|
90
|
+
)}
|
|
91
|
+
</div>
|
|
92
|
+
<div className="str-video__call-participants-screen-view__buttons-wrapper">
|
|
93
|
+
{scrollPosition && scrollPosition !== 'top' && (
|
|
94
|
+
<IconButton
|
|
95
|
+
onClick={scrollUpClickHandler}
|
|
96
|
+
icon="caret-up"
|
|
97
|
+
className="str-video__call-participants-screen-view__button-up"
|
|
98
|
+
/>
|
|
99
|
+
)}
|
|
100
|
+
<div
|
|
101
|
+
ref={setScrollWrapper}
|
|
102
|
+
className="str-video__call-participants-screen-view__participants-wrapper"
|
|
103
|
+
>
|
|
104
|
+
<div className="str-video__call-participants-screen-view__participants">
|
|
105
|
+
{allParticipants.map((participant) => (
|
|
106
|
+
<ParticipantView
|
|
107
|
+
key={participant.sessionId}
|
|
108
|
+
participant={participant}
|
|
109
|
+
sinkId={localParticipant?.audioOutputDeviceId}
|
|
110
|
+
ParticipantViewUI={DefaultParticipantViewUI}
|
|
111
|
+
/>
|
|
112
|
+
))}
|
|
113
|
+
</div>
|
|
114
|
+
</div>
|
|
115
|
+
{scrollPosition && scrollPosition !== 'bottom' && (
|
|
116
|
+
<IconButton
|
|
117
|
+
onClick={scrollDownClickHandler}
|
|
118
|
+
icon="caret-down"
|
|
119
|
+
className="str-video__call-participants-screen-view__button-down"
|
|
120
|
+
/>
|
|
121
|
+
)}
|
|
122
|
+
</div>
|
|
123
|
+
</div>
|
|
124
|
+
);
|
|
125
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Call } from '@stream-io/video-client';
|
|
2
|
+
import { DefaultParticipantViewUI, ParticipantView } from '../../core';
|
|
3
|
+
import {
|
|
4
|
+
useLocalParticipant,
|
|
5
|
+
useParticipants,
|
|
6
|
+
} from '@stream-io/video-react-bindings';
|
|
7
|
+
|
|
8
|
+
export const CallParticipantsView = (props: { call: Call }) => {
|
|
9
|
+
const localParticipant = useLocalParticipant();
|
|
10
|
+
const participants = useParticipants();
|
|
11
|
+
const grid = `str-video__grid-${participants.length || 1}`;
|
|
12
|
+
return (
|
|
13
|
+
<div className={`str-video__call-participants-view ${grid}`}>
|
|
14
|
+
{participants.map((participant) => (
|
|
15
|
+
<ParticipantView
|
|
16
|
+
key={participant.sessionId}
|
|
17
|
+
participant={participant}
|
|
18
|
+
sinkId={localParticipant?.audioOutputDeviceId}
|
|
19
|
+
ParticipantViewUI={DefaultParticipantViewUI}
|
|
20
|
+
/>
|
|
21
|
+
))}
|
|
22
|
+
</div>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
@@ -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,19 @@
|
|
|
1
|
+
import { ElementType, HTMLProps, PropsWithChildren } from 'react';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
|
|
4
|
+
export type StreamThemeProps = HTMLProps<HTMLElement> & {
|
|
5
|
+
as?: ElementType;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export const StreamTheme = ({
|
|
9
|
+
as: Component = 'div',
|
|
10
|
+
className,
|
|
11
|
+
children,
|
|
12
|
+
...props
|
|
13
|
+
}: PropsWithChildren<StreamThemeProps>) => {
|
|
14
|
+
return (
|
|
15
|
+
<Component {...props} className={clsx('str-video', className)}>
|
|
16
|
+
{children}
|
|
17
|
+
</Component>
|
|
18
|
+
);
|
|
19
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './StreamTheme';
|
|
@@ -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,152 @@
|
|
|
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';
|
|
11
|
+
import {
|
|
12
|
+
DEVICE_STATE,
|
|
13
|
+
useMediaDevices,
|
|
14
|
+
useOnUnavailableVideoDevices,
|
|
15
|
+
useVideoDevices,
|
|
16
|
+
} from '../../core';
|
|
17
|
+
import { LoadingIndicator } from '../LoadingIndicator';
|
|
18
|
+
|
|
19
|
+
const DefaultDisabledVideoPreview = () => {
|
|
20
|
+
return <div>Video is disabled</div>;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const DefaultNoCameraPreview = () => {
|
|
24
|
+
return <div>No camera found</div>;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
type VideoErrorPreviewProps = {
|
|
28
|
+
message?: string;
|
|
29
|
+
};
|
|
30
|
+
const DefaultVideoErrorPreview = ({ message }: VideoErrorPreviewProps) => {
|
|
31
|
+
return (
|
|
32
|
+
<>
|
|
33
|
+
<div>Error:</div>
|
|
34
|
+
<p>{message || 'Unexpected error happened'}</p>
|
|
35
|
+
</>
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export type VideoPreviewProps = {
|
|
40
|
+
/**
|
|
41
|
+
* Enforces mirroring of the video on the X axis. Defaults to true.
|
|
42
|
+
*/
|
|
43
|
+
mirror?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Component rendered when user turns off the video.
|
|
46
|
+
*/
|
|
47
|
+
DisabledVideoPreview?: ComponentType;
|
|
48
|
+
/**
|
|
49
|
+
* Component rendered when no camera devices are available.
|
|
50
|
+
*/
|
|
51
|
+
NoCameraPreview?: ComponentType;
|
|
52
|
+
/**
|
|
53
|
+
* Component rendered above the BaseVideo until the video is ready (meaning until the play event is emitted).
|
|
54
|
+
*/
|
|
55
|
+
StartingCameraPreview?: ComponentType;
|
|
56
|
+
/**
|
|
57
|
+
* Component rendered when the video stream could not be retrieved.
|
|
58
|
+
*/
|
|
59
|
+
VideoErrorPreview?: ComponentType<VideoErrorPreviewProps>;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export const VideoPreview = ({
|
|
63
|
+
mirror = true,
|
|
64
|
+
DisabledVideoPreview = DefaultDisabledVideoPreview,
|
|
65
|
+
NoCameraPreview = DefaultNoCameraPreview,
|
|
66
|
+
StartingCameraPreview = LoadingIndicator,
|
|
67
|
+
VideoErrorPreview = DefaultVideoErrorPreview,
|
|
68
|
+
}: VideoPreviewProps) => {
|
|
69
|
+
const [stream, setStream] = useState<MediaStream>();
|
|
70
|
+
const {
|
|
71
|
+
selectedVideoDeviceId,
|
|
72
|
+
getVideoStream,
|
|
73
|
+
initialVideoState,
|
|
74
|
+
setInitialVideoState,
|
|
75
|
+
} = useMediaDevices();
|
|
76
|
+
// When there are 0 video devices (e.g. when laptop lid closed),
|
|
77
|
+
// we do not restart the video automatically when the device is again available,
|
|
78
|
+
// but rather leave turning the video on manually to the user.
|
|
79
|
+
useOnUnavailableVideoDevices(() =>
|
|
80
|
+
setInitialVideoState(DEVICE_STATE.stopped),
|
|
81
|
+
);
|
|
82
|
+
const videoDevices = useVideoDevices();
|
|
83
|
+
|
|
84
|
+
useEffect(() => {
|
|
85
|
+
if (!initialVideoState.enabled) return;
|
|
86
|
+
|
|
87
|
+
getVideoStream({ deviceId: selectedVideoDeviceId })
|
|
88
|
+
.then((s) => {
|
|
89
|
+
setStream((previousStream) => {
|
|
90
|
+
if (previousStream) {
|
|
91
|
+
disposeOfMediaStream(previousStream);
|
|
92
|
+
}
|
|
93
|
+
return s;
|
|
94
|
+
});
|
|
95
|
+
})
|
|
96
|
+
.catch((e) =>
|
|
97
|
+
setInitialVideoState({
|
|
98
|
+
...DEVICE_STATE.error,
|
|
99
|
+
message: (e as Error).message,
|
|
100
|
+
}),
|
|
101
|
+
);
|
|
102
|
+
return () => {
|
|
103
|
+
setStream(undefined);
|
|
104
|
+
};
|
|
105
|
+
}, [
|
|
106
|
+
initialVideoState,
|
|
107
|
+
getVideoStream,
|
|
108
|
+
selectedVideoDeviceId,
|
|
109
|
+
setInitialVideoState,
|
|
110
|
+
videoDevices.length,
|
|
111
|
+
]);
|
|
112
|
+
|
|
113
|
+
useEffect(() => {
|
|
114
|
+
if (initialVideoState.type === 'stopped') {
|
|
115
|
+
setStream(undefined);
|
|
116
|
+
}
|
|
117
|
+
}, [initialVideoState]);
|
|
118
|
+
|
|
119
|
+
const handleOnPlay: ReactEventHandler<HTMLVideoElement> = useCallback(() => {
|
|
120
|
+
setInitialVideoState(DEVICE_STATE.playing);
|
|
121
|
+
}, [setInitialVideoState]);
|
|
122
|
+
|
|
123
|
+
let contents;
|
|
124
|
+
if (initialVideoState.type === 'error') {
|
|
125
|
+
contents = <VideoErrorPreview />;
|
|
126
|
+
} else if (initialVideoState.type === 'stopped' && !videoDevices.length) {
|
|
127
|
+
contents = <NoCameraPreview />;
|
|
128
|
+
} else if (initialVideoState.enabled) {
|
|
129
|
+
const loading = initialVideoState.type === 'starting';
|
|
130
|
+
contents = (
|
|
131
|
+
<>
|
|
132
|
+
{stream && (
|
|
133
|
+
<BaseVideo
|
|
134
|
+
stream={stream}
|
|
135
|
+
className={clsx('str-video__video-preview', {
|
|
136
|
+
'str-video__video-preview--mirror': mirror,
|
|
137
|
+
'str-video__video-preview--loading': loading,
|
|
138
|
+
})}
|
|
139
|
+
onPlay={handleOnPlay}
|
|
140
|
+
/>
|
|
141
|
+
)}
|
|
142
|
+
{loading && <StartingCameraPreview />}
|
|
143
|
+
</>
|
|
144
|
+
);
|
|
145
|
+
} else {
|
|
146
|
+
contents = <DisabledVideoPreview />;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
return (
|
|
150
|
+
<div className={clsx('str-video__video-preview-container')}>{contents}</div>
|
|
151
|
+
);
|
|
152
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export * from './Avatar';
|
|
2
|
+
export * from './Button';
|
|
3
|
+
export * from './CallControls';
|
|
4
|
+
export * from './CallParticipantsList';
|
|
5
|
+
export * from './CallRecordingList';
|
|
6
|
+
export * from './DeviceSettings';
|
|
7
|
+
export * from './LoadingIndicator';
|
|
8
|
+
export * from './Menu';
|
|
9
|
+
export * from './Notification';
|
|
10
|
+
export * from './PendingCallPanel';
|
|
11
|
+
export * from './Permissions';
|
|
12
|
+
export * from './StreamCall';
|
|
13
|
+
export * from './StreamTheme';
|
|
14
|
+
export * from './Search';
|
|
15
|
+
export * from './Tooltip';
|
|
16
|
+
export * from './Video';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AudioHTMLAttributes,
|
|
3
|
+
DetailedHTMLProps,
|
|
4
|
+
useEffect,
|
|
5
|
+
useRef,
|
|
6
|
+
} from 'react';
|
|
7
|
+
import { StreamVideoParticipant } from '@stream-io/video-client';
|
|
8
|
+
|
|
9
|
+
export type AudioProps = DetailedHTMLProps<
|
|
10
|
+
AudioHTMLAttributes<HTMLAudioElement>,
|
|
11
|
+
HTMLAudioElement
|
|
12
|
+
> &
|
|
13
|
+
Pick<StreamVideoParticipant, 'audioStream'> & {
|
|
14
|
+
sinkId?: string;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
// TODO: rename to BaseAudio
|
|
18
|
+
export const Audio = ({ audioStream, sinkId, ...rest }: AudioProps) => {
|
|
19
|
+
const audioRef = useRef<HTMLAudioElement>(null);
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
const $el = audioRef.current;
|
|
22
|
+
if (!($el && audioStream)) return;
|
|
23
|
+
|
|
24
|
+
console.log(`Attaching audio stream`, $el, audioStream);
|
|
25
|
+
$el.srcObject = audioStream;
|
|
26
|
+
return () => {
|
|
27
|
+
$el.srcObject = null;
|
|
28
|
+
};
|
|
29
|
+
}, [audioStream]);
|
|
30
|
+
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
const $el = audioRef.current;
|
|
33
|
+
if (!$el || !sinkId) return;
|
|
34
|
+
|
|
35
|
+
console.log(`Setting sinkId`, $el, sinkId);
|
|
36
|
+
if (($el as any).setSinkId) {
|
|
37
|
+
($el as any).setSinkId(sinkId);
|
|
38
|
+
}
|
|
39
|
+
}, [sinkId]);
|
|
40
|
+
|
|
41
|
+
return <audio autoPlay ref={audioRef} {...rest} />;
|
|
42
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Audio';
|