@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,192 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { Participant } from 'livekit-client';
|
|
3
|
+
import { Track } from 'livekit-client';
|
|
4
|
+
import type { ParticipantClickEvent, TrackReferenceOrPlaceholder } from '@livekit/components-core';
|
|
5
|
+
import { isTrackReference, isTrackReferencePinned } from '@livekit/components-core';
|
|
6
|
+
import { ConnectionQualityIndicator } from './ConnectionQualityIndicator';
|
|
7
|
+
import { ParticipantName } from './ParticipantName';
|
|
8
|
+
import { TrackMutedIndicator } from './TrackMutedIndicator';
|
|
9
|
+
import {
|
|
10
|
+
ParticipantContext,
|
|
11
|
+
TrackRefContext,
|
|
12
|
+
useEnsureTrackRef,
|
|
13
|
+
useFeatureContext,
|
|
14
|
+
useMaybeLayoutContext,
|
|
15
|
+
useMaybeParticipantContext,
|
|
16
|
+
useMaybeTrackRefContext,
|
|
17
|
+
} from '../../context';
|
|
18
|
+
import { FocusToggle } from '../controls/FocusToggle';
|
|
19
|
+
import { ParticipantPlaceholder } from '../../assets/images';
|
|
20
|
+
import { LockLockedIcon, ScreenShareIcon } from '../../assets/icons';
|
|
21
|
+
import { VideoTrack } from './VideoTrack';
|
|
22
|
+
import { AudioTrack } from './AudioTrack';
|
|
23
|
+
import { useParticipantTile } from '../../hooks';
|
|
24
|
+
import { useIsEncrypted } from '../../hooks/useIsEncrypted';
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* The `ParticipantContextIfNeeded` component only creates a `ParticipantContext`
|
|
28
|
+
* if there is no `ParticipantContext` already.
|
|
29
|
+
* @example
|
|
30
|
+
* ```tsx
|
|
31
|
+
* <ParticipantContextIfNeeded participant={trackReference.participant}>
|
|
32
|
+
* ...
|
|
33
|
+
* </ParticipantContextIfNeeded>
|
|
34
|
+
* ```
|
|
35
|
+
* @public
|
|
36
|
+
*/
|
|
37
|
+
export function ParticipantContextIfNeeded(
|
|
38
|
+
props: React.PropsWithChildren<{
|
|
39
|
+
participant?: Participant;
|
|
40
|
+
}>,
|
|
41
|
+
) {
|
|
42
|
+
const hasContext = !!useMaybeParticipantContext();
|
|
43
|
+
return props.participant && !hasContext ? (
|
|
44
|
+
<ParticipantContext.Provider value={props.participant}>
|
|
45
|
+
{props.children}
|
|
46
|
+
</ParticipantContext.Provider>
|
|
47
|
+
) : (
|
|
48
|
+
<>{props.children}</>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Only create a `TrackRefContext` if there is no `TrackRefContext` already.
|
|
54
|
+
* @internal
|
|
55
|
+
*/
|
|
56
|
+
export function TrackRefContextIfNeeded(
|
|
57
|
+
props: React.PropsWithChildren<{
|
|
58
|
+
trackRef?: TrackReferenceOrPlaceholder;
|
|
59
|
+
}>,
|
|
60
|
+
) {
|
|
61
|
+
const hasContext = !!useMaybeTrackRefContext();
|
|
62
|
+
return props.trackRef && !hasContext ? (
|
|
63
|
+
<TrackRefContext.Provider value={props.trackRef}>{props.children}</TrackRefContext.Provider>
|
|
64
|
+
) : (
|
|
65
|
+
<>{props.children}</>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** @public */
|
|
70
|
+
export interface ParticipantTileProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
71
|
+
/** The track reference to display. */
|
|
72
|
+
trackRef?: TrackReferenceOrPlaceholder;
|
|
73
|
+
disableSpeakingIndicator?: boolean;
|
|
74
|
+
|
|
75
|
+
onParticipantClick?: (event: ParticipantClickEvent) => void;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* The `ParticipantTile` component is the base utility wrapper for displaying a visual representation of a participant.
|
|
80
|
+
* This component can be used as a child of the `TrackLoop` component or by passing a track reference as property.
|
|
81
|
+
*
|
|
82
|
+
* @example Using the `ParticipantTile` component with a track reference:
|
|
83
|
+
* ```tsx
|
|
84
|
+
* <ParticipantTile trackRef={trackRef} />
|
|
85
|
+
* ```
|
|
86
|
+
* @example Using the `ParticipantTile` component as a child of the `TrackLoop` component:
|
|
87
|
+
* ```tsx
|
|
88
|
+
* <TrackLoop>
|
|
89
|
+
* <ParticipantTile />
|
|
90
|
+
* </TrackLoop>
|
|
91
|
+
* ```
|
|
92
|
+
* @public
|
|
93
|
+
*/
|
|
94
|
+
export const ParticipantTile: (
|
|
95
|
+
props: ParticipantTileProps & React.RefAttributes<HTMLDivElement>,
|
|
96
|
+
) => React.ReactNode = /* @__PURE__ */ React.forwardRef<HTMLDivElement, ParticipantTileProps>(
|
|
97
|
+
function ParticipantTile(
|
|
98
|
+
{
|
|
99
|
+
trackRef,
|
|
100
|
+
children,
|
|
101
|
+
onParticipantClick,
|
|
102
|
+
disableSpeakingIndicator,
|
|
103
|
+
...htmlProps
|
|
104
|
+
}: ParticipantTileProps,
|
|
105
|
+
ref,
|
|
106
|
+
) {
|
|
107
|
+
const trackReference = useEnsureTrackRef(trackRef);
|
|
108
|
+
|
|
109
|
+
const { elementProps } = useParticipantTile<HTMLDivElement>({
|
|
110
|
+
htmlProps,
|
|
111
|
+
disableSpeakingIndicator,
|
|
112
|
+
onParticipantClick,
|
|
113
|
+
trackRef: trackReference,
|
|
114
|
+
});
|
|
115
|
+
const isEncrypted = useIsEncrypted(trackReference.participant);
|
|
116
|
+
const layoutContext = useMaybeLayoutContext();
|
|
117
|
+
|
|
118
|
+
const autoManageSubscription = useFeatureContext()?.autoSubscription;
|
|
119
|
+
|
|
120
|
+
const handleSubscribe = React.useCallback(
|
|
121
|
+
(subscribed: boolean) => {
|
|
122
|
+
if (
|
|
123
|
+
trackReference.source &&
|
|
124
|
+
!subscribed &&
|
|
125
|
+
layoutContext &&
|
|
126
|
+
layoutContext.pin.dispatch &&
|
|
127
|
+
isTrackReferencePinned(trackReference, layoutContext.pin.state)
|
|
128
|
+
) {
|
|
129
|
+
layoutContext.pin.dispatch({ msg: 'clear_pin' });
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
[trackReference, layoutContext],
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
return (
|
|
136
|
+
<div ref={ref} style={{ position: 'relative' }} {...elementProps}>
|
|
137
|
+
<TrackRefContextIfNeeded trackRef={trackReference}>
|
|
138
|
+
<ParticipantContextIfNeeded participant={trackReference.participant}>
|
|
139
|
+
{children ?? (
|
|
140
|
+
<>
|
|
141
|
+
{isTrackReference(trackReference) &&
|
|
142
|
+
(trackReference.publication?.kind === 'video' ||
|
|
143
|
+
trackReference.source === Track.Source.Camera ||
|
|
144
|
+
trackReference.source === Track.Source.ScreenShare) ? (
|
|
145
|
+
<VideoTrack
|
|
146
|
+
trackRef={trackReference}
|
|
147
|
+
onSubscriptionStatusChanged={handleSubscribe}
|
|
148
|
+
manageSubscription={autoManageSubscription}
|
|
149
|
+
/>
|
|
150
|
+
) : (
|
|
151
|
+
isTrackReference(trackReference) && (
|
|
152
|
+
<AudioTrack
|
|
153
|
+
trackRef={trackReference}
|
|
154
|
+
onSubscriptionStatusChanged={handleSubscribe}
|
|
155
|
+
/>
|
|
156
|
+
)
|
|
157
|
+
)}
|
|
158
|
+
<div className="lk-participant-placeholder">
|
|
159
|
+
<ParticipantPlaceholder />
|
|
160
|
+
</div>
|
|
161
|
+
<div className="lk-participant-metadata">
|
|
162
|
+
<div className="lk-participant-metadata-item">
|
|
163
|
+
{trackReference.source === Track.Source.Camera ? (
|
|
164
|
+
<>
|
|
165
|
+
{isEncrypted && <LockLockedIcon style={{ marginRight: '0.25rem' }} />}
|
|
166
|
+
<TrackMutedIndicator
|
|
167
|
+
trackRef={{
|
|
168
|
+
participant: trackReference.participant,
|
|
169
|
+
source: Track.Source.Microphone,
|
|
170
|
+
}}
|
|
171
|
+
show={'muted'}
|
|
172
|
+
></TrackMutedIndicator>
|
|
173
|
+
<ParticipantName />
|
|
174
|
+
</>
|
|
175
|
+
) : (
|
|
176
|
+
<>
|
|
177
|
+
<ScreenShareIcon style={{ marginRight: '0.25rem' }} />
|
|
178
|
+
<ParticipantName>'s screen</ParticipantName>
|
|
179
|
+
</>
|
|
180
|
+
)}
|
|
181
|
+
</div>
|
|
182
|
+
<ConnectionQualityIndicator className="lk-participant-metadata-item" />
|
|
183
|
+
</div>
|
|
184
|
+
</>
|
|
185
|
+
)}
|
|
186
|
+
<FocusToggle trackRef={trackReference} />
|
|
187
|
+
</ParticipantContextIfNeeded>
|
|
188
|
+
</TrackRefContextIfNeeded>
|
|
189
|
+
</div>
|
|
190
|
+
);
|
|
191
|
+
},
|
|
192
|
+
);
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { mergeProps } from '../../utils';
|
|
3
|
+
import { getSourceIcon } from '../../assets/icons/util';
|
|
4
|
+
import { useTrackMutedIndicator } from '../../hooks';
|
|
5
|
+
import type { TrackReferenceOrPlaceholder } from '@livekit/components-core';
|
|
6
|
+
|
|
7
|
+
/** @public */
|
|
8
|
+
export interface TrackMutedIndicatorProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
9
|
+
trackRef: TrackReferenceOrPlaceholder;
|
|
10
|
+
show?: 'always' | 'muted' | 'unmuted';
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* The `TrackMutedIndicator` shows whether the participant's camera or microphone is muted or not.
|
|
15
|
+
* By default, a muted/unmuted icon is displayed for a camera, microphone, and screen sharing track.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* <TrackMutedIndicator trackRef={trackRef} />
|
|
20
|
+
* ```
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
23
|
+
export const TrackMutedIndicator: (
|
|
24
|
+
props: TrackMutedIndicatorProps & React.RefAttributes<HTMLDivElement>,
|
|
25
|
+
) => React.ReactNode = /* @__PURE__ */ React.forwardRef<HTMLDivElement, TrackMutedIndicatorProps>(
|
|
26
|
+
function TrackMutedIndicator(
|
|
27
|
+
{ trackRef, show = 'always', ...props }: TrackMutedIndicatorProps,
|
|
28
|
+
ref,
|
|
29
|
+
) {
|
|
30
|
+
const { className, isMuted } = useTrackMutedIndicator(trackRef);
|
|
31
|
+
|
|
32
|
+
const showIndicator =
|
|
33
|
+
show === 'always' || (show === 'muted' && isMuted) || (show === 'unmuted' && !isMuted);
|
|
34
|
+
|
|
35
|
+
const htmlProps = React.useMemo(
|
|
36
|
+
() =>
|
|
37
|
+
mergeProps(props, {
|
|
38
|
+
className,
|
|
39
|
+
}),
|
|
40
|
+
[className, props],
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
if (!showIndicator) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<div ref={ref} {...htmlProps} data-lk-muted={isMuted}>
|
|
49
|
+
{props.children ?? getSourceIcon(trackRef.source, !isMuted)}
|
|
50
|
+
</div>
|
|
51
|
+
);
|
|
52
|
+
},
|
|
53
|
+
);
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { RemoteTrackPublication } from 'livekit-client';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { useMediaTrackBySourceOrName } from '../../hooks/useMediaTrackBySourceOrName';
|
|
4
|
+
import type { ParticipantClickEvent, TrackReference } from '@livekit/components-core';
|
|
5
|
+
import { useEnsureTrackRef } from '../../context';
|
|
6
|
+
import * as useHooks from 'usehooks-ts';
|
|
7
|
+
|
|
8
|
+
/** @public */
|
|
9
|
+
export interface VideoTrackProps extends React.VideoHTMLAttributes<HTMLVideoElement> {
|
|
10
|
+
/** The track reference of the track to render. */
|
|
11
|
+
trackRef?: TrackReference;
|
|
12
|
+
onTrackClick?: (evt: ParticipantClickEvent) => void;
|
|
13
|
+
onSubscriptionStatusChanged?: (subscribed: boolean) => void;
|
|
14
|
+
manageSubscription?: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The `VideoTrack` component is responsible for rendering participant video tracks like `camera` and `screen_share`.
|
|
19
|
+
* This component must have access to the participant's context, or alternatively pass it a `Participant` as a property.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* <VideoTrack trackRef={trackRef} />
|
|
24
|
+
* ```
|
|
25
|
+
* @see {@link @livekit/components-react#ParticipantTile | ParticipantTile}
|
|
26
|
+
* @public
|
|
27
|
+
*/
|
|
28
|
+
export const VideoTrack: (
|
|
29
|
+
props: VideoTrackProps & React.RefAttributes<HTMLVideoElement>,
|
|
30
|
+
) => React.ReactNode = /* @__PURE__ */ React.forwardRef<HTMLVideoElement, VideoTrackProps>(
|
|
31
|
+
function VideoTrack(
|
|
32
|
+
{
|
|
33
|
+
onTrackClick,
|
|
34
|
+
onClick,
|
|
35
|
+
onSubscriptionStatusChanged,
|
|
36
|
+
trackRef,
|
|
37
|
+
manageSubscription,
|
|
38
|
+
...props
|
|
39
|
+
}: VideoTrackProps,
|
|
40
|
+
ref,
|
|
41
|
+
) {
|
|
42
|
+
const trackReference = useEnsureTrackRef(trackRef);
|
|
43
|
+
|
|
44
|
+
const mediaEl = React.useRef<HTMLVideoElement>(null);
|
|
45
|
+
React.useImperativeHandle(ref, () => mediaEl.current as HTMLVideoElement);
|
|
46
|
+
|
|
47
|
+
const intersectionEntry = useHooks.useIntersectionObserver({ root: mediaEl.current });
|
|
48
|
+
|
|
49
|
+
const [debouncedIntersectionEntry] = useHooks.useDebounceValue(intersectionEntry, 3000);
|
|
50
|
+
|
|
51
|
+
React.useEffect(() => {
|
|
52
|
+
if (
|
|
53
|
+
manageSubscription &&
|
|
54
|
+
trackReference.publication instanceof RemoteTrackPublication &&
|
|
55
|
+
debouncedIntersectionEntry?.isIntersecting === false &&
|
|
56
|
+
intersectionEntry?.isIntersecting === false
|
|
57
|
+
) {
|
|
58
|
+
trackReference.publication.setSubscribed(false);
|
|
59
|
+
}
|
|
60
|
+
}, [debouncedIntersectionEntry, trackReference, manageSubscription]);
|
|
61
|
+
|
|
62
|
+
React.useEffect(() => {
|
|
63
|
+
if (
|
|
64
|
+
manageSubscription &&
|
|
65
|
+
trackReference.publication instanceof RemoteTrackPublication &&
|
|
66
|
+
intersectionEntry?.isIntersecting === true
|
|
67
|
+
) {
|
|
68
|
+
trackReference.publication.setSubscribed(true);
|
|
69
|
+
}
|
|
70
|
+
}, [intersectionEntry, trackReference, manageSubscription]);
|
|
71
|
+
|
|
72
|
+
const {
|
|
73
|
+
elementProps,
|
|
74
|
+
publication: pub,
|
|
75
|
+
isSubscribed,
|
|
76
|
+
} = useMediaTrackBySourceOrName(trackReference, {
|
|
77
|
+
element: mediaEl,
|
|
78
|
+
props,
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
React.useEffect(() => {
|
|
82
|
+
onSubscriptionStatusChanged?.(!!isSubscribed);
|
|
83
|
+
}, [isSubscribed, onSubscriptionStatusChanged]);
|
|
84
|
+
|
|
85
|
+
const clickHandler = (evt: React.MouseEvent<HTMLVideoElement, MouseEvent>) => {
|
|
86
|
+
onClick?.(evt);
|
|
87
|
+
onTrackClick?.({ participant: trackReference?.participant, track: pub });
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
return <video ref={mediaEl} {...elementProps} muted={true} onClick={clickHandler}></video>;
|
|
91
|
+
},
|
|
92
|
+
);
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { generateConnectingSequenceBar } from '../animationSequences/connectingSequence';
|
|
3
|
+
import { generateListeningSequenceBar } from '../animationSequences/listeningSequence';
|
|
4
|
+
import type { AgentState } from '../../../hooks';
|
|
5
|
+
|
|
6
|
+
export const useBarAnimator = (
|
|
7
|
+
state: AgentState | undefined,
|
|
8
|
+
columns: number,
|
|
9
|
+
interval: number,
|
|
10
|
+
): number[] => {
|
|
11
|
+
const [index, setIndex] = useState(0);
|
|
12
|
+
const [sequence, setSequence] = useState<number[][]>([[]]);
|
|
13
|
+
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
if (state === 'thinking') {
|
|
16
|
+
setSequence(generateListeningSequenceBar(columns));
|
|
17
|
+
} else if (state === 'connecting' || state === 'initializing') {
|
|
18
|
+
const sequence = [...generateConnectingSequenceBar(columns)];
|
|
19
|
+
setSequence(sequence);
|
|
20
|
+
} else if (state === 'listening') {
|
|
21
|
+
setSequence(generateListeningSequenceBar(columns));
|
|
22
|
+
} else if (state === undefined || state === 'speaking') {
|
|
23
|
+
setSequence([new Array(columns).fill(0).map((_, idx) => idx)]);
|
|
24
|
+
} else {
|
|
25
|
+
setSequence([[]]);
|
|
26
|
+
}
|
|
27
|
+
setIndex(0);
|
|
28
|
+
}, [state, columns]);
|
|
29
|
+
|
|
30
|
+
const animationFrameId = useRef<number | null>(null);
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
let startTime = performance.now();
|
|
33
|
+
|
|
34
|
+
const animate = (time: DOMHighResTimeStamp) => {
|
|
35
|
+
const timeElapsed = time - startTime;
|
|
36
|
+
|
|
37
|
+
if (timeElapsed >= interval) {
|
|
38
|
+
setIndex((prev) => prev + 1);
|
|
39
|
+
startTime = time;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
animationFrameId.current = requestAnimationFrame(animate);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
animationFrameId.current = requestAnimationFrame(animate);
|
|
46
|
+
|
|
47
|
+
return () => {
|
|
48
|
+
if (animationFrameId.current !== null) {
|
|
49
|
+
cancelAnimationFrame(animationFrameId.current);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}, [interval, columns, state, sequence.length]);
|
|
53
|
+
|
|
54
|
+
return sequence[index % sequence.length];
|
|
55
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { WidgetState } from '@livekit/components-core';
|
|
2
|
+
import type * as React from 'react';
|
|
3
|
+
|
|
4
|
+
/** @internal */
|
|
5
|
+
export type ChatContextAction =
|
|
6
|
+
| { msg: 'show_chat' }
|
|
7
|
+
| { msg: 'hide_chat' }
|
|
8
|
+
| { msg: 'toggle_chat' }
|
|
9
|
+
| { msg: 'unread_msg'; count: number }
|
|
10
|
+
| { msg: 'toggle_settings' };
|
|
11
|
+
|
|
12
|
+
/** @internal */
|
|
13
|
+
export type WidgetContextType = {
|
|
14
|
+
dispatch?: React.Dispatch<ChatContextAction>;
|
|
15
|
+
state?: WidgetState;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/** @internal */
|
|
19
|
+
export function chatReducer(state: WidgetState, action: ChatContextAction): WidgetState {
|
|
20
|
+
if (action.msg === 'show_chat') {
|
|
21
|
+
return { ...state, showChat: true, unreadMessages: 0 };
|
|
22
|
+
} else if (action.msg === 'hide_chat') {
|
|
23
|
+
return { ...state, showChat: false };
|
|
24
|
+
} else if (action.msg === 'toggle_chat') {
|
|
25
|
+
const newState = { ...state, showChat: !state.showChat };
|
|
26
|
+
if (newState.showChat === true) {
|
|
27
|
+
newState.unreadMessages = 0;
|
|
28
|
+
}
|
|
29
|
+
return newState;
|
|
30
|
+
} else if (action.msg === 'unread_msg') {
|
|
31
|
+
return { ...state, unreadMessages: action.count };
|
|
32
|
+
} else if (action.msg === 'toggle_settings') {
|
|
33
|
+
return { ...state, showSettings: !state.showSettings };
|
|
34
|
+
} else {
|
|
35
|
+
return { ...state };
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
/** @internal */
|
|
4
|
+
export interface FeatureFlags {
|
|
5
|
+
autoSubscription?: boolean;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
type FeatureContext<T extends boolean = false> = T extends true
|
|
9
|
+
? FeatureFlags
|
|
10
|
+
: FeatureFlags | undefined;
|
|
11
|
+
|
|
12
|
+
/** @internal */
|
|
13
|
+
export const LKFeatureContext = React.createContext<FeatureFlags | undefined>(undefined);
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
export function useFeatureContext<T extends boolean>(require?: T): FeatureContext<T> {
|
|
19
|
+
const ctx = React.useContext(LKFeatureContext) as FeatureContext<T>;
|
|
20
|
+
if (require === true) {
|
|
21
|
+
if (ctx) {
|
|
22
|
+
return ctx;
|
|
23
|
+
} else {
|
|
24
|
+
throw Error('tried to access feature context, but none is present');
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return ctx;
|
|
28
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export {} from './chat-context';
|
|
2
|
+
export type { LayoutContextType } from './layout-context';
|
|
3
|
+
export {
|
|
4
|
+
LayoutContext,
|
|
5
|
+
useCreateLayoutContext,
|
|
6
|
+
useEnsureCreateLayoutContext,
|
|
7
|
+
useEnsureLayoutContext,
|
|
8
|
+
useLayoutContext,
|
|
9
|
+
useMaybeLayoutContext,
|
|
10
|
+
} from './layout-context';
|
|
11
|
+
export {
|
|
12
|
+
ParticipantContext,
|
|
13
|
+
useEnsureParticipant,
|
|
14
|
+
useMaybeParticipantContext,
|
|
15
|
+
useParticipantContext,
|
|
16
|
+
} from './participant-context';
|
|
17
|
+
export {} from './pin-context';
|
|
18
|
+
export { RoomContext, useEnsureRoom, useMaybeRoomContext, useRoomContext } from './room-context';
|
|
19
|
+
export { useEnsureSession, useMaybeSessionContext, useSessionContext } from './session-context';
|
|
20
|
+
export {
|
|
21
|
+
TrackRefContext,
|
|
22
|
+
useEnsureTrackRef,
|
|
23
|
+
useMaybeTrackRefContext,
|
|
24
|
+
useTrackRefContext,
|
|
25
|
+
} from './track-reference-context';
|
|
26
|
+
|
|
27
|
+
export { type FeatureFlags, useFeatureContext, LKFeatureContext } from './feature-context';
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { PIN_DEFAULT_STATE, WIDGET_DEFAULT_STATE } from '@livekit/components-core';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import type { PinContextType } from './pin-context';
|
|
4
|
+
import type { WidgetContextType } from './chat-context';
|
|
5
|
+
import { chatReducer } from './chat-context';
|
|
6
|
+
import { pinReducer } from './pin-context';
|
|
7
|
+
|
|
8
|
+
/** @public */
|
|
9
|
+
export type LayoutContextType = {
|
|
10
|
+
pin: PinContextType;
|
|
11
|
+
widget: WidgetContextType;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/** @public */
|
|
15
|
+
export const LayoutContext = React.createContext<LayoutContextType | undefined>(undefined);
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Ensures that a layout context is provided via context.
|
|
19
|
+
* If no layout context is provided, an error is thrown.
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
export function useLayoutContext(): LayoutContextType {
|
|
23
|
+
const layoutContext = React.useContext(LayoutContext);
|
|
24
|
+
if (!layoutContext) {
|
|
25
|
+
throw Error('Tried to access LayoutContext context outside a LayoutContextProvider provider.');
|
|
26
|
+
}
|
|
27
|
+
return layoutContext;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Ensures that a layout context is provided, either via context or explicitly as a parameter.
|
|
32
|
+
* If not inside a `LayoutContext` and no layout context is provided, an error is thrown.
|
|
33
|
+
* @public
|
|
34
|
+
*/
|
|
35
|
+
export function useEnsureLayoutContext(layoutContext?: LayoutContextType) {
|
|
36
|
+
const layout = useMaybeLayoutContext();
|
|
37
|
+
layoutContext ??= layout;
|
|
38
|
+
if (!layoutContext) {
|
|
39
|
+
throw Error('Tried to access LayoutContext context outside a LayoutContextProvider provider.');
|
|
40
|
+
}
|
|
41
|
+
return layoutContext;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** @public */
|
|
45
|
+
export function useCreateLayoutContext(): LayoutContextType {
|
|
46
|
+
const [pinState, pinDispatch] = React.useReducer(pinReducer, PIN_DEFAULT_STATE);
|
|
47
|
+
const [widgetState, widgetDispatch] = React.useReducer(chatReducer, WIDGET_DEFAULT_STATE);
|
|
48
|
+
return {
|
|
49
|
+
pin: { dispatch: pinDispatch, state: pinState },
|
|
50
|
+
widget: { dispatch: widgetDispatch, state: widgetState },
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** @public */
|
|
55
|
+
export function useEnsureCreateLayoutContext(layoutContext?: LayoutContextType): LayoutContextType {
|
|
56
|
+
const [pinState, pinDispatch] = React.useReducer(pinReducer, PIN_DEFAULT_STATE);
|
|
57
|
+
const [widgetState, widgetDispatch] = React.useReducer(chatReducer, WIDGET_DEFAULT_STATE);
|
|
58
|
+
return (
|
|
59
|
+
layoutContext ?? {
|
|
60
|
+
pin: { dispatch: pinDispatch, state: pinState },
|
|
61
|
+
widget: { dispatch: widgetDispatch, state: widgetState },
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Returns a layout context from the `LayoutContext` if it exists, otherwise `undefined`.
|
|
68
|
+
* @public
|
|
69
|
+
*/
|
|
70
|
+
export function useMaybeLayoutContext(): LayoutContextType | undefined {
|
|
71
|
+
return React.useContext(LayoutContext);
|
|
72
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { Participant } from 'livekit-client';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { useMaybeTrackRefContext } from './track-reference-context';
|
|
4
|
+
|
|
5
|
+
/** @public */
|
|
6
|
+
export const ParticipantContext = React.createContext<Participant | undefined>(undefined);
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Ensures that a participant is provided via context.
|
|
10
|
+
* If not inside a `ParticipantContext`, an error is thrown.
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
export function useParticipantContext() {
|
|
14
|
+
const participant = React.useContext(ParticipantContext);
|
|
15
|
+
if (!participant) {
|
|
16
|
+
throw Error('tried to access participant context outside of participant context provider');
|
|
17
|
+
}
|
|
18
|
+
return participant;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Returns a participant from the `ParticipantContext` if it exists, otherwise `undefined`.
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
25
|
+
export function useMaybeParticipantContext() {
|
|
26
|
+
return React.useContext(ParticipantContext);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Ensures that a participant is provided, either via context or explicitly as a parameter.
|
|
31
|
+
* If not inside a `ParticipantContext` and no participant is provided, an error is thrown.
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
34
|
+
export function useEnsureParticipant(participant?: Participant) {
|
|
35
|
+
const context = useMaybeParticipantContext();
|
|
36
|
+
const trackContext = useMaybeTrackRefContext();
|
|
37
|
+
const p = participant ?? context ?? trackContext?.participant;
|
|
38
|
+
if (!p) {
|
|
39
|
+
throw new Error(
|
|
40
|
+
'No participant provided, make sure you are inside a participant context or pass the participant explicitly',
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
return p;
|
|
44
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { PinState, TrackReferenceOrPlaceholder } from '@livekit/components-core';
|
|
2
|
+
import type * as React from 'react';
|
|
3
|
+
|
|
4
|
+
/** @internal */
|
|
5
|
+
export type PinAction =
|
|
6
|
+
| {
|
|
7
|
+
msg: 'set_pin';
|
|
8
|
+
trackReference: TrackReferenceOrPlaceholder;
|
|
9
|
+
}
|
|
10
|
+
| { msg: 'clear_pin' };
|
|
11
|
+
|
|
12
|
+
/** @internal */
|
|
13
|
+
export type PinContextType = {
|
|
14
|
+
dispatch?: React.Dispatch<PinAction>;
|
|
15
|
+
state?: PinState;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/** @internal */
|
|
19
|
+
export function pinReducer(state: PinState, action: PinAction): PinState {
|
|
20
|
+
if (action.msg === 'set_pin') {
|
|
21
|
+
return [action.trackReference];
|
|
22
|
+
} else if (action.msg === 'clear_pin') {
|
|
23
|
+
return [];
|
|
24
|
+
} else {
|
|
25
|
+
return { ...state };
|
|
26
|
+
}
|
|
27
|
+
}
|