用途:该技能面向使用 LiveKit 构建实时音视频及语音 AI 智能体应用的开发者,通过 @livekit/components-react 提供的 Hooks 对房间状态、参与者、音视频轨道和智能体数据进行低层控制,从而搭建完全自定义的 React UI。
主要能力:参与者类 Hooks 包括 useParticipants、useLocalParticipant、useRemoteParticipants、useParticipantInfo、useParticipantAttributes;轨道类包括 useTracks、useParticipantTracks、useTrackToggle、useIsMuted、useIsSpeaking、useTrackVolume;房间类包括 useConnectionState、useRoomInfo、useLiveKitRoom、useIsRecording、useMediaDeviceSelect;会话类(beta)包括 useSession、useSessionMessages;智能体类(beta)包括 useVoiceAssistant、useAgent;数据类包括 useChat、useDataChannel、useTextStream、useTranscriptions、useEvents。
使用方式:安装命令为 npm install @livekit/components-react livekit-client。智能体应用推荐用 useSession 创建会话,再传给 livekit-agents-ui 的 AgentSessionProvider;useVoiceAssistant 需在该 Provider 内使用。TokenSource 建议用 useRef 记忆化,生产环境用 TokenSource.endpoint('/api/token')。该技能可与 LiveKit MCP 服务器工具(docs_search、get_pages、get_changelog、code_search、get_python_agent_example)配合获取最新文档与示例。
适用场景:需要自定义智能体状态展示、麦克风/摄像头切换、参与者列表、聊天与转录显示等超出预置 Agents UI 组件能力的场景。
限制:智能体应用不应直接使用 @livekit/components-react 的 UI 组件,应改用 livekit-agents-ui 的 shadcn 组件;多数 Hooks 依赖房间上下文;useSession、useAgent、useVoiceAssistant、useTextStream、useTranscriptions 等标记为 beta,可能变更。具体收费与平台支持资料暂未提供。