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

相关推荐
陈随易1 小时前
在Finch用了62亿词元,我认为这是新一代Agent工具之神
前端·人工智能·后端
水域安全老周2 小时前
水趣钓鱼救生衣专利拆解:两级锁紧如何解决落水人衣分离
java·前端·网络
计算机魔术师2 小时前
Anthropic CEO突然喊踩刹车,OpenAI罕见力挺:AI这辆车不能只踩油门了
前端
wing983 小时前
从codex转战workbuddy使用一周的感受
前端·人工智能·后端
Highcharts.js3 小时前
常见报错排雷指南2:导出失败的官方解法
javascript·react.js·ecmascript·highcharts·可视化图表·导出模块失败·导出服务
EatFan3 小时前
Java接入支付宝 JSAPI 支付保姆教程(二):流程讲解与前后端代码讲解
前端·spring boot·后端·微信小程序·小程序·uni-app
梦想平凡3 小时前
百游棋牌源代码开发搭建教程(五):房间创建、座位分配与请求幂等实现
前端·javascript·数据库·源代码管理
IT_陈寒3 小时前
Redis的Set操作居然能把我的服务整挂了?
前端·人工智能·后端
计算机魔术师4 小时前
Suno 发布 v6 音乐模型,推出 v6、v6-wild、v6-mini 三个版本
前端
whyweplay4 小时前
elpis : DSL动态组件学习
前端