@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,69 @@
|
|
|
1
|
+
import { participantAttributesObserver } from '@livekit/components-core';
|
|
2
|
+
import type { Participant } from 'livekit-client';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { useEnsureParticipant, useMaybeParticipantContext } from '../context';
|
|
5
|
+
import { useObservableState } from './internal';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The `useParticipantAttributes` hook returns the attributes of a given participant and allows to set them.
|
|
9
|
+
* It requires a `Participant` object passed as property or via the `ParticipantContext`.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* const { attributes } = useParticipantAttributes({ participant });
|
|
14
|
+
* ```
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
export interface UseParticipantAttributesOptions {
|
|
18
|
+
participant?: Participant;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** @public */
|
|
22
|
+
export function useParticipantAttributes(props: UseParticipantAttributesOptions = {}) {
|
|
23
|
+
const participantContext = useMaybeParticipantContext();
|
|
24
|
+
const p = props.participant ?? participantContext;
|
|
25
|
+
const attributeObserver = React.useMemo(
|
|
26
|
+
// weird typescript constraint
|
|
27
|
+
() => (p ? participantAttributesObserver(p) : participantAttributesObserver(p)),
|
|
28
|
+
[p],
|
|
29
|
+
);
|
|
30
|
+
const attributeState = useObservableState(attributeObserver, {
|
|
31
|
+
attributes: p?.attributes,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
return attributeState;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* The `useParticipantAttribute` hook returns the latest value of a given attribute key of a participant.
|
|
39
|
+
* It requires a `Participant` object passed as property in the `UseParticipantAttributesOptions` or via the `ParticipantContext`.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```tsx
|
|
43
|
+
* const myAttributeValue = useParticipantAttribute('targetAttributeName');
|
|
44
|
+
* ```
|
|
45
|
+
* @public
|
|
46
|
+
*/
|
|
47
|
+
export function useParticipantAttribute(
|
|
48
|
+
attributeKey: string,
|
|
49
|
+
options: UseParticipantAttributesOptions = {},
|
|
50
|
+
) {
|
|
51
|
+
const p = useEnsureParticipant(options.participant);
|
|
52
|
+
const [attribute, setAttribute] = React.useState(p.attributes[attributeKey]);
|
|
53
|
+
|
|
54
|
+
React.useEffect(() => {
|
|
55
|
+
if (!p) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const subscription = participantAttributesObserver(p).subscribe((val) => {
|
|
59
|
+
if (val.changed[attributeKey] !== undefined) {
|
|
60
|
+
setAttribute(val.attributes[attributeKey]);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
return () => {
|
|
64
|
+
subscription.unsubscribe();
|
|
65
|
+
};
|
|
66
|
+
}, [p, attributeKey]);
|
|
67
|
+
|
|
68
|
+
return attribute;
|
|
69
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { participantInfoObserver } from '@livekit/components-core';
|
|
2
|
+
import type { Participant } from 'livekit-client';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { useMaybeParticipantContext } from '../context';
|
|
5
|
+
import { useObservableState } from './internal';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The `useParticipantInfo` hook returns the identity, name, and metadata of a given participant.
|
|
9
|
+
* It requires a `Participant` object passed as property or via the `ParticipantContext`.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* const { identity, name, metadata } = useParticipantInfo({ participant });
|
|
14
|
+
* ```
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
export interface UseParticipantInfoOptions {
|
|
18
|
+
participant?: Participant;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** @public */
|
|
22
|
+
export function useParticipantInfo(props: UseParticipantInfoOptions = {}) {
|
|
23
|
+
let p = useMaybeParticipantContext();
|
|
24
|
+
if (props.participant) {
|
|
25
|
+
p = props.participant;
|
|
26
|
+
}
|
|
27
|
+
const infoObserver = React.useMemo(() => participantInfoObserver(p), [p]);
|
|
28
|
+
const { identity, name, metadata } = useObservableState(infoObserver, {
|
|
29
|
+
name: p?.name,
|
|
30
|
+
identity: p?.identity,
|
|
31
|
+
metadata: p?.metadata,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
return { identity, name, metadata };
|
|
35
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { participantPermissionObserver } from '@livekit/components-core';
|
|
2
|
+
import type { ParticipantPermission } from '@livekit/protocol';
|
|
3
|
+
import type { Participant } from 'livekit-client';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { useEnsureParticipant } from '../context';
|
|
6
|
+
import { useObservableState } from './internal/useObservableState';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The `useParticipantPermissions` hook returns the permissions of a given participant.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* const permissions = useParticipantPermissions({ participant });
|
|
14
|
+
* ```
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
export interface UseParticipantPermissionsOptions {
|
|
18
|
+
participant?: Participant;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** @public */
|
|
22
|
+
export function useParticipantPermissions(
|
|
23
|
+
options: UseParticipantPermissionsOptions = {},
|
|
24
|
+
): ParticipantPermission | undefined {
|
|
25
|
+
const p = useEnsureParticipant(options.participant);
|
|
26
|
+
const permissionObserver = React.useMemo(() => participantPermissionObserver(p), [p]);
|
|
27
|
+
const permissions = useObservableState(permissionObserver, p.permissions);
|
|
28
|
+
return permissions;
|
|
29
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { ParticipantClickEvent, TrackReferenceOrPlaceholder } from '@livekit/components-core';
|
|
2
|
+
import { setupParticipantTile } from '@livekit/components-core';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { useEnsureTrackRef } from '../context';
|
|
5
|
+
import { mergeProps } from '../mergeProps';
|
|
6
|
+
import { useFacingMode } from './useFacingMode';
|
|
7
|
+
import { useIsMuted } from './useIsMuted';
|
|
8
|
+
import { useIsSpeaking } from './useIsSpeaking';
|
|
9
|
+
import { Track } from 'livekit-client';
|
|
10
|
+
|
|
11
|
+
/** @public */
|
|
12
|
+
export interface UseParticipantTileProps<T extends HTMLElement> extends React.HTMLAttributes<T> {
|
|
13
|
+
/** The track reference to display. */
|
|
14
|
+
trackRef?: TrackReferenceOrPlaceholder;
|
|
15
|
+
disableSpeakingIndicator?: boolean;
|
|
16
|
+
onParticipantClick?: (event: ParticipantClickEvent) => void;
|
|
17
|
+
htmlProps: React.HTMLAttributes<T>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The `useParticipantTile` hook is used to implement the `ParticipantTile` and returns the props needed to render the tile.
|
|
22
|
+
* @remarks
|
|
23
|
+
* The returned props include many data attributes that are useful for CSS styling purposes because they
|
|
24
|
+
* indicate the state of the participant and the track.
|
|
25
|
+
* For example: `data-lk-audio-muted`, `data-lk-video-muted`, `data-lk-speaking`, `data-lk-local-participant`, `data-lk-source`, `data-lk-facing-mode`.
|
|
26
|
+
* @public
|
|
27
|
+
*/
|
|
28
|
+
export function useParticipantTile<T extends HTMLElement>({
|
|
29
|
+
trackRef,
|
|
30
|
+
onParticipantClick,
|
|
31
|
+
disableSpeakingIndicator,
|
|
32
|
+
htmlProps,
|
|
33
|
+
}: UseParticipantTileProps<T>) {
|
|
34
|
+
const trackReference = useEnsureTrackRef(trackRef);
|
|
35
|
+
|
|
36
|
+
const mergedProps = React.useMemo(() => {
|
|
37
|
+
const { className } = setupParticipantTile();
|
|
38
|
+
return mergeProps(htmlProps, {
|
|
39
|
+
className,
|
|
40
|
+
onClick: (event: React.MouseEvent<T, MouseEvent>) => {
|
|
41
|
+
htmlProps.onClick?.(event);
|
|
42
|
+
if (typeof onParticipantClick === 'function') {
|
|
43
|
+
const track =
|
|
44
|
+
trackReference.publication ??
|
|
45
|
+
trackReference.participant.getTrackPublication(trackReference.source);
|
|
46
|
+
onParticipantClick({ participant: trackReference.participant, track });
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
}, [
|
|
51
|
+
htmlProps,
|
|
52
|
+
onParticipantClick,
|
|
53
|
+
trackReference.publication,
|
|
54
|
+
trackReference.source,
|
|
55
|
+
trackReference.participant,
|
|
56
|
+
]);
|
|
57
|
+
|
|
58
|
+
const micTrack = trackReference.participant.getTrackPublication(Track.Source.Microphone);
|
|
59
|
+
const micRef = React.useMemo(() => {
|
|
60
|
+
return {
|
|
61
|
+
participant: trackReference.participant,
|
|
62
|
+
source: Track.Source.Microphone,
|
|
63
|
+
publication: micTrack,
|
|
64
|
+
};
|
|
65
|
+
}, [micTrack, trackReference.participant]);
|
|
66
|
+
const isVideoMuted = useIsMuted(trackReference);
|
|
67
|
+
const isAudioMuted = useIsMuted(micRef);
|
|
68
|
+
const isSpeaking = useIsSpeaking(trackReference.participant);
|
|
69
|
+
const facingMode = useFacingMode(trackReference);
|
|
70
|
+
return {
|
|
71
|
+
elementProps: {
|
|
72
|
+
'data-lk-audio-muted': isAudioMuted,
|
|
73
|
+
'data-lk-video-muted': isVideoMuted,
|
|
74
|
+
'data-lk-speaking': disableSpeakingIndicator === true ? false : isSpeaking,
|
|
75
|
+
'data-lk-local-participant': trackReference.participant.isLocal,
|
|
76
|
+
'data-lk-source': trackReference.source,
|
|
77
|
+
'data-lk-facing-mode': facingMode,
|
|
78
|
+
...mergedProps,
|
|
79
|
+
} as React.HTMLAttributes<T>,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { TrackReference } from '@livekit/components-core';
|
|
3
|
+
import { participantTracksObservable } from '@livekit/components-core';
|
|
4
|
+
import { useObservableState } from './internal';
|
|
5
|
+
import type { Room, Track } from 'livekit-client';
|
|
6
|
+
import { useMaybeParticipantContext } from '../context';
|
|
7
|
+
import { useParticipants } from './useParticipants';
|
|
8
|
+
|
|
9
|
+
type UseParticipantTracksOptions = {
|
|
10
|
+
participantIdentity?: string;
|
|
11
|
+
room?: Room;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* `useParticipantTracks` is a custom React that allows you to get tracks of a specific participant only, by specifiying the participant's identity.
|
|
16
|
+
* If the participant identity is not passed the hook will try to get the participant from a participant context.
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
export function useParticipantTracks<TrackSource extends Track.Source>(
|
|
20
|
+
sources: Array<TrackSource>,
|
|
21
|
+
optionsOrParticipantIdentity:
|
|
22
|
+
| UseParticipantTracksOptions
|
|
23
|
+
| UseParticipantTracksOptions['participantIdentity'] = {},
|
|
24
|
+
): Array<TrackReference> {
|
|
25
|
+
let participantIdentity: UseParticipantTracksOptions['participantIdentity'];
|
|
26
|
+
let room: UseParticipantTracksOptions['room'];
|
|
27
|
+
if (typeof optionsOrParticipantIdentity === 'string') {
|
|
28
|
+
participantIdentity = optionsOrParticipantIdentity;
|
|
29
|
+
} else {
|
|
30
|
+
participantIdentity = optionsOrParticipantIdentity?.participantIdentity;
|
|
31
|
+
room = optionsOrParticipantIdentity?.room;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const participantContext = useMaybeParticipantContext();
|
|
35
|
+
const participants = useParticipants({ room, updateOnlyOn: [] });
|
|
36
|
+
|
|
37
|
+
const p = React.useMemo(() => {
|
|
38
|
+
if (participantIdentity) {
|
|
39
|
+
return participants.find((p) => p.identity === participantIdentity);
|
|
40
|
+
}
|
|
41
|
+
return participantContext;
|
|
42
|
+
}, [participantIdentity, participants, participantContext]);
|
|
43
|
+
|
|
44
|
+
const observable = React.useMemo(() => {
|
|
45
|
+
if (!p) {
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
return participantTracksObservable(p, { sources });
|
|
49
|
+
}, [p, JSON.stringify(sources)]);
|
|
50
|
+
|
|
51
|
+
const trackRefs = useObservableState(observable, [] as Array<TrackReference>);
|
|
52
|
+
|
|
53
|
+
return trackRefs;
|
|
54
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { Room, RoomEvent } from 'livekit-client';
|
|
2
|
+
import { useLocalParticipant } from './useLocalParticipant';
|
|
3
|
+
import { useRemoteParticipants } from './useRemoteParticipants';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
|
|
6
|
+
/** @public */
|
|
7
|
+
export interface UseParticipantsOptions {
|
|
8
|
+
/**
|
|
9
|
+
* To optimize performance, you can use the `updateOnlyOn` property to decide on what RoomEvents the hook updates.
|
|
10
|
+
* By default it updates on all relevant RoomEvents to keep the returned participants array up to date.
|
|
11
|
+
* The minimal set of non-overwriteable `RoomEvents` is: `[RoomEvent.ParticipantConnected, RoomEvent.ParticipantDisconnected, RoomEvent.ConnectionStateChanged]`
|
|
12
|
+
*/
|
|
13
|
+
updateOnlyOn?: RoomEvent[];
|
|
14
|
+
/**
|
|
15
|
+
* The room to use. If not provided, the hook will use the room from the context.
|
|
16
|
+
*/
|
|
17
|
+
room?: Room;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The `useParticipants` hook returns all participants (local and remote) of the current room.
|
|
22
|
+
* @remarks
|
|
23
|
+
* To optimize performance, you can use the `updateOnlyOn` property to decide on what `RoomEvents` the hook updates.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```tsx
|
|
27
|
+
* const participants = useParticipants();
|
|
28
|
+
* <ParticipantLoop participants={participants}>
|
|
29
|
+
* <ParticipantName />
|
|
30
|
+
* </ParticipantLoop>
|
|
31
|
+
* ```
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
34
|
+
export function useParticipants(options: UseParticipantsOptions = {}) {
|
|
35
|
+
const remoteParticipants = useRemoteParticipants(options);
|
|
36
|
+
const { localParticipant } = useLocalParticipant(options);
|
|
37
|
+
|
|
38
|
+
return React.useMemo(
|
|
39
|
+
() => [localParticipant, ...remoteParticipants],
|
|
40
|
+
[localParticipant, remoteParticipants],
|
|
41
|
+
);
|
|
42
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { LocalUserChoices } from '@livekit/components-core';
|
|
2
|
+
import { loadUserChoices, saveUserChoices } from '@livekit/components-core';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Options for the `usePersistentDeviceSettings` hook.
|
|
7
|
+
* @alpha
|
|
8
|
+
*/
|
|
9
|
+
export interface UsePersistentUserChoicesOptions {
|
|
10
|
+
/**
|
|
11
|
+
* The default value to use if reading from local storage returns no results or fails.
|
|
12
|
+
*/
|
|
13
|
+
defaults?: Partial<LocalUserChoices>;
|
|
14
|
+
/**
|
|
15
|
+
* Whether to prevent saving to persistent storage.
|
|
16
|
+
* @defaultValue false
|
|
17
|
+
*/
|
|
18
|
+
preventSave?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Whether to prevent loading user choices from persistent storage and use `defaults` instead.
|
|
21
|
+
* @defaultValue false
|
|
22
|
+
*/
|
|
23
|
+
preventLoad?: boolean;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* A hook that provides access to user choices stored in local storage, such as
|
|
28
|
+
* selected media devices and their current state (on or off), as well as the user name.
|
|
29
|
+
* @alpha
|
|
30
|
+
*/
|
|
31
|
+
export function usePersistentUserChoices(options: UsePersistentUserChoicesOptions = {}) {
|
|
32
|
+
const [userChoices, setSettings] = React.useState<LocalUserChoices>(
|
|
33
|
+
loadUserChoices(options.defaults, options.preventLoad ?? false),
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
const saveAudioInputEnabled = React.useCallback((isEnabled: boolean) => {
|
|
37
|
+
setSettings((prev) => ({ ...prev, audioEnabled: isEnabled }));
|
|
38
|
+
}, []);
|
|
39
|
+
const saveVideoInputEnabled = React.useCallback((isEnabled: boolean) => {
|
|
40
|
+
setSettings((prev) => ({ ...prev, videoEnabled: isEnabled }));
|
|
41
|
+
}, []);
|
|
42
|
+
const saveAudioInputDeviceId = React.useCallback((deviceId: string) => {
|
|
43
|
+
setSettings((prev) => ({ ...prev, audioDeviceId: deviceId }));
|
|
44
|
+
}, []);
|
|
45
|
+
const saveVideoInputDeviceId = React.useCallback((deviceId: string) => {
|
|
46
|
+
setSettings((prev) => ({ ...prev, videoDeviceId: deviceId }));
|
|
47
|
+
}, []);
|
|
48
|
+
const saveUsername = React.useCallback((username: string) => {
|
|
49
|
+
setSettings((prev) => ({ ...prev, username: username }));
|
|
50
|
+
}, []);
|
|
51
|
+
|
|
52
|
+
React.useEffect(() => {
|
|
53
|
+
saveUserChoices(userChoices, options.preventSave ?? false);
|
|
54
|
+
}, [userChoices, options.preventSave]);
|
|
55
|
+
|
|
56
|
+
return {
|
|
57
|
+
userChoices,
|
|
58
|
+
saveAudioInputEnabled,
|
|
59
|
+
saveVideoInputEnabled,
|
|
60
|
+
saveAudioInputDeviceId,
|
|
61
|
+
saveVideoInputDeviceId,
|
|
62
|
+
saveUsername,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { TrackReferenceOrPlaceholder } from '@livekit/components-core';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import type { LayoutContextType } from '../context';
|
|
4
|
+
import { useEnsureLayoutContext } from '../context';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The `usePinnedTracks` hook returns a array of the pinned tracks of the current room.
|
|
8
|
+
* @remarks
|
|
9
|
+
* To function properly, this hook must be called within a `LayoutContext`.
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* const pinnedTracks = usePinnedTracks();
|
|
13
|
+
* ```
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
export function usePinnedTracks(layoutContext?: LayoutContextType): TrackReferenceOrPlaceholder[] {
|
|
17
|
+
layoutContext = useEnsureLayoutContext(layoutContext);
|
|
18
|
+
return React.useMemo(() => {
|
|
19
|
+
if (layoutContext?.pin.state !== undefined && layoutContext.pin.state.length >= 1) {
|
|
20
|
+
return layoutContext.pin.state;
|
|
21
|
+
}
|
|
22
|
+
return [];
|
|
23
|
+
}, [layoutContext.pin.state]);
|
|
24
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type ParticipantIdentifier,
|
|
3
|
+
connectedParticipantObserver,
|
|
4
|
+
participantByIdentifierObserver,
|
|
5
|
+
} from '@livekit/components-core';
|
|
6
|
+
import type { ParticipantEvent, RemoteParticipant } from 'livekit-client';
|
|
7
|
+
import * as React from 'react';
|
|
8
|
+
import { useRoomContext } from '../context';
|
|
9
|
+
|
|
10
|
+
/** @public */
|
|
11
|
+
export interface UseRemoteParticipantOptions {
|
|
12
|
+
/**
|
|
13
|
+
* To optimize performance, you can use the `updateOnlyOn` property to decide on what `ParticipantEvents` the hook updates.
|
|
14
|
+
* By default it updates on all relevant ParticipantEvents to keep the returned participant up to date.
|
|
15
|
+
*/
|
|
16
|
+
updateOnlyOn?: ParticipantEvent[];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The `useRemoteParticipant` hook returns the first RemoteParticipant by either identity and/or based on the participant kind.
|
|
21
|
+
* @remarks
|
|
22
|
+
* To optimize performance, you can use the `updateOnlyOn` property to decide on what `ParticipantEvents` the hook updates.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```tsx
|
|
26
|
+
* const participant = useRemoteParticipant({kind: ParticipantKind.Agent, identity: 'myAgent'});
|
|
27
|
+
* ```
|
|
28
|
+
* @public
|
|
29
|
+
*/
|
|
30
|
+
export function useRemoteParticipant(
|
|
31
|
+
identifier: ParticipantIdentifier,
|
|
32
|
+
options?: UseRemoteParticipantOptions,
|
|
33
|
+
): RemoteParticipant | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* The `useRemoteParticipant` hook returns the first RemoteParticipant by either identity or based on the participant kind.
|
|
36
|
+
* @remarks
|
|
37
|
+
* To optimize performance, you can use the `updateOnlyOn` property to decide on what `ParticipantEvents` the hook updates.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```tsx
|
|
41
|
+
* const participant = useRemoteParticipant('Russ');
|
|
42
|
+
* ```
|
|
43
|
+
* @public
|
|
44
|
+
*/
|
|
45
|
+
export function useRemoteParticipant(
|
|
46
|
+
identity: string,
|
|
47
|
+
options?: UseRemoteParticipantOptions,
|
|
48
|
+
): RemoteParticipant | undefined;
|
|
49
|
+
export function useRemoteParticipant(
|
|
50
|
+
identityOrIdentifier: string | ParticipantIdentifier,
|
|
51
|
+
options: UseRemoteParticipantOptions = {},
|
|
52
|
+
): RemoteParticipant | undefined {
|
|
53
|
+
const room = useRoomContext();
|
|
54
|
+
const [updateOnlyOn] = React.useState(options.updateOnlyOn);
|
|
55
|
+
|
|
56
|
+
const observable = React.useMemo(() => {
|
|
57
|
+
if (typeof identityOrIdentifier === 'string') {
|
|
58
|
+
return connectedParticipantObserver(room, identityOrIdentifier, {
|
|
59
|
+
additionalEvents: updateOnlyOn,
|
|
60
|
+
});
|
|
61
|
+
} else {
|
|
62
|
+
return participantByIdentifierObserver(room, identityOrIdentifier, {
|
|
63
|
+
additionalEvents: updateOnlyOn,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}, [room, JSON.stringify(identityOrIdentifier), updateOnlyOn]);
|
|
67
|
+
|
|
68
|
+
// Using `wrapperParticipant` to ensure a new object reference,
|
|
69
|
+
// triggering a re-render when the participant events fire.
|
|
70
|
+
const [participantWrapper, setParticipantWrapper] = React.useState({
|
|
71
|
+
p: undefined as RemoteParticipant | undefined,
|
|
72
|
+
});
|
|
73
|
+
React.useEffect(() => {
|
|
74
|
+
const listener = observable.subscribe((p) => setParticipantWrapper({ p }));
|
|
75
|
+
return () => listener.unsubscribe();
|
|
76
|
+
}, [observable]);
|
|
77
|
+
|
|
78
|
+
return participantWrapper.p;
|
|
79
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { connectedParticipantsObserver } from '@livekit/components-core';
|
|
2
|
+
import type { RoomEvent, RemoteParticipant, Room } from 'livekit-client';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { useEnsureRoom } from '../context';
|
|
5
|
+
|
|
6
|
+
/** @public */
|
|
7
|
+
export interface UseRemoteParticipantsOptions {
|
|
8
|
+
/**
|
|
9
|
+
* To optimize performance, you can use the `updateOnlyOn` property to decide on what RoomEvents the hook updates.
|
|
10
|
+
* By default it updates on all relevant RoomEvents to keep the returned participants array up to date.
|
|
11
|
+
* The minimal set of non-overwriteable `RoomEvents` is: `[RoomEvent.ParticipantConnected, RoomEvent.ParticipantDisconnected, RoomEvent.ConnectionStateChanged]`
|
|
12
|
+
*/
|
|
13
|
+
updateOnlyOn?: RoomEvent[];
|
|
14
|
+
/**
|
|
15
|
+
* The room to use. If not provided, the hook will use the room from the context.
|
|
16
|
+
*/
|
|
17
|
+
room?: Room;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The `useRemoteParticipants` hook returns all remote participants (without the local) of the current room.
|
|
22
|
+
* @remarks
|
|
23
|
+
* To optimize performance, you can use the `updateOnlyOn` property to decide on what `RoomEvents` the hook updates.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```tsx
|
|
27
|
+
* const participants = useRemoteParticipants();
|
|
28
|
+
* <ParticipantLoop participants={participants}>
|
|
29
|
+
* <ParticipantName />
|
|
30
|
+
* </ParticipantLoop>
|
|
31
|
+
* ```
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
34
|
+
export function useRemoteParticipants(options: UseRemoteParticipantsOptions = {}) {
|
|
35
|
+
const room = useEnsureRoom(options.room);
|
|
36
|
+
const [participants, setParticipants] = React.useState<RemoteParticipant[]>([]);
|
|
37
|
+
|
|
38
|
+
React.useEffect(() => {
|
|
39
|
+
const listener = connectedParticipantsObserver(room, {
|
|
40
|
+
additionalRoomEvents: options.updateOnlyOn,
|
|
41
|
+
}).subscribe(setParticipants);
|
|
42
|
+
return () => listener.unsubscribe();
|
|
43
|
+
}, [room, JSON.stringify(options.updateOnlyOn)]);
|
|
44
|
+
return participants;
|
|
45
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { roomInfoObserver } from '@livekit/components-core';
|
|
2
|
+
import type { Room } from 'livekit-client';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { useEnsureRoom } from '../context';
|
|
5
|
+
import { useObservableState } from './internal';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The `useRoomInfo` hook returns the name and metadata of the given `Room`.
|
|
9
|
+
* @remarks
|
|
10
|
+
* Needs to be called inside a `RoomContext` or by passing a `Room` instance.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* const { name, metadata } = useRoomInfo();
|
|
15
|
+
* ```
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
export interface UseRoomInfoOptions {
|
|
19
|
+
room?: Room;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** @public */
|
|
23
|
+
export function useRoomInfo(options: UseRoomInfoOptions = {}) {
|
|
24
|
+
const room = useEnsureRoom(options.room);
|
|
25
|
+
const infoObserver = React.useMemo(() => roomInfoObserver(room), [room]);
|
|
26
|
+
const { name, metadata } = useObservableState(infoObserver, {
|
|
27
|
+
name: room.name,
|
|
28
|
+
metadata: room.metadata,
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
return { name, metadata };
|
|
32
|
+
}
|