@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,34 @@
|
|
|
1
|
+
import type { Room } from 'livekit-client';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { useObservableState } from './internal';
|
|
4
|
+
import { roomAudioPlaybackAllowedObservable } from '@livekit/components-core';
|
|
5
|
+
import { useEnsureRoom } from '../context';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* In many browsers to start audio playback, the user must perform a user-initiated event such as clicking a button.
|
|
9
|
+
* The `useAudioPlayback` hook returns an object with a boolean `canPlayAudio` flag that indicates whether audio
|
|
10
|
+
* playback is allowed in the current context, as well as a `startAudio` function that can be called in a button
|
|
11
|
+
* `onClick` callback to start audio playback in the current context.
|
|
12
|
+
*
|
|
13
|
+
* @see Autoplay policy on MDN web docs for more info: {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API/Best_practices#autoplay_policy}
|
|
14
|
+
* @alpha
|
|
15
|
+
*/
|
|
16
|
+
export function useAudioPlayback(room?: Room): {
|
|
17
|
+
canPlayAudio: boolean;
|
|
18
|
+
startAudio: () => Promise<void>;
|
|
19
|
+
} {
|
|
20
|
+
const roomEnsured = useEnsureRoom(room);
|
|
21
|
+
const startAudio = React.useCallback(async () => {
|
|
22
|
+
await roomEnsured.startAudio();
|
|
23
|
+
}, [roomEnsured]);
|
|
24
|
+
|
|
25
|
+
const observable = React.useMemo(
|
|
26
|
+
() => roomAudioPlaybackAllowedObservable(roomEnsured),
|
|
27
|
+
[roomEnsured],
|
|
28
|
+
);
|
|
29
|
+
const { canPlayAudio } = useObservableState(observable, {
|
|
30
|
+
canPlayAudio: roomEnsured.canPlaybackAudio,
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
return { canPlayAudio, startAudio };
|
|
34
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { ChatOptions, ReceivedChatMessage } from '@livekit/components-core';
|
|
3
|
+
import { setupChat } from '@livekit/components-core';
|
|
4
|
+
import { ConnectionState, Room } from 'livekit-client';
|
|
5
|
+
import { useEnsureRoom } from '../context';
|
|
6
|
+
import { useObservableState } from './internal/useObservableState';
|
|
7
|
+
import { useConnectionState } from './useConnectionStatus';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The `useChat` hook provides chat functionality for a LiveKit room.
|
|
11
|
+
*
|
|
12
|
+
* @remarks
|
|
13
|
+
* Message history is not persisted and will be lost if the component is refreshed.
|
|
14
|
+
* You may want to persist message history in the browser, a cache or a database.
|
|
15
|
+
*
|
|
16
|
+
* @returns An object containing:
|
|
17
|
+
* - `chatMessages` - Array of received chat messages
|
|
18
|
+
* - `send` - Function to send a new message
|
|
19
|
+
* - `isSending` - Boolean indicating if a message is currently being sent
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* function ChatComponent() {
|
|
24
|
+
* const { chatMessages, send, isSending } = useChat();
|
|
25
|
+
*
|
|
26
|
+
* return (
|
|
27
|
+
* <div>
|
|
28
|
+
* {chatMessages.map((msg) => (
|
|
29
|
+
* <div key={msg.timestamp}>
|
|
30
|
+
* {msg.from?.identity}: {msg.message}
|
|
31
|
+
* </div>
|
|
32
|
+
* ))}
|
|
33
|
+
* <button disabled={isSending} onClick={() => send("Hello!")}>
|
|
34
|
+
* Send Message
|
|
35
|
+
* </button>
|
|
36
|
+
* </div>
|
|
37
|
+
* );
|
|
38
|
+
* }
|
|
39
|
+
* ```
|
|
40
|
+
* @public
|
|
41
|
+
*/
|
|
42
|
+
export function useChat(options?: ChatOptions & { room?: Room }) {
|
|
43
|
+
const room = useEnsureRoom(options?.room);
|
|
44
|
+
const connectionState = useConnectionState(room);
|
|
45
|
+
const isDisconnected = React.useMemo(
|
|
46
|
+
() => connectionState === ConnectionState.Disconnected,
|
|
47
|
+
[connectionState],
|
|
48
|
+
); // used to reset the messages on room disconnect
|
|
49
|
+
const setup = React.useMemo<ReturnType<typeof setupChat>>(
|
|
50
|
+
() => setupChat(room, options),
|
|
51
|
+
[room, options, isDisconnected],
|
|
52
|
+
);
|
|
53
|
+
const isSending = useObservableState(setup.isSendingObservable, false);
|
|
54
|
+
const chatMessages = useObservableState<ReceivedChatMessage[]>(setup.messageObservable, []);
|
|
55
|
+
|
|
56
|
+
return { send: setup.send, chatMessages, isSending };
|
|
57
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { setupChatToggle } from '@livekit/components-core';
|
|
2
|
+
import { useLayoutContext } from '../context';
|
|
3
|
+
import { mergeProps } from '../mergeProps';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
|
|
6
|
+
/** @public */
|
|
7
|
+
export interface UseChatToggleProps {
|
|
8
|
+
props: React.ButtonHTMLAttributes<HTMLButtonElement>;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The `useChatToggle` hook provides state and functions for toggling the chat window.
|
|
13
|
+
* @remarks
|
|
14
|
+
* Depends on the `LayoutContext` to work properly.
|
|
15
|
+
* @see {@link ChatToggle}, {@link Chat}
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
export function useChatToggle({ props }: UseChatToggleProps) {
|
|
19
|
+
const { dispatch, state } = useLayoutContext().widget;
|
|
20
|
+
const { className } = React.useMemo(() => setupChatToggle(), []);
|
|
21
|
+
|
|
22
|
+
const mergedProps = React.useMemo(() => {
|
|
23
|
+
return mergeProps(props, {
|
|
24
|
+
className,
|
|
25
|
+
onClick: () => {
|
|
26
|
+
if (dispatch) dispatch({ msg: 'toggle_chat' });
|
|
27
|
+
},
|
|
28
|
+
'aria-pressed': state?.showChat ? 'true' : 'false',
|
|
29
|
+
'data-lk-unread-msgs': state
|
|
30
|
+
? state.unreadMessages < 10
|
|
31
|
+
? state.unreadMessages.toFixed(0)
|
|
32
|
+
: '9+'
|
|
33
|
+
: '0',
|
|
34
|
+
});
|
|
35
|
+
}, [props, className, dispatch, state]);
|
|
36
|
+
|
|
37
|
+
return { mergedProps };
|
|
38
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { setupClearPinButton } from '@livekit/components-core';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { useLayoutContext } from '../context';
|
|
4
|
+
import { mergeProps } from '../mergeProps';
|
|
5
|
+
import type { ClearPinButtonProps } from '../components';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The `useClearPinButton` hook provides props for the {@link ClearPinButton}
|
|
9
|
+
* or your custom implementation of it component. It adds the `onClick` handler
|
|
10
|
+
* to signal the `LayoutContext` that the tile in focus should be cleared.
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
export function useClearPinButton(props: ClearPinButtonProps) {
|
|
14
|
+
const { state, dispatch } = useLayoutContext().pin;
|
|
15
|
+
|
|
16
|
+
const buttonProps = React.useMemo(() => {
|
|
17
|
+
const { className } = setupClearPinButton();
|
|
18
|
+
const mergedProps = mergeProps(props, {
|
|
19
|
+
className,
|
|
20
|
+
disabled: !state?.length,
|
|
21
|
+
onClick: () => {
|
|
22
|
+
if (dispatch) dispatch({ msg: 'clear_pin' });
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
return mergedProps;
|
|
26
|
+
}, [props, dispatch, state]);
|
|
27
|
+
|
|
28
|
+
return { buttonProps };
|
|
29
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { setupConnectionQualityIndicator } from '@livekit/components-core';
|
|
2
|
+
import type { Participant } from 'livekit-client';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { useEnsureParticipant } from '../context';
|
|
5
|
+
import { useObservableState } from './internal';
|
|
6
|
+
|
|
7
|
+
/** @public */
|
|
8
|
+
export interface ConnectionQualityIndicatorOptions {
|
|
9
|
+
participant?: Participant;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The `useConnectionQualityIndicator` hook provides props for the `ConnectionQualityIndicator` or your custom implementation of it component.
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* const { quality } = useConnectionQualityIndicator();
|
|
17
|
+
* // or
|
|
18
|
+
* const { quality } = useConnectionQualityIndicator({ participant });
|
|
19
|
+
* ```
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
export function useConnectionQualityIndicator(options: ConnectionQualityIndicatorOptions = {}) {
|
|
23
|
+
const p = useEnsureParticipant(options.participant);
|
|
24
|
+
|
|
25
|
+
const { className, connectionQualityObserver } = React.useMemo(
|
|
26
|
+
() => setupConnectionQualityIndicator(p),
|
|
27
|
+
[p],
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
const quality = useObservableState(connectionQualityObserver, p.connectionQuality);
|
|
31
|
+
|
|
32
|
+
return { className, quality };
|
|
33
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { connectionStateObserver } 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 `useConnectionState` hook allows you to simply implement your own `ConnectionState` component.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* const connectionState = useConnectionState(room);
|
|
13
|
+
* ```
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
export function useConnectionState(room?: Room) {
|
|
17
|
+
// passed room takes precedence, if not supplied get current room context
|
|
18
|
+
const r = useEnsureRoom(room);
|
|
19
|
+
const observable = React.useMemo(() => connectionStateObserver(r), [r]);
|
|
20
|
+
const connectionState = useObservableState(observable, r.state);
|
|
21
|
+
return connectionState;
|
|
22
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { ReceivedDataMessage } from '@livekit/components-core';
|
|
2
|
+
import { setupDataMessageHandler } from '@livekit/components-core';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import type { DataPublishOptions } from 'livekit-client';
|
|
5
|
+
import { useRoomContext } from '../context';
|
|
6
|
+
import { useObservableState } from './internal';
|
|
7
|
+
|
|
8
|
+
type UseDataChannelReturnType<T extends string | undefined = undefined> = {
|
|
9
|
+
isSending: boolean;
|
|
10
|
+
send: (payload: Uint8Array, options: DataPublishOptions) => Promise<void>;
|
|
11
|
+
message: ReceivedDataMessage<T> | undefined;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The `useDataChannel` hook returns the ability to send and receive messages.
|
|
16
|
+
* Pass an optional `topic` to narrow down which messages are returned in the messages array.
|
|
17
|
+
*
|
|
18
|
+
* @remarks
|
|
19
|
+
* There is only one data channel. Passing a `topic` does not open a new data channel.
|
|
20
|
+
* It is only used to filter out messages with no or a different `topic`.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```tsx
|
|
24
|
+
* // Send messages to all participants via the 'chat' topic.
|
|
25
|
+
* const { message: latestMessage, send } = useDataChannel('chat', (msg) => console.log("message received", msg));
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```tsx
|
|
30
|
+
* // Receive all messages (no topic filtering)
|
|
31
|
+
* const { message: latestMessage, send } = useDataChannel((msg) => console.log("message received", msg));
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @public
|
|
35
|
+
*/
|
|
36
|
+
export function useDataChannel<T extends string>(
|
|
37
|
+
topic: T,
|
|
38
|
+
onMessage?: (msg: ReceivedDataMessage<T>) => void,
|
|
39
|
+
): UseDataChannelReturnType<T>;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Overload for `useDataChannel` without a topic. See {@link (useDataChannel:1)} for information and usage examples.
|
|
43
|
+
*
|
|
44
|
+
* @public
|
|
45
|
+
*/
|
|
46
|
+
export function useDataChannel(
|
|
47
|
+
onMessage?: (msg: ReceivedDataMessage) => void,
|
|
48
|
+
): UseDataChannelReturnType;
|
|
49
|
+
/**
|
|
50
|
+
* @internal
|
|
51
|
+
*/
|
|
52
|
+
export function useDataChannel<T extends string>(
|
|
53
|
+
topicOrCallback?: T | ((msg: ReceivedDataMessage) => void),
|
|
54
|
+
callback?: (msg: ReceivedDataMessage<T>) => void,
|
|
55
|
+
) {
|
|
56
|
+
const onMessage = typeof topicOrCallback === 'function' ? topicOrCallback : callback;
|
|
57
|
+
|
|
58
|
+
const topic = typeof topicOrCallback === 'string' ? topicOrCallback : undefined;
|
|
59
|
+
const room = useRoomContext();
|
|
60
|
+
const { send, messageObservable, isSendingObservable } = React.useMemo(
|
|
61
|
+
() => setupDataMessageHandler(room, topic, onMessage),
|
|
62
|
+
[room, topic, onMessage],
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
const message = useObservableState(messageObservable, undefined);
|
|
66
|
+
const isSending = useObservableState(isSendingObservable, false);
|
|
67
|
+
|
|
68
|
+
return {
|
|
69
|
+
message,
|
|
70
|
+
send,
|
|
71
|
+
isSending,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { setupDisconnectButton } from '@livekit/components-core';
|
|
2
|
+
import { ConnectionState } from 'livekit-client';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import type { DisconnectButtonProps } from '../components';
|
|
5
|
+
import { useRoomContext } from '../context';
|
|
6
|
+
import { mergeProps } from '../mergeProps';
|
|
7
|
+
import { useConnectionState } from './useConnectionStatus';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The `useDisconnectButton` hook is used to implement the `DisconnectButton` or your
|
|
11
|
+
* custom implementation of it. It adds onClick handler to the button to disconnect
|
|
12
|
+
* from the room.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* const { buttonProps } = useDisconnectButton(buttonProps);
|
|
17
|
+
* return <button {...buttonProps}>Disconnect</button>;
|
|
18
|
+
* ```
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
export function useDisconnectButton(props: DisconnectButtonProps) {
|
|
22
|
+
const room = useRoomContext();
|
|
23
|
+
const connectionState = useConnectionState(room);
|
|
24
|
+
|
|
25
|
+
const buttonProps = React.useMemo(() => {
|
|
26
|
+
const { className, disconnect } = setupDisconnectButton(room);
|
|
27
|
+
const mergedProps = mergeProps(props, {
|
|
28
|
+
className,
|
|
29
|
+
onClick: () => disconnect(props.stopTracks ?? true),
|
|
30
|
+
disabled: connectionState === ConnectionState.Disconnected,
|
|
31
|
+
});
|
|
32
|
+
return mergedProps;
|
|
33
|
+
}, [room, props, connectionState]);
|
|
34
|
+
|
|
35
|
+
return { buttonProps };
|
|
36
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import TypedEventEmitter, { EventMap } from 'typed-emitter';
|
|
3
|
+
|
|
4
|
+
/** @public */
|
|
5
|
+
export function useEvents<
|
|
6
|
+
Emitter extends TypedEventEmitter<EventMap>,
|
|
7
|
+
EmitterEventMap extends Emitter extends TypedEventEmitter<infer EM> ? EM : never,
|
|
8
|
+
Event extends Parameters<Emitter['on']>[0],
|
|
9
|
+
Callback extends EmitterEventMap[Event],
|
|
10
|
+
>(
|
|
11
|
+
instance: Emitter | { internal: { emitter: Emitter } } | null | undefined,
|
|
12
|
+
event: Event,
|
|
13
|
+
handlerFn: Callback | undefined,
|
|
14
|
+
dependencies?: React.DependencyList,
|
|
15
|
+
) {
|
|
16
|
+
const fallback = React.useMemo(() => () => {}, []);
|
|
17
|
+
const wrappedCallback = React.useCallback(handlerFn ?? fallback, dependencies ?? []);
|
|
18
|
+
const callback = dependencies ? wrappedCallback : handlerFn;
|
|
19
|
+
|
|
20
|
+
const emitter = React.useMemo(() => {
|
|
21
|
+
if (!instance) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
if ('internal' in instance) {
|
|
25
|
+
return instance.internal.emitter;
|
|
26
|
+
}
|
|
27
|
+
return instance;
|
|
28
|
+
}, [instance]);
|
|
29
|
+
|
|
30
|
+
React.useEffect(() => {
|
|
31
|
+
if (!emitter || !callback) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
emitter.on(event, callback);
|
|
35
|
+
return () => {
|
|
36
|
+
emitter.off(event, callback);
|
|
37
|
+
};
|
|
38
|
+
}, [emitter, event, callback]);
|
|
39
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { TrackReferenceOrPlaceholder } from '@livekit/components-core';
|
|
2
|
+
import { LocalTrackPublication, facingModeFromLocalTrack } from 'livekit-client';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Try to determine the `facingMode` of a local participant video track.
|
|
6
|
+
* @remarks
|
|
7
|
+
* Works only on local video tracks.
|
|
8
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackConstraints/facingMode | MDN docs on facingMode}
|
|
9
|
+
* @alpha
|
|
10
|
+
*/
|
|
11
|
+
export function useFacingMode(
|
|
12
|
+
trackReference: TrackReferenceOrPlaceholder,
|
|
13
|
+
): 'user' | 'environment' | 'left' | 'right' | 'undefined' {
|
|
14
|
+
if (trackReference.publication instanceof LocalTrackPublication) {
|
|
15
|
+
const localTrack = trackReference.publication.track;
|
|
16
|
+
if (localTrack) {
|
|
17
|
+
const { facingMode } = facingModeFromLocalTrack(localTrack);
|
|
18
|
+
return facingMode;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return 'undefined';
|
|
22
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { TrackReferenceOrPlaceholder } from '@livekit/components-core';
|
|
2
|
+
import { setupFocusToggle, isTrackReferencePinned } from '@livekit/components-core';
|
|
3
|
+
import { useEnsureTrackRef, useMaybeLayoutContext } from '../context';
|
|
4
|
+
import { mergeProps } from '../mergeProps';
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
|
|
7
|
+
/** @public */
|
|
8
|
+
export interface UseFocusToggleProps {
|
|
9
|
+
trackRef?: TrackReferenceOrPlaceholder;
|
|
10
|
+
props: React.ButtonHTMLAttributes<HTMLButtonElement>;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* The `useFocusToggle` hook is used to implement the `FocusToggle` or your custom implementation of it.
|
|
15
|
+
* The `TrackReferenceOrPlaceholder` is used to register a onClick handler and to identify the track to focus on.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* const { mergedProps, inFocus } = useFocusToggle({ trackRef, props: yourButtonProps });
|
|
20
|
+
* return <button {...mergedProps}>{inFocus ? 'Unfocus' : 'Focus'}</button>;
|
|
21
|
+
* ```
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
24
|
+
export function useFocusToggle({ trackRef, props }: UseFocusToggleProps) {
|
|
25
|
+
const trackReference = useEnsureTrackRef(trackRef);
|
|
26
|
+
|
|
27
|
+
const layoutContext = useMaybeLayoutContext();
|
|
28
|
+
const { className } = React.useMemo(() => setupFocusToggle(), []);
|
|
29
|
+
|
|
30
|
+
const inFocus: boolean = React.useMemo(() => {
|
|
31
|
+
return isTrackReferencePinned(trackReference, layoutContext?.pin.state);
|
|
32
|
+
}, [trackReference, layoutContext?.pin.state]);
|
|
33
|
+
|
|
34
|
+
const mergedProps = React.useMemo(
|
|
35
|
+
() =>
|
|
36
|
+
mergeProps(props, {
|
|
37
|
+
className,
|
|
38
|
+
onClick: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
|
|
39
|
+
// Call user defined on click callbacks.
|
|
40
|
+
props.onClick?.(event);
|
|
41
|
+
|
|
42
|
+
// Set or clear focus based on current focus state.
|
|
43
|
+
if (inFocus) {
|
|
44
|
+
layoutContext?.pin.dispatch?.({
|
|
45
|
+
msg: 'clear_pin',
|
|
46
|
+
});
|
|
47
|
+
} else {
|
|
48
|
+
layoutContext?.pin.dispatch?.({
|
|
49
|
+
msg: 'set_pin',
|
|
50
|
+
trackReference,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
}),
|
|
55
|
+
[props, className, trackReference, inFocus, layoutContext?.pin],
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
return { mergedProps, inFocus };
|
|
59
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { GRID_LAYOUTS, selectGridLayout } from '@livekit/components-core';
|
|
2
|
+
import type { GridLayoutDefinition, GridLayoutInfo } from '@livekit/components-core';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { useSize } from './internal';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The `useGridLayout` hook tries to select the best layout to fit all tiles.
|
|
8
|
+
* If the available screen space is not enough, it will reduce the number of maximum visible
|
|
9
|
+
* tiles and select a layout that still works visually within the given limitations.
|
|
10
|
+
* As the order of tiles changes over time, the hook tries to keep visual updates to a minimum
|
|
11
|
+
* while trying to display important tiles such as speaking participants or screen shares.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* const { layout } = useGridLayout(gridElement, trackCount);
|
|
16
|
+
* ```
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
export function useGridLayout(
|
|
20
|
+
/** HTML element that contains the grid. */
|
|
21
|
+
gridElement: React.RefObject<HTMLDivElement>,
|
|
22
|
+
/** Count of tracks that should get layed out */
|
|
23
|
+
trackCount: number,
|
|
24
|
+
options: {
|
|
25
|
+
gridLayouts?: GridLayoutDefinition[];
|
|
26
|
+
} = {},
|
|
27
|
+
): { layout: GridLayoutInfo; containerWidth: number; containerHeight: number } {
|
|
28
|
+
const gridLayouts = options.gridLayouts ?? GRID_LAYOUTS;
|
|
29
|
+
const { width, height } = useSize(gridElement);
|
|
30
|
+
const layout = selectGridLayout(gridLayouts, trackCount, width, height);
|
|
31
|
+
|
|
32
|
+
React.useEffect(() => {
|
|
33
|
+
if (gridElement.current && layout) {
|
|
34
|
+
gridElement.current.style.setProperty('--lk-col-count', layout?.columns.toString());
|
|
35
|
+
gridElement.current.style.setProperty('--lk-row-count', layout?.rows.toString());
|
|
36
|
+
}
|
|
37
|
+
}, [gridElement, layout]);
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
layout,
|
|
41
|
+
containerWidth: width,
|
|
42
|
+
containerHeight: height,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { LocalParticipant } from 'livekit-client';
|
|
3
|
+
import type { Participant, Room } from 'livekit-client';
|
|
4
|
+
import { encryptionStatusObservable } from '@livekit/components-core';
|
|
5
|
+
import { useEnsureParticipant, useEnsureRoom } from '../context';
|
|
6
|
+
import { useObservableState } from './internal';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @alpha
|
|
10
|
+
*/
|
|
11
|
+
export interface UseIsEncryptedOptions {
|
|
12
|
+
room?: Room;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @alpha
|
|
17
|
+
*/
|
|
18
|
+
export function useIsEncrypted(participant?: Participant, options: UseIsEncryptedOptions = {}) {
|
|
19
|
+
const p = useEnsureParticipant(participant);
|
|
20
|
+
|
|
21
|
+
const room = useEnsureRoom(options.room);
|
|
22
|
+
|
|
23
|
+
const observer = React.useMemo(() => encryptionStatusObservable(room, p), [room, p]);
|
|
24
|
+
const isEncrypted = useObservableState(
|
|
25
|
+
observer,
|
|
26
|
+
p.isLocal ? (p as LocalParticipant).isE2EEEnabled : !!p?.isEncrypted,
|
|
27
|
+
);
|
|
28
|
+
return isEncrypted;
|
|
29
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type TrackReferenceOrPlaceholder,
|
|
3
|
+
getTrackReferenceId,
|
|
4
|
+
mutedObserver,
|
|
5
|
+
} from '@livekit/components-core';
|
|
6
|
+
import type { Participant, Track } from 'livekit-client';
|
|
7
|
+
import * as React from 'react';
|
|
8
|
+
import { useEnsureParticipant } from '../context';
|
|
9
|
+
|
|
10
|
+
/** @public */
|
|
11
|
+
export interface UseIsMutedOptions {
|
|
12
|
+
participant?: Participant;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The `useIsMuted` hook is used to implement the `TrackMutedIndicator` or your custom implementation of it.
|
|
17
|
+
* It returns a `boolean` that indicates if the track is muted or not.
|
|
18
|
+
*
|
|
19
|
+
* @example With a track reference
|
|
20
|
+
* ```tsx
|
|
21
|
+
* const isMuted = useIsMuted(track);
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @param trackRef - A `TrackReference` indicating the track to monitor.
|
|
25
|
+
* @returns boolean indicating if the track is muted
|
|
26
|
+
*
|
|
27
|
+
* @public
|
|
28
|
+
*/
|
|
29
|
+
export function useIsMuted(trackRef: TrackReferenceOrPlaceholder): boolean;
|
|
30
|
+
export function useIsMuted(
|
|
31
|
+
sourceOrTrackRef: TrackReferenceOrPlaceholder | Track.Source,
|
|
32
|
+
options: UseIsMutedOptions = {},
|
|
33
|
+
) {
|
|
34
|
+
const passedParticipant =
|
|
35
|
+
typeof sourceOrTrackRef === 'string' ? options.participant : sourceOrTrackRef.participant;
|
|
36
|
+
const p = useEnsureParticipant(passedParticipant);
|
|
37
|
+
const ref =
|
|
38
|
+
typeof sourceOrTrackRef === 'string'
|
|
39
|
+
? { participant: p, source: sourceOrTrackRef }
|
|
40
|
+
: sourceOrTrackRef;
|
|
41
|
+
const [isMuted, setIsMuted] = React.useState(
|
|
42
|
+
!!(ref.publication?.isMuted || p.getTrackPublication(ref.source)?.isMuted),
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
React.useEffect(() => {
|
|
46
|
+
const listener = mutedObserver(ref).subscribe(setIsMuted);
|
|
47
|
+
return () => listener.unsubscribe();
|
|
48
|
+
}, [getTrackReferenceId(ref)]);
|
|
49
|
+
|
|
50
|
+
return isMuted;
|
|
51
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { recordingStatusObservable } from '@livekit/components-core';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { useEnsureRoom } from '../context';
|
|
4
|
+
import { useObservableState } from './internal';
|
|
5
|
+
import { useConnectionState } from './useConnectionStatus';
|
|
6
|
+
import type { Room } from 'livekit-client';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The `useIsRecording` hook returns a `boolean` that indicates if the room is currently being recorded.
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* const isRecording = useIsRecording();
|
|
13
|
+
* ```
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
export function useIsRecording(room?: Room) {
|
|
17
|
+
const r = useEnsureRoom(room);
|
|
18
|
+
const connectionState = useConnectionState(r);
|
|
19
|
+
const observable = React.useMemo(() => recordingStatusObservable(r), [r, connectionState]);
|
|
20
|
+
const isRecording = useObservableState(observable, r.isRecording);
|
|
21
|
+
|
|
22
|
+
return isRecording;
|
|
23
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createIsSpeakingObserver } from '@livekit/components-core';
|
|
2
|
+
import type { Participant } from 'livekit-client';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { useEnsureParticipant } from '../context';
|
|
5
|
+
import { useObservableState } from './internal';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The `useIsSpeaking` hook returns a `boolean` that indicates if the participant is speaking or not.
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* const isSpeaking = useIsSpeaking(participant);
|
|
12
|
+
* ```
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
export function useIsSpeaking(participant?: Participant) {
|
|
16
|
+
const p = useEnsureParticipant(participant);
|
|
17
|
+
const observable = React.useMemo(() => createIsSpeakingObserver(p), [p]);
|
|
18
|
+
const isSpeaking = useObservableState(observable, p.isSpeaking);
|
|
19
|
+
|
|
20
|
+
return isSpeaking;
|
|
21
|
+
}
|