Files
piik/docs/guide/network.zh-CN.md
T
08a76209c2 feat(room): add remote co-play and refresh the room experience (#497)
## Problem and outcome

This phase adds consented remote co-play to normal App/Web rooms and integrates the accepted audio, playback, participant-state and multi-site improvements. It also rebuilds the bilingual README/documentation reading path, refreshes real-component illustrations, and publishes the selected website film.

The candidate preserves the established 2.x sharing/viewing contracts. Optional new behavior follows negotiated capabilities; Windows gamepads use an externally installed driver. The separate accompaniment experiment and unselected film studies are outside this phase.

## Release notes

**Play together. Your turn!**

Approved friends can now play together with shared keyboard and mouse controls or optional gamepads.

**远程同乐,轮到你啦!**

获准的朋友现在可以共用键鼠,或使用可选手柄,一起玩本地多人游戏。

### English

Piik 2.4 adds remote co-play, improves shared sound and room controls, and rewrites the bilingual getting-started and help guides around what you want to do.

#### Highlights

- Let approved friends control together. Each player's held keys and gamepad retire independently; everyone shares the Host's mouse pointer. On Windows x64, optional virtual gamepads use a Host-installed ViGEmBus driver. Piik does not bundle or install it.
- Control shared output volume from the Host's playback bar. The optional share microphone adds your voice to the picture, independently of room voice; stopping the share leaves room voice running. Room voice now defaults to 64 kbps and offers a Host bitrate control.
- See voice and remote-control participation directly on the couch. Connection details group picture and voice by receive/send direction. Playback actions, chat-overlay settings and dismissible operation feedback have clearer, consistent places.
- Approve several Piik sites in App and manage each separately, with one optional startup favorite.
- Follow rewritten English and Chinese README and documentation paths: watching, starting a share, room tools, remote control/co-play, and symptom-based help. Illustrated guides use current product components, theme-aware screenshots and shared diagrams. A dedicated network guide covers campus networks, media UDP, SFU sites and optional virtual LANs.
- The website has clearer App and co-play FAQs and the selected bilingual 64-second film, with shared playback controls and a held closing card.

#### Fixes

- Tolerate small macOS capture-crop rounding errors without accepting genuinely invalid geometry.
- Keep shared-audio and microphone volume changes independent, preserve commentary through source replacement, and retire each input at its owning lifecycle boundary.
- Improve narrow-player controls, touch-held volume menus, tooltip placement and feedback cleanup after reconnection.
- Repair the release recovery test on macOS and refresh the build and tunnel runtimes.

#### Updating and limits

Update the Host's App and the room site, then refresh open pages to use the new features. Established sharing and viewing remain compatible within 2.x; older peers retain the features they support. The wire versions and SQLite schema are unchanged. Restarting App or Server interrupts active sessions.

Before downgrading App, remove extra approved sites in the newer launcher so at most one remains. Use the [remote-control guide](https://piik.tv/docs/remote-control.html?lang=en) for the optional Windows driver. Linux gamepads remain experimental; macOS virtual gamepads are not currently available. Windows 10 window-sharing black screens ([#495](https://github.com/TNTcraftHIM/Piik/issues/495)) remain under investigation; use screen sharing if affected.

### 中文

Piik 2.4 新增多人远程同乐,改进分享声音与房间控制,并围绕实际任务重写双语上手教程和帮助文档。

#### 主要更新

- 允许获准的朋友同时控制。各人的按键持有和手柄独立释放,大家共用房主的鼠标指针。Windows x64 可使用房主自行安装的 ViGEmBus 驱动提供虚拟手柄;Piik 不捆绑或安装驱动。
- 房主可通过播控调整分享输出音量。可选的分享麦克风把说话声加入画面,与房间语音独立;停播后房间语音继续。房间语音默认提升至 64 kbps,并提供房主码率设置。
- 沙发人物直接呈现语音和远控参与状态;连接详情按画面/语音、接收/发送分组。播放操作、弹幕设置和可关闭的操作提示各有清楚、一致的位置。
- App 可授权多个 Piik 站点,逐个管理,并选择一个启动时打开的星标站点。
- 重写中英文 README 和文档中心:从观看、开始分享、房间工具、远控/同乐到按症状排障。图文教程使用当前正式组件、明暗主题截图与同源示意图;独立网络指南说明校园网、媒体 UDP、SFU 站点和可选虚拟局域网的用法。
- 官网改进 App 与多人同乐 FAQ,采用选定的双语 64 秒短片,复用产品播控并保留结尾品牌卡。

#### 修复

- 容忍 macOS 采集裁剪中的微小舍入误差,仍拒绝真正无效的画面边界。
- 分享总音量与麦克风音量分别更新;换源保留解说,各项输入按所属生命周期释放。
- 改进窄屏播控、触摸长按音量菜单、提示定位,以及重连后的提示清理。
- 修复 macOS 上发布恢复测试的可移植性,更新构建与公网隧道运行组件。

#### 更新与限制

将房主 App 和房间站点更新后,刷新已打开的页面,即可使用新功能。2.x 内保留已有分享与观看兼容性,旧端继续使用其支持的功能;协议版本和 SQLite schema 不变。重启 App 或 Server 会中断当前会话。

如需降级 App,先在新版启动页删除额外授权,最多保留一个站点。可选的 Windows 驱动安装方法见[远控指南](https://piik.tv/docs/zh/remote-control.html)。Linux 手柄仍属实验能力,macOS 当前暂不提供虚拟手柄。Windows 10 窗口分享黑屏而整屏正常的反馈([#495](https://github.com/TNTcraftHIM/Piik/issues/495))仍在调查,本版不声称已修复。

## Verification

- Integrated Web typecheck, 98 test files / 1,734 tests and production build passed. Later scoped UI repairs passed focused typecheck/tests and preview checks.
- Focused Go checks cover input grant/held-state ownership, delayed device retirement, native control/Host, config/launcher/loopback, voice negotiation and source-volume binding. Windows capture compilation/probe and the isolated Linux uinput kernel gate passed.
- Normal-page P2P (22 checks) and embedded-SFU (19 checks) gates passed. P2P explicitly exercised source commentary with room voice, independent shutdown, share retirement and the next share's default-off state; SFU also covers live voice bitrate and voice recovery.
- Documentation links (108 Markdown files), generated-diagram freshness, the complete bilingual/theme screenshot pipeline and website production build passed. Website/readers were checked at 320, 768 and 1440 px with both languages/themes.
- macOS crop logic retains geometric self-tests; this Windows environment did not repeat a macOS SDK/hardware run. Linux desktop/game recognition and macOS virtual-gamepad entitlement/runtime remain explicit limits.
- Windows native window-sharing acceptance passed: Host/Viewer decoding, live and paused quality changes, resize/minimize/restore, source replacement, stop and restart. Capturing the Host Chrome window also passed with Auto/H.264 and VP8, including decoded-frame and pixel checks. The Windows 10 case in #495 was not reproduced and remains separate.
- Current Go serializers passed the published v2.0.0/v2.3.0 TypeScript readers; existing native input opt-in checks passed. This checks payload compatibility, not an end-to-end run of old published clients.

## Impact

Compatible 2.x feature release; Browser/server v24, Native control v10, capture v7 and SQLite schema 2 remain unchanged. New co-play, presence, voice settings and native volume behavior are capability-negotiated. Multi-site App settings retain the older single-site reader path; arbitrary binary downgrade is not promised. No independent room/router, new NAT policy, driver installer or separate accompaniment channel is introduced.

## Related work

Includes the macOS crop correction reported in #492 and the macOS deployment-test portability contribution from #496. Supersedes the incomplete phase PR #494. #495 remains open.

## Attribution

Co-authored-by: Yuqing Huang <670081066@qq.com>
Co-authored-by: luol75569-collab <297886760+luol75569-collab@users.noreply.github.com>
2026-10-23 16:29:31 -04:00

124 lines
7.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 进阶网络排查
[English](./network.md) · 简体中文 · [问题排查](./troubleshooting.zh-CN.md)
本页用于排查 **网页能打开,但画面或语音连接不上**。按你的情况选择:
- **校园网、公司网络,或换成热点就能看:** [选择连接方案](#校园网或严格-nat)。
- **同一邀请在别的浏览器里正常:** [检查浏览器限制](#浏览器限制了-webrtc)。
- **日志提到 STUN,或准备检查自家路由器:** [地址发现与路由器](#stunipv6-与路由器检查)。
- **准备使用 UU、Tailscale 或 ZeroTier:** [虚拟局域网使用步骤](#可选虚拟局域网)。
网页与聊天、画面与声音使用不同的连接。媒体连接失败时,检查 WebRTC UDP 和下方的连接方案。
![房主和朋友通过站点访问网页与聊天;画面和声音使用独立的直连或转发连接。](../assets/guide/network-paths.zh-CN.svg)
如果是[邀请网页打不开](./troubleshooting.zh-CN.md#公网邀请创建失败或出现-1033),或[画面已经出现但模糊、卡顿](./troubleshooting.zh-CN.md#画面模糊卡顿或中断),先按对应症状排查。
## 校园网或严格 NAT
**先用手机热点打开同一邀请。** 热点能看、原网络不能看时,原网络的共享出口或防火墙限制更值得检查。
需要长期使用时,可以选择以下方案:
- **有可用的 Piik 站点:** 请管理员[启用服务器媒体转发(SFU)](../operations/self-hosting.zh-CN.md#可选启用媒体兜底),房主关闭 **隐私模式**,直连失败时即可尝试转发。使用 App 采集时,[授权新站点](./getting-started.zh-CN.md#通过已有站点使用-app),再发送该站点的邀请。
- **朋友们可以安装组网工具:** 按下方[虚拟局域网步骤](#可选虚拟局域网),通过 App 的 **本地房间** 分享。
- **所需的连接被网络阻断:** 换用可用网络,或请网络管理员检查放行。
> **媒体需要 UDP。** `demo.piik.tv` 和 App 的 **公网邀请** 使用纯 P2P。
> 服务器转发需要站点启用 SFU,并且 UDP 端点可达。
## 浏览器限制了 WebRTC
浏览器的 WebRTC 设置、VPN 或隐私扩展可能阻止媒体 UDP,
包括同一台电脑上的浏览器与 App 之间的连接。
1. 用默认设置、未启用相关隐私扩展的浏览器打开同一邀请,对照能否观看。
2. 如果新配置可以观看,检查原浏览器中的 **WebRTC** 或 **IP 泄露保护** 选项,恢复允许 WebRTC UDP 的策略。
3. 修改后刷新 Piik 页面,再尝试分享或观看。学校或公司统一管理的策略需由管理员调整。
<details>
<summary>Chrome / Vivaldi 设置</summary>
`disable_non_proxied_udp` 表示限制未经代理的 UDP,可先与浏览器默认策略对照。
Chrome 的扩展可能控制此策略,即使浏览器没有显式开关。
Vivaldi 在 **设置 → 隐私和安全 → WebRTC IP 处理** 中提供 **广播 IP 以获得最佳 WebRTC 性能**。
直连可能向对端暴露网络地址。调整阻止 UDP 的设置,其他隐私设置可按需保留。
参考 [Chrome 策略说明](https://developer.chrome.com/docs/extensions/reference/api/privacy#property-network)
与 [Vivaldi 隐私设置](https://help.vivaldi.com/desktop/privacy/privacy-settings/)(英文)。
</details>
## STUN、IPv6 与路由器检查
这部分适合查看日志的 App 用户,以及可以管理站点或路由器的人。只检查你能够管理的部分。
<details>
<summary>STUN:地址发现与服务配置</summary>
STUN 用于发现设备可连接的地址。App 公网邀请会尝试多个服务;地址发现失败时,
在启动公网邀请前设置 [`PIIK_STUN_URLS`](../standards/configuration.md#piik-app-configuration),替换内置地址。
自部署管理员应检查 `STUN_URLS` 是否指向可达的 UDP 服务;HTTP 反向代理不能转发 STUN。
STUN 服务会接收到参与者的公网 IP,请选择信任的服务。
[WebRTC 连接说明](https://webrtc.org/getting-started/peer-connections)介绍了地址发现的作用(英文)。
</details>
<details>
<summary>IPv6:检查双方网络</summary>
宽带、路由器和双方设备都有可用 IPv6 时,Piik 可以在 IPv4 之外尝试这条路径。
同时保留 IPv4;IPv6 仍受防火墙约束。路由器菜单因型号而异,参考厂商的
[IPv6 配置说明](https://support.google.com/googlehome/answer/6361450?hl=zh-Hans)。
</details>
<details>
<summary>路由器:端口映射与共享地址</summary>
支持的 UPnP、PCP 或 NAT-PMP 可以让 App 原生媒体连接申请端口映射;纯浏览器采集不会申请。
光猫和路由器都做 NAT 时,可按对应型号的桥接或 AP 模式说明减少一层,修改前先备份配置。
运营商共享公网地址(CGNAT)位于上游,需向运营商咨询公网 IPv4 或 IPv6 服务。
参考厂商的 [UPnP 说明](https://support.google.com/googlehome/answer/6274337?hl=zh-Hans)
和[双重 NAT 示例](https://www.tp-link.com/us/support/faq/3113/)(英文)。
</details>
## 可选:虚拟局域网
虚拟局域网让异地设备像在同一网络中一样互访,再通过 Piik App 的 **本地房间** 分享。
工具必须提供可互访的虚拟 IPv4 地址,同时支持网页访问和 WebRTC UDP;只加速某个游戏的功能不适用。
选择朋友们都能使用的工具即可:
- **[UU](https://uu.163.com/blog/lan-multiplayer-guide-net.html):** 使用通用局域网组网入口,加入同一房间。在 Piik 中选择房主的 UU 虚拟 IPv4 地址。
- **[Tailscale](https://tailscale.com/docs/how-to/quickstart)(英文教程):** 各设备安装后,邀请朋友加入同一个私有网络(tailnet)。在 Piik 中选择房主的 Tailscale IPv4 地址(`100.x.y.z`)。
- **[ZeroTier](https://docs.zerotier.com/quickstart/)(英文教程):** 各设备加入同一个网络 ID,再在管理页面授权这些设备。在 Piik 中选择分配给房主的虚拟 IPv4 地址。
![虚拟局域网三步:加入同一虚拟网络,在本地房间选择虚拟地址,发送完整邀请并确认证书。](../assets/guide/virtual-lan.zh-CN.svg)
1. **加入同一网络。** 房主和朋友都运行组网工具,进入同一个虚拟局域网。
2. **房主选择虚拟地址。** 在新版 Piik App 选择 **本地房间**,展开 **局域网邀请地址**,选择组网工具提供的 IP,然后进入房间并分享。
3. **发送完整邀请。** 朋友打开该虚拟 IP 下的 HTTPS 邀请,首次访问先与房主[核对本地证书](./troubleshooting.zh-CN.md#本地-https-证书提示),再进入房间。不要发送 `localhost` 地址或只发房间号。
4. **确认画面和声音。** 所有设备保持组网工具运行,房主同时保持 Piik App 运行。虚拟 IP 变化后,房主需重新选择地址并发送新邀请。
遇到问题时,按最先失败的一步检查:
- **网页打不开:** 先查[本地邀请与防火墙](./troubleshooting.zh-CN.md#本地邀请打不开),确认 Piik 可通过该虚拟网络访问。
- **网页能开,画面连不上:** 检查工具是否传输媒体 UDP,以及[浏览器 WebRTC 设置](#浏览器限制了-webrtc)。
- **不能开麦或远控:** 使用 App 生成的 HTTPS 邀请,确认证书,再查[浏览器权限](./troubleshooting.zh-CN.md#无法使用麦克风或远程控制)。支持的浏览器无需公网隧道即可使用这些功能,普通局域网同样适用。
仅与信任的朋友组网。
<details>
<summary>通过 frp 转发已有服务器</summary>
有公网服务器的管理员可按 [frp 教程](../operations/self-hosting.zh-CN.md#可选通过-frp-转发已有服务),
通过 frps 转发已有站点的网页和 SFU 端点,需同时配置网页与媒体转发。
</details>
仍有问题时,请按[反馈说明](./troubleshooting.zh-CN.md#反馈问题)收集同一次尝试的报告。