refactor: extract sharing views and repair player ownership

This commit is contained in:
illusia committed 2026-10-01 19:11:29 +08:00
1 parent 8b6c998c43
commit 6ed8abfb15
11 files changed
+355 -222

No files matched your search

+2
View File
@@ -185,6 +185,8 @@ The public join form uses explicit named field models and emits page actions. Th
The member panel and actions menu also share one page-owned member controller. The panel exposes an audio-dock slot; menu placement uses measured viewport bounds, converts through the page CSS zoom, and releases its resize observer/listener on unmount. Only desktop may open the move submenu on hover: mobile bottom-anchored menus change position when expanded and must open on click to avoid moving a member accidentally. Constrain short-window menus and allow scrolling.
Voice diagnostics and screen-sharing presentation also reuse page-owned controllers. Bind the player and video with explicit element callbacks. Rebind an existing stream when its video element changes, clear the previous element, and never stop the media owner's tracks during presentation cleanup. Fullscreen requires a non-null owned player; removing it exits only its own fullscreen. Known screen owner IDs take precedence over nickname fallback, including duplicate nicknames. Sharing settings use the common dialog focus handling.
The audio dock and whisper strip share the page-owned audio controller. Push-to-talk belongs to one primary pointer or one Space/Enter press; unrelated releases and key repeats must not change it. Failed pointer capture must not enable whispering. Clear ownership before releasing capture, and stop on blur, hidden controls/pages and disposal. The whisper component owns and releases its window/document listeners; keep media state in the voice layer.
Audio settings and password dialogs retain one page-owned media/connection state. Dialog focus supports initial focus, Tab cycling, Escape and return to the opener, with a connect-button fallback after pending connections disable that opener. Settings error feedback belongs to the current opening and latest request; closing synchronously stops recording tests, and scope disposal retires pending feedback and stops tests too. A non-password channel error must release the password dialog's pending state and preserve its draft for retry; reject duplicate submissions while pending.
+26 -14
View File
@@ -1,18 +1,18 @@
# WebSpeak 代码待修改清单与修改方向
本文聚焦 `webspeak-webclient`,记录当前代码结构、待修改项、大致修改方向与验收条件。本批提取桌面音频工具栏与私语控制条,修复私语键盘不可用、指针归属不明及控件隐藏后未停止的问题;统一验证通过 403 项测试及前后端构建。待办分为结构整理、已有改动验收和真实环境验证;缺少验证证据的事项不直接认定为代码故障。
本文聚焦 `webspeak-webclient`,记录当前代码结构、待修改项、大致修改方向与验收条件。本批提取语音诊断、屏幕共享设置和播放器,修复视频元素替换后未绑定现有流、空播放器全屏误判及同昵称共享归属混淆;统一验证通过 409 项测试及前后端构建。待办分为结构整理、已有改动验收和真实环境验证;缺少验证证据的事项不直接认定为代码故障。
按用户要求,每批仅处理当前节点相关问题,合并相关修复后统一验证,不扩展到无关模块。管理页主要交互与布局已检查,原生确认框阻塞的操作验收单独保留。加入、聊天、频道成员、成员菜单、音频设置及密码弹窗已拆分;音频工具栏与私语控制条本批已提取,后续处理剩余语音活动、诊断与屏幕共享展示,样式格式整理单独进行。真实消息兼容、TeamSpeak 媒体、Android 真机及发布复现独立跟踪,可提前安排。媒体、连接、命令、诊断、消息、身份及公共皮肤状态已有独立模块,继续复用。当前待办和实施方向放在前部,历史修复及验证记录保留在后部。
按用户要求,每批仅处理当前节点相关问题,合并相关修复后统一验证,不扩展到无关模块。管理页主要交互与布局已检查,原生确认框阻塞的操作验收单独保留。加入、聊天、频道成员、成员菜单、音频设置及密码弹窗已拆分;音频工具栏、私语控制条、语音诊断、共享设置与播放器已提取,后续处理剩余语音活动成员卡片,样式格式整理单独进行。真实消息兼容、TeamSpeak 媒体、Android 真机及发布复现独立跟踪,可提前安排。媒体、连接、命令、诊断、消息、身份及公共皮肤状态已有独立模块,继续复用。当前待办和实施方向放在前部,历史修复及验证记录保留在后部。
## 范围与依据
- 记录日期:2026 年 10 月 1 日。
- 当前记录基线:`dev` 分支,`9bdd860dc73d5256ac31b7528ec50a5a08657eed`;应用版本 `0.2.5-preview`。以下现状包含当前工作区,不能全部归为该提交的内容。
- 本批仅处理 06-C 的桌面音频工具栏、私语控制条及按住讲话的输入生命周期。业务状态和媒体资源仍由父页及现有控制模块拥有;协议、媒体实现、数据库和依赖未变。
- 新增 5 项私语操作测试,覆盖非主按钮、指针归属、捕获失败、键盘重复与松开及作用域释放。相关修复合并后,`npm run verify` 通过 403 项测试、后端编译及前端类型检查和生产构建;随后简化展示属性接口,并补跑前端类型检查与构建。
- 当前记录基线:`dev` 分支,`8b1c76dc249b5356c037b3050414bb4401126abf`;应用版本 `0.2.5-preview`。以下现状包含当前工作区,不能全部归为该提交的内容。
- 本批仅处理 06-C 的语音诊断、共享设置、播放器展示及其元素绑定、全屏和成员匹配。采样、媒体流及传输仍由父页现有控制模块拥有;协议、数据库和依赖未变。
- 新增 6 项播放器与共享设置测试,覆盖视频替换、清理、不误退出其他全屏、同昵称归属及输出参数。首轮统一验证发现旧样式断言不接受 `:deep` 选择器;保留样式断言内容并兼容组件边界后,`npm run verify` 通过 409 项测试、后端编译及前端类型检查和生产构建。
- 既有皮肤修复记录记载新增 23 项测试,以及 `npm run verify` 通过 385 项测试和前后端构建;其中 5 项先复现旧结果覆盖及失效归属问题。这些是此前批次的验证结果,不是本轮重新执行的结果。
- 本批浏览器使用实际前端及 HTTP/WebSocket 桥接、模拟 TeamSpeak 客户端,覆盖音频快捷按钮、私语指针/键盘接线、隐藏与失焦停止。15 组语言/皮肤/尺寸抽样及 10 个桌面音量面板边界检查通过;模拟结果不能证明真实语音或伴奏传输可用。
- 上批 `9bdd860` 的 CI 与 Docker 健康检查已确认成功(运行 36851189830);本批工具栏改动需使用自己的提交核对远端结果。
- 本批使用实际前端及模拟 TeamSpeak 网关检查诊断与设置;30 组语言/皮肤/尺寸抽样通过。另用本地产生的画布媒体验证真实视频元素替换和全屏退出,不采集桌面;这些结果不能证明真实 TeamSpeak 屏幕共享或媒体互通。
- 上批 `8b1c76d` 的 CI 与 Docker 健康检查已确认成功(运行 36852437116);本批共享展示改动需使用自己的提交核对远端结果。
- 下文“代码可确认”指控制流或配置可直接支持的判断;具体故障发生条件仍需回归用例验证。“待验收”表示证据尚缺,不等于已发生故障。P1/P2/P3 表示建议实施顺序,不代表安全漏洞等级。
- 后文身份、消息、媒体、皮肤等“实施记录”属于此前批次;其中“本批”指各记录对应的历史批次。当前待办以本页前部状态表为准。
@@ -31,7 +31,7 @@
| 浏览器连接与命令 | `web/src/voice/connection.ts`、`commands.ts` | 连接模块 132 行,拥有请求取消、期限、socket 与代次;命令模块 59 行,拥有确认等待及统一收尾 |
| 浏览器诊断 | `web/src/voice/audio-diagnostics.ts`、`web/src/composables/useWebClientPerformance.ts` | 采样模块 168 行,拥有等待、来源范围与兼容计数;面板 composable 管理轮询和可比样本的展示 |
| 会话消息状态 | `web/src/voice/session-state.ts` | 172 行;拥有成员与频道、聊天历史、事件、通知、会话范围和私聊身份映射 |
| 页面与业务状态 | `web/src/views/`、`web/src/composables/` | 主页面 873 行,管理页 251 行;聊天 composable 管理按会话和对象隔离的草稿、发送等待及反馈 |
| 页面与业务状态 | `web/src/views/`、`web/src/composables/` | 主页面 797 行,管理页 251 行;聊天 composable 管理按会话和对象隔离的草稿、发送等待及反馈 |
| 管理展示组件 | `web/src/components/admin/` | 服务器设置 125 行、运维 39 行、皮肤 48 行;状态仍由父页创建,主要表单与路由交互已验收 |
| 身份导入与导出 | `useWebClientIdentity.ts`、`components/web-client/IdentityImportDialog.vue` | 159 行状态模块与 53 行展示组件;异步操作、启动恢复与导出资源独立归属 |
| 前端基础服务 | `web/src/services/`、`web/src/i18n/`、`web/src/skins/` | 请求、浏览器存储、身份导入、主题、皮肤及多语言;皮肤运行时的提交受取消和期限保护 |
@@ -49,7 +49,7 @@
| 编号 | 优先级 | 待办及依据 | 大致修改方向 | 完成条件 |
| --- | --- | --- | --- | --- |
| 06-C 客户端 | P2 | 加入、聊天、频道成员、成员菜单、设置及密码弹窗已提取;工具栏与私语控制条已提取,剩余语音活动、诊断与屏幕共享展示待整理,触屏拖动及原生输入框流程待验收 | 按区域提取,相关区域合并验收;页面保留连接和状态编排 | 表单、五语、主题、皮肤接口、键盘与窄屏布局保持一致 |
| 06-C 客户端 | P2 | 加入、聊天、频道成员、成员菜单、设置及密码弹窗已提取;工具栏、私语、诊断、共享设置与播放器已提取,剩余语音活动成员卡片待整理,触屏拖动及原生输入框流程待验收 | 按区域提取,相关区域合并验收;页面保留连接和状态编排 | 表单、五语、主题、皮肤接口、键盘与窄屏布局保持一致 |
| 06-C 管理页 | P2 | 展示拆分与主要交互已完成;移除皮肤时原生确认框使浏览器工具卡住,移除、断开会话及下载的完整浏览器流程仍缺记录 | 保留确认与业务逻辑,工具恢复或人工检查时补验,不为绕过工具问题重写功能 | 移除、断开与下载的实际结果有记录;状态及接口测试不能替代完整浏览器链路 |
| 03 | P2 | 共享契约已落地,真实收发与旧客户端兼容仍缺验收证据 | 用脱敏的实际消息样本核对字段、默认值、非法输入及兼容范围 | 两端解析一致;非法消息受控处理,不误丢有效事件 |
| 02-C | P2 | 本机与边界替身测试不能证明真实媒体链路 | 建立真实 TeamSpeak 双向语音、WebRTC 回退、伴奏和多用户验收步骤 | 记录版本、浏览器、网络、设备、步骤及实际结果 |
@@ -80,7 +80,7 @@
### 06-C 页面组件
当前依据:[WebClient.vue](<USER_HOME>/Desktop/othercode/teamspeakclient4web/webspeak-webclient/web/src/views/WebClient.vue:1) 有 873 行,加入表单、聊天面板、频道成员、成员菜单、身份导入、音频设置及密码弹窗已独立;父页仍承载语音活动、诊断和屏幕共享展示。[AdminView.vue](<USER_HOME>/Desktop/othercode/teamspeakclient4web/webspeak-webclient/web/src/views/AdminView.vue:41) 已由 400 行减至 251 行,三个管理模板迁移到独立组件。管理页剩余浏览器验收缺口见前表,客户端继续明确展示边界;不以文件长度推定运行故障。
当前依据:[WebClient.vue](<USER_HOME>/Desktop/othercode/teamspeakclient4web/webspeak-webclient/web/src/views/WebClient.vue:1) 有 797 行,加入表单、聊天面板、频道成员、成员菜单、身份导入、音频设置及密码弹窗已独立;父页仍承载语音活动成员卡片及页面编排。[AdminView.vue](<USER_HOME>/Desktop/othercode/teamspeakclient4web/webspeak-webclient/web/src/views/AdminView.vue:41) 已由 400 行减至 251 行,三个管理模板迁移到独立组件。管理页剩余浏览器验收缺口见前表,客户端继续明确展示边界;不以文件长度推定运行故障。
以下名称为建议,实施时按实际接口确定。按稳定区域迁移,相关展示区域合并后统一验收,避免同时重写模板和业务状态。
@@ -91,12 +91,13 @@
| 聊天,已提取 | `ChatPanel` 展示标签、历史、草稿和发送反馈 | 草稿与待确认状态继续由单一 `useWebClientChat` 实例管理;保留外部打开私聊的入口 | 切标签保留草稿、发送失败与重试、目标离线、滚动和移动端切页 |
| 设置与密码弹窗,已提取 | `AudioSettingsDialog`、`ChannelPasswordDialog`、`ServerPasswordDialog` 展示设置及连接反馈;身份导入此前已提取 | 复用父页单一媒体与连接状态;设置错误受打开代次和请求顺序保护;共享焦点工具管理循环、Esc 和返回 | 焦点、Esc、设置持久化、密码等待与重试已检查;真实设备切换与录音待媒体验收 |
| 音频工具栏与私语,已提取 | `AudioDock` 展示桌面快捷操作;`WhisperControls` 展示目标与按住讲话入口 | 使用父页单一音频控制器;私语按钮只拥有当前输入,隐藏、失焦和卸载时停止;监听随组件释放 | 静音、音量、设置入口、伴奏不可用提示、指针/键盘命令及布局已检查,真实媒体另行验收 |
| 剩余语音及共享展示 | 继续拆语音活动、诊断与屏幕共享展示 | 媒体仍由语音控制模块拥有,页面保留连接编排 | 活动、诊断与共享操作接线,播放器元素及全屏引用保持一致 |
| 诊断与共享展示,已提取 | `VoicePerformancePanel`、`ScreenShareSettingsDialog`、`ScreenSharePlayer` | 父页创建诊断与共享控制器;视频和播放器通过明确函数引用交回控制器,组件不创建采集或 PeerConnection | 兼容传输诊断、设置字段/焦点、合成视频元素替换与全屏已检查;真实 WebRTC/TeamSpeak 互通仍待验证 |
| 剩余语音活动 | 提取成员卡片及其共享操作入口 | 复用频道投影、成员动作和共享控制器,活动区域保留播放器及私语插槽 | 在线、发言、自身状态、空成员、共享/观看入口和移动菜单保持一致 |
| 管理功能页,已提交 | `AdminServerSettings`、`AdminOperations`、`AdminSkins` 已提取,先验收这三个边界 | 父页创建三个管理 composable,通过稳定 `model` 对象传入;登录、CSRF、路由与总览仍在页面;欢迎词语言用具名模型传递,WebRTC 提示用事件返回 | 保存期间继续编辑、请求失败保留草稿、欢迎词语言、退出失败、路由切换、皮肤文件选择及操作互斥 |
接口只传该区域需要的状态和动作,避免把整页上下文塞进一个对象,也避免父子各自实例化同一个业务 composable。管理组件当前使用 `ReturnType<typeof useAdmin...>` 描述功能控制器,并在 setup 中解构,因此依赖父页维持同一控制器实例;若后续支持替换实例,需要同步调整读取方式。可以用 `Pick` 或专用接口缩小暴露范围,但不为形式重写已明确的状态归属。展示辅助函数如头像、时间格式在确有多处复用时集中,不额外引入全局状态层。
样式需要随组件边界一并核对。[客户端样式入口](<USER_HOME>/Desktop/othercode/teamspeakclient4web/webspeak-webclient/web/src/views/WebClient.vue:873)和[管理页样式入口](<USER_HOME>/Desktop/othercode/teamspeakclient4web/webspeak-webclient/web/src/views/AdminView.vue:251)均使用 `scoped`,当前 CSS 分别为 1,303 与 451 行。身份弹窗已有针对组件的 `:deep` 规则;管理页当前改动将大量功能区选择器改为 `:deep`,并保留部分外壳和语言控件选择器的原作用范围。不要把这项源码变化直接等同于视觉一致:需对比子组件内部、共享按钮与语言菜单的字体、间距、尺寸、折行,以及样式声明顺序和优先级。必要时改为组件自有样式或更窄的区域选择器,保留明暗主题、`data-ws-part` 和路由隔离,管理页保持独立于公开皮肤。
样式需要随组件边界一并核对。[客户端样式入口](<USER_HOME>/Desktop/othercode/teamspeakclient4web/webspeak-webclient/web/src/views/WebClient.vue:797)和[管理页样式入口](<USER_HOME>/Desktop/othercode/teamspeakclient4web/webspeak-webclient/web/src/views/AdminView.vue:251)均使用 `scoped`,当前 CSS 分别为 1,303 与 451 行。身份弹窗已有针对组件的 `:deep` 规则;管理页当前改动将大量功能区选择器改为 `:deep`,并保留部分外壳和语言控件选择器的原作用范围。不要把这项源码变化直接等同于视觉一致:需对比子组件内部、共享按钮与语言菜单的字体、间距、尺寸、折行,以及样式声明顺序和优先级。必要时改为组件自有样式或更窄的区域选择器,保留明暗主题、`data-ws-part` 和路由隔离,管理页保持独立于公开皮肤。
测试也需跟随边界调整:[皮肤节点检查](<USER_HOME>/Desktop/othercode/teamspeakclient4web/webspeak-webclient/web/src/services/skin-pack.test.ts:80)在当前工作区已递归读取 `components/web-client` 和 `components/admin` 下的 Vue 文件,保留公开节点契约及管理页隔离检查。[管理页状态测试](<USER_HOME>/Desktop/othercode/teamspeakclient4web/webspeak-webclient/web/test/admin-view.test.mjs:79)已改为读取父页功能模型,仍用 `render: () => null` 替换模板,不能单独证明子组件的字段与事件接线正确。后续验收必须覆盖真实渲染的表单、按钮和路由交互;这属于测试覆盖边界,不能推定测试已发现业务故障。
@@ -104,7 +105,17 @@
每个区域验收包括桌面与窄屏、五语长文案、明暗主题和自定义皮肤;对比布局、滚动、弹层遮挡及键盘操作。编译通过和源码正则匹配不能替代实际渲染检查。
### 音频工具栏与私语控制的本批结果
### 诊断与屏幕共享展示的本批结果
- 三个展示组件使用父页单一控制器,诊断采样继续在原模块运行;共享设置沿用原输出参数和存储行为,补上 Tab 循环、Esc 关闭和返回入口焦点。播放器通过 `setVideoElement` 与 `setPlayerElement` 绑定真实 DOM,不把组件实例当成播放器。
- 原视频绑定仅监听流和音量,元素替换而流不变时会漏绑。现在同时监听视频元素,在渲染后绑定当前流与音量;旧元素立即清空 `srcObject`,卸载不停止其他模块拥有的媒体轨道。
- 原全屏判断在两个元素都为空时会为真。现在要求当前播放器存在;播放器移除或作用域释放仅退出自身拥有的全屏,失败时从真实文档状态重新同步。
- 有明确成员 ID 或 TeamSpeak peer ID 的共享流以该身份为准,不再因昵称相同匹配到另一成员;缺少身份的旧数据仍保留昵称兼容。
- 新增 6 项测试验证上述绑定、清理、全屏归属、同昵称匹配及 720p/30 FPS 输出参数。最终统一验证为 409 项测试及前后端构建通过。原有 4 条播放器皮肤样式断言保留颜色和层级要求,只兼容 `:deep` 写法。
- 实际应用中,诊断面板 37 个可见元素和共享设置 21 个可见元素的尺寸、字体、颜色、间距与拆分前一致。共享设置选择 720p/30 FPS 后关闭再打开仍保留;Tab 首尾循环、Esc 与返回入口焦点通过。诊断浏览器结果覆盖兼容传输分支,WebRTC peer 数据的真实链路仍归媒体验收。
- 共享设置与诊断分别在 zh/浅色、en/深色、de/ILLUSIA、ru/浅色、ja/深色五组配对下检查 1280×720、390×844、320×568,共 30 组;等待实际语言及皮肤生效后记录,弹层均在窗口内。
- 独立本地预览用画布生成 640×360 媒体:新播放器可继续播放现有流,旧视频已解绑、轨道仍存活;全屏状态可进入,退出播放器后全屏清除。这只是浏览器展示生命周期证据,不代表真实共享采集、信令或跨端媒体已验收。临时预览文件和进程在收尾时移除。
### 此前音频工具栏与私语控制的结果
- `AudioDock.vue` 通过稳定对象接收所需语音引用与动作,设置及输出静音用事件返回;`WhisperControls.vue` 复用同一控制器,清空目标仍交回成员模块。原有皮肤节点和样式声明顺序保留。
- 私语只接受主指针左键,记录捕获指针并忽略其他指针的松开;捕获失败不进入讲话状态。新增空格/回车按住支持,忽略重复按键与无关松开。停止先清除归属,再释放捕获,避免丢失捕获事件重复停止。
@@ -192,6 +203,7 @@ Android 记录具体设备和系统,验收连接、双向语音、输入输出
| 原事项或范围 | 当前状态 |
| --- | --- |
| 06-C 诊断与共享展示 | 三个组件已提取;修复视频重新绑定、全屏空值判断及同昵称归属,409 项测试与 30 组布局抽样通过,真实跨端共享验收保留 |
| 06-C 工具栏与私语 | 两个展示组件已提取,修复指针归属并支持键盘按住;隐藏、失焦及释放停止,403 项测试及浏览器接线/布局检查通过 |
| 06-C 设置与密码弹窗 | 三个展示组件已提取;修复迟到设置错误及频道密码普通错误后卡等待,新增 8 项回归;398 项测试与 45 组抽样布局检查通过,真实媒体验收另行保留 |
| 06-K 管理页导航 | 窄屏改为品牌与退出、四项导航两行布局;五语四路由四宽度共 80 组边界检查通过 |
@@ -206,7 +218,7 @@ Android 记录具体设备和系统,验收连接、双向语音、输入输出
| 04-E 至 04-J 浏览器媒体、连接与诊断 | 伴奏切换及取消、电平监测、命令等待、凭证取消和诊断来源隔离已有实现;此前验证结果保留于对应章节 |
| 05-A 服务端会话音频 | `SessionAudioTransport` 已接入 PCM、WebRTC 和 TeamSpeak 下行,统一路由、背压与统计 |
| 05-B、05-C WebRTC 关闭 | 已逐项容错释放资源,重复关闭共享完成 Promise,包括失败结果 |
| 02-B 测试入口遗漏 | WebRTC、诊断、身份、皮肤和存储回归均进入统一命令;当前 41 个列出的测试文件均存在 |
| 02-B 测试入口遗漏 | WebRTC、诊断、身份、皮肤和存储回归均进入统一命令;当前 42 个列出的测试文件均存在 |
| 05-D SDK 事件与目录 | `SessionEventCoordinator` 已提取;旧 SDK 来源、关闭等待、重连等待及踢出到达顺序已有实现和回归记录 |
| 成员头像 | 下载控制器与 SDK 异步阶段均绑定连接代次;批次、缓存、监听及迟到结果有生命周期限制 |
| 前端基础整理 | 共享消息契约、管理请求与三个状态模块、五语管理文案、头部组件及路由延迟加载已实现 |
+1 -1
View File
@@ -11,7 +11,7 @@
"scripts": {
"dev": "tsx src/index.ts",
"build": "tsc",
"test": "node --import tsx --test src/admin/skin-registry.test.ts web/test/admin-api.integration.test.ts web/test/admin-view.test.mjs web/src/services/admin-api.test.ts src/security/open-target-policy.test.ts src/server/visitor-count.test.ts src/server/voice-protocol.test.ts src/server/teamspeak-resolver.test.ts src/server/ts-client.test.ts src/server/join-ticket.test.ts src/server/identity-lease.test.ts src/server/session-manager.test.ts src/server/directory-sync.test.ts src/server/session-events.test.ts src/server/reconnect-policy.test.ts src/server/voice-commands.test.ts src/server/voice-bridge.test.ts src/server/session-audio.test.ts src/server/voice-bridge.integration.test.ts src/server/webrtc-audio.test.ts src/server/audio-stats.test.ts src/server/directory-view.test.ts src/server/member-avatars.test.ts src/server/screen-share-coordinator.test.ts src/shared/client-commands.test.ts src/shared/server-messages.test.ts src/shared/webrtc.test.ts scripts/docker-healthcheck.test.mjs web/test/voice-session.test.mjs web/test/audio-controls.test.mjs web/test/connection-dialogs.test.mjs web/test/voice-performance.test.mjs web/test/screen-share.test.ts web/test/android-gateway.test.ts web/src/services/skin-catalog.test.ts web/src/services/member-menu-placement.test.ts web/src/services/skin-pack.test.ts web/src/services/identity-import.test.ts web/test/identity-dialog.test.mjs web/test/skin-lifecycle.test.mjs web/src/services/local-persistence.test.ts",
"test": "node --import tsx --test src/admin/skin-registry.test.ts web/test/admin-api.integration.test.ts web/test/admin-view.test.mjs web/src/services/admin-api.test.ts src/security/open-target-policy.test.ts src/server/visitor-count.test.ts src/server/voice-protocol.test.ts src/server/teamspeak-resolver.test.ts src/server/ts-client.test.ts src/server/join-ticket.test.ts src/server/identity-lease.test.ts src/server/session-manager.test.ts src/server/directory-sync.test.ts src/server/session-events.test.ts src/server/reconnect-policy.test.ts src/server/voice-commands.test.ts src/server/voice-bridge.test.ts src/server/session-audio.test.ts src/server/voice-bridge.integration.test.ts src/server/webrtc-audio.test.ts src/server/audio-stats.test.ts src/server/directory-view.test.ts src/server/member-avatars.test.ts src/server/screen-share-coordinator.test.ts src/shared/client-commands.test.ts src/shared/server-messages.test.ts src/shared/webrtc.test.ts scripts/docker-healthcheck.test.mjs web/test/voice-session.test.mjs web/test/audio-controls.test.mjs web/test/connection-dialogs.test.mjs web/test/voice-performance.test.mjs web/test/screen-share.test.ts web/test/screen-share-ui.test.mjs web/test/android-gateway.test.ts web/src/services/skin-catalog.test.ts web/src/services/member-menu-placement.test.ts web/src/services/skin-pack.test.ts web/src/services/identity-import.test.ts web/test/identity-dialog.test.mjs web/test/skin-lifecycle.test.mjs web/src/services/local-persistence.test.ts",
"verify": "npm test && npm run build && npm run web:build",
"start": "node dist/index.js",
"web:dev": "cd web && npx vite --host",
@@ -0,0 +1,30 @@
<template>
<section :ref="setPlayerElement" class="screen-share-player" data-ws-part="voice.screen-player" role="region" :aria-label="t('screenShare')">
<div class="screen-share-player-stage" data-ws-part="voice.screen-player.stage">
<video v-if="screenShareRemoteStream" :ref="setScreenVideoElement" class="screen-share-player-video" data-ws-part="voice.screen-player.video" autoplay playsinline :muted="screenShareRemoteVolume === 0"></video>
<div v-else class="screen-share-player-placeholder" data-ws-part="voice.screen-player.placeholder"><span class="screen-share-player-placeholder-icon"><Icon name="monitor" :size="28" /></span><strong>{{ t('screenShareConnecting') }}</strong><span>{{ screenShareError ? screenShareErrorText : t('directP2POnly') }}</span></div>
<button type="button" class="screen-share-player-exit" data-ws-part="voice.screen-player.exit" :aria-label="t('screenShareExit')" :title="t('screenShareExit')" @click="leaveScreenShare"><Icon name="close" :size="22" /></button>
<div class="screen-share-player-viewers" data-ws-part="voice.screen-player.viewers" :aria-label="t('screenShareViewers')">
<span class="screen-share-player-viewer-label"><Icon name="users" :size="14" /> {{ screenSharePlayerViewerCount }}</span>
<span class="screen-share-player-viewer-avatars"><span v-for="viewer in screenSharePlayerViewers" :key="viewer.peerId" class="screen-share-player-viewer-avatar" data-ws-part="voice.screen-player.viewer-avatar" :style="screenShareViewerStyle(viewer)" :title="viewer.nickname">{{ viewer.avatar ? '' : avatarInitial(viewer.nickname) }}</span></span>
</div>
<span class="screen-share-player-live" data-ws-part="voice.screen-player.live"><i></i>{{ t('watchingScreenShare') }}</span>
<span class="screen-share-player-source" data-ws-part="voice.screen-player.source">{{ screenSharePlayerOwnerName }}</span>
<div class="screen-share-player-controls" data-ws-part="voice.screen-player.controls">
<label data-ws-part="voice.screen-player.volume" :title="t('screenShareVolume')"><Icon :name="screenShareRemoteVolume === 0 ? 'volume-off' : 'volume'" :size="18" /><input type="range" min="0" max="100" :value="screenShareRemoteVolume * 100" :aria-label="t('screenShareVolume')" @input="onScreenShareVolume" /></label>
<button type="button" data-ws-part="voice.screen-player.fullscreen" :aria-label="screenShareFullscreen ? t('screenShareExitFullscreen') : t('screenShareFullscreen')" :title="screenShareFullscreen ? t('screenShareExitFullscreen') : t('screenShareFullscreen')" @click="toggleScreenShareFullscreen"><Icon :name="screenShareFullscreen ? 'fullscreen-exit' : 'fullscreen'" :size="19" /></button>
</div>
</div>
</section>
</template>
<script setup lang="ts">
import Icon from "../Icon.vue";
import type { useWebClientScreenShare } from "../../composables/useWebClientScreenShare.js";
const props = defineProps<{
model: Pick<ReturnType<typeof useWebClientScreenShare>, "fullscreen" | "viewers" | "viewerCount" | "ownerName" | "errorText" | "setPlayerElement" | "setVideoElement" | "viewerStyle" | "setVolume" | "toggleFullscreen">;
screenShareRemoteStream: MediaStream | null; screenShareRemoteVolume: number; screenShareError: string;
leaveScreenShare: () => void; avatarInitial: (name: string) => string; t: (key: string) => string;
}>();
const { fullscreen: screenShareFullscreen, viewers: screenSharePlayerViewers, viewerCount: screenSharePlayerViewerCount, ownerName: screenSharePlayerOwnerName, errorText: screenShareErrorText, setPlayerElement, setVideoElement: setScreenVideoElement, viewerStyle: screenShareViewerStyle, setVolume: onScreenShareVolume, toggleFullscreen: toggleScreenShareFullscreen } = props.model;
</script>
@@ -0,0 +1,26 @@
<template>
<div class="modal-backdrop screen-share-settings-backdrop" @click.self="emit('close')">
<section ref="dialog" tabindex="-1" @keydown="onDialogKeydown" class="screen-share-settings-modal" data-ws-part="voice.screen-share-settings" role="dialog" aria-modal="true" aria-labelledby="screen-share-settings-title" @click.stop>
<button type="button" class="screen-share-settings-close" :aria-label="t('close')" :title="t('close')" @click="emit('close')"><Icon name="close" :size="17" /></button>
<div class="screen-share-settings-heading" data-ws-part="voice.screen-share-settings.heading"><span class="card-kicker">{{ t('screenShare') }}</span><h2 id="screen-share-settings-title">{{ t('screenShareSettings') }}</h2><p>{{ t('screenShareSettingsHint') }}</p></div>
<div class="screen-share-settings-fields" data-ws-part="voice.screen-share-settings.fields">
<label><span>{{ t('screenShareResolution') }}</span><select v-model="screenShareResolutionPreset" :aria-label="t('screenShareResolution')"><option v-for="option in screenShareResolutionOptions" :key="option.value" :value="option.value">{{ t(option.label) }}</option></select></label>
<label><span>{{ t('screenShareFrameRate') }}</span><select v-model.number="screenShareFrameRate" :aria-label="t('screenShareFrameRate')"><option v-for="fps in screenShareFrameRateOptions" :key="fps" :value="fps">{{ fps }} FPS</option></select></label>
</div>
<p class="screen-share-settings-note" data-ws-part="voice.screen-share-settings.note">{{ t('screenShareSettingsNote') }}</p>
<footer class="screen-share-settings-footer" data-ws-part="voice.screen-share-settings.actions"><button type="button" class="text-button" @click="emit('close')">{{ t('cancel') }}</button><button type="button" class="primary-button screen-share-settings-start" @click="startScreenShareWithSettings"><Icon name="monitor" :size="14" /> {{ t('startScreenShare') }}</button></footer>
</section>
</div>
</template>
<script setup lang="ts">
import { ref } from "vue";
import Icon from "../Icon.vue";
import { useDialogFocus } from "../../composables/useDialogFocus.js";
import type { useWebClientScreenShare } from "../../composables/useWebClientScreenShare.js";
const props = defineProps<{ model: Pick<ReturnType<typeof useWebClientScreenShare>, "resolutionOptions" | "frameRateOptions" | "resolutionPreset" | "frameRate" | "startWithSettings">; t: (key: string) => string }>();
const { resolutionOptions: screenShareResolutionOptions, frameRateOptions: screenShareFrameRateOptions, resolutionPreset: screenShareResolutionPreset, frameRate: screenShareFrameRate, startWithSettings: startScreenShareWithSettings } = props.model;
const emit = defineEmits<{ close: [] }>();
const dialog = ref<HTMLElement | null>(null);
const { onDialogKeydown } = useDialogFocus(dialog, () => emit("close"));
</script>
@@ -0,0 +1,45 @@
<template>
<div class="network-performance" data-ws-part="voice.performance">
<button type="button" class="performance-trigger" :title="t('voiceStatus')" :aria-label="t('voiceStatus')" :aria-expanded="performancePanelOpen" @click.stop="togglePerformancePanel"><Icon name="activity" :size="16" /><span class="performance-trigger-label">{{ t('voiceStatus') }}</span><small v-if="performanceStats.ready">{{ voiceTransportLabel }}</small><Icon name="chevron-down" :size="13" /></button>
<section v-if="performancePanelOpen" class="performance-panel" data-ws-part="voice.performance.panel" role="dialog" :aria-label="t('voiceStatus')" @click.stop>
<header><div><strong>{{ t('voiceStatus') }}</strong><small>{{ t('voiceStatusHint') }}</small></div><button type="button" class="performance-refresh" :title="t('measureNow')" :disabled="performanceRunning" @click="refreshPerformanceProbe"><Icon name="refresh" :size="15" /></button></header>
<div class="voice-status-summary" :data-health="performanceStats.health" data-ws-part="voice.performance.route"><i></i><div><strong>{{ voiceHealthLabel }}</strong><small>{{ voiceTransportLabel }}<template v-if="performanceStats.connectionState"> · {{ performanceStats.connectionState }}</template></small></div></div>
<div class="performance-metrics voice-audio-metrics" data-ws-part="voice.performance.metrics">
<article><small>{{ t('voiceUplink') }}</small><strong>{{ performanceStats.uplinkFramesPerSecond == null ? '—' : `${performanceStats.uplinkFramesPerSecond} ${t('audioFramesPerSecondUnit')}` }}</strong><span>{{ t('audioBitrate') }} {{ performanceStats.uplinkBitrateKbps == null ? '—' : `${performanceStats.uplinkBitrateKbps} kbps` }}</span><span v-if="performanceStats.transport === 'webrtc'">{{ t('voicePacketLoss') }} {{ performanceStats.uplinkLossPercent == null ? '—' : `${performanceStats.uplinkLossPercent.toFixed(2)}%` }} · {{ t('voiceRtt') }} {{ performanceStats.uplinkRttMs == null ? '—' : `${Math.round(performanceStats.uplinkRttMs)} ms` }}</span><span v-else>{{ t('voiceFallbackMetricHint') }}</span></article>
<article><small>{{ t('voiceDownlink') }}</small><strong>{{ performanceStats.downlinkFramesPerSecond == null ? '—' : `${performanceStats.downlinkFramesPerSecond} ${t('audioFramesPerSecondUnit')}` }}</strong><span>{{ t('audioBitrate') }} {{ performanceStats.downlinkBitrateKbps == null ? '—' : `${performanceStats.downlinkBitrateKbps} kbps` }}</span><span v-if="performanceStats.transport === 'webrtc'">{{ t('voicePacketLoss') }} {{ performanceStats.downlinkLossPercent == null ? '—' : `${performanceStats.downlinkLossPercent.toFixed(2)}%` }} · {{ t('voiceJitter') }} {{ performanceStats.downlinkJitterMs == null ? '—' : `${Math.round(performanceStats.downlinkJitterMs)} ms` }}</span><span v-else>{{ t('voiceFallbackMetricHint') }}</span></article>
</div>
<div class="voice-audio-details"><span>{{ t('microphone') }} · {{ voiceMicrophoneLabel }}</span><span>{{ t('voicePlayback') }} · {{ voicePlaybackLabel }}</span><span>{{ t('voiceSendErrors') }} {{ performanceStats.sendErrors == null ? '—' : performanceStats.sendErrors }} · {{ t('voiceDroppedFrames') }} {{ performanceStats.droppedFrames == null ? '—' : performanceStats.droppedFrames }}</span><span v-if="performanceStats.transport === 'webrtc'">{{ t('voiceQueueUnderruns') }} {{ performanceStats.queueUnderruns == null ? '—' : performanceStats.queueUnderruns }}</span></div>
<p class="performance-status" data-ws-part="voice.performance.status">{{ performanceRunning ? t('voiceStatusSampling') : performanceStats.ready ? t('voiceStatusLiveHint') : t('voiceStatusWaiting') }}</p>
<section v-if="screenShareWebRtcStats.peers.length" class="webrtc-stats" data-ws-part="voice.performance.webrtc-stats" aria-live="polite">
<header><div><strong>{{ t('webrtcStats') }}</strong><small>{{ t('webrtcStatsHint') }}</small></div></header>
<div v-if="screenShareWebRtcStats.capture" class="webrtc-stats-capture"><span>{{ t('screenShareCapture') }}</span><strong>{{ screenShareWebRtcStats.capture.width ?? '—' }} × {{ screenShareWebRtcStats.capture.height ?? '—' }}</strong><small>{{ screenShareWebRtcStats.capture.frameRate == null ? '—' : `${screenShareWebRtcStats.capture.frameRate.toFixed(1)} FPS` }}</small></div>
<div v-for="peer in screenShareWebRtcStats.peers" :key="peer.peerId" class="webrtc-stats-peer">
<div class="webrtc-stats-peer-heading"><strong>{{ peer.direction === 'outbound' ? t('screenShareSending') : t('screenShareReceiving') }}</strong><small>{{ peer.connectionState }} · {{ peer.candidateType ?? '—' }}</small></div>
<div class="webrtc-stats-values"><span>{{ peer.frameRate == null ? '—' : `${peer.frameRate.toFixed(1)} FPS` }}</span><span>{{ peer.bitrateKbps == null ? '—' : `${Math.round(peer.bitrateKbps)} kbps` }}</span><span>{{ peer.lossPercent == null ? '—' : `${peer.lossPercent.toFixed(2)}%` }} {{ t('packetLoss') }}</span><span>{{ peer.framesDropped == null ? '—' : peer.framesDropped }} {{ t('screenShareDroppedFrames') }}</span><span>{{ peer.jitterMs == null ? '—' : `${Math.round(peer.jitterMs)} ms` }} {{ t('screenShareJitter') }}</span><span>{{ peer.roundTripTimeMs == null ? '—' : `${Math.round(peer.roundTripTimeMs)} ms` }} {{ t('screenShareRtt') }}</span></div>
<small v-if="peer.codec || peer.qualityLimitationReason" class="webrtc-stats-detail">{{ peer.codec ?? '—' }}<template v-if="peer.qualityLimitationReason"> · {{ peer.qualityLimitationReason }}</template></small>
</div>
</section>
</section>
</div>
</template>
<script setup lang="ts">
import { computed } from "vue";
import Icon from "../Icon.vue";
import type { useWebClientPerformance } from "../../composables/useWebClientPerformance.js";
import type { ScreenShareWebRtcStats } from "../../composables/useVoiceWebSocket.js";
const props = defineProps<{ model: ReturnType<typeof useWebClientPerformance>; screenShareWebRtcStats: ScreenShareWebRtcStats; t: (key: string) => string }>();
const { panelOpen: performancePanelOpen, running: performanceRunning, stats: performanceStats, togglePanel: togglePerformancePanel, refresh: refreshPerformanceProbe } = props.model;
const t = props.t;
const voiceHealthLabel = computed(() => t(({ disconnected: "voiceHealthDisconnected", sampling: "voiceHealthSampling", connecting: "voiceHealthConnecting", warning: "voiceHealthWarning", active: "voiceHealthActive", quiet: "voiceHealthQuiet" } as const)[performanceStats.value.health]));
const voiceTransportLabel = computed(() => t(({ webrtc: "voiceTransportWebRTC", websocket: "voiceTransportWebSocket", negotiating: "voiceTransportNegotiating", disconnected: "voiceTransportDisconnected" } as const)[performanceStats.value.transport]));
const voicePlaybackLabel = computed(() => t(({ playing: "voicePlaybackReady", paused: "voicePlaybackPaused", unavailable: "voicePlaybackUnavailable" } as const)[performanceStats.value.playbackState ?? "unavailable"]));
const voiceMicrophoneLabel = computed(() => performanceStats.value.microphoneMuted
? t("voiceMicMuted")
: performanceStats.value.microphoneReady
? t("voiceMicOpen")
: performanceStats.value.microphonePermission === "denied" || performanceStats.value.microphonePermission === "granted"
? t("voiceMicUnavailable")
: t("voiceMicWaiting"));
</script>
+28 -16
View File
@@ -1,4 +1,4 @@
import { computed, nextTick, onMounted, onUnmounted, ref, watch, type Ref } from "vue";
import { computed, onMounted, onBeforeUnmount, ref, watch, type Ref } from "vue";
import type { ChannelMember, ScreenShareOutputSettings, ScreenShareStream } from "./useVoiceWebSocket.js";
export type ScreenShareResolutionPreset = "source" | "720p" | "1080p";
@@ -62,13 +62,23 @@ export function useWebClientScreenShare({
const errorText = computed(() => errorCode.value === "SCREEN_SHARE_NATIVE_BRIDGE_REQUIRED" ? t("screenShareNativeUnavailable") : error.value);
function setVideoElement(element: unknown): void {
if (videoElement.value && videoElement.value !== element) videoElement.value.srcObject = null;
videoElement.value = element instanceof HTMLVideoElement ? element : null;
}
function setPlayerElement(element: unknown): void {
const previous = playerElement.value;
if (previous && previous !== element && document.fullscreenElement === previous) {
void document.exitFullscreen().catch(() => undefined);
}
playerElement.value = element instanceof HTMLElement ? element : null;
syncFullscreen();
}
function streamForMember(member: ChannelMember): ScreenShareStream | null {
return streams.find((stream) => {
if (typeof stream.ownerClientId === "number" && stream.ownerClientId === member.id) return true;
if (stream.source === "teamspeak" && stream.ownerPeerId === `ts-${member.id}`) return true;
if (typeof stream.ownerClientId === "number") return stream.ownerClientId === member.id;
if (stream.source === "teamspeak" && /^ts-\d+$/.test(stream.ownerPeerId)) return stream.ownerPeerId === `ts-${member.id}`;
return stream.ownerNickname === member.nickname;
}) ?? null;
}
@@ -89,7 +99,7 @@ export function useWebClientScreenShare({
}
function syncFullscreen(): void {
fullscreen.value = document.fullscreenElement === playerElement.value;
fullscreen.value = Boolean(playerElement.value && document.fullscreenElement === playerElement.value);
}
async function toggleFullscreen(): Promise<void> {
@@ -99,7 +109,7 @@ export function useWebClientScreenShare({
if (document.fullscreenElement === player) await document.exitFullscreen();
else if (player.requestFullscreen) await player.requestFullscreen();
} catch {
fullscreen.value = false;
syncFullscreen();
}
}
@@ -115,21 +125,22 @@ export function useWebClientScreenShare({
await startScreenShare(true, settings);
}
watch([remoteStream, remoteVolume], ([stream, volume]) => {
void nextTick(() => {
const video = videoElement.value;
if (!video) return;
if (video.srcObject !== stream) video.srcObject = stream;
video.volume = Math.max(0, Math.min(1, volume ?? 1));
if (stream) void video.play().catch(() => undefined);
});
});
watch([videoElement, remoteStream, remoteVolume], ([video, stream, volume]) => {
if (!video) return;
if (video.srcObject !== stream) video.srcObject = stream;
video.volume = Math.max(0, Math.min(1, volume ?? 1));
if (stream) void video.play().catch(() => undefined);
}, { flush: "post", immediate: true });
watch(viewing, (isViewing) => {
if (!isViewing && document.fullscreenElement === playerElement.value) void document.exitFullscreen().catch(() => undefined);
if (!isViewing && playerElement.value && document.fullscreenElement === playerElement.value) void document.exitFullscreen().catch(() => undefined);
});
onMounted(() => document.addEventListener("fullscreenchange", syncFullscreen));
onUnmounted(() => document.removeEventListener("fullscreenchange", syncFullscreen));
onBeforeUnmount(() => {
document.removeEventListener("fullscreenchange", syncFullscreen);
setVideoElement(null);
setPlayerElement(null);
});
return {
videoElement,
@@ -146,6 +157,7 @@ export function useWebClientScreenShare({
ownerName,
errorText,
setVideoElement,
setPlayerElement,
streamForMember,
toggleForMember,
viewerStyle,
+4 -4
View File
@@ -196,10 +196,10 @@ test("the activity artwork layer floats above room content without intercepting
assert.match(css, /:deep\(\.app-shell \.member-panel::before\)\s*\{\s*content: "";\s*position: absolute;\s*z-index: 1;\s*left: -28px;\s*bottom: 18px;\s*width: min\(430px, calc\(100vw - 24px\)\);\s*aspect-ratio: 3 \/ 2;[^}]*perspective\(1100px\) rotateY\(-8deg\)/);
assert.match(css, /:deep\(\.app-shell \.chat-empty\[data-ws-state="messages-empty"\]\)\s*\{[^}]*min-height: 210px;\s*padding: 126px 12px 10px;/);
assert.match(css, /:deep\(\.app-shell \.chat-panel \.section-heading\),[\s\S]*?:deep\(\.app-shell \.chat-panel \.message-composer\)\s*\{\s*position: relative;\s*z-index: 3;/);
assert.match(css, /\.screen-share-player\s*\{[^}]*background: var\(--surface-1\)/);
assert.match(css, /\.screen-share-player-exit\s*\{[^}]*z-index: 3;/);
assert.match(css, /\.screen-share-player-stage\s*\{[^}]*var\(--accent\)[^}]*var\(--surface-2\)/);
assert.match(css, /\.screen-share-player-video\s*\{[^}]*background: var\(--surface-2\)/);
assert.match(css, /\.screen-share-player\)?\s*\{[^}]*background: var\(--surface-1\)/);
assert.match(css, /\.screen-share-player-exit\)?\s*\{[^}]*z-index: 3;/);
assert.match(css, /\.screen-share-player-stage\)?\s*\{[^}]*var\(--accent\)[^}]*var\(--surface-2\)/);
assert.match(css, /\.screen-share-player-video\)?\s*\{[^}]*background: var\(--surface-2\)/);
assert.match(css, /@media \(min-width: 741px\)\s*\{\s*\/\* Keep header menus above the independently stacked screen-share stage\. \*\/\s*\.app-shell \.workspace-header\s*\{\s*position: relative;\s*z-index: 40;/);
});
+99 -99
View File
@@ -752,55 +752,55 @@
.join-page :deep(.qq-button) { width: 28px; min-width: 28px; min-height: 28px; height: 28px; padding: 0; }
}
.network-performance { position: relative; z-index: 8; }
.performance-trigger { display: inline-flex; align-items: center; gap: 6px; min-height: 33px; padding: 0 9px; color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface-1)); border: 1px solid var(--border); border-radius: 8px; font-size: 11px; cursor: pointer; transition: .16s; }
.performance-trigger:hover, .performance-trigger[aria-expanded="true"] { background: color-mix(in srgb, var(--accent) 15%, var(--surface-1)); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.performance-trigger small { color: var(--text-muted); font-size: 10px; }
.performance-panel { position: absolute; top: calc(100% + 10px); right: 0; width: 380px; padding: 15px; color: var(--text-primary); background: var(--surface-1); border: 1px solid var(--border); border-radius: 13px; box-shadow: 0 16px 36px color-mix(in srgb, var(--text-primary) 18%, transparent); }
.performance-panel header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.performance-panel header strong, .performance-panel header small { display: block; }
.performance-panel header strong { font-size: 13px; }
.performance-panel header small { max-width: 255px; margin-top: 4px; color: var(--text-muted); font-size: 10px; line-height: 1.45; }
.performance-refresh { display: grid; place-items: center; width: 28px; height: 28px; flex: 0 0 28px; color: var(--accent); background: var(--surface-2); border: 1px solid var(--border); border-radius: 7px; cursor: pointer; }
.performance-refresh:disabled { cursor: wait; opacity: .55; }
:deep(.network-performance) { position: relative; z-index: 8; }
:deep(.performance-trigger) { display: inline-flex; align-items: center; gap: 6px; min-height: 33px; padding: 0 9px; color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface-1)); border: 1px solid var(--border); border-radius: 8px; font-size: 11px; cursor: pointer; transition: .16s; }
:deep(.performance-trigger:hover), :deep(.performance-trigger[aria-expanded="true"]) { background: color-mix(in srgb, var(--accent) 15%, var(--surface-1)); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
:deep(.performance-trigger small) { color: var(--text-muted); font-size: 10px; }
:deep(.performance-panel) { position: absolute; top: calc(100% + 10px); right: 0; width: 380px; padding: 15px; color: var(--text-primary); background: var(--surface-1); border: 1px solid var(--border); border-radius: 13px; box-shadow: 0 16px 36px color-mix(in srgb, var(--text-primary) 18%, transparent); }
:deep(.performance-panel header) { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
:deep(.performance-panel header strong), :deep(.performance-panel header small) { display: block; }
:deep(.performance-panel header strong) { font-size: 13px; }
:deep(.performance-panel header small) { max-width: 255px; margin-top: 4px; color: var(--text-muted); font-size: 10px; line-height: 1.45; }
:deep(.performance-refresh) { display: grid; place-items: center; width: 28px; height: 28px; flex: 0 0 28px; color: var(--accent); background: var(--surface-2); border: 1px solid var(--border); border-radius: 7px; cursor: pointer; }
:deep(.performance-refresh:disabled) { cursor: wait; opacity: .55; }
.performance-route { display: flex; align-items: center; gap: 6px; margin: 15px 0 11px; color: var(--text-muted); font-size: 9px; }
.performance-route span { padding: 4px 6px; background: var(--surface-2); border-radius: 5px; white-space: nowrap; }
.performance-route i { width: 18px; height: 1px; flex: 1; background: var(--accent); opacity: .55; }
.performance-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.performance-metrics article { min-width: 0; padding: 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; }
.performance-metrics small, .performance-metrics strong, .performance-metrics span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.performance-metrics small { color: var(--text-muted); font-size: 9px; }
.performance-metrics strong { margin-top: 6px; color: var(--accent); font-size: 18px; }
.performance-metrics span { margin-top: 4px; color: var(--text-muted); font-size: 9px; }
.performance-status { margin: 11px 0 0; color: var(--text-muted); font-size: 10px; }
.voice-status-summary { display: flex; align-items: center; gap: 9px; margin: 14px 0 10px; padding: 9px 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; }
.voice-status-summary > i { width: 9px; height: 9px; flex: 0 0 9px; background: var(--text-muted); border-radius: 50%; box-shadow: 0 0 0 3px color-mix(in srgb, var(--text-muted) 12%, transparent); }
.voice-status-summary[data-health="active"] > i { background: #22a777; box-shadow: 0 0 0 3px color-mix(in srgb, #22a777 16%, transparent); }
.voice-status-summary[data-health="warning"] > i { background: #dc8b24; box-shadow: 0 0 0 3px color-mix(in srgb, #dc8b24 16%, transparent); }
.voice-status-summary[data-health="connecting"], .voice-status-summary[data-health="sampling"] { opacity: .82; }
.voice-status-summary > div { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
.voice-status-summary strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.voice-status-summary small { overflow: hidden; color: var(--text-muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.voice-audio-metrics article { min-height: 104px; }
.voice-audio-metrics strong { font-size: 16px; }
.voice-audio-metrics span { white-space: normal; line-height: 1.45; }
.voice-audio-details { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; margin-top: 9px; color: var(--text-muted); font-size: 9px; line-height: 1.4; }
.voice-audio-details > span { min-width: 0; overflow-wrap: anywhere; }
.webrtc-stats { margin-top: 13px; padding-top: 12px; border-top: 1px solid var(--border); }
.webrtc-stats > header { display: block; margin-bottom: 8px; }
.webrtc-stats > header strong, .webrtc-stats > header small { display: block; }
.webrtc-stats > header strong { font-size: 11px; }
.webrtc-stats > header small { margin-top: 3px; color: var(--text-muted); font-size: 9px; }
.webrtc-stats-capture, .webrtc-stats-peer { padding: 8px 9px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; }
.webrtc-stats-capture { display: flex; align-items: baseline; gap: 7px; margin-bottom: 7px; }
.webrtc-stats-capture span, .webrtc-stats-capture small, .webrtc-stats-peer-heading small, .webrtc-stats-detail { color: var(--text-muted); font-size: 9px; }
.webrtc-stats-capture strong { margin-left: auto; color: var(--accent); font-size: 11px; }
.webrtc-stats-peer + .webrtc-stats-peer { margin-top: 7px; }
.webrtc-stats-peer-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.webrtc-stats-peer-heading strong { font-size: 10px; }
.webrtc-stats-peer-heading small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.webrtc-stats-values { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 8px; margin-top: 7px; color: var(--accent); font-size: 10px; font-variant-numeric: tabular-nums; }
.webrtc-stats-detail { display: block; margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
:deep(.performance-metrics) { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
:deep(.performance-metrics article) { min-width: 0; padding: 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; }
:deep(.performance-metrics small), :deep(.performance-metrics strong), :deep(.performance-metrics span) { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
:deep(.performance-metrics small) { color: var(--text-muted); font-size: 9px; }
:deep(.performance-metrics strong) { margin-top: 6px; color: var(--accent); font-size: 18px; }
:deep(.performance-metrics span) { margin-top: 4px; color: var(--text-muted); font-size: 9px; }
:deep(.performance-status) { margin: 11px 0 0; color: var(--text-muted); font-size: 10px; }
:deep(.voice-status-summary) { display: flex; align-items: center; gap: 9px; margin: 14px 0 10px; padding: 9px 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; }
:deep(.voice-status-summary > i) { width: 9px; height: 9px; flex: 0 0 9px; background: var(--text-muted); border-radius: 50%; box-shadow: 0 0 0 3px color-mix(in srgb, var(--text-muted) 12%, transparent); }
:deep(.voice-status-summary[data-health="active"] > i) { background: #22a777; box-shadow: 0 0 0 3px color-mix(in srgb, #22a777 16%, transparent); }
:deep(.voice-status-summary[data-health="warning"] > i) { background: #dc8b24; box-shadow: 0 0 0 3px color-mix(in srgb, #dc8b24 16%, transparent); }
:deep(.voice-status-summary[data-health="connecting"]), :deep(.voice-status-summary[data-health="sampling"]) { opacity: .82; }
:deep(.voice-status-summary > div) { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
:deep(.voice-status-summary strong) { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
:deep(.voice-status-summary small) { overflow: hidden; color: var(--text-muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
:deep(.voice-audio-metrics article) { min-height: 104px; }
:deep(.voice-audio-metrics strong) { font-size: 16px; }
:deep(.voice-audio-metrics span) { white-space: normal; line-height: 1.45; }
:deep(.voice-audio-details) { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; margin-top: 9px; color: var(--text-muted); font-size: 9px; line-height: 1.4; }
:deep(.voice-audio-details > span) { min-width: 0; overflow-wrap: anywhere; }
:deep(.webrtc-stats) { margin-top: 13px; padding-top: 12px; border-top: 1px solid var(--border); }
:deep(.webrtc-stats > header) { display: block; margin-bottom: 8px; }
:deep(.webrtc-stats > header strong), :deep(.webrtc-stats > header small) { display: block; }
:deep(.webrtc-stats > header strong) { font-size: 11px; }
:deep(.webrtc-stats > header small) { margin-top: 3px; color: var(--text-muted); font-size: 9px; }
:deep(.webrtc-stats-capture), :deep(.webrtc-stats-peer) { padding: 8px 9px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; }
:deep(.webrtc-stats-capture) { display: flex; align-items: baseline; gap: 7px; margin-bottom: 7px; }
:deep(.webrtc-stats-capture span), :deep(.webrtc-stats-capture small), :deep(.webrtc-stats-peer-heading small), :deep(.webrtc-stats-detail) { color: var(--text-muted); font-size: 9px; }
:deep(.webrtc-stats-capture strong) { margin-left: auto; color: var(--accent); font-size: 11px; }
:deep(.webrtc-stats-peer + .webrtc-stats-peer) { margin-top: 7px; }
:deep(.webrtc-stats-peer-heading) { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
:deep(.webrtc-stats-peer-heading strong) { font-size: 10px; }
:deep(.webrtc-stats-peer-heading small) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
:deep(.webrtc-stats-values) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 8px; margin-top: 7px; color: var(--accent); font-size: 10px; font-variant-numeric: tabular-nums; }
:deep(.webrtc-stats-detail) { display: block; margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Latin-script translations need a little more room than Chinese copy. Keep
the Chinese layout unchanged and use a compact type scale for English and
@@ -871,14 +871,14 @@
}
@media (max-width: 740px) {
.performance-trigger { width: 36px; height: 36px; min-height: 36px; justify-content: center; padding: 0; }
.performance-trigger-label, .performance-trigger small, .performance-trigger > .ui-icon:last-child { display: none; }
.performance-panel { position: fixed; top: calc(60px + env(safe-area-inset-top, 0px)); right: 10px; width: min(340px, calc(100vw - 20px)); }
:deep(.performance-trigger) { width: 36px; height: 36px; min-height: 36px; justify-content: center; padding: 0; }
:deep(.performance-trigger-label), :deep(.performance-trigger small), :deep(.performance-trigger > .ui-icon:last-child) { display: none; }
:deep(.performance-panel) { position: fixed; top: calc(60px + env(safe-area-inset-top, 0px)); right: 10px; width: min(340px, calc(100vw - 20px)); }
}
@media (max-width: 390px) {
.performance-trigger { width: 32px; height: 32px; flex-basis: 32px; }
.performance-panel { right: 8px; width: min(330px, calc(100vw - 16px)); padding: 13px; }
:deep(.performance-trigger) { width: 32px; height: 32px; flex-basis: 32px; }
:deep(.performance-panel) { right: 8px; width: min(330px, calc(100vw - 16px)); padding: 13px; }
.performance-route { gap: 3px; }
.performance-route span { padding-inline: 4px; font-size: 8px; }
}
@@ -974,58 +974,58 @@
.screen-share-card-button.viewing { color: #fff; border-color: var(--accent); background: var(--accent); }
.screen-share-settings-button { display: grid; place-items: center; width: 25px; min-width: 25px; min-height: 25px; padding: 0; color: var(--text-muted); border: 1px solid var(--border); border-radius: 50%; background: var(--surface-1); cursor: pointer; }
.screen-share-settings-button:hover, .screen-share-settings-button[aria-expanded="true"] { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); background: color-mix(in srgb, var(--accent) 9%, var(--surface-1)); }
.screen-share-settings-backdrop { z-index: 25; align-items: center; padding: 16px; }
.screen-share-settings-modal { position: relative; width: min(360px, 100%); padding: 22px; color: var(--text-primary); border: 1px solid var(--border); border-radius: 16px; background: var(--surface-1); box-shadow: 0 20px 60px color-mix(in srgb, var(--text-primary) 20%, transparent); }
.screen-share-settings-close { position: absolute; top: 12px; right: 12px; display: grid; place-items: center; width: 30px; height: 30px; padding: 0; color: var(--text-muted); border: 1px solid var(--border); border-radius: 50%; background: var(--surface-2); cursor: pointer; }
.screen-share-settings-close:hover { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.screen-share-settings-heading { padding-right: 35px; }
.screen-share-settings-heading h2 { margin: 5px 0 4px; color: var(--text-primary); font-size: 20px; letter-spacing: -.04em; }
.screen-share-settings-heading p { margin: 0; color: var(--text-muted); font-size: 10px; line-height: 1.45; }
.screen-share-settings-fields { display: grid; gap: 13px; margin-top: 22px; }
.screen-share-settings-fields label { display: grid; gap: 6px; min-width: 0; color: var(--text-muted); font-size: 10px; }
.screen-share-settings-fields label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.screen-share-settings-fields select { display: block; width: 100%; min-width: 0; max-width: 100%; min-height: 37px; padding: 0 9px; overflow: hidden; color: var(--text-primary); border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); font: inherit; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.screen-share-settings-fields select:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 48%, transparent); outline-offset: 1px; }
.screen-share-settings-note { margin: 15px 0 0; color: var(--text-muted); font-size: 9px; line-height: 1.45; }
.screen-share-settings-footer { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 20px; padding-top: 15px; border-top: 1px solid var(--border); }
.screen-share-settings-start { min-height: 35px; padding: 0 12px; font-size: 10px; }
.screen-share-player { position: relative; margin-top: 17px; overflow: hidden; color: var(--text-primary); border: 1px solid var(--border); border-radius: 18px; background: var(--surface-1); box-shadow: 0 12px 30px color-mix(in srgb, var(--text-primary) 18%, transparent); }
.screen-share-player-stage { position: relative; display: grid; width: 100%; min-height: 245px; aspect-ratio: 16 / 9; place-items: center; overflow: hidden; background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--accent) 12%, var(--surface-1)), var(--surface-2) 74%); }
.screen-share-player-video { display: block; width: 100%; height: 100%; object-fit: contain; background: var(--surface-2); }
.screen-share-player-placeholder { display: flex; align-items: center; flex-direction: column; gap: 10px; max-width: 360px; padding: 30px; color: var(--text-muted); text-align: center; }
.screen-share-player-placeholder-icon { display: grid; place-items: center; width: 58px; height: 58px; color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 36%, transparent); border-radius: 18px; background: color-mix(in srgb, var(--accent) 12%, transparent); }
.screen-share-player-placeholder strong { color: var(--text-primary); font-size: 15px; }
.screen-share-player-placeholder > span:last-child { color: var(--text-muted); font-size: 10px; line-height: 1.5; }
.screen-share-player-exit, .screen-share-player-controls button { display: grid; place-items: center; width: 38px; height: 38px; padding: 0; color: var(--text-primary); border: 1px solid color-mix(in srgb, var(--border) 78%, transparent); border-radius: 50%; background: color-mix(in srgb, var(--surface-1) 88%, transparent); box-shadow: 0 5px 16px color-mix(in srgb, var(--text-primary) 14%, transparent); backdrop-filter: blur(8px); cursor: pointer; }
.screen-share-player-exit { position: absolute; top: 15px; left: 15px; z-index: 3; }
.screen-share-player-exit:hover, .screen-share-player-controls button:hover { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); background: color-mix(in srgb, var(--accent) 12%, var(--surface-1)); }
.screen-share-player-viewers { position: absolute; top: 15px; right: 15px; z-index: 3; display: flex; align-items: center; gap: 8px; min-height: 38px; padding: 5px 8px 5px 11px; color: var(--text-primary); border: 1px solid color-mix(in srgb, var(--border) 78%, transparent); border-radius: 999px; background: color-mix(in srgb, var(--surface-1) 88%, transparent); box-shadow: 0 5px 16px color-mix(in srgb, var(--text-primary) 14%, transparent); backdrop-filter: blur(8px); }
.screen-share-player-viewer-label { display: inline-flex; align-items: center; gap: 5px; color: inherit; font-size: 10px; font-weight: 700; white-space: nowrap; }
.screen-share-player-viewer-avatars { display: inline-flex; align-items: center; padding-left: 4px; }
.screen-share-player-viewer-avatar { display: grid; place-items: center; width: 25px; height: 25px; margin-left: -4px; color: #fff; border: 2px solid var(--surface-1); border-radius: 50%; font-size: 9px; font-weight: 800; box-shadow: 0 2px 7px color-mix(in srgb, var(--text-primary) 22%, transparent); }
.screen-share-player-live { position: absolute; top: 22px; left: 64px; z-index: 3; display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px; color: var(--text-primary); border: 1px solid color-mix(in srgb, var(--border) 78%, transparent); border-radius: 999px; background: color-mix(in srgb, var(--surface-1) 88%, transparent); box-shadow: 0 5px 16px color-mix(in srgb, var(--text-primary) 14%, transparent); backdrop-filter: blur(8px); font-size: 11px; font-weight: 800; }
.screen-share-player-live i { width: 7px; height: 7px; border-radius: 50%; background: #65e48b; box-shadow: 0 0 0 4px rgba(101,228,139,.18); animation: screen-share-live-dot 1.2s ease-in-out infinite; }
.screen-share-player-source { position: absolute; bottom: 18px; left: 18px; z-index: 3; max-width: 45%; overflow: hidden; padding: 7px 10px; color: var(--text-primary); border: 1px solid color-mix(in srgb, var(--border) 78%, transparent); border-radius: 999px; background: color-mix(in srgb, var(--surface-1) 88%, transparent); box-shadow: 0 5px 16px color-mix(in srgb, var(--text-primary) 14%, transparent); backdrop-filter: blur(8px); font-size: 12px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.screen-share-player-controls { position: absolute; right: 15px; bottom: 15px; z-index: 3; display: flex; align-items: center; gap: 9px; }
.screen-share-player-controls label { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 11px; color: var(--text-primary); border: 1px solid color-mix(in srgb, var(--border) 78%, transparent); border-radius: 999px; background: color-mix(in srgb, var(--surface-1) 88%, transparent); box-shadow: 0 5px 16px color-mix(in srgb, var(--text-primary) 14%, transparent); backdrop-filter: blur(8px); }
.screen-share-player-controls input { width: 102px; height: 4px; accent-color: #69d2c7; cursor: pointer; }
.screen-share-player:fullscreen { width: 100vw; height: 100vh; border: 0; border-radius: 0; background: var(--surface-0); }
.screen-share-player:fullscreen .screen-share-player-stage { height: 100%; max-height: none; aspect-ratio: auto; }
.screen-share-player::backdrop { background: var(--surface-0); }
:deep(.screen-share-settings-backdrop) { z-index: 25; align-items: center; padding: 16px; }
:deep(.screen-share-settings-modal) { position: relative; width: min(360px, 100%); padding: 22px; color: var(--text-primary); border: 1px solid var(--border); border-radius: 16px; background: var(--surface-1); box-shadow: 0 20px 60px color-mix(in srgb, var(--text-primary) 20%, transparent); }
:deep(.screen-share-settings-close) { position: absolute; top: 12px; right: 12px; display: grid; place-items: center; width: 30px; height: 30px; padding: 0; color: var(--text-muted); border: 1px solid var(--border); border-radius: 50%; background: var(--surface-2); cursor: pointer; }
:deep(.screen-share-settings-close:hover) { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
:deep(.screen-share-settings-heading) { padding-right: 35px; }
:deep(.screen-share-settings-heading h2) { margin: 5px 0 4px; color: var(--text-primary); font-size: 20px; letter-spacing: -.04em; }
:deep(.screen-share-settings-heading p) { margin: 0; color: var(--text-muted); font-size: 10px; line-height: 1.45; }
:deep(.screen-share-settings-fields) { display: grid; gap: 13px; margin-top: 22px; }
:deep(.screen-share-settings-fields label) { display: grid; gap: 6px; min-width: 0; color: var(--text-muted); font-size: 10px; }
:deep(.screen-share-settings-fields label span) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
:deep(.screen-share-settings-fields select) { display: block; width: 100%; min-width: 0; max-width: 100%; min-height: 37px; padding: 0 9px; overflow: hidden; color: var(--text-primary); border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); font: inherit; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
:deep(.screen-share-settings-fields select:focus-visible) { outline: 2px solid color-mix(in srgb, var(--accent) 48%, transparent); outline-offset: 1px; }
:deep(.screen-share-settings-note) { margin: 15px 0 0; color: var(--text-muted); font-size: 9px; line-height: 1.45; }
:deep(.screen-share-settings-footer) { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 20px; padding-top: 15px; border-top: 1px solid var(--border); }
:deep(.screen-share-settings-start) { min-height: 35px; padding: 0 12px; font-size: 10px; }
:deep(.screen-share-player) { position: relative; margin-top: 17px; overflow: hidden; color: var(--text-primary); border: 1px solid var(--border); border-radius: 18px; background: var(--surface-1); box-shadow: 0 12px 30px color-mix(in srgb, var(--text-primary) 18%, transparent); }
:deep(.screen-share-player-stage) { position: relative; display: grid; width: 100%; min-height: 245px; aspect-ratio: 16 / 9; place-items: center; overflow: hidden; background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--accent) 12%, var(--surface-1)), var(--surface-2) 74%); }
:deep(.screen-share-player-video) { display: block; width: 100%; height: 100%; object-fit: contain; background: var(--surface-2); }
:deep(.screen-share-player-placeholder) { display: flex; align-items: center; flex-direction: column; gap: 10px; max-width: 360px; padding: 30px; color: var(--text-muted); text-align: center; }
:deep(.screen-share-player-placeholder-icon) { display: grid; place-items: center; width: 58px; height: 58px; color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 36%, transparent); border-radius: 18px; background: color-mix(in srgb, var(--accent) 12%, transparent); }
:deep(.screen-share-player-placeholder strong) { color: var(--text-primary); font-size: 15px; }
:deep(.screen-share-player-placeholder > span:last-child) { color: var(--text-muted); font-size: 10px; line-height: 1.5; }
:deep(.screen-share-player-exit), :deep(.screen-share-player-controls button) { display: grid; place-items: center; width: 38px; height: 38px; padding: 0; color: var(--text-primary); border: 1px solid color-mix(in srgb, var(--border) 78%, transparent); border-radius: 50%; background: color-mix(in srgb, var(--surface-1) 88%, transparent); box-shadow: 0 5px 16px color-mix(in srgb, var(--text-primary) 14%, transparent); backdrop-filter: blur(8px); cursor: pointer; }
:deep(.screen-share-player-exit) { position: absolute; top: 15px; left: 15px; z-index: 3; }
:deep(.screen-share-player-exit:hover), :deep(.screen-share-player-controls button:hover) { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); background: color-mix(in srgb, var(--accent) 12%, var(--surface-1)); }
:deep(.screen-share-player-viewers) { position: absolute; top: 15px; right: 15px; z-index: 3; display: flex; align-items: center; gap: 8px; min-height: 38px; padding: 5px 8px 5px 11px; color: var(--text-primary); border: 1px solid color-mix(in srgb, var(--border) 78%, transparent); border-radius: 999px; background: color-mix(in srgb, var(--surface-1) 88%, transparent); box-shadow: 0 5px 16px color-mix(in srgb, var(--text-primary) 14%, transparent); backdrop-filter: blur(8px); }
:deep(.screen-share-player-viewer-label) { display: inline-flex; align-items: center; gap: 5px; color: inherit; font-size: 10px; font-weight: 700; white-space: nowrap; }
:deep(.screen-share-player-viewer-avatars) { display: inline-flex; align-items: center; padding-left: 4px; }
:deep(.screen-share-player-viewer-avatar) { display: grid; place-items: center; width: 25px; height: 25px; margin-left: -4px; color: #fff; border: 2px solid var(--surface-1); border-radius: 50%; font-size: 9px; font-weight: 800; box-shadow: 0 2px 7px color-mix(in srgb, var(--text-primary) 22%, transparent); }
:deep(.screen-share-player-live) { position: absolute; top: 22px; left: 64px; z-index: 3; display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px; color: var(--text-primary); border: 1px solid color-mix(in srgb, var(--border) 78%, transparent); border-radius: 999px; background: color-mix(in srgb, var(--surface-1) 88%, transparent); box-shadow: 0 5px 16px color-mix(in srgb, var(--text-primary) 14%, transparent); backdrop-filter: blur(8px); font-size: 11px; font-weight: 800; }
:deep(.screen-share-player-live i) { width: 7px; height: 7px; border-radius: 50%; background: #65e48b; box-shadow: 0 0 0 4px rgba(101,228,139,.18); animation: screen-share-live-dot 1.2s ease-in-out infinite; }
:deep(.screen-share-player-source) { position: absolute; bottom: 18px; left: 18px; z-index: 3; max-width: 45%; overflow: hidden; padding: 7px 10px; color: var(--text-primary); border: 1px solid color-mix(in srgb, var(--border) 78%, transparent); border-radius: 999px; background: color-mix(in srgb, var(--surface-1) 88%, transparent); box-shadow: 0 5px 16px color-mix(in srgb, var(--text-primary) 14%, transparent); backdrop-filter: blur(8px); font-size: 12px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
:deep(.screen-share-player-controls) { position: absolute; right: 15px; bottom: 15px; z-index: 3; display: flex; align-items: center; gap: 9px; }
:deep(.screen-share-player-controls label) { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 11px; color: var(--text-primary); border: 1px solid color-mix(in srgb, var(--border) 78%, transparent); border-radius: 999px; background: color-mix(in srgb, var(--surface-1) 88%, transparent); box-shadow: 0 5px 16px color-mix(in srgb, var(--text-primary) 14%, transparent); backdrop-filter: blur(8px); }
:deep(.screen-share-player-controls input) { width: 102px; height: 4px; accent-color: #69d2c7; cursor: pointer; }
:deep(.screen-share-player:fullscreen) { width: 100vw; height: 100vh; border: 0; border-radius: 0; background: var(--surface-0); }
:deep(.screen-share-player:fullscreen .screen-share-player-stage) { height: 100%; max-height: none; aspect-ratio: auto; }
:deep(.screen-share-player::backdrop) { background: var(--surface-0); }
@keyframes screen-share-wave { 0% { transform: scaleY(.45); opacity: .5; } 100% { transform: scaleY(1); opacity: 1; } }
@keyframes screen-share-live-dot { 0%, 100% { opacity: .55; transform: scale(.86); } 50% { opacity: 1; transform: scale(1); } }
@media (max-width: 740px) {
.screen-share-live-indicator { top: -14px; font-size: 7px; }
.screen-share-card-button { font-size: 8px; }
.screen-share-player { margin-top: 14px; border-radius: 14px; }
.screen-share-player-stage { min-height: 210px; }
.screen-share-player-viewers { top: 10px; right: 10px; }
.screen-share-player-live { top: 19px; left: 57px; }
.screen-share-player-source { bottom: 12px; left: 12px; max-width: 40%; }
.screen-share-player-controls { right: 10px; bottom: 10px; gap: 6px; }
.screen-share-player-controls label { padding-inline: 9px; }
.screen-share-player-controls input { width: 70px; }
.screen-share-player-exit { top: 10px; left: 10px; }
:deep(.screen-share-player) { margin-top: 14px; border-radius: 14px; }
:deep(.screen-share-player-stage) { min-height: 210px; }
:deep(.screen-share-player-viewers) { top: 10px; right: 10px; }
:deep(.screen-share-player-live) { top: 19px; left: 57px; }
:deep(.screen-share-player-source) { bottom: 12px; left: 12px; max-width: 40%; }
:deep(.screen-share-player-controls) { right: 10px; bottom: 10px; gap: 6px; }
:deep(.screen-share-player-controls label) { padding-inline: 9px; }
:deep(.screen-share-player-controls input) { width: 70px; }
:deep(.screen-share-player-exit) { top: 10px; left: 10px; }
}
/* The footer artwork belongs to the viewport, while its copy stays aligned
@@ -1037,7 +1037,7 @@
/* Keep the performance popover out of the activity area on tablet layouts. */
@media (min-width: 741px) and (max-width: 1200px) {
.app-shell .performance-panel {
:deep(.app-shell .performance-panel) {
position: fixed;
top: 82px;
right: 16px;
+12 -88
View File
@@ -91,28 +91,7 @@
<header class="workspace-header" data-ws-part="voice.header">
<div class="breadcrumbs" data-ws-part="voice.breadcrumbs"><span class="mobile-brand">TeamSpeak <em>Web</em></span><span class="crumb-muted">{{ t('serverBreadcrumb') }}</span><Icon name="chevron-right" :size="14" /><strong>{{ currentChannelName }}</strong></div>
<div class="workspace-actions" data-ws-part="voice.header-actions">
<div class="network-performance" data-ws-part="voice.performance">
<button type="button" class="performance-trigger" :title="t('voiceStatus')" :aria-label="t('voiceStatus')" :aria-expanded="performancePanelOpen" @click.stop="togglePerformancePanel"><Icon name="activity" :size="16" /><span class="performance-trigger-label">{{ t('voiceStatus') }}</span><small v-if="performanceStats.ready">{{ voiceTransportLabel }}</small><Icon name="chevron-down" :size="13" /></button>
<section v-if="performancePanelOpen" class="performance-panel" data-ws-part="voice.performance.panel" role="dialog" :aria-label="t('voiceStatus')" @click.stop>
<header><div><strong>{{ t('voiceStatus') }}</strong><small>{{ t('voiceStatusHint') }}</small></div><button type="button" class="performance-refresh" :title="t('measureNow')" :disabled="performanceRunning" @click="refreshPerformanceProbe"><Icon name="refresh" :size="15" /></button></header>
<div class="voice-status-summary" :data-health="performanceStats.health" data-ws-part="voice.performance.route"><i></i><div><strong>{{ voiceHealthLabel }}</strong><small>{{ voiceTransportLabel }}<template v-if="performanceStats.connectionState"> · {{ performanceStats.connectionState }}</template></small></div></div>
<div class="performance-metrics voice-audio-metrics" data-ws-part="voice.performance.metrics">
<article><small>{{ t('voiceUplink') }}</small><strong>{{ performanceStats.uplinkFramesPerSecond == null ? '—' : `${performanceStats.uplinkFramesPerSecond} ${t('audioFramesPerSecondUnit')}` }}</strong><span>{{ t('audioBitrate') }} {{ performanceStats.uplinkBitrateKbps == null ? '—' : `${performanceStats.uplinkBitrateKbps} kbps` }}</span><span v-if="performanceStats.transport === 'webrtc'">{{ t('voicePacketLoss') }} {{ performanceStats.uplinkLossPercent == null ? '—' : `${performanceStats.uplinkLossPercent.toFixed(2)}%` }} · {{ t('voiceRtt') }} {{ performanceStats.uplinkRttMs == null ? '—' : `${Math.round(performanceStats.uplinkRttMs)} ms` }}</span><span v-else>{{ t('voiceFallbackMetricHint') }}</span></article>
<article><small>{{ t('voiceDownlink') }}</small><strong>{{ performanceStats.downlinkFramesPerSecond == null ? '—' : `${performanceStats.downlinkFramesPerSecond} ${t('audioFramesPerSecondUnit')}` }}</strong><span>{{ t('audioBitrate') }} {{ performanceStats.downlinkBitrateKbps == null ? '—' : `${performanceStats.downlinkBitrateKbps} kbps` }}</span><span v-if="performanceStats.transport === 'webrtc'">{{ t('voicePacketLoss') }} {{ performanceStats.downlinkLossPercent == null ? '—' : `${performanceStats.downlinkLossPercent.toFixed(2)}%` }} · {{ t('voiceJitter') }} {{ performanceStats.downlinkJitterMs == null ? '—' : `${Math.round(performanceStats.downlinkJitterMs)} ms` }}</span><span v-else>{{ t('voiceFallbackMetricHint') }}</span></article>
</div>
<div class="voice-audio-details"><span>{{ t('microphone') }} · {{ voiceMicrophoneLabel }}</span><span>{{ t('voicePlayback') }} · {{ voicePlaybackLabel }}</span><span>{{ t('voiceSendErrors') }} {{ performanceStats.sendErrors == null ? '—' : performanceStats.sendErrors }} · {{ t('voiceDroppedFrames') }} {{ performanceStats.droppedFrames == null ? '—' : performanceStats.droppedFrames }}</span><span v-if="performanceStats.transport === 'webrtc'">{{ t('voiceQueueUnderruns') }} {{ performanceStats.queueUnderruns == null ? '—' : performanceStats.queueUnderruns }}</span></div>
<p class="performance-status" data-ws-part="voice.performance.status">{{ performanceRunning ? t('voiceStatusSampling') : performanceStats.ready ? t('voiceStatusLiveHint') : t('voiceStatusWaiting') }}</p>
<section v-if="screenShareWebRtcStats.peers.length" class="webrtc-stats" data-ws-part="voice.performance.webrtc-stats" aria-live="polite">
<header><div><strong>{{ t('webrtcStats') }}</strong><small>{{ t('webrtcStatsHint') }}</small></div></header>
<div v-if="screenShareWebRtcStats.capture" class="webrtc-stats-capture"><span>{{ t('screenShareCapture') }}</span><strong>{{ screenShareWebRtcStats.capture.width ?? '—' }} × {{ screenShareWebRtcStats.capture.height ?? '—' }}</strong><small>{{ screenShareWebRtcStats.capture.frameRate == null ? '—' : `${screenShareWebRtcStats.capture.frameRate.toFixed(1)} FPS` }}</small></div>
<div v-for="peer in screenShareWebRtcStats.peers" :key="peer.peerId" class="webrtc-stats-peer">
<div class="webrtc-stats-peer-heading"><strong>{{ peer.direction === 'outbound' ? t('screenShareSending') : t('screenShareReceiving') }}</strong><small>{{ peer.connectionState }} · {{ peer.candidateType ?? '—' }}</small></div>
<div class="webrtc-stats-values"><span>{{ peer.frameRate == null ? '—' : `${peer.frameRate.toFixed(1)} FPS` }}</span><span>{{ peer.bitrateKbps == null ? '—' : `${Math.round(peer.bitrateKbps)} kbps` }}</span><span>{{ peer.lossPercent == null ? '—' : `${peer.lossPercent.toFixed(2)}%` }} {{ t('packetLoss') }}</span><span>{{ peer.framesDropped == null ? '—' : peer.framesDropped }} {{ t('screenShareDroppedFrames') }}</span><span>{{ peer.jitterMs == null ? '—' : `${Math.round(peer.jitterMs)} ms` }} {{ t('screenShareJitter') }}</span><span>{{ peer.roundTripTimeMs == null ? '—' : `${Math.round(peer.roundTripTimeMs)} ms` }} {{ t('screenShareRtt') }}</span></div>
<small v-if="peer.codec || peer.qualityLimitationReason" class="webrtc-stats-detail">{{ peer.codec ?? '—' }}<template v-if="peer.qualityLimitationReason"> · {{ peer.qualityLimitationReason }}</template></small>
</div>
</section>
</section>
</div>
<VoicePerformancePanel :model="performance" :screen-share-web-rtc-stats="screenShareWebRtcStats" :t="t" />
<button class="header-action" :title="t('copyInvite')" @click="doShare"><Icon name="share" :size="18" /></button>
<button v-if="isMobileViewport" class="header-action microphone-header-toggle" :class="{ muted: microphoneMuted }" :title="microphoneMuted ? t('unmuteMic') : t('muteMic')" :aria-label="microphoneMuted ? t('microphoneMuted') : t('microphoneActive')" :aria-pressed="!microphoneMuted" @click="toggleMicrophone"><Icon :name="microphoneMuted ? 'mic-off' : 'mic'" :size="18" /></button>
<button v-if="isMobileViewport" class="header-action" :title="t('audioSettings')" :aria-label="t('audioSettings')" @click="settingsOpen = true"><Icon name="settings" :size="18" /></button>
@@ -122,18 +101,7 @@
</div>
</header>
<div v-if="screenShareSettingsOpen" class="modal-backdrop screen-share-settings-backdrop" @click.self="screenShareSettingsOpen = false">
<section class="screen-share-settings-modal" data-ws-part="voice.screen-share-settings" role="dialog" aria-modal="true" aria-labelledby="screen-share-settings-title" @click.stop>
<button type="button" class="screen-share-settings-close" :aria-label="t('close')" :title="t('close')" @click="screenShareSettingsOpen = false"><Icon name="close" :size="17" /></button>
<div class="screen-share-settings-heading" data-ws-part="voice.screen-share-settings.heading"><span class="card-kicker">{{ t('screenShare') }}</span><h2 id="screen-share-settings-title">{{ t('screenShareSettings') }}</h2><p>{{ t('screenShareSettingsHint') }}</p></div>
<div class="screen-share-settings-fields" data-ws-part="voice.screen-share-settings.fields">
<label><span>{{ t('screenShareResolution') }}</span><select v-model="screenShareResolutionPreset" :aria-label="t('screenShareResolution')"><option v-for="option in screenShareResolutionOptions" :key="option.value" :value="option.value">{{ t(option.label) }}</option></select></label>
<label><span>{{ t('screenShareFrameRate') }}</span><select v-model.number="screenShareFrameRate" :aria-label="t('screenShareFrameRate')"><option v-for="fps in screenShareFrameRateOptions" :key="fps" :value="fps">{{ fps }} FPS</option></select></label>
</div>
<p class="screen-share-settings-note" data-ws-part="voice.screen-share-settings.note">{{ t('screenShareSettingsNote') }}</p>
<footer class="screen-share-settings-footer" data-ws-part="voice.screen-share-settings.actions"><button type="button" class="text-button" @click="screenShareSettingsOpen = false">{{ t('cancel') }}</button><button type="button" class="primary-button screen-share-settings-start" @click="startScreenShareWithSettings"><Icon name="monitor" :size="14" /> {{ t('startScreenShare') }}</button></footer>
</section>
</div>
<ScreenShareSettingsDialog v-if="screenShareSettingsOpen" :model="screenShareControls" :t="t" @close="screenShareSettingsOpen = false" />
<div v-if="voiceState.reconnecting || voiceState.reconnectFailed" :class="['reconnect-banner', { failed: voiceState.reconnectFailed }]" data-ws-part="voice.connection-status" role="status">
<div class="reconnect-copy"><strong>{{ voiceState.reconnectFailed ? t('reconnectFailed') : t('connectionInterrupted') }}</strong><span v-if="voiceState.reconnecting">{{ t('reconnectingAttempt', { attempt: voiceState.reconnectAttempt }) }}</span><span v-else>{{ localizedMessage(voiceState.error) }}</span></div>
@@ -148,23 +116,9 @@
<div class="voice-activity-artwork" data-ws-part="voice.activity.artwork" aria-hidden="true"></div>
<div class="section-heading" data-ws-part="voice.activity-heading"><div><span class="section-kicker">{{ t('voiceActivity') }}</span><h2>{{ t('speakingNow') }}</h2></div><span class="section-counter">{{ t('onlineShort', { count: currentMembers.length }) }}</span></div>
<div v-if="screenShareError" class="screen-share-inline-error" data-ws-part="voice.screen-share-error" role="status"><Icon name="info" :size="15" /> <span>{{ screenShareErrorText }}</span></div>
<section v-if="screenShareViewing" ref="screenSharePlayerEl" class="screen-share-player" data-ws-part="voice.screen-player" role="region" :aria-label="t('screenShare')">
<div class="screen-share-player-stage" data-ws-part="voice.screen-player.stage">
<video v-if="screenShareRemoteStream" :ref="setScreenVideoElement" class="screen-share-player-video" data-ws-part="voice.screen-player.video" autoplay playsinline :muted="screenShareRemoteVolume === 0"></video>
<div v-else class="screen-share-player-placeholder" data-ws-part="voice.screen-player.placeholder"><span class="screen-share-player-placeholder-icon"><Icon name="monitor" :size="28" /></span><strong>{{ t('screenShareConnecting') }}</strong><span>{{ screenShareError ? screenShareErrorText : t('directP2POnly') }}</span></div>
<button type="button" class="screen-share-player-exit" data-ws-part="voice.screen-player.exit" :aria-label="t('screenShareExit')" :title="t('screenShareExit')" @click="leaveScreenShare"><Icon name="close" :size="22" /></button>
<div class="screen-share-player-viewers" data-ws-part="voice.screen-player.viewers" :aria-label="t('screenShareViewers')">
<span class="screen-share-player-viewer-label"><Icon name="users" :size="14" /> {{ screenSharePlayerViewerCount }}</span>
<span class="screen-share-player-viewer-avatars"><span v-for="viewer in screenSharePlayerViewers" :key="viewer.peerId" class="screen-share-player-viewer-avatar" data-ws-part="voice.screen-player.viewer-avatar" :style="screenShareViewerStyle(viewer)" :title="viewer.nickname">{{ viewer.avatar ? '' : avatarInitial(viewer.nickname) }}</span></span>
</div>
<span class="screen-share-player-live" data-ws-part="voice.screen-player.live"><i></i>{{ t('watchingScreenShare') }}</span>
<span class="screen-share-player-source" data-ws-part="voice.screen-player.source">{{ screenSharePlayerOwnerName }}</span>
<div class="screen-share-player-controls" data-ws-part="voice.screen-player.controls">
<label data-ws-part="voice.screen-player.volume" :title="t('screenShareVolume')"><Icon :name="screenShareRemoteVolume === 0 ? 'volume-off' : 'volume'" :size="18" /><input type="range" min="0" max="100" :value="screenShareRemoteVolume * 100" :aria-label="t('screenShareVolume')" @input="onScreenShareVolume" /></label>
<button type="button" data-ws-part="voice.screen-player.fullscreen" :aria-label="screenShareFullscreen ? t('screenShareExitFullscreen') : t('screenShareFullscreen')" :title="screenShareFullscreen ? t('screenShareExitFullscreen') : t('screenShareFullscreen')" @click="toggleScreenShareFullscreen"><Icon :name="screenShareFullscreen ? 'fullscreen-exit' : 'fullscreen'" :size="19" /></button>
</div>
</div>
</section>
<ScreenSharePlayer v-if="screenShareViewing" :model="screenShareControls"
:screen-share-remote-stream="screenShareRemoteStream" :screen-share-remote-volume="screenShareRemoteVolume"
:screen-share-error="screenShareError" :leave-screen-share="leaveScreenShare" :avatar-initial="avatarInitial" :t="t" />
<div v-if="currentMembers.length" class="voice-grid" data-ws-part="voice.members">
<article v-for="member in currentMembers" :key="member.id" :class="['voice-card', { speaking: isSpeaking(member), self: member.isSelf }]" data-ws-part="voice.member" :data-ws-state="member.isSelf ? 'self' : isSpeaking(member) ? 'speaking' : 'connected'" :data-ws-member-id="member.id" :data-ws-speaking="isSpeaking(member) ? 'true' : 'false'" :data-ws-self="member.isSelf ? 'true' : 'false'">
<button v-if="isMobileViewport && !member.isSelf" type="button" class="voice-member-action" :aria-label="t('moreMemberOptions')" @click.stop="openMemberActions(member)"><Icon name="more" :size="17" /></button>
@@ -256,6 +210,9 @@
<script setup lang="ts">
import { computed, onMounted, onUnmounted, reactive, ref, shallowRef, watch } from "vue";
import Icon from "../components/Icon.vue";
import VoicePerformancePanel from "../components/web-client/VoicePerformancePanel.vue";
import ScreenShareSettingsDialog from "../components/web-client/ScreenShareSettingsDialog.vue";
import ScreenSharePlayer from "../components/web-client/ScreenSharePlayer.vue";
import AudioDock from "../components/web-client/AudioDock.vue";
import WhisperControls from "../components/web-client/WhisperControls.vue";
import AudioSettingsDialog from "../components/web-client/AudioSettingsDialog.vue";
@@ -370,23 +327,8 @@ const {
clearError,
measureVoiceAudioStatus,
} = useVoiceWebSocket();
const {
panelOpen: performancePanelOpen,
running: performanceRunning,
stats: performanceStats,
togglePanel: togglePerformancePanel,
refresh: refreshPerformanceProbe,
} = useWebClientPerformance(computed(() => voiceState.connected), measureVoiceAudioStatus);
const voiceHealthLabel = computed(() => t(({ disconnected: "voiceHealthDisconnected", sampling: "voiceHealthSampling", connecting: "voiceHealthConnecting", warning: "voiceHealthWarning", active: "voiceHealthActive", quiet: "voiceHealthQuiet" } as const)[performanceStats.value.health]));
const voiceTransportLabel = computed(() => t(({ webrtc: "voiceTransportWebRTC", websocket: "voiceTransportWebSocket", negotiating: "voiceTransportNegotiating", disconnected: "voiceTransportDisconnected" } as const)[performanceStats.value.transport]));
const voicePlaybackLabel = computed(() => t(({ playing: "voicePlaybackReady", paused: "voicePlaybackPaused", unavailable: "voicePlaybackUnavailable" } as const)[performanceStats.value.playbackState ?? "unavailable"]));
const voiceMicrophoneLabel = computed(() => performanceStats.value.microphoneMuted
? t("voiceMicMuted")
: performanceStats.value.microphoneReady
? t("voiceMicOpen")
: performanceStats.value.microphonePermission === "denied" || performanceStats.value.microphonePermission === "granted"
? t("voiceMicUnavailable")
: t("voiceMicWaiting"));
const performance = useWebClientPerformance(computed(() => voiceState.connected), measureVoiceAudioStatus);
const { panelOpen: performancePanelOpen } = performance;
const query = new URLSearchParams(location.search);
const initialChannel = query.get("channel") ?? "";
@@ -563,26 +505,7 @@ function persistLanguage() {
}
const screenShareIndicatorBars = [5, 10, 7, 12, 8, 10];
const {
playerElement: screenSharePlayerEl,
fullscreen: screenShareFullscreen,
resolutionOptions: screenShareResolutionOptions,
frameRateOptions: screenShareFrameRateOptions,
resolutionPreset: screenShareResolutionPreset,
frameRate: screenShareFrameRate,
settingsOpen: screenShareSettingsOpen,
viewers: screenSharePlayerViewers,
viewerCount: screenSharePlayerViewerCount,
ownerName: screenSharePlayerOwnerName,
errorText: screenShareErrorText,
setVideoElement: setScreenVideoElement,
streamForMember: screenShareStreamForMember,
toggleForMember: toggleScreenShareForMember,
viewerStyle: screenShareViewerStyle,
setVolume: onScreenShareVolume,
toggleFullscreen: toggleScreenShareFullscreen,
startWithSettings: startScreenShareWithSettings,
} = useWebClientScreenShare({
const screenShareControls = useWebClientScreenShare({
streams: screenShareStreams,
viewing: screenShareViewing,
viewingStreamId: screenShareViewingStreamId,
@@ -597,6 +520,7 @@ const {
avatarStyle,
t,
});
const { settingsOpen: screenShareSettingsOpen, errorText: screenShareErrorText, streamForMember: screenShareStreamForMember, toggleForMember: toggleScreenShareForMember, startWithSettings: startScreenShareWithSettings } = screenShareControls;
const {
channelTree,
currentChannel,
+82
View File
@@ -0,0 +1,82 @@
import assert from "node:assert/strict";
import { before, after, test } from "node:test";
import { fileURLToPath } from "node:url";
import { createServer } from "vite";
import { createRenderer, nextTick, shallowRef, markRaw } from "vue";
let vite, useWebClientScreenShare;
const renderer = createRenderer({ createComment: text => ({ text }), createText: text => ({ text }), createElement: () => ({}), insert() {}, remove() {}, setText() {}, setElementText() {}, patchProp() {}, parentNode: () => null, nextSibling: () => null });
before(async () => {
vite = await createServer({ configFile: false, root: fileURLToPath(new URL("../", import.meta.url)), server: { middlewareMode: true, hmr: false, ws: false, watch: null }, optimizeDeps: { noDiscovery: true, include: [] }, appType: "custom" });
({ useWebClientScreenShare } = await vite.ssrLoadModule("/src/composables/useWebClientScreenShare.ts"));
});
after(async () => { await vite?.close(); });
function mount(t, initialStream = null) {
const listeners = new Set(), starts = [], storage = new Map(); let exits = 0, ui;
class Element {}
class Video extends Element { srcObject = null; volume = 1; plays = 0; async play() { this.plays++; } }
const doc = { fullscreenElement: null, addEventListener: (_event, fn) => listeners.add(fn), removeEventListener: (_event, fn) => listeners.delete(fn), async exitFullscreen() { exits++; doc.fullscreenElement = null; for (const fn of listeners) fn(); } };
for (const [key, value] of Object.entries({ HTMLElement: Element, HTMLVideoElement: Video, document: doc, localStorage: { getItem: key => storage.get(key) ?? null, setItem: (key, value) => storage.set(key, value) } })) {
const original = Object.getOwnPropertyDescriptor(globalThis, key);
Object.defineProperty(globalThis, key, { configurable: true, value });
t.after(() => { if (original) Object.defineProperty(globalThis, key, original); else delete globalThis[key]; });
}
const viewing = shallowRef(true), stream = shallowRef(initialStream), volume = shallowRef(.4), streams = [];
const app = renderer.createApp({ setup() { ui = useWebClientScreenShare({ streams, viewing, viewingStreamId: shallowRef("s"), remoteStream: stream, remoteVolume: volume, error: shallowRef(""), errorCode: shallowRef(""), startScreenShare: async (...args) => starts.push(args), joinScreenShare() {}, leaveScreenShare() {}, nickname: shallowRef("Self"), avatarStyle: () => ({}), t: key => key }); return () => null; } });
app.mount({});
return { ui, app, doc, viewing, stream, volume, streams, starts, storage, listeners, exits: () => exits, video: () => markRaw(new Video()), player: () => markRaw(new Element()) };
}
test("a newly mounted or replaced video receives the existing stream and volume", async t => {
const media = { id: "stream" }, f = mount(t, media);
try {
const first = f.video(); f.ui.setVideoElement(first); await nextTick();
assert.equal(first.srcObject, media); assert.equal(first.volume, .4);
const second = f.video(); f.ui.setVideoElement(second); await nextTick();
assert.equal(first.srcObject, null); assert.equal(second.srcObject, media); assert.equal(second.volume, .4);
f.volume.value = .7; await nextTick(); assert.equal(second.volume, .7);
} finally { f.app.unmount(); }
});
test("unmount detaches video and retires a pending binding without stopping its stream", async t => {
let stops = 0; const media = { getTracks: () => [{ stop: () => stops++ }] }, f = mount(t, media);
try { const video = f.video(); f.ui.setVideoElement(video); await nextTick();
f.volume.value = .8; f.app.unmount(); await nextTick();
assert.equal(video.srcObject, null); assert.equal(stops, 0); assert.equal(f.listeners.size, 0);
} finally { if (f.listeners.size) f.app.unmount(); }
});
test("absent player is never fullscreen and does not request fullscreen exit", async t => {
const f = mount(t);
try { f.ui.syncFullscreen(); assert.equal(f.ui.fullscreen.value, false); f.viewing.value = false; await nextTick(); assert.equal(f.exits(), 0); }
finally { f.app.unmount(); }
});
test("removing a fullscreen player exits only that player's fullscreen", async t => {
const f = mount(t);
try { const player = f.player(); f.ui.setPlayerElement(player); f.doc.fullscreenElement = player; f.ui.syncFullscreen();
assert.equal(f.ui.fullscreen.value, true); f.ui.setPlayerElement(null); await nextTick();
assert.equal(f.exits(), 1); assert.equal(f.ui.fullscreen.value, false);
f.ui.setPlayerElement(f.player()); f.doc.fullscreenElement = f.player(); f.ui.setPlayerElement(null);
assert.equal(f.exits(), 1);
} finally { f.app.unmount(); }
});
test("known screen owner IDs cannot fall back to another member with the same nickname", t => {
const f = mount(t);
try { f.streams.push({ streamId: "s", ownerClientId: 7, ownerPeerId: "peer", ownerNickname: "Same", source: "browser" });
assert.equal(f.ui.streamForMember({ id: 8, nickname: "Same" }), null);
assert.equal(f.ui.streamForMember({ id: 7, nickname: "Renamed" }).streamId, "s");
f.streams[0] = { streamId: "ts", ownerPeerId: "ts-7", ownerNickname: "Same", source: "teamspeak" };
assert.equal(f.ui.streamForMember({ id: 8, nickname: "Same" }), null);
f.streams[0] = { streamId: "legacy", ownerPeerId: "unknown", ownerNickname: "Same", source: "browser" };
assert.equal(f.ui.streamForMember({ id: 8, nickname: "Same" }).streamId, "legacy");
} finally { f.app.unmount(); }
});
test("share settings submit the selected resolution and frame rate", async t => {
const f = mount(t);
try { f.ui.settingsOpen.value = true; f.ui.resolutionPreset.value = "720p"; f.ui.frameRate.value = 30; await f.ui.startWithSettings();
assert.deepEqual(f.starts, [[true, { maxWidth: 1280, maxHeight: 720, maxFrameRate: 30 }]]);
assert.equal(f.ui.settingsOpen.value, false); assert.equal(f.storage.get("webspeak:screen-share-framerate"), "30");
} finally { f.app.unmount(); }
});