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';

相关推荐
小兵张健2 小时前
价值1000的 AI 工作流:Codex 通用前端协作模式
前端·aigc·ai编程
sunny_2 小时前
面试踩大坑!同一段 Node.js 代码,CJS 和 ESM 的执行顺序居然是反的?!99% 的人都答错了
前端·面试·node.js
拉不动的猪2 小时前
移动端调试工具VConsole初始化时的加载阻塞问题
前端·javascript·微信小程序
ayqy贾杰4 小时前
Agent First Engineering
前端·vue.js·面试
IT_陈寒4 小时前
SpringBoot实战:5个让你的API性能翻倍的隐藏技巧
前端·人工智能·后端
iceiceiceice5 小时前
iOS PDF阅读器段评实现:如何从 PDFSelection 精准还原一个自然段
前端·人工智能·ios
大金乄5 小时前
封装一个vue2的elementUI 表格组件(包含表格编辑以及多级表头)
前端·javascript
葡萄城技术团队5 小时前
【性能优化篇】面对万行数据也不卡顿?揭秘协同服务器的“片段机制 (Fragments)”
前端
程序员阿峰6 小时前
2026前端必备:TensorFlow.js,浏览器里的AI引擎,不写Python也能玩转智能
前端
Jans6 小时前
Shipfe — Rust 写的前端静态部署工具:一条命令上线 + 零停机 + 可回滚 + 自动清理
前端