@werxt/livekit-components-react 2.9.20
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/LICENSE +201 -0
- package/README.md +36 -0
- package/dist/assets/icons/CameraDisabledIcon.d.ts +11 -0
- package/dist/assets/icons/CameraDisabledIcon.d.ts.map +1 -0
- package/dist/assets/icons/CameraIcon.d.ts +11 -0
- package/dist/assets/icons/CameraIcon.d.ts.map +1 -0
- package/dist/assets/icons/ChatCloseIcon.d.ts +11 -0
- package/dist/assets/icons/ChatCloseIcon.d.ts.map +1 -0
- package/dist/assets/icons/ChatIcon.d.ts +11 -0
- package/dist/assets/icons/ChatIcon.d.ts.map +1 -0
- package/dist/assets/icons/Chevron.d.ts +11 -0
- package/dist/assets/icons/Chevron.d.ts.map +1 -0
- package/dist/assets/icons/FocusToggleIcon.d.ts +11 -0
- package/dist/assets/icons/FocusToggleIcon.d.ts.map +1 -0
- package/dist/assets/icons/GearIcon.d.ts +11 -0
- package/dist/assets/icons/GearIcon.d.ts.map +1 -0
- package/dist/assets/icons/LeaveIcon.d.ts +11 -0
- package/dist/assets/icons/LeaveIcon.d.ts.map +1 -0
- package/dist/assets/icons/LockLockedIcon.d.ts +11 -0
- package/dist/assets/icons/LockLockedIcon.d.ts.map +1 -0
- package/dist/assets/icons/MicDisabledIcon.d.ts +11 -0
- package/dist/assets/icons/MicDisabledIcon.d.ts.map +1 -0
- package/dist/assets/icons/MicIcon.d.ts +11 -0
- package/dist/assets/icons/MicIcon.d.ts.map +1 -0
- package/dist/assets/icons/QualityExcellentIcon.d.ts +11 -0
- package/dist/assets/icons/QualityExcellentIcon.d.ts.map +1 -0
- package/dist/assets/icons/QualityGoodIcon.d.ts +11 -0
- package/dist/assets/icons/QualityGoodIcon.d.ts.map +1 -0
- package/dist/assets/icons/QualityPoorIcon.d.ts +11 -0
- package/dist/assets/icons/QualityPoorIcon.d.ts.map +1 -0
- package/dist/assets/icons/QualityUnknownIcon.d.ts +11 -0
- package/dist/assets/icons/QualityUnknownIcon.d.ts.map +1 -0
- package/dist/assets/icons/ScreenShareIcon.d.ts +11 -0
- package/dist/assets/icons/ScreenShareIcon.d.ts.map +1 -0
- package/dist/assets/icons/ScreenShareStopIcon.d.ts +11 -0
- package/dist/assets/icons/ScreenShareStopIcon.d.ts.map +1 -0
- package/dist/assets/icons/SpinnerIcon.d.ts +11 -0
- package/dist/assets/icons/SpinnerIcon.d.ts.map +1 -0
- package/dist/assets/icons/UnfocusToggleIcon.d.ts +11 -0
- package/dist/assets/icons/UnfocusToggleIcon.d.ts.map +1 -0
- package/dist/assets/icons/index.d.ts +20 -0
- package/dist/assets/icons/index.d.ts.map +1 -0
- package/dist/assets/icons/util.d.ts +11 -0
- package/dist/assets/icons/util.d.ts.map +1 -0
- package/dist/assets/images/ParticipantPlaceholder.d.ts +11 -0
- package/dist/assets/images/ParticipantPlaceholder.d.ts.map +1 -0
- package/dist/assets/images/index.d.ts +2 -0
- package/dist/assets/images/index.d.ts.map +1 -0
- package/dist/components/ChatEntry.d.ts +35 -0
- package/dist/components/ChatEntry.d.ts.map +1 -0
- package/dist/components/ConnectionState.d.ts +23 -0
- package/dist/components/ConnectionState.d.ts.map +1 -0
- package/dist/components/ConnectionStateToast.d.ts +13 -0
- package/dist/components/ConnectionStateToast.d.ts.map +1 -0
- package/dist/components/LiveKitRoom.d.ts +92 -0
- package/dist/components/LiveKitRoom.d.ts.map +1 -0
- package/dist/components/ParticipantLoop.d.ts +28 -0
- package/dist/components/ParticipantLoop.d.ts.map +1 -0
- package/dist/components/RoomAudioRenderer.d.ts +29 -0
- package/dist/components/RoomAudioRenderer.d.ts.map +1 -0
- package/dist/components/RoomName.d.ts +20 -0
- package/dist/components/RoomName.d.ts.map +1 -0
- package/dist/components/SessionProvider.d.ts +13 -0
- package/dist/components/SessionProvider.d.ts.map +1 -0
- package/dist/components/Toast.d.ts +14 -0
- package/dist/components/Toast.d.ts.map +1 -0
- package/dist/components/TrackLoop.d.ts +26 -0
- package/dist/components/TrackLoop.d.ts.map +1 -0
- package/dist/components/controls/ChatToggle.d.ts +19 -0
- package/dist/components/controls/ChatToggle.d.ts.map +1 -0
- package/dist/components/controls/ClearPinButton.d.ts +20 -0
- package/dist/components/controls/ClearPinButton.d.ts.map +1 -0
- package/dist/components/controls/DisconnectButton.d.ts +19 -0
- package/dist/components/controls/DisconnectButton.d.ts.map +1 -0
- package/dist/components/controls/FocusToggle.d.ts +21 -0
- package/dist/components/controls/FocusToggle.d.ts.map +1 -0
- package/dist/components/controls/MediaDeviceSelect.d.ts +40 -0
- package/dist/components/controls/MediaDeviceSelect.d.ts.map +1 -0
- package/dist/components/controls/PaginationControl.d.ts +9 -0
- package/dist/components/controls/PaginationControl.d.ts.map +1 -0
- package/dist/components/controls/PaginationIndicator.d.ts +7 -0
- package/dist/components/controls/PaginationIndicator.d.ts.map +1 -0
- package/dist/components/controls/SettingsMenuToggle.d.ts +13 -0
- package/dist/components/controls/SettingsMenuToggle.d.ts.map +1 -0
- package/dist/components/controls/StartAudio.d.ts +24 -0
- package/dist/components/controls/StartAudio.d.ts.map +1 -0
- package/dist/components/controls/StartMediaButton.d.ts +22 -0
- package/dist/components/controls/StartMediaButton.d.ts.map +1 -0
- package/dist/components/controls/TrackToggle.d.ts +32 -0
- package/dist/components/controls/TrackToggle.d.ts.map +1 -0
- package/dist/components/index.d.ts +30 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/layout/CarouselLayout.d.ts +27 -0
- package/dist/components/layout/CarouselLayout.d.ts.map +1 -0
- package/dist/components/layout/FocusLayout.d.ts +25 -0
- package/dist/components/layout/FocusLayout.d.ts.map +1 -0
- package/dist/components/layout/GridLayout.d.ts +26 -0
- package/dist/components/layout/GridLayout.d.ts.map +1 -0
- package/dist/components/layout/LayoutContextProvider.d.ts +12 -0
- package/dist/components/layout/LayoutContextProvider.d.ts.map +1 -0
- package/dist/components/layout/index.d.ts +4 -0
- package/dist/components/layout/index.d.ts.map +1 -0
- package/dist/components/participant/AudioTrack.d.ts +33 -0
- package/dist/components/participant/AudioTrack.d.ts.map +1 -0
- package/dist/components/participant/AudioVisualizer.d.ts +22 -0
- package/dist/components/participant/AudioVisualizer.d.ts.map +1 -0
- package/dist/components/participant/BarVisualizer.d.ts +77 -0
- package/dist/components/participant/BarVisualizer.d.ts.map +1 -0
- package/dist/components/participant/ConnectionQualityIndicator.d.ts +16 -0
- package/dist/components/participant/ConnectionQualityIndicator.d.ts.map +1 -0
- package/dist/components/participant/ParticipantAudioTile.d.ts +14 -0
- package/dist/components/participant/ParticipantAudioTile.d.ts.map +1 -0
- package/dist/components/participant/ParticipantName.d.ts +17 -0
- package/dist/components/participant/ParticipantName.d.ts.map +1 -0
- package/dist/components/participant/ParticipantTile.d.ts +49 -0
- package/dist/components/participant/ParticipantTile.d.ts.map +1 -0
- package/dist/components/participant/TrackMutedIndicator.d.ts +19 -0
- package/dist/components/participant/TrackMutedIndicator.d.ts.map +1 -0
- package/dist/components/participant/VideoTrack.d.ts +23 -0
- package/dist/components/participant/VideoTrack.d.ts.map +1 -0
- package/dist/components/participant/animationSequences/connectingSequence.d.ts +2 -0
- package/dist/components/participant/animationSequences/connectingSequence.d.ts.map +1 -0
- package/dist/components/participant/animationSequences/listeningSequence.d.ts +2 -0
- package/dist/components/participant/animationSequences/listeningSequence.d.ts.map +1 -0
- package/dist/components/participant/animationSequences/thinkingSequence.d.ts +2 -0
- package/dist/components/participant/animationSequences/thinkingSequence.d.ts.map +1 -0
- package/dist/components/participant/animators/useBarAnimator.d.ts +3 -0
- package/dist/components/participant/animators/useBarAnimator.d.ts.map +1 -0
- package/dist/components-lNrIMTWQ.mjs +1051 -0
- package/dist/components-lNrIMTWQ.mjs.map +1 -0
- package/dist/context/chat-context.d.ts +23 -0
- package/dist/context/chat-context.d.ts.map +1 -0
- package/dist/context/feature-context.d.ts +14 -0
- package/dist/context/feature-context.d.ts.map +1 -0
- package/dist/context/index.d.ts +10 -0
- package/dist/context/index.d.ts.map +1 -0
- package/dist/context/layout-context.d.ts +32 -0
- package/dist/context/layout-context.d.ts.map +1 -0
- package/dist/context/participant-context.d.ts +22 -0
- package/dist/context/participant-context.d.ts.map +1 -0
- package/dist/context/pin-context.d.ts +17 -0
- package/dist/context/pin-context.d.ts.map +1 -0
- package/dist/context/room-context.d.ts +22 -0
- package/dist/context/room-context.d.ts.map +1 -0
- package/dist/context/session-context.d.ts +22 -0
- package/dist/context/session-context.d.ts.map +1 -0
- package/dist/context/track-reference-context.d.ts +25 -0
- package/dist/context/track-reference-context.d.ts.map +1 -0
- package/dist/contexts-D4V9wQRc.mjs +4026 -0
- package/dist/contexts-D4V9wQRc.mjs.map +1 -0
- package/dist/hooks/cloud/krisp/useKrispNoiseFilter.d.ts +42 -0
- package/dist/hooks/cloud/krisp/useKrispNoiseFilter.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +54 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/internal/index.d.ts +10 -0
- package/dist/hooks/internal/index.d.ts.map +1 -0
- package/dist/hooks/internal/useMediaQuery.d.ts +7 -0
- package/dist/hooks/internal/useMediaQuery.d.ts.map +1 -0
- package/dist/hooks/internal/useObservableState.d.ts +6 -0
- package/dist/hooks/internal/useObservableState.d.ts.map +1 -0
- package/dist/hooks/internal/useResizeObserver.d.ts +14 -0
- package/dist/hooks/internal/useResizeObserver.d.ts.map +1 -0
- package/dist/hooks/useAgent.d.ts +219 -0
- package/dist/hooks/useAgent.d.ts.map +1 -0
- package/dist/hooks/useAudioPlayback.d.ts +15 -0
- package/dist/hooks/useAudioPlayback.d.ts.map +1 -0
- package/dist/hooks/useChat.d.ts +43 -0
- package/dist/hooks/useChat.d.ts.map +1 -0
- package/dist/hooks/useChatToggle.d.ts +21 -0
- package/dist/hooks/useChatToggle.d.ts.map +1 -0
- package/dist/hooks/useClearPinButton.d.ts +15 -0
- package/dist/hooks/useClearPinButton.d.ts.map +1 -0
- package/dist/hooks/useConnectionQualityIndicator.d.ts +20 -0
- package/dist/hooks/useConnectionQualityIndicator.d.ts.map +1 -0
- package/dist/hooks/useConnectionStatus.d.ts +12 -0
- package/dist/hooks/useConnectionStatus.d.ts.map +1 -0
- package/dist/hooks/useDataChannel.d.ts +38 -0
- package/dist/hooks/useDataChannel.d.ts.map +1 -0
- package/dist/hooks/useDisconnectButton.d.ts +21 -0
- package/dist/hooks/useDisconnectButton.d.ts.map +1 -0
- package/dist/hooks/useEvents.d.ts +9 -0
- package/dist/hooks/useEvents.d.ts.map +1 -0
- package/dist/hooks/useFacingMode.d.ts +10 -0
- package/dist/hooks/useFacingMode.d.ts.map +1 -0
- package/dist/hooks/useFocusToggle.d.ts +26 -0
- package/dist/hooks/useFocusToggle.d.ts.map +1 -0
- package/dist/hooks/useGridLayout.d.ts +27 -0
- package/dist/hooks/useGridLayout.d.ts.map +1 -0
- package/dist/hooks/useIsEncrypted.d.ts +12 -0
- package/dist/hooks/useIsEncrypted.d.ts.map +1 -0
- package/dist/hooks/useIsMuted.d.ts +22 -0
- package/dist/hooks/useIsMuted.d.ts.map +1 -0
- package/dist/hooks/useIsRecording.d.ts +11 -0
- package/dist/hooks/useIsRecording.d.ts.map +1 -0
- package/dist/hooks/useIsSpeaking.d.ts +11 -0
- package/dist/hooks/useIsSpeaking.d.ts.map +1 -0
- package/dist/hooks/useLiveKitRoom.d.ts +19 -0
- package/dist/hooks/useLiveKitRoom.d.ts.map +1 -0
- package/dist/hooks/useLocalParticipant.d.ts +29 -0
- package/dist/hooks/useLocalParticipant.d.ts.map +1 -0
- package/dist/hooks/useLocalParticipantPermissions.d.ts +12 -0
- package/dist/hooks/useLocalParticipantPermissions.d.ts.map +1 -0
- package/dist/hooks/useMediaDeviceSelect.d.ts +41 -0
- package/dist/hooks/useMediaDeviceSelect.d.ts.map +1 -0
- package/dist/hooks/useMediaDevices.d.ts +15 -0
- package/dist/hooks/useMediaDevices.d.ts.map +1 -0
- package/dist/hooks/useMediaTrackBySourceOrName.d.ts +18 -0
- package/dist/hooks/useMediaTrackBySourceOrName.d.ts.map +1 -0
- package/dist/hooks/usePagination.d.ts +24 -0
- package/dist/hooks/usePagination.d.ts.map +1 -0
- package/dist/hooks/useParticipantAttributes.d.ts +30 -0
- package/dist/hooks/useParticipantAttributes.d.ts.map +1 -0
- package/dist/hooks/useParticipantInfo.d.ts +21 -0
- package/dist/hooks/useParticipantInfo.d.ts.map +1 -0
- package/dist/hooks/useParticipantPermissions.d.ts +17 -0
- package/dist/hooks/useParticipantPermissions.d.ts.map +1 -0
- package/dist/hooks/useParticipantTile.d.ts +22 -0
- package/dist/hooks/useParticipantTile.d.ts.map +1 -0
- package/dist/hooks/useParticipantTracks.d.ts +14 -0
- package/dist/hooks/useParticipantTracks.d.ts.map +1 -0
- package/dist/hooks/useParticipants.d.ts +30 -0
- package/dist/hooks/useParticipants.d.ts.map +1 -0
- package/dist/hooks/usePersistentUserChoices.d.ts +35 -0
- package/dist/hooks/usePersistentUserChoices.d.ts.map +1 -0
- package/dist/hooks/usePinnedTracks.d.ts +14 -0
- package/dist/hooks/usePinnedTracks.d.ts.map +1 -0
- package/dist/hooks/useRemoteParticipant.d.ts +35 -0
- package/dist/hooks/useRemoteParticipant.d.ts.map +1 -0
- package/dist/hooks/useRemoteParticipants.d.ts +30 -0
- package/dist/hooks/useRemoteParticipants.d.ts.map +1 -0
- package/dist/hooks/useRoomInfo.d.ts +21 -0
- package/dist/hooks/useRoomInfo.d.ts.map +1 -0
- package/dist/hooks/useSequentialRoomConnectDisconnect.d.ts +27 -0
- package/dist/hooks/useSequentialRoomConnectDisconnect.d.ts.map +1 -0
- package/dist/hooks/useSession.d.ts +130 -0
- package/dist/hooks/useSession.d.ts.map +1 -0
- package/dist/hooks/useSessionMessages.d.ts +29 -0
- package/dist/hooks/useSessionMessages.d.ts.map +1 -0
- package/dist/hooks/useSettingsToggle.d.ts +20 -0
- package/dist/hooks/useSettingsToggle.d.ts.map +1 -0
- package/dist/hooks/useSortedParticipants.d.ts +7 -0
- package/dist/hooks/useSortedParticipants.d.ts.map +1 -0
- package/dist/hooks/useSpeakingParticipants.d.ts +16 -0
- package/dist/hooks/useSpeakingParticipants.d.ts.map +1 -0
- package/dist/hooks/useStartAudio.d.ts +27 -0
- package/dist/hooks/useStartAudio.d.ts.map +1 -0
- package/dist/hooks/useStartVideo.d.ts +26 -0
- package/dist/hooks/useStartVideo.d.ts.map +1 -0
- package/dist/hooks/useSwipe.d.ts +24 -0
- package/dist/hooks/useSwipe.d.ts.map +1 -0
- package/dist/hooks/useTextStream.d.ts +20 -0
- package/dist/hooks/useTextStream.d.ts.map +1 -0
- package/dist/hooks/useToken.d.ts +20 -0
- package/dist/hooks/useToken.d.ts.map +1 -0
- package/dist/hooks/useTrack.d.ts +4 -0
- package/dist/hooks/useTrack.d.ts.map +1 -0
- package/dist/hooks/useTrackByName.d.ts +10 -0
- package/dist/hooks/useTrackByName.d.ts.map +1 -0
- package/dist/hooks/useTrackMutedIndicator.d.ts +18 -0
- package/dist/hooks/useTrackMutedIndicator.d.ts.map +1 -0
- package/dist/hooks/useTrackRefBySourceOrName.d.ts +7 -0
- package/dist/hooks/useTrackRefBySourceOrName.d.ts.map +1 -0
- package/dist/hooks/useTrackSyncTime.d.ts +10 -0
- package/dist/hooks/useTrackSyncTime.d.ts.map +1 -0
- package/dist/hooks/useTrackToggle.d.ts +27 -0
- package/dist/hooks/useTrackToggle.d.ts.map +1 -0
- package/dist/hooks/useTrackTranscription.d.ts +26 -0
- package/dist/hooks/useTrackTranscription.d.ts.map +1 -0
- package/dist/hooks/useTrackVolume.d.ts +49 -0
- package/dist/hooks/useTrackVolume.d.ts.map +1 -0
- package/dist/hooks/useTracks.d.ts +29 -0
- package/dist/hooks/useTracks.d.ts.map +1 -0
- package/dist/hooks/useTranscriptions.d.ts +21 -0
- package/dist/hooks/useTranscriptions.d.ts.map +1 -0
- package/dist/hooks/useVisualStableUpdate.d.ts +27 -0
- package/dist/hooks/useVisualStableUpdate.d.ts.map +1 -0
- package/dist/hooks/useVoiceAssistant.d.ts +43 -0
- package/dist/hooks/useVoiceAssistant.d.ts.map +1 -0
- package/dist/hooks/useWarnAboutMissingStyles.d.ts +5 -0
- package/dist/hooks/useWarnAboutMissingStyles.d.ts.map +1 -0
- package/dist/hooks-hQJmeINB.mjs +1992 -0
- package/dist/hooks-hQJmeINB.mjs.map +1 -0
- package/dist/hooks.d.ts +2 -0
- package/dist/hooks.js +2 -0
- package/dist/hooks.js.map +1 -0
- package/dist/hooks.mjs +64 -0
- package/dist/hooks.mjs.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.docs.d.ts +6 -0
- package/dist/index.docs.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +157 -0
- package/dist/index.mjs.map +1 -0
- package/dist/krisp.d.ts +2 -0
- package/dist/krisp.js +2 -0
- package/dist/krisp.js.map +1 -0
- package/dist/krisp.mjs +45 -0
- package/dist/krisp.mjs.map +1 -0
- package/dist/mergeProps.d.ts +25 -0
- package/dist/mergeProps.d.ts.map +1 -0
- package/dist/prefabs/AudioConference.d.ts +22 -0
- package/dist/prefabs/AudioConference.d.ts.map +1 -0
- package/dist/prefabs/Chat.d.ts +35 -0
- package/dist/prefabs/Chat.d.ts.map +1 -0
- package/dist/prefabs/ControlBar.d.ts +45 -0
- package/dist/prefabs/ControlBar.d.ts.map +1 -0
- package/dist/prefabs/MediaDeviceMenu.d.ts +36 -0
- package/dist/prefabs/MediaDeviceMenu.d.ts.map +1 -0
- package/dist/prefabs/PreJoin.d.ts +59 -0
- package/dist/prefabs/PreJoin.d.ts.map +1 -0
- package/dist/prefabs/VideoConference.d.ts +35 -0
- package/dist/prefabs/VideoConference.d.ts.map +1 -0
- package/dist/prefabs/VoiceAssistantControlBar.d.ts +32 -0
- package/dist/prefabs/VoiceAssistantControlBar.d.ts.map +1 -0
- package/dist/prefabs/index.d.ts +8 -0
- package/dist/prefabs/index.d.ts.map +1 -0
- package/dist/prefabs.d.ts +2 -0
- package/dist/prefabs.js +2 -0
- package/dist/prefabs.js.map +1 -0
- package/dist/prefabs.mjs +579 -0
- package/dist/prefabs.mjs.map +1 -0
- package/dist/room-BP3SCCCd.mjs +191 -0
- package/dist/room-BP3SCCCd.mjs.map +1 -0
- package/dist/shared-88J2fzv7.js +2 -0
- package/dist/shared-88J2fzv7.js.map +1 -0
- package/dist/shared-BDr0qLg4.js +4 -0
- package/dist/shared-BDr0qLg4.js.map +1 -0
- package/dist/shared-CjI_UuOX.js +2 -0
- package/dist/shared-CjI_UuOX.js.map +1 -0
- package/dist/shared-DTHOl3uJ.js +2 -0
- package/dist/shared-DTHOl3uJ.js.map +1 -0
- package/dist/utils.d.ts +19 -0
- package/dist/utils.d.ts.map +1 -0
- package/package.json +104 -0
- package/src/assets/icons/CameraDisabledIcon.tsx +15 -0
- package/src/assets/icons/CameraIcon.tsx +14 -0
- package/src/assets/icons/ChatCloseIcon.tsx +17 -0
- package/src/assets/icons/ChatIcon.tsx +25 -0
- package/src/assets/icons/Chevron.tsx +19 -0
- package/src/assets/icons/FocusToggleIcon.tsx +16 -0
- package/src/assets/icons/GearIcon.tsx +19 -0
- package/src/assets/icons/LeaveIcon.tsx +25 -0
- package/src/assets/icons/LockLockedIcon.tsx +19 -0
- package/src/assets/icons/MicDisabledIcon.tsx +15 -0
- package/src/assets/icons/MicIcon.tsx +19 -0
- package/src/assets/icons/QualityExcellentIcon.tsx +15 -0
- package/src/assets/icons/QualityGoodIcon.tsx +19 -0
- package/src/assets/icons/QualityPoorIcon.tsx +20 -0
- package/src/assets/icons/QualityUnknownIcon.tsx +17 -0
- package/src/assets/icons/ScreenShareIcon.tsx +25 -0
- package/src/assets/icons/ScreenShareStopIcon.tsx +21 -0
- package/src/assets/icons/SpinnerIcon.tsx +93 -0
- package/src/assets/icons/UnfocusToggleIcon.tsx +16 -0
- package/src/assets/icons/index.ts +19 -0
- package/src/assets/icons/util.tsx +47 -0
- package/src/assets/images/ParticipantPlaceholder.tsx +31 -0
- package/src/assets/images/index.ts +1 -0
- package/src/assets/template.js +21 -0
- package/src/components/ChatEntry.tsx +112 -0
- package/src/components/ConnectionState.tsx +36 -0
- package/src/components/ConnectionStateToast.tsx +47 -0
- package/src/components/LiveKitRoom.tsx +122 -0
- package/src/components/ParticipantLoop.tsx +41 -0
- package/src/components/RoomAudioRenderer.tsx +57 -0
- package/src/components/RoomName.tsx +36 -0
- package/src/components/SessionProvider.tsx +22 -0
- package/src/components/Toast.tsx +18 -0
- package/src/components/TrackLoop.tsx +45 -0
- package/src/components/controls/ChatToggle.tsx +32 -0
- package/src/components/controls/ClearPinButton.tsx +32 -0
- package/src/components/controls/DisconnectButton.tsx +32 -0
- package/src/components/controls/FocusToggle.tsx +54 -0
- package/src/components/controls/MediaDeviceSelect.tsx +144 -0
- package/src/components/controls/PaginationControl.tsx +51 -0
- package/src/components/controls/PaginationIndicator.tsx +26 -0
- package/src/components/controls/SettingsMenuToggle.tsx +26 -0
- package/src/components/controls/StartAudio.tsx +40 -0
- package/src/components/controls/StartMediaButton.tsx +41 -0
- package/src/components/controls/TrackToggle.tsx +54 -0
- package/src/components/index.ts +34 -0
- package/src/components/layout/CarouselLayout.tsx +80 -0
- package/src/components/layout/FocusLayout.tsx +37 -0
- package/src/components/layout/GridLayout.tsx +63 -0
- package/src/components/layout/LayoutContextProvider.tsx +36 -0
- package/src/components/layout/index.ts +3 -0
- package/src/components/participant/AudioTrack.tsx +89 -0
- package/src/components/participant/AudioVisualizer.tsx +67 -0
- package/src/components/participant/BarVisualizer.tsx +164 -0
- package/src/components/participant/ConnectionQualityIndicator.tsx +36 -0
- package/src/components/participant/ParticipantAudioTile.tsx +67 -0
- package/src/components/participant/ParticipantName.tsx +50 -0
- package/src/components/participant/ParticipantTile.tsx +192 -0
- package/src/components/participant/TrackMutedIndicator.tsx +53 -0
- package/src/components/participant/VideoTrack.tsx +92 -0
- package/src/components/participant/animationSequences/connectingSequence.ts +9 -0
- package/src/components/participant/animationSequences/listeningSequence.ts +6 -0
- package/src/components/participant/animationSequences/thinkingSequence.ts +12 -0
- package/src/components/participant/animators/useBarAnimator.ts +55 -0
- package/src/context/chat-context.ts +37 -0
- package/src/context/feature-context.ts +28 -0
- package/src/context/index.ts +27 -0
- package/src/context/layout-context.ts +72 -0
- package/src/context/participant-context.ts +44 -0
- package/src/context/pin-context.ts +27 -0
- package/src/context/room-context.ts +42 -0
- package/src/context/session-context.ts +43 -0
- package/src/context/track-reference-context.ts +47 -0
- package/src/hooks/cloud/krisp/useKrispNoiseFilter.ts +110 -0
- package/src/hooks/index.ts +72 -0
- package/src/hooks/internal/index.ts +10 -0
- package/src/hooks/internal/useMediaQuery.ts +46 -0
- package/src/hooks/internal/useObservableState.ts +24 -0
- package/src/hooks/internal/useResizeObserver.ts +124 -0
- package/src/hooks/useAgent.ts +945 -0
- package/src/hooks/useAudioPlayback.ts +34 -0
- package/src/hooks/useChat.ts +57 -0
- package/src/hooks/useChatToggle.ts +38 -0
- package/src/hooks/useClearPinButton.ts +29 -0
- package/src/hooks/useConnectionQualityIndicator.ts +33 -0
- package/src/hooks/useConnectionStatus.ts +22 -0
- package/src/hooks/useDataChannel.ts +73 -0
- package/src/hooks/useDisconnectButton.ts +36 -0
- package/src/hooks/useEvents.ts +39 -0
- package/src/hooks/useFacingMode.ts +22 -0
- package/src/hooks/useFocusToggle.ts +59 -0
- package/src/hooks/useGridLayout.ts +44 -0
- package/src/hooks/useIsEncrypted.ts +29 -0
- package/src/hooks/useIsMuted.ts +51 -0
- package/src/hooks/useIsRecording.ts +23 -0
- package/src/hooks/useIsSpeaking.ts +21 -0
- package/src/hooks/useLiveKitRoom.ts +186 -0
- package/src/hooks/useLocalParticipant.ts +73 -0
- package/src/hooks/useLocalParticipantPermissions.ts +24 -0
- package/src/hooks/useMediaDeviceSelect.ts +81 -0
- package/src/hooks/useMediaDevices.ts +28 -0
- package/src/hooks/useMediaTrackBySourceOrName.ts +97 -0
- package/src/hooks/usePagination.test.ts +77 -0
- package/src/hooks/usePagination.ts +67 -0
- package/src/hooks/useParticipantAttributes.ts +69 -0
- package/src/hooks/useParticipantInfo.ts +35 -0
- package/src/hooks/useParticipantPermissions.ts +29 -0
- package/src/hooks/useParticipantTile.ts +81 -0
- package/src/hooks/useParticipantTracks.ts +54 -0
- package/src/hooks/useParticipants.ts +42 -0
- package/src/hooks/usePersistentUserChoices.ts +64 -0
- package/src/hooks/usePinnedTracks.ts +24 -0
- package/src/hooks/useRemoteParticipant.ts +79 -0
- package/src/hooks/useRemoteParticipants.ts +45 -0
- package/src/hooks/useRoomInfo.ts +32 -0
- package/src/hooks/useSequentialRoomConnectDisconnect.ts +171 -0
- package/src/hooks/useSession.ts +642 -0
- package/src/hooks/useSessionMessages.ts +158 -0
- package/src/hooks/useSettingsToggle.ts +32 -0
- package/src/hooks/useSortedParticipants.ts +20 -0
- package/src/hooks/useSpeakingParticipants.ts +27 -0
- package/src/hooks/useStartAudio.ts +50 -0
- package/src/hooks/useStartVideo.ts +49 -0
- package/src/hooks/useSwipe.ts +68 -0
- package/src/hooks/useTextStream.ts +35 -0
- package/src/hooks/useToken.ts +54 -0
- package/src/hooks/useTrack.ts +11 -0
- package/src/hooks/useTrackByName.ts +15 -0
- package/src/hooks/useTrackMutedIndicator.ts +44 -0
- package/src/hooks/useTrackRefBySourceOrName.ts +30 -0
- package/src/hooks/useTrackSyncTime.ts +18 -0
- package/src/hooks/useTrackToggle.ts +93 -0
- package/src/hooks/useTrackTranscription.ts +75 -0
- package/src/hooks/useTrackVolume.ts +283 -0
- package/src/hooks/useTracks.test.ts +60 -0
- package/src/hooks/useTracks.ts +154 -0
- package/src/hooks/useTranscriptions.ts +48 -0
- package/src/hooks/useVisualStableUpdate.ts +63 -0
- package/src/hooks/useVoiceAssistant.ts +109 -0
- package/src/hooks/useWarnAboutMissingStyles.ts +11 -0
- package/src/index.docs.ts +12 -0
- package/src/index.ts +32 -0
- package/src/mergeProps.ts +87 -0
- package/src/prefabs/AudioConference.tsx +57 -0
- package/src/prefabs/Chat.tsx +153 -0
- package/src/prefabs/ControlBar.tsx +227 -0
- package/src/prefabs/MediaDeviceMenu.tsx +159 -0
- package/src/prefabs/PreJoin.tsx +439 -0
- package/src/prefabs/VideoConference.tsx +184 -0
- package/src/prefabs/VoiceAssistantControlBar.tsx +109 -0
- package/src/prefabs/index.ts +11 -0
- package/src/utils.ts +78 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useDisconnectButton } from '../../hooks';
|
|
3
|
+
|
|
4
|
+
/** @public */
|
|
5
|
+
export interface DisconnectButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
6
|
+
stopTracks?: boolean;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The `DisconnectButton` is a basic html button with the added ability to disconnect from a LiveKit room.
|
|
11
|
+
* Normally this is the big red button that allows end users to leave the video or audio call.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* <LiveKitRoom>
|
|
16
|
+
* <DisconnectButton>Leave room</DisconnectButton>
|
|
17
|
+
* </LiveKitRoom>
|
|
18
|
+
* ```
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
export const DisconnectButton: (
|
|
22
|
+
props: DisconnectButtonProps & React.RefAttributes<HTMLButtonElement>,
|
|
23
|
+
) => React.ReactNode = /* @__PURE__ */ React.forwardRef<HTMLButtonElement, DisconnectButtonProps>(
|
|
24
|
+
function DisconnectButton(props: DisconnectButtonProps, ref) {
|
|
25
|
+
const { buttonProps } = useDisconnectButton(props);
|
|
26
|
+
return (
|
|
27
|
+
<button ref={ref} {...buttonProps}>
|
|
28
|
+
{props.children}
|
|
29
|
+
</button>
|
|
30
|
+
);
|
|
31
|
+
},
|
|
32
|
+
);
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { LayoutContext, useMaybeTrackRefContext } from '../../context';
|
|
3
|
+
import { FocusToggleIcon, UnfocusToggleIcon } from '../../assets/icons';
|
|
4
|
+
import { useFocusToggle } from '../../hooks';
|
|
5
|
+
import type { TrackReferenceOrPlaceholder } from '@livekit/components-core';
|
|
6
|
+
|
|
7
|
+
/** @public */
|
|
8
|
+
export interface FocusToggleProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
9
|
+
trackRef?: TrackReferenceOrPlaceholder;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The `FocusToggle` puts the `ParticipantTile` in focus or removes it from focus.
|
|
14
|
+
* @remarks
|
|
15
|
+
* This component needs to live inside `LayoutContext` to work properly.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* <ParticipantTile>
|
|
20
|
+
* <FocusToggle />
|
|
21
|
+
* </ParticipantTile>
|
|
22
|
+
* ```
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
25
|
+
export const FocusToggle: (
|
|
26
|
+
props: FocusToggleProps & React.RefAttributes<HTMLButtonElement>,
|
|
27
|
+
) => React.ReactNode = /* @__PURE__ */ React.forwardRef<HTMLButtonElement, FocusToggleProps>(
|
|
28
|
+
function FocusToggle({ trackRef, ...props }: FocusToggleProps, ref) {
|
|
29
|
+
const trackRefFromContext = useMaybeTrackRefContext();
|
|
30
|
+
|
|
31
|
+
const { mergedProps, inFocus } = useFocusToggle({
|
|
32
|
+
trackRef: trackRef ?? trackRefFromContext,
|
|
33
|
+
props,
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<LayoutContext.Consumer>
|
|
38
|
+
{(layoutContext) =>
|
|
39
|
+
layoutContext !== undefined && (
|
|
40
|
+
<button ref={ref} {...mergedProps}>
|
|
41
|
+
{props.children ? (
|
|
42
|
+
props.children
|
|
43
|
+
) : inFocus ? (
|
|
44
|
+
<UnfocusToggleIcon />
|
|
45
|
+
) : (
|
|
46
|
+
<FocusToggleIcon />
|
|
47
|
+
)}
|
|
48
|
+
</button>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
</LayoutContext.Consumer>
|
|
52
|
+
);
|
|
53
|
+
},
|
|
54
|
+
);
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useMaybeRoomContext } from '../../context';
|
|
3
|
+
import { mergeProps } from '../../utils';
|
|
4
|
+
import { RoomEvent, type LocalAudioTrack, type LocalVideoTrack } from 'livekit-client';
|
|
5
|
+
import { useMediaDeviceSelect } from '../../hooks';
|
|
6
|
+
|
|
7
|
+
/** @public */
|
|
8
|
+
export interface MediaDeviceSelectProps
|
|
9
|
+
extends Omit<React.HTMLAttributes<HTMLUListElement>, 'onError'> {
|
|
10
|
+
kind: MediaDeviceKind;
|
|
11
|
+
onActiveDeviceChange?: (deviceId: string) => void;
|
|
12
|
+
onDeviceListChange?: (devices: MediaDeviceInfo[]) => void;
|
|
13
|
+
onDeviceSelectError?: (e: Error) => void;
|
|
14
|
+
initialSelection?: string;
|
|
15
|
+
/** will force the browser to only return the specified device
|
|
16
|
+
* will call `onDeviceSelectError` with the error in case this fails
|
|
17
|
+
*/
|
|
18
|
+
exactMatch?: boolean;
|
|
19
|
+
track?: LocalAudioTrack | LocalVideoTrack;
|
|
20
|
+
/**
|
|
21
|
+
* this will call getUserMedia if the permissions are not yet given to enumerate the devices with device labels.
|
|
22
|
+
* in some browsers multiple calls to getUserMedia result in multiple permission prompts.
|
|
23
|
+
* It's generally advised only flip this to true, once a (preview) track has been acquired successfully with the
|
|
24
|
+
* appropriate permissions.
|
|
25
|
+
*
|
|
26
|
+
* @see {@link MediaDeviceMenu}
|
|
27
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/enumerateDevices | MDN enumerateDevices}
|
|
28
|
+
*/
|
|
29
|
+
requestPermissions?: boolean;
|
|
30
|
+
onError?: (e: Error) => void;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The `MediaDeviceSelect` list all media devices of one kind.
|
|
35
|
+
* Clicking on one of the listed devices make it the active media device.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```tsx
|
|
39
|
+
* <LiveKitRoom>
|
|
40
|
+
* <MediaDeviceSelect kind='audioinput' />
|
|
41
|
+
* </LiveKitRoom>
|
|
42
|
+
* ```
|
|
43
|
+
* @public
|
|
44
|
+
*/
|
|
45
|
+
export const MediaDeviceSelect: (
|
|
46
|
+
props: MediaDeviceSelectProps & React.RefAttributes<HTMLUListElement>,
|
|
47
|
+
) => React.ReactNode = /* @__PURE__ */ React.forwardRef<HTMLUListElement, MediaDeviceSelectProps>(
|
|
48
|
+
function MediaDeviceSelect(
|
|
49
|
+
{
|
|
50
|
+
kind,
|
|
51
|
+
initialSelection,
|
|
52
|
+
onActiveDeviceChange,
|
|
53
|
+
onDeviceListChange,
|
|
54
|
+
onDeviceSelectError,
|
|
55
|
+
exactMatch,
|
|
56
|
+
track,
|
|
57
|
+
requestPermissions,
|
|
58
|
+
onError,
|
|
59
|
+
...props
|
|
60
|
+
}: MediaDeviceSelectProps,
|
|
61
|
+
ref,
|
|
62
|
+
) {
|
|
63
|
+
const room = useMaybeRoomContext();
|
|
64
|
+
const previousActiveDeviceId = React.useRef<string>('default');
|
|
65
|
+
const handleError = React.useCallback(
|
|
66
|
+
(e: Error) => {
|
|
67
|
+
if (room) {
|
|
68
|
+
// awkwardly emit the event from outside of the room, as we don't have other means to raise a MediaDeviceError
|
|
69
|
+
room.emit(RoomEvent.MediaDevicesError, e);
|
|
70
|
+
}
|
|
71
|
+
onError?.(e);
|
|
72
|
+
},
|
|
73
|
+
[room, onError],
|
|
74
|
+
);
|
|
75
|
+
const { devices, activeDeviceId, setActiveMediaDevice, className } = useMediaDeviceSelect({
|
|
76
|
+
kind,
|
|
77
|
+
room,
|
|
78
|
+
track,
|
|
79
|
+
requestPermissions,
|
|
80
|
+
onError: handleError,
|
|
81
|
+
});
|
|
82
|
+
React.useEffect(() => {
|
|
83
|
+
if (initialSelection !== undefined) {
|
|
84
|
+
setActiveMediaDevice(initialSelection);
|
|
85
|
+
}
|
|
86
|
+
}, [setActiveMediaDevice]);
|
|
87
|
+
|
|
88
|
+
React.useEffect(() => {
|
|
89
|
+
if (typeof onDeviceListChange === 'function') {
|
|
90
|
+
onDeviceListChange(devices);
|
|
91
|
+
}
|
|
92
|
+
}, [onDeviceListChange, devices]);
|
|
93
|
+
|
|
94
|
+
React.useEffect(() => {
|
|
95
|
+
if (activeDeviceId !== previousActiveDeviceId.current) {
|
|
96
|
+
onActiveDeviceChange?.(activeDeviceId);
|
|
97
|
+
}
|
|
98
|
+
previousActiveDeviceId.current = activeDeviceId;
|
|
99
|
+
}, [activeDeviceId]);
|
|
100
|
+
|
|
101
|
+
const handleActiveDeviceChange = async (deviceId: string) => {
|
|
102
|
+
try {
|
|
103
|
+
await setActiveMediaDevice(deviceId, { exact: exactMatch ?? true });
|
|
104
|
+
} catch (e) {
|
|
105
|
+
if (e instanceof Error) {
|
|
106
|
+
onDeviceSelectError?.(e);
|
|
107
|
+
} else {
|
|
108
|
+
throw e;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
// Merge Props
|
|
113
|
+
const mergedProps = React.useMemo(
|
|
114
|
+
() => mergeProps(props, { className }, { className: 'lk-list' }),
|
|
115
|
+
[className, props],
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
const hasDefault = !!devices.find((info) => info.label.toLowerCase().startsWith('default'));
|
|
119
|
+
|
|
120
|
+
function isActive(deviceId: string, activeDeviceId: string, index: number) {
|
|
121
|
+
return (
|
|
122
|
+
deviceId === activeDeviceId || (!hasDefault && index === 0 && activeDeviceId === 'default')
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
return (
|
|
127
|
+
<ul ref={ref} {...mergedProps}>
|
|
128
|
+
{devices.map((device, index) => (
|
|
129
|
+
<li
|
|
130
|
+
key={device.deviceId}
|
|
131
|
+
id={device.deviceId}
|
|
132
|
+
data-lk-active={isActive(device.deviceId, activeDeviceId, index)}
|
|
133
|
+
aria-selected={isActive(device.deviceId, activeDeviceId, index)}
|
|
134
|
+
role="option"
|
|
135
|
+
>
|
|
136
|
+
<button className="lk-button" onClick={() => handleActiveDeviceChange(device.deviceId)}>
|
|
137
|
+
{device.label}
|
|
138
|
+
</button>
|
|
139
|
+
</li>
|
|
140
|
+
))}
|
|
141
|
+
</ul>
|
|
142
|
+
);
|
|
143
|
+
},
|
|
144
|
+
);
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import SvgChevron from '../../assets/icons/Chevron';
|
|
3
|
+
import type { usePagination } from '../../hooks';
|
|
4
|
+
import { createInteractingObservable } from '@livekit/components-core';
|
|
5
|
+
|
|
6
|
+
export interface PaginationControlProps
|
|
7
|
+
extends Pick<
|
|
8
|
+
ReturnType<typeof usePagination>,
|
|
9
|
+
'totalPageCount' | 'nextPage' | 'prevPage' | 'currentPage'
|
|
10
|
+
> {
|
|
11
|
+
/** Reference to an HTML element that holds the pages, while interacting (`mouseover`)
|
|
12
|
+
* with it, the pagination controls will appear for a while. */
|
|
13
|
+
pagesContainer?: React.RefObject<HTMLElement>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function PaginationControl({
|
|
17
|
+
totalPageCount,
|
|
18
|
+
nextPage,
|
|
19
|
+
prevPage,
|
|
20
|
+
currentPage,
|
|
21
|
+
pagesContainer: connectedElement,
|
|
22
|
+
}: PaginationControlProps) {
|
|
23
|
+
const [interactive, setInteractive] = React.useState(false);
|
|
24
|
+
React.useEffect(() => {
|
|
25
|
+
let subscription:
|
|
26
|
+
| ReturnType<ReturnType<typeof createInteractingObservable>['subscribe']>
|
|
27
|
+
| undefined;
|
|
28
|
+
if (connectedElement) {
|
|
29
|
+
subscription = createInteractingObservable(connectedElement.current, 2000).subscribe(
|
|
30
|
+
setInteractive,
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
return () => {
|
|
34
|
+
if (subscription) {
|
|
35
|
+
subscription.unsubscribe();
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}, [connectedElement]);
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<div className="lk-pagination-control" data-lk-user-interaction={interactive}>
|
|
42
|
+
<button className="lk-button" onClick={prevPage}>
|
|
43
|
+
<SvgChevron />
|
|
44
|
+
</button>
|
|
45
|
+
<span className="lk-pagination-count">{`${currentPage} of ${totalPageCount}`}</span>
|
|
46
|
+
<button className="lk-button" onClick={nextPage}>
|
|
47
|
+
<SvgChevron />
|
|
48
|
+
</button>
|
|
49
|
+
</div>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
export interface PaginationIndicatorProps {
|
|
4
|
+
totalPageCount: number;
|
|
5
|
+
currentPage: number;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const PaginationIndicator: (
|
|
9
|
+
props: PaginationIndicatorProps & React.RefAttributes<HTMLDivElement>,
|
|
10
|
+
) => React.ReactNode = /* @__PURE__ */ React.forwardRef<HTMLDivElement, PaginationIndicatorProps>(
|
|
11
|
+
function PaginationIndicator({ totalPageCount, currentPage }: PaginationIndicatorProps, ref) {
|
|
12
|
+
const bubbles = new Array(totalPageCount).fill('').map((_, index) => {
|
|
13
|
+
if (index + 1 === currentPage) {
|
|
14
|
+
return <span data-lk-active key={index} />;
|
|
15
|
+
} else {
|
|
16
|
+
return <span key={index} />;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<div ref={ref} className="lk-pagination-indicator">
|
|
22
|
+
{bubbles}
|
|
23
|
+
</div>
|
|
24
|
+
);
|
|
25
|
+
},
|
|
26
|
+
);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useSettingsToggle } from '../../hooks/useSettingsToggle';
|
|
3
|
+
|
|
4
|
+
/** @alpha */
|
|
5
|
+
export interface SettingsMenuToggleProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {}
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The `SettingsMenuToggle` component is a button that toggles the visibility of the `SettingsMenu` component.
|
|
9
|
+
* @remarks
|
|
10
|
+
* For the component to have any effect it has to live inside a `LayoutContext` context.
|
|
11
|
+
*
|
|
12
|
+
* @alpha
|
|
13
|
+
*/
|
|
14
|
+
export const SettingsMenuToggle: (
|
|
15
|
+
props: SettingsMenuToggleProps & React.RefAttributes<HTMLButtonElement>,
|
|
16
|
+
) => React.ReactNode = /* @__PURE__ */ React.forwardRef<HTMLButtonElement, SettingsMenuToggleProps>(
|
|
17
|
+
function SettingsMenuToggle(props: SettingsMenuToggleProps, ref) {
|
|
18
|
+
const { mergedProps } = useSettingsToggle({ props });
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<button ref={ref} {...mergedProps}>
|
|
22
|
+
{props.children}
|
|
23
|
+
</button>
|
|
24
|
+
);
|
|
25
|
+
},
|
|
26
|
+
);
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useEnsureRoom } from '../../context';
|
|
3
|
+
import { useStartAudio } from '../../hooks';
|
|
4
|
+
import { Room } from 'livekit-client';
|
|
5
|
+
|
|
6
|
+
/** @public */
|
|
7
|
+
export interface AllowAudioPlaybackProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
8
|
+
room?: Room;
|
|
9
|
+
label: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The `StartAudio` component is only visible when the browser blocks audio playback. This is due to some browser implemented autoplay policies.
|
|
14
|
+
* To start audio playback, the user must perform a user-initiated event such as clicking this button.
|
|
15
|
+
* As soon as audio playback starts, the button hides itself again.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* <LiveKitRoom>
|
|
20
|
+
* <StartAudio label="Click to allow audio playback" />
|
|
21
|
+
* </LiveKitRoom>
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @see Autoplay policy on MDN web docs: {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API/Best_practices#autoplay_policy}
|
|
25
|
+
* @public
|
|
26
|
+
*/
|
|
27
|
+
export const StartAudio: (
|
|
28
|
+
props: AllowAudioPlaybackProps & React.RefAttributes<HTMLButtonElement>,
|
|
29
|
+
) => React.ReactNode = /* @__PURE__ */ React.forwardRef<HTMLButtonElement, AllowAudioPlaybackProps>(
|
|
30
|
+
function StartAudio({ label = 'Allow Audio', ...props }: AllowAudioPlaybackProps, ref) {
|
|
31
|
+
const room = useEnsureRoom(props.room);
|
|
32
|
+
const { mergedProps } = useStartAudio({ room, props });
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<button ref={ref} {...mergedProps}>
|
|
36
|
+
{label}
|
|
37
|
+
</button>
|
|
38
|
+
);
|
|
39
|
+
},
|
|
40
|
+
);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useRoomContext } from '../../context';
|
|
3
|
+
import { useStartAudio, useStartVideo } from '../../hooks';
|
|
4
|
+
|
|
5
|
+
/** @public */
|
|
6
|
+
export interface AllowMediaPlaybackProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
7
|
+
label?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The `StartMediaButton` component is only visible when the browser blocks media playback. This is due to some browser implemented autoplay policies.
|
|
12
|
+
* To start media playback, the user must perform a user-initiated event such as clicking this button.
|
|
13
|
+
* As soon as media playback starts, the button hides itself again.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* <LiveKitRoom>
|
|
18
|
+
* <StartMediaButton label="Click to allow media playback" />
|
|
19
|
+
* </LiveKitRoom>
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @see Autoplay policy on MDN web docs: {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API/Best_practices#autoplay_policy}
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
25
|
+
export const StartMediaButton: (
|
|
26
|
+
props: AllowMediaPlaybackProps & React.RefAttributes<HTMLButtonElement>,
|
|
27
|
+
) => React.ReactNode = /* @__PURE__ */ React.forwardRef<HTMLButtonElement, AllowMediaPlaybackProps>(
|
|
28
|
+
function StartMediaButton({ label, ...props }: AllowMediaPlaybackProps, ref) {
|
|
29
|
+
const room = useRoomContext();
|
|
30
|
+
const { mergedProps: audioProps, canPlayAudio } = useStartAudio({ room, props });
|
|
31
|
+
const { mergedProps, canPlayVideo } = useStartVideo({ room, props: audioProps });
|
|
32
|
+
const { style, ...restProps } = mergedProps;
|
|
33
|
+
style.display = canPlayAudio && canPlayVideo ? 'none' : 'block';
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<button ref={ref} style={style} {...restProps}>
|
|
37
|
+
{label ?? `Start ${!canPlayAudio ? 'Audio' : 'Video'}`}
|
|
38
|
+
</button>
|
|
39
|
+
);
|
|
40
|
+
},
|
|
41
|
+
);
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { CaptureOptionsBySource, ToggleSource } from '@livekit/components-core';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { getSourceIcon } from '../../assets/icons/util';
|
|
4
|
+
import { useTrackToggle } from '../../hooks';
|
|
5
|
+
import { TrackPublishOptions } from 'livekit-client';
|
|
6
|
+
|
|
7
|
+
/** @public */
|
|
8
|
+
export interface TrackToggleProps<T extends ToggleSource>
|
|
9
|
+
extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'onChange'> {
|
|
10
|
+
source: T;
|
|
11
|
+
showIcon?: boolean;
|
|
12
|
+
initialState?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Function that is called when the enabled state of the toggle changes.
|
|
15
|
+
* The second function argument `isUserInitiated` is `true` if the change was initiated by a user interaction, such as a click.
|
|
16
|
+
*/
|
|
17
|
+
onChange?: (enabled: boolean, isUserInitiated: boolean) => void;
|
|
18
|
+
captureOptions?: CaptureOptionsBySource<T>;
|
|
19
|
+
publishOptions?: TrackPublishOptions;
|
|
20
|
+
onDeviceError?: (error: Error) => void;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* With the `TrackToggle` component it is possible to mute and unmute your camera and microphone.
|
|
25
|
+
* The component uses an html button element under the hood so you can treat it like a button.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```tsx
|
|
29
|
+
* <LiveKitRoom>
|
|
30
|
+
* <TrackToggle source={Track.Source.Microphone} />
|
|
31
|
+
* <TrackToggle source={Track.Source.Camera} />
|
|
32
|
+
* </LiveKitRoom>
|
|
33
|
+
* ```
|
|
34
|
+
* @public
|
|
35
|
+
*/
|
|
36
|
+
export const TrackToggle: <T extends ToggleSource>(
|
|
37
|
+
props: TrackToggleProps<T> & React.RefAttributes<HTMLButtonElement>,
|
|
38
|
+
) => React.ReactNode = /* @__PURE__ */ React.forwardRef(function TrackToggle<
|
|
39
|
+
T extends ToggleSource,
|
|
40
|
+
>({ showIcon, ...props }: TrackToggleProps<T>, ref: React.ForwardedRef<HTMLButtonElement>) {
|
|
41
|
+
const { buttonProps, enabled } = useTrackToggle(props);
|
|
42
|
+
const [isClient, setIsClient] = React.useState(false);
|
|
43
|
+
React.useEffect(() => {
|
|
44
|
+
setIsClient(true);
|
|
45
|
+
}, []);
|
|
46
|
+
return (
|
|
47
|
+
isClient && (
|
|
48
|
+
<button ref={ref} {...buttonProps}>
|
|
49
|
+
{(showIcon ?? true) && getSourceIcon(props.source, enabled)}
|
|
50
|
+
{props.children}
|
|
51
|
+
</button>
|
|
52
|
+
)
|
|
53
|
+
);
|
|
54
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export * from './controls/ClearPinButton';
|
|
2
|
+
export * from './ConnectionState';
|
|
3
|
+
export * from './controls/ChatToggle';
|
|
4
|
+
export * from './controls/DisconnectButton';
|
|
5
|
+
export * from './controls/FocusToggle';
|
|
6
|
+
export * from './controls/MediaDeviceSelect';
|
|
7
|
+
export * from './controls/StartAudio';
|
|
8
|
+
export * from './controls/StartMediaButton';
|
|
9
|
+
export * from './controls/TrackToggle';
|
|
10
|
+
export * from './layout';
|
|
11
|
+
export * from './layout/LayoutContextProvider';
|
|
12
|
+
export * from './LiveKitRoom';
|
|
13
|
+
export * from './participant/AudioVisualizer';
|
|
14
|
+
export * from './participant/ConnectionQualityIndicator';
|
|
15
|
+
export * from './participant/AudioTrack';
|
|
16
|
+
export * from './participant/VideoTrack';
|
|
17
|
+
export * from './participant/ParticipantName';
|
|
18
|
+
export * from './participant/TrackMutedIndicator';
|
|
19
|
+
export * from './ParticipantLoop';
|
|
20
|
+
export { RoomAudioRenderer, type RoomAudioRendererProps } from './RoomAudioRenderer';
|
|
21
|
+
export * from './RoomName';
|
|
22
|
+
export { Toast } from './Toast';
|
|
23
|
+
export * from './TrackLoop';
|
|
24
|
+
export * from './participant/ParticipantTile';
|
|
25
|
+
export * from './participant/ParticipantAudioTile';
|
|
26
|
+
export * from './participant/BarVisualizer';
|
|
27
|
+
export { ConnectionStateToast, type ConnectionStateToastProps } from './ConnectionStateToast';
|
|
28
|
+
export {
|
|
29
|
+
type MessageFormatter,
|
|
30
|
+
type ChatEntryProps,
|
|
31
|
+
ChatEntry,
|
|
32
|
+
formatChatMessageLinks,
|
|
33
|
+
} from './ChatEntry';
|
|
34
|
+
export * from './SessionProvider';
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { TrackReferenceOrPlaceholder } from '@livekit/components-core';
|
|
2
|
+
import { getScrollBarWidth } from '@livekit/components-core';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { useSize } from '../../hooks/internal';
|
|
5
|
+
import { useVisualStableUpdate } from '../../hooks';
|
|
6
|
+
import { TrackLoop } from '../TrackLoop';
|
|
7
|
+
|
|
8
|
+
const MIN_HEIGHT = 130;
|
|
9
|
+
const MIN_WIDTH = 140;
|
|
10
|
+
const MIN_VISIBLE_TILES = 1;
|
|
11
|
+
const ASPECT_RATIO = 16 / 10;
|
|
12
|
+
const ASPECT_RATIO_INVERT = (1 - ASPECT_RATIO) * -1;
|
|
13
|
+
|
|
14
|
+
/** @public */
|
|
15
|
+
export interface CarouselLayoutProps extends React.HTMLAttributes<HTMLMediaElement> {
|
|
16
|
+
tracks: TrackReferenceOrPlaceholder[];
|
|
17
|
+
children: React.ReactNode;
|
|
18
|
+
/** Place the tiles vertically or horizontally next to each other.
|
|
19
|
+
* If undefined orientation is guessed by the dimensions of the container. */
|
|
20
|
+
orientation?: 'vertical' | 'horizontal';
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The `CarouselLayout` component displays a list of tracks in a scroll container.
|
|
25
|
+
* It will display as many tiles as possible and overflow the rest.
|
|
26
|
+
* @remarks
|
|
27
|
+
* To ensure visual stability when tiles are reordered due to track updates,
|
|
28
|
+
* the component uses the `useVisualStableUpdate` hook.
|
|
29
|
+
* @example
|
|
30
|
+
* ```tsx
|
|
31
|
+
* const tracks = useTracks([Track.Source.Camera]);
|
|
32
|
+
* <CarouselLayout tracks={tracks}>
|
|
33
|
+
* <ParticipantTile />
|
|
34
|
+
* </CarouselLayout>
|
|
35
|
+
* ```
|
|
36
|
+
* @public
|
|
37
|
+
*/
|
|
38
|
+
export function CarouselLayout({ tracks, orientation, ...props }: CarouselLayoutProps) {
|
|
39
|
+
const asideEl = React.useRef<HTMLDivElement>(null);
|
|
40
|
+
const [prevTiles, setPrevTiles] = React.useState(0);
|
|
41
|
+
const { width, height } = useSize(asideEl);
|
|
42
|
+
const carouselOrientation = orientation
|
|
43
|
+
? orientation
|
|
44
|
+
: height >= width
|
|
45
|
+
? 'vertical'
|
|
46
|
+
: 'horizontal';
|
|
47
|
+
|
|
48
|
+
const tileSpan =
|
|
49
|
+
carouselOrientation === 'vertical'
|
|
50
|
+
? Math.max(width * ASPECT_RATIO_INVERT, MIN_HEIGHT)
|
|
51
|
+
: Math.max(height * ASPECT_RATIO, MIN_WIDTH);
|
|
52
|
+
const scrollBarWidth = getScrollBarWidth();
|
|
53
|
+
|
|
54
|
+
const tilesThatFit =
|
|
55
|
+
carouselOrientation === 'vertical'
|
|
56
|
+
? Math.max((height - scrollBarWidth) / tileSpan, MIN_VISIBLE_TILES)
|
|
57
|
+
: Math.max((width - scrollBarWidth) / tileSpan, MIN_VISIBLE_TILES);
|
|
58
|
+
|
|
59
|
+
let maxVisibleTiles = Math.round(tilesThatFit);
|
|
60
|
+
if (Math.abs(tilesThatFit - prevTiles) < 0.5) {
|
|
61
|
+
maxVisibleTiles = Math.round(prevTiles);
|
|
62
|
+
} else if (prevTiles !== tilesThatFit) {
|
|
63
|
+
setPrevTiles(tilesThatFit);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const sortedTiles = useVisualStableUpdate(tracks, maxVisibleTiles);
|
|
67
|
+
|
|
68
|
+
React.useLayoutEffect(() => {
|
|
69
|
+
if (asideEl.current) {
|
|
70
|
+
asideEl.current.dataset.lkOrientation = carouselOrientation;
|
|
71
|
+
asideEl.current.style.setProperty('--lk-max-visible-tiles', maxVisibleTiles.toString());
|
|
72
|
+
}
|
|
73
|
+
}, [maxVisibleTiles, carouselOrientation]);
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<aside key={carouselOrientation} className="lk-carousel" ref={asideEl} {...props}>
|
|
77
|
+
<TrackLoop tracks={sortedTiles}>{props.children}</TrackLoop>
|
|
78
|
+
</aside>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { mergeProps } from '../../utils';
|
|
3
|
+
import type { TrackReferenceOrPlaceholder } from '@livekit/components-core';
|
|
4
|
+
import { ParticipantTile } from '../participant/ParticipantTile';
|
|
5
|
+
import type { ParticipantClickEvent } from '@livekit/components-core';
|
|
6
|
+
|
|
7
|
+
/** @public */
|
|
8
|
+
export interface FocusLayoutContainerProps extends React.HTMLAttributes<HTMLDivElement> {}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The `FocusLayoutContainer` is a layout component that expects two children:
|
|
12
|
+
* A small side component: In a video conference, this is usually a carousel of participants
|
|
13
|
+
* who are not in focus. And a larger main component to display the focused participant.
|
|
14
|
+
* For example, with the `FocusLayout` component.
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
export function FocusLayoutContainer(props: FocusLayoutContainerProps) {
|
|
18
|
+
const elementProps = mergeProps(props, { className: 'lk-focus-layout' });
|
|
19
|
+
|
|
20
|
+
return <div {...elementProps}>{props.children}</div>;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** @public */
|
|
24
|
+
export interface FocusLayoutProps extends React.HTMLAttributes<HTMLElement> {
|
|
25
|
+
/** The track to display in the focus layout. */
|
|
26
|
+
trackRef?: TrackReferenceOrPlaceholder;
|
|
27
|
+
|
|
28
|
+
onParticipantClick?: (evt: ParticipantClickEvent) => void;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The `FocusLayout` component is just a light wrapper around the `ParticipantTile` to display a single participant.
|
|
33
|
+
* @public
|
|
34
|
+
*/
|
|
35
|
+
export function FocusLayout({ trackRef, ...htmlProps }: FocusLayoutProps) {
|
|
36
|
+
return <ParticipantTile trackRef={trackRef} {...htmlProps} />;
|
|
37
|
+
}
|