@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,157 @@
|
|
|
1
|
+
import { PropsWithChildren, useEffect, useState } from 'react';
|
|
2
|
+
import { Call, CallingState, JoinCallData } from '@stream-io/video-client';
|
|
3
|
+
import {
|
|
4
|
+
StreamCallProvider,
|
|
5
|
+
useConnectedUser,
|
|
6
|
+
useStreamVideoClient,
|
|
7
|
+
} from '@stream-io/video-react-bindings';
|
|
8
|
+
import {
|
|
9
|
+
MediaDevicesProvider,
|
|
10
|
+
MediaDevicesProviderProps,
|
|
11
|
+
} from '../../contexts';
|
|
12
|
+
|
|
13
|
+
type InitWithCallCID = {
|
|
14
|
+
/**
|
|
15
|
+
* The call type.
|
|
16
|
+
*/
|
|
17
|
+
callType: string;
|
|
18
|
+
/**
|
|
19
|
+
* The call id.
|
|
20
|
+
*/
|
|
21
|
+
callId: string;
|
|
22
|
+
/**
|
|
23
|
+
* The call instance to use.
|
|
24
|
+
*/
|
|
25
|
+
call?: never;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
type InitWithCallInstance = {
|
|
29
|
+
/**
|
|
30
|
+
* The call instance to use.
|
|
31
|
+
*/
|
|
32
|
+
call: Call | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* The call type.
|
|
35
|
+
*/
|
|
36
|
+
callType?: never;
|
|
37
|
+
/**
|
|
38
|
+
* The call id.
|
|
39
|
+
*/
|
|
40
|
+
callId?: never;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
type InitStreamCall = InitWithCallCID | InitWithCallInstance;
|
|
44
|
+
|
|
45
|
+
export type StreamCallProps = InitStreamCall & {
|
|
46
|
+
/**
|
|
47
|
+
* If true, the call will be joined automatically.
|
|
48
|
+
* Set it to true if you want to join the call immediately.
|
|
49
|
+
* Useful for scenarios where you want to skip prompting the user to join the call.
|
|
50
|
+
*
|
|
51
|
+
* @default false.
|
|
52
|
+
*/
|
|
53
|
+
autoJoin?: boolean;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* If true, the call data will be loaded automatically from the server.
|
|
57
|
+
*
|
|
58
|
+
* This property is useful for the scenarios where you declaratively create
|
|
59
|
+
* the call instance by using the `callId` and `callType` props,
|
|
60
|
+
* and you have a UI that depends on the call metadata.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```jsx
|
|
64
|
+
* <StreamCall callId="call-id" callType="call-type" autoLoad>
|
|
65
|
+
* <CallMetadata /> // has access to `call.metadata` although not joined yet
|
|
66
|
+
* <CallUI />
|
|
67
|
+
* <CallControls />
|
|
68
|
+
* </StreamCall>
|
|
69
|
+
* ```
|
|
70
|
+
*
|
|
71
|
+
* This property is ignored if you pass the `call` prop or enable `autoJoin`.
|
|
72
|
+
*
|
|
73
|
+
* @default true.
|
|
74
|
+
*/
|
|
75
|
+
autoLoad?: boolean;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* An optional data to pass when joining the call.
|
|
79
|
+
*/
|
|
80
|
+
data?: JoinCallData;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* An optional props to pass to the `MediaDevicesProvider`.
|
|
84
|
+
*/
|
|
85
|
+
mediaDevicesProviderProps?: MediaDevicesProviderProps;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export const StreamCall = ({
|
|
89
|
+
children,
|
|
90
|
+
callId,
|
|
91
|
+
callType,
|
|
92
|
+
call,
|
|
93
|
+
autoJoin = false,
|
|
94
|
+
autoLoad = true,
|
|
95
|
+
data,
|
|
96
|
+
mediaDevicesProviderProps,
|
|
97
|
+
}: PropsWithChildren<StreamCallProps>) => {
|
|
98
|
+
const client = useStreamVideoClient();
|
|
99
|
+
const [activeCall, setActiveCall] = useState<Call | undefined>(() => {
|
|
100
|
+
if (call) return call;
|
|
101
|
+
if (!client || !callId || !callType) return;
|
|
102
|
+
return client.call(callType, callId);
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
useEffect(() => {
|
|
106
|
+
if (!client) return;
|
|
107
|
+
|
|
108
|
+
if (callId && callType && !activeCall) {
|
|
109
|
+
const newCall = client.call(callType, callId);
|
|
110
|
+
setActiveCall(newCall);
|
|
111
|
+
}
|
|
112
|
+
}, [activeCall, callId, callType, client]);
|
|
113
|
+
|
|
114
|
+
const connectedUser = useConnectedUser();
|
|
115
|
+
useEffect(() => {
|
|
116
|
+
// run the effect only when the user is connected and the call
|
|
117
|
+
// is created declaratively by using the `callId` and `callType` props.
|
|
118
|
+
if (!connectedUser) return;
|
|
119
|
+
if (activeCall && callType && callId && autoLoad && !autoJoin) {
|
|
120
|
+
activeCall
|
|
121
|
+
.getOrCreate({
|
|
122
|
+
ring: data?.ring,
|
|
123
|
+
data: data?.data,
|
|
124
|
+
members_limit: data?.members_limit,
|
|
125
|
+
})
|
|
126
|
+
.catch((err) => {
|
|
127
|
+
console.error(`Failed to get or create call`, err);
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
}, [
|
|
131
|
+
activeCall,
|
|
132
|
+
autoJoin,
|
|
133
|
+
autoLoad,
|
|
134
|
+
callId,
|
|
135
|
+
callType,
|
|
136
|
+
connectedUser,
|
|
137
|
+
data?.data,
|
|
138
|
+
data?.members_limit,
|
|
139
|
+
data?.ring,
|
|
140
|
+
]);
|
|
141
|
+
|
|
142
|
+
useEffect(() => {
|
|
143
|
+
if (autoJoin && activeCall?.state.callingState === CallingState.IDLE) {
|
|
144
|
+
activeCall.join(data).catch((err) => {
|
|
145
|
+
console.error(`Failed to join call`, err);
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
}, [activeCall, autoJoin, data]);
|
|
149
|
+
|
|
150
|
+
return (
|
|
151
|
+
<StreamCallProvider call={activeCall}>
|
|
152
|
+
<MediaDevicesProvider {...mediaDevicesProviderProps}>
|
|
153
|
+
{children}
|
|
154
|
+
</MediaDevicesProvider>
|
|
155
|
+
</StreamCallProvider>
|
|
156
|
+
);
|
|
157
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './StreamCall';
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { ComponentPropsWithRef, forwardRef, useEffect, useState } from 'react';
|
|
2
|
+
import { Browsers } from '@stream-io/video-client';
|
|
3
|
+
|
|
4
|
+
import { applyElementToRef } from '../../../utilities';
|
|
5
|
+
|
|
6
|
+
export type BaseVideoProps = ComponentPropsWithRef<'video'> & {
|
|
7
|
+
stream?: MediaStream;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @description Extends video element with `stream` property
|
|
12
|
+
* (`srcObject`) to reactively handle stream changes
|
|
13
|
+
*/
|
|
14
|
+
export const BaseVideo = forwardRef<HTMLVideoElement, BaseVideoProps>(
|
|
15
|
+
({ stream, ...rest }, ref) => {
|
|
16
|
+
const [videoElement, setVideoElement] = useState<HTMLVideoElement | null>(
|
|
17
|
+
null,
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
if (!videoElement || !stream) return;
|
|
22
|
+
if (stream === videoElement.srcObject) return;
|
|
23
|
+
|
|
24
|
+
videoElement.srcObject = stream;
|
|
25
|
+
if (Browsers.isSafari() || Browsers.isFirefox()) {
|
|
26
|
+
// Firefox and Safari have some timing issue
|
|
27
|
+
setTimeout(() => {
|
|
28
|
+
videoElement.srcObject = stream;
|
|
29
|
+
videoElement.play().catch((e) => {
|
|
30
|
+
console.error(`Failed to play stream`, e);
|
|
31
|
+
});
|
|
32
|
+
}, 0);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return () => {
|
|
36
|
+
videoElement.pause();
|
|
37
|
+
videoElement.srcObject = null;
|
|
38
|
+
};
|
|
39
|
+
}, [stream, videoElement]);
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<video
|
|
43
|
+
autoPlay
|
|
44
|
+
playsInline
|
|
45
|
+
{...rest}
|
|
46
|
+
ref={(element) => {
|
|
47
|
+
applyElementToRef(ref, element);
|
|
48
|
+
setVideoElement(element);
|
|
49
|
+
}}
|
|
50
|
+
/>
|
|
51
|
+
);
|
|
52
|
+
},
|
|
53
|
+
);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ComponentPropsWithRef, forwardRef, useState } from 'react';
|
|
2
|
+
import type { StreamVideoParticipant } from '@stream-io/video-client';
|
|
3
|
+
|
|
4
|
+
export type VideoPlaceholderProps = {
|
|
5
|
+
participant: StreamVideoParticipant;
|
|
6
|
+
} & ComponentPropsWithRef<'div'>;
|
|
7
|
+
|
|
8
|
+
export const DefaultVideoPlaceholder = forwardRef<
|
|
9
|
+
HTMLDivElement,
|
|
10
|
+
VideoPlaceholderProps
|
|
11
|
+
>(({ participant, style }, ref) => {
|
|
12
|
+
const [error, setError] = useState(false);
|
|
13
|
+
|
|
14
|
+
const name = participant?.name || participant?.userId;
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<div className="str-video__video-placeholder" style={style} ref={ref}>
|
|
18
|
+
{(!participant.image || error) &&
|
|
19
|
+
(name ? (
|
|
20
|
+
<div className="str-video__video-placeholder__initials-fallback">
|
|
21
|
+
<div>{name[0]}</div>
|
|
22
|
+
</div>
|
|
23
|
+
) : (
|
|
24
|
+
<div>Video is disabled</div>
|
|
25
|
+
))}
|
|
26
|
+
{participant.image && !error && (
|
|
27
|
+
<img
|
|
28
|
+
onError={() => setError(true)}
|
|
29
|
+
alt="video-placeholder"
|
|
30
|
+
className="str-video__video-placeholder__avatar"
|
|
31
|
+
src={participant.image}
|
|
32
|
+
/>
|
|
33
|
+
)}
|
|
34
|
+
</div>
|
|
35
|
+
);
|
|
36
|
+
});
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ComponentPropsWithoutRef,
|
|
3
|
+
ComponentType,
|
|
4
|
+
useCallback,
|
|
5
|
+
useEffect,
|
|
6
|
+
useRef,
|
|
7
|
+
useState,
|
|
8
|
+
} from 'react';
|
|
9
|
+
import {
|
|
10
|
+
DebounceType,
|
|
11
|
+
SfuModels,
|
|
12
|
+
StreamVideoParticipant,
|
|
13
|
+
VisibilityState,
|
|
14
|
+
} from '@stream-io/video-client';
|
|
15
|
+
import clsx from 'clsx';
|
|
16
|
+
import {
|
|
17
|
+
DefaultVideoPlaceholder,
|
|
18
|
+
VideoPlaceholderProps,
|
|
19
|
+
} from './DefaultVideoPlaceholder';
|
|
20
|
+
import { BaseVideo } from './BaseVideo';
|
|
21
|
+
import { useCall } from '@stream-io/video-react-bindings';
|
|
22
|
+
|
|
23
|
+
export type VideoProps = ComponentPropsWithoutRef<'video'> & {
|
|
24
|
+
kind: 'video' | 'screen';
|
|
25
|
+
participant: StreamVideoParticipant;
|
|
26
|
+
VideoPlaceholder?: ComponentType<VideoPlaceholderProps>;
|
|
27
|
+
refs?: {
|
|
28
|
+
setVideoElement?: (element: HTMLVideoElement | null) => void;
|
|
29
|
+
setVideoPlaceholderElement?: (element: HTMLDivElement | null) => void;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const Video = ({
|
|
34
|
+
kind,
|
|
35
|
+
participant,
|
|
36
|
+
className,
|
|
37
|
+
VideoPlaceholder = DefaultVideoPlaceholder,
|
|
38
|
+
refs,
|
|
39
|
+
...rest
|
|
40
|
+
}: VideoProps) => {
|
|
41
|
+
const {
|
|
42
|
+
sessionId,
|
|
43
|
+
videoStream,
|
|
44
|
+
screenShareStream,
|
|
45
|
+
publishedTracks,
|
|
46
|
+
viewportVisibilityState,
|
|
47
|
+
isLoggedInUser,
|
|
48
|
+
userId,
|
|
49
|
+
} = participant;
|
|
50
|
+
|
|
51
|
+
const call = useCall();
|
|
52
|
+
|
|
53
|
+
const [videoElement, setVideoElement] = useState<HTMLVideoElement | null>(
|
|
54
|
+
null,
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
// const [videoTrackMuted, setVideoTrackMuted] = useState(false);
|
|
58
|
+
const [videoPlaying, setVideoPlaying] = useState(false);
|
|
59
|
+
const viewportVisibilityRef = useRef<VisibilityState | undefined>(
|
|
60
|
+
viewportVisibilityState,
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
const stream = kind === 'video' ? videoStream : screenShareStream;
|
|
64
|
+
|
|
65
|
+
// TODO: handle track muting
|
|
66
|
+
// useEffect(() => {
|
|
67
|
+
// if (!stream) return;
|
|
68
|
+
|
|
69
|
+
// const [track] = stream.getVideoTracks();
|
|
70
|
+
// setVideoTrackMuted(track.muted);
|
|
71
|
+
|
|
72
|
+
// const handleMute = () => {
|
|
73
|
+
// setVideoTrackMuted(true);
|
|
74
|
+
// };
|
|
75
|
+
// const handleUnmute = () => {
|
|
76
|
+
// setVideoTrackMuted(false);
|
|
77
|
+
// };
|
|
78
|
+
|
|
79
|
+
// track.addEventListener('mute', handleMute);
|
|
80
|
+
// track.addEventListener('unmute', handleUnmute);
|
|
81
|
+
|
|
82
|
+
// return () => {
|
|
83
|
+
// track.removeEventListener('mute', handleMute);
|
|
84
|
+
// track.removeEventListener('unmute', handleUnmute);
|
|
85
|
+
// };
|
|
86
|
+
// }, [stream]);
|
|
87
|
+
|
|
88
|
+
const isPublishingTrack = publishedTracks.includes(
|
|
89
|
+
kind === 'video'
|
|
90
|
+
? SfuModels.TrackType.VIDEO
|
|
91
|
+
: SfuModels.TrackType.SCREEN_SHARE,
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
const displayPlaceholder =
|
|
95
|
+
!isPublishingTrack ||
|
|
96
|
+
(viewportVisibilityState === VisibilityState.INVISIBLE &&
|
|
97
|
+
!screenShareStream) ||
|
|
98
|
+
!videoPlaying;
|
|
99
|
+
|
|
100
|
+
const lastDimensionRef = useRef<string | undefined>();
|
|
101
|
+
const updateSubscription = useCallback(
|
|
102
|
+
(
|
|
103
|
+
dimension?: SfuModels.VideoDimension,
|
|
104
|
+
type: DebounceType = DebounceType.SLOW,
|
|
105
|
+
) => {
|
|
106
|
+
if (!call) return;
|
|
107
|
+
|
|
108
|
+
call.updateSubscriptionsPartial(
|
|
109
|
+
kind,
|
|
110
|
+
{
|
|
111
|
+
[sessionId]: {
|
|
112
|
+
dimension,
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
type,
|
|
116
|
+
);
|
|
117
|
+
},
|
|
118
|
+
[call, kind, sessionId],
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
// handle visibility subscription updates
|
|
122
|
+
useEffect(() => {
|
|
123
|
+
viewportVisibilityRef.current = viewportVisibilityState;
|
|
124
|
+
|
|
125
|
+
if (!videoElement || !isPublishingTrack || isLoggedInUser) return;
|
|
126
|
+
|
|
127
|
+
const isInvisibleVVS =
|
|
128
|
+
viewportVisibilityState === VisibilityState.INVISIBLE;
|
|
129
|
+
|
|
130
|
+
updateSubscription(
|
|
131
|
+
isInvisibleVVS
|
|
132
|
+
? undefined
|
|
133
|
+
: {
|
|
134
|
+
height: videoElement.clientHeight,
|
|
135
|
+
width: videoElement.clientWidth,
|
|
136
|
+
},
|
|
137
|
+
DebounceType.MEDIUM,
|
|
138
|
+
);
|
|
139
|
+
}, [
|
|
140
|
+
updateSubscription,
|
|
141
|
+
viewportVisibilityState,
|
|
142
|
+
videoElement,
|
|
143
|
+
isPublishingTrack,
|
|
144
|
+
isLoggedInUser,
|
|
145
|
+
]);
|
|
146
|
+
|
|
147
|
+
// handle resize subscription updates
|
|
148
|
+
useEffect(() => {
|
|
149
|
+
if (!videoElement || !isPublishingTrack || isLoggedInUser) return;
|
|
150
|
+
|
|
151
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
152
|
+
const currentDimensions = `${videoElement.clientWidth},${videoElement.clientHeight}`;
|
|
153
|
+
|
|
154
|
+
// skip initial trigger of the observer
|
|
155
|
+
if (!lastDimensionRef.current) {
|
|
156
|
+
return (lastDimensionRef.current = currentDimensions);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (
|
|
160
|
+
lastDimensionRef.current === currentDimensions ||
|
|
161
|
+
viewportVisibilityRef.current === VisibilityState.INVISIBLE
|
|
162
|
+
)
|
|
163
|
+
return;
|
|
164
|
+
|
|
165
|
+
updateSubscription(
|
|
166
|
+
{
|
|
167
|
+
height: videoElement.clientHeight,
|
|
168
|
+
width: videoElement.clientWidth,
|
|
169
|
+
},
|
|
170
|
+
DebounceType.SLOW,
|
|
171
|
+
);
|
|
172
|
+
lastDimensionRef.current = currentDimensions;
|
|
173
|
+
});
|
|
174
|
+
resizeObserver.observe(videoElement);
|
|
175
|
+
|
|
176
|
+
return () => {
|
|
177
|
+
resizeObserver.disconnect();
|
|
178
|
+
};
|
|
179
|
+
}, [
|
|
180
|
+
updateSubscription,
|
|
181
|
+
videoElement,
|
|
182
|
+
viewportVisibilityState,
|
|
183
|
+
isPublishingTrack,
|
|
184
|
+
isLoggedInUser,
|
|
185
|
+
]);
|
|
186
|
+
|
|
187
|
+
// handle generic subscription updates
|
|
188
|
+
useEffect(() => {
|
|
189
|
+
if (!isPublishingTrack || !videoElement || isLoggedInUser) return;
|
|
190
|
+
|
|
191
|
+
updateSubscription(
|
|
192
|
+
{
|
|
193
|
+
height: videoElement.clientHeight,
|
|
194
|
+
width: videoElement.clientWidth,
|
|
195
|
+
},
|
|
196
|
+
DebounceType.FAST,
|
|
197
|
+
);
|
|
198
|
+
|
|
199
|
+
return () => {
|
|
200
|
+
updateSubscription(undefined, DebounceType.FAST);
|
|
201
|
+
};
|
|
202
|
+
}, [updateSubscription, videoElement, isPublishingTrack, isLoggedInUser]);
|
|
203
|
+
|
|
204
|
+
const [isWideMode, setIsWideMode] = useState(true);
|
|
205
|
+
useEffect(() => {
|
|
206
|
+
if (!stream || !videoElement) return;
|
|
207
|
+
|
|
208
|
+
setVideoPlaying(!videoElement.paused);
|
|
209
|
+
|
|
210
|
+
const calculateVideoRatio = () => {
|
|
211
|
+
setVideoPlaying(true);
|
|
212
|
+
const [track] = stream.getVideoTracks();
|
|
213
|
+
if (!track) return;
|
|
214
|
+
|
|
215
|
+
const { width = 0, height = 0 } = track.getSettings();
|
|
216
|
+
setIsWideMode(width > height);
|
|
217
|
+
};
|
|
218
|
+
videoElement.addEventListener('play', calculateVideoRatio);
|
|
219
|
+
return () => {
|
|
220
|
+
videoElement.removeEventListener('play', calculateVideoRatio);
|
|
221
|
+
};
|
|
222
|
+
}, [stream, videoElement]);
|
|
223
|
+
|
|
224
|
+
if (!call) return null;
|
|
225
|
+
|
|
226
|
+
return (
|
|
227
|
+
<>
|
|
228
|
+
<BaseVideo
|
|
229
|
+
{...rest}
|
|
230
|
+
stream={stream}
|
|
231
|
+
className={clsx(className, 'str-video__video', {
|
|
232
|
+
'str-video__video--tall': !isWideMode,
|
|
233
|
+
'str-video__video--mirror': isLoggedInUser && kind === 'video',
|
|
234
|
+
'str-video__video--screen-share': kind === 'screen',
|
|
235
|
+
})}
|
|
236
|
+
data-user-id={userId}
|
|
237
|
+
data-session-id={sessionId}
|
|
238
|
+
ref={(element) => {
|
|
239
|
+
setVideoElement(element);
|
|
240
|
+
refs?.setVideoElement?.(element);
|
|
241
|
+
}}
|
|
242
|
+
/>
|
|
243
|
+
{displayPlaceholder && (
|
|
244
|
+
<VideoPlaceholder
|
|
245
|
+
style={{ position: 'absolute' }}
|
|
246
|
+
participant={participant}
|
|
247
|
+
ref={refs?.setVideoPlaceholderElement}
|
|
248
|
+
/>
|
|
249
|
+
)}
|
|
250
|
+
</>
|
|
251
|
+
);
|
|
252
|
+
};
|