Rocket.Chat Video Call

我来帮您找到Rocket.Chat中video call按钮的代码位置。让我先搜索相关的代码。

Search files... 让我继续搜索更多相关的代码,特别是主要的video call按钮实现:

Ran tool Search files... 现在让我查看房间工具栏的实现,找到video call按钮是如何被渲染的:

Search files... 现在让我查看房间工具栏的hook,了解video call按钮是如何被注册的:

Search files... 基于我的搜索结果,我现在可以为您详细说明Rocket.Chat中video call按钮的代码位置和实现方式。

Rocket.Chat Video Call按钮代码位置总结

主要实现文件

1. 主要的Video Call按钮Hook:

12:15:apps/meteor/client/hooks/roomActions/useVideoCallRoomAction.tsx 复制代码
export const useVideoCallRoomAction = () => {
	const { t } = useTranslation();
	const room = useRoom();
	const user = useUser();

这个hook定义了主要的video call按钮,包括:

  • 按钮ID: start-video-call
  • 标题: Video_call
  • 图标: video
  • 设置为featured(优先显示)
  • 支持多种房间类型(DM、频道、群组、团队、LiveChat)

2. WebRTC Video Call按钮Hook:

12:15:apps/meteor/client/hooks/roomActions/useWebRTCVideoRoomAction.ts 复制代码
export const useWebRTCVideoRoomAction = () => {
	const enabled = useSetting('WebRTC_Enabled', false);
	const room = useRoom();
	const federated = isRoomFederated(room);

这个hook专门用于WebRTC视频通话,主要针对LiveChat房间。

3. 房间工具栏组件:

13:15:apps/meteor/client/views/room/HeaderV2/RoomToolbox/RoomToolbox.tsx 复制代码
const RoomToolbox = ({ className }: RoomToolboxProps) => {
	const { t } = useTranslation();
	const toolbox = useRoomToolbox();

4. 房间工具栏Actions Hook:

7:10:apps/meteor/client/views/room/HeaderV2/RoomToolbox/hooks/useRoomToolboxActions.ts 复制代码
export const useRoomToolboxActions = ({ actions, openTab }: Pick<RoomToolboxContextValue, 'actions' | 'openTab'>) => {
	const { t } = useTranslation();
	const { roomToolboxExpanded } = useLayout();

按钮注册和渲染流程

1. 按钮注册:apps/meteor/client/ui.ts 中,video call相关的hooks被注册到 roomActionHooks 数组中:

67:70:apps/meteor/client/ui.ts 复制代码
	useWebRTCVideoRoomAction,
	useAppsRoomStarActions,
	useVideoCallRoomAction,
	useVoiceCallRoomAction,

2. 按钮渲染:

  • RoomToolbox 组件使用 useRoomToolboxActions hook来获取所有可用的工具栏动作
  • featuredActions 包含优先显示的动作(如video call按钮)
  • visibleActions 包含在展开模式下显示的动作
  • hiddenActions 包含在菜单中显示的动作

3. 按钮配置: Video call按钮的主要配置:

  • id: 'start-video-call'
  • title: 'Video_call' (会通过i18n翻译)
  • icon: 'video'
  • featured: true (优先显示)
  • order: -1 (高优先级排序)
  • 支持多种房间类型组

用户信息卡片中的Video Call按钮

还有一个在用户信息卡片中显示的video call按钮,实现在:

16:18:apps/meteor/client/views/room/hooks/useUserInfoActions/actions/useVideoCallAction.tsx 复制代码
export const useVideoCallAction = (user: Pick<IUser, '_id' | 'username'>): UserInfoAction | undefined => {
	const t = useTranslation();
	const usernameSubscription = useSubscriptionByName(user.username ?? '');

总结

要找到video call按钮的代码位置,主要关注这些文件:

  1. apps/meteor/client/hooks/roomActions/useVideoCallRoomAction.tsx - 主要的video call按钮逻辑
  2. apps/meteor/client/views/room/HeaderV2/RoomToolbox/RoomToolbox.tsx - 按钮渲染组件
  3. apps/meteor/client/ui.ts - 按钮注册配置
  4. apps/meteor/client/views/room/HeaderV2/RoomToolbox/hooks/useRoomToolboxActions.ts - 按钮显示逻辑

这些文件共同工作,实现了Rocket.Chat中房间工具栏的video call按钮功能。

Rocket.Chat\apps\meteor\client\views\room\contextualBar\VideoConference\VideoConfPopups\VideoConfPopup\StartCallPopup.tsx 开始通话 按钮

home\Rocket.Chat\apps\meteor\client\views\room\contextualBar\VideoConference\VideoConfPopups\VideoConfPopup\TimedVideoConfPopup.tsx import StartCallPopup from './StartCallPopup';

相关推荐
Pedantic2 小时前
SwiftUI 手势层级(Gesture Hierarchy)详解
前端
飘尘2 小时前
前端转型全栈(Java后端)的快速上手指引
前端·后端·全栈
一颗烂土豆2 小时前
Meshopt 压缩深度解析,为什么它比 Draco 更快
前端·javascript·webgl
浏览器工程师3 小时前
AI Agent 接浏览器任务,先别让它一路点到底
前端·后端
雨季mo浅忆3 小时前
VSCode自动格式化三要素
前端
爱勇宝4 小时前
深扒 Anthropic 1680 位工程师简历:应届生几乎没机会,AI 公司最缺的不是博士
前端·后端·程序员
kyriewen4 小时前
同事每天催我 Code Review,我写了个脚本让 AI 替我 review PR——现在他反过来催 AI 了
前端·javascript·ai编程
user20585561518137 小时前
Windows 项目安装时报 `node-sass` 错误,如何快速处理
前端
LiaCode7 小时前
Redis 在生产项目的使用
前端·后端