Commit Graph
5 Commits
  • feat(app): improve startup and media recovery (#478)
    This compatible update improves quality recovery after congestion and stream changes, and lets an approved Site become the App's startup page. It also aligns responsive controls and external brand assets while preserving the in-page mascot and illustrations.
    
    The existing media allocator, room graph and authorization owners remain in place. The scoped LiveKit demand-input patch is pinned and submitted upstream in livekit/livekit#5016; its removal condition is documented. No wire or storage version changes.
    
    ## Validation
    
    - Web type-check, unit tests and production build; Go core/native acceptance and website build.
    - Focused controlled recovery/relay/NAT evidence reused from this phase, plus final integrated lifecycle checks.
    - Independent media and UI reviews; corrected the ready App button's stale passive styling.
    - Repository hygiene, documentation links, responsive launcher/theme previews and package icon propagation.
    - Physical macOS/Linux capture and unmatched reporter cases remain documented; controlled tests do not establish a public connection success rate.
    
    ## Release notes
    
    ### 中文
    
    这是一次兼容 2.x 的功能与维护更新,重点改善网络波动后的画质恢复,并让常用站点的 App 启动流程更方便。
    
    - **更快恢复画质:** 修复部分 App 分享与服务器中转线路在网络恢复后仍长时间保持低码率的问题;调整 Windows 原生编码,减少短暂波动造成的分辨率下降,并加快恢复。
    - **更稳定的中继播放:** 修复原生中继在分辨率变化、画面数据不完整和换源时的恢复处理,以及延迟关键帧请求被丢失的问题。
    - **启动时打开常用站点:** 可以为已授权站点加星,下次启动 App 时直接打开它;仍可通过网页 App 按钮或终端地址返回启动页管理授权和选择模式。
    - **简化连接设置:** NAT 穿透增强在能力可用时自动启用;高级用户可通过 `PIIK_STUN_URLS` 指定 App 公网邀请使用的 STUN 服务。
    - **界面与图标打磨:** 修正窄屏房间工具栏、昵称编辑和浮层排版,精简启动页说明,统一官网与应用的语言、深浅色控件,并更新 App 图标与网站 favicon。页面内的 mascot 和插画保持原有风格。
    - **补充连接排查指引:** 更清楚地区分公网邀请服务、站点访问与媒体连接问题。
    
    本次更新不改变 2.x 通信协议或数据库格式。浏览器采集在部分网络波动后仍可能恢复较慢;此次修复不代表所有网络和设备上的画质问题均已消除。
    
    ### English
    
    This compatible 2.x feature and maintenance update improves quality recovery after network disturbances and makes it easier to launch the App with your usual Site.
    
    - **Faster quality recovery:** Fixed cases where native App sharing or server-relayed media stayed at a low bitrate after bandwidth returned. Tuned Windows native encoding to reduce resolution drops during brief disturbances and recover sooner.
    - **More reliable relay playback:** Fixed native relay recovery across resolution changes, incomplete frames and source replacement, and preserved delayed keyframe requests until they can be fulfilled.
    - **Open your usual Site on startup:** Star an approved Site to open it when the App starts. The page's App button and the terminal's launcher address still provide access to approval management and room modes.
    - **Simpler connection settings:** Available NAT traversal enhancement now activates automatically. Advanced users can set `PIIK_STUN_URLS` to choose the STUN services used by App public invitations.
    - **Interface and icon polish:** Fixed narrow-screen room controls, nickname editing and overlays; simplified launcher guidance; aligned website language and theme controls with the App; and refreshed App icons and website favicons. In-page mascots and illustrations retain their existing appearance.
    - **Clearer connection troubleshooting:** Updated guidance distinguishes public-invitation service failures, Site access and media connectivity.
    
    This update preserves the 2.x communication protocols and database format. Browser capture can still recover slowly after some network disturbances; these fixes do not resolve every quality issue on every network or device.
  • feat: add room interactions and media sharing improvements
    ## Problem and outcome / 问题与结果
    
    This phase adds lightweight room interaction without making media depend on chat,
    and adds Windows source-audio exclusion and optional SFU-only hosting at their
    existing owners. It also corrects confirmed encoder/capture ownership and native
    color-conversion defects. Host microphone commentary remains on the shared media
    path; room voice and 4K are outside this phase.
    
    ## Release notes
    
    ### 中文
    
    这是一次功能更新:Piik 加入了文字聊天与表情互动,并完善了 Windows 声音采集、画面颜色和自部署选项。
    
    #### 新功能
    
    - **边看边聊。** 在可移动、可缩放的聊天窗口中发送消息,或开启弹幕。停止分享后,房间中的朋友仍可继续聊天。
    - **表情互动。** 点击沙发上的人物,给自己发表情,或把番茄等表情送给朋友;各端按同一事件显示动画。
    - **排除应用声音。** Windows App 分享整个屏幕时,可排除一个应用及其子进程的声音,适合同时使用语音软件。所选应用退出后,来源声音停止,避免恢复为未过滤的系统声音。
    - **可选的纯 SFU 模式。** 自部署管理员可让共享画面和声音统一通过媒体服务器转发。默认仍为优先 P2P;App 公网邀请保持纯 P2P。
    - **Windows HDR 转 SDR。** 原生采集与缩略图自动将 HDR 来源转换为 SDR,沿用现有观看链路。
    
    #### 修复与改进
    
    - 修复原生颜色转换的范围与矩阵处理,避免已复现的暗部丢失、高光裁切和颜色偏差。
    - 修复共享编码器切换时使用过期需求或过期帧信息的问题,保护正在观看的画面;修复换源后旧采集事件可能影响新来源的问题。
    - 统一新控件、浮窗与来源选择文案,补充中英文使用说明。
    
    #### 使用与升级
    
    聊天与表情需要新版站点页面和 Server;声音排除需要新版页面与支持此能力的 Windows App。聊天只保留本页最近收到的消息,刷新后清空,不补发历史,且不提供端到端加密。
    
    HDR 转换输出为 SDR,不代表端到端 HDR 或多声道支持。既有房主麦克风与立体声能力保留。
    
    ### English
    
    This feature update brings text chat and reactions to Piik, alongside improvements to Windows audio capture, picture colors and self-hosting options.
    
    #### New features
    
    - **Chat while watching.** Send messages in a movable, resizable window, or enable on-screen chat. Friends can keep chatting after the host stops sharing.
    - **Reactions.** Select a person on the sofa to react above yourself or send a tomato and other reactions to a friend. Participants animate the same shared event.
    - **Exclude application audio.** When sharing a whole screen with Windows App, exclude one application and its child processes, useful when using a separate voice app. Source audio stops if the selected app exits, preventing a return to unfiltered system sound.
    - **Optional SFU-only hosting.** Site operators can require shared video and audio to pass through the media server. P2P-first remains the default; App Public invite remains P2P-only.
    - **Windows HDR-to-SDR conversion.** Native capture and source thumbnails automatically convert HDR sources to SDR for the existing viewing path.
    
    #### Fixes and improvements
    
    - Correct native color-conversion ranges and matrices, addressing reproduced crushed shadows, clipped highlights and color shifts.
    - Correct stale demand and frame evidence during shared-encoder handoffs to protect the current picture. Prevent events from a replaced capture from affecting its successor.
    - Align new controls, floating panels and source-picker copy, with updated Chinese and English guides.
    
    #### Using this update
    
    Chat and reactions require updated site pages and Server. Audio exclusion requires updated pages and a Windows App that supports the capability. Chat retains only recent messages received by the current page, clears on refresh and does not replay history. It is not end-to-end encrypted.
    
    HDR conversion produces SDR; it does not add end-to-end HDR or surround sound. Existing host microphone commentary and stereo support remain available.
    
    ## Verification / 验证
    
    - Web type checks, 78 test files / 1275 tests and production build: PASS.
    - Go core tests, formatting/vet and target builds: PASS; Darwin cgo remains platform-limited on this Windows runner.
    - Native build/check/color probes and synthetic HDR-to-SDR H.264/VP8 browser reception: PASS.
    - Access/privacy gate, Native H.264 SFU-only media gate and local Auto/H.264 Host gate: PASS.
    - Three real production pages: chat/reactions, stop/resume, idle-room join, host departure/return, offline draft recovery and invitation revocation: PASS.
    - Synthetic parent/child process-audio exclusion and target lifetime: PASS; no raw audio retained.
    - Windows candidate archive extraction and packaged Local startup/shutdown: PASS.
    - Documentation and website build: PASS.
    - [Candidate CI](https://github.com/TNTcraftHIM/Piik/actions/runs/36873766646) at
      `f26cd208d03bc0dcbe353f8cac217f993216b0a3`: Go core and race checks, Web tests,
      Server/container checks and Windows/macOS/Linux App packaging all PASS.
      Publication was skipped as intended.
    
    The owner accepted the UI/model and bounded local walkthrough for phase closure.
    Physical HDR/mixed displays, mobile keyboard,
    real voice applications across output devices and macOS/Linux capture remain
    unverified. Existing field reports without matched evidence are not claimed
    resolved. The owner authorized v1.7.0 publication on 2026-10-02. The final
    documentation-only commit records that authorization; product code matches
    the verified candidate above.
    
    ## Impact / 影响
    
    Authorized version: **v1.7.0**, matching the local release planner. Current wire
    contracts remain Browser/server 23, Native control 9 and capture 7. Optional
    capabilities gate new functionality; existing room/media authority remains owned
    by the existing services. No new ports, message persistence, room voice or
    automatic room creation on page visit. Updated README, guides, standards,
    research evidence and TODO stay with the candidate phase.
  • fix(media): stabilize sharing startup and recovery
    ## Problem and outcome / 问题与结果
    
    Sharing could fail when an optional output or encoder comparison failed, while retired Browser work could block media cleanup. Browser pooling also spent its startup protection before publication and classified its synthetic transport clock as realtime video, delaying recovery after a bandwidth drop. These repairs stay within the existing capture, producer, edge and connection owners.
    
    Self-hosting samples now follow the configured public Origin and permit the site's requested camera/microphone capture. Piik's own Origin rejection has a specific bilingual explanation, distinct from arbitrary proxy 403 responses.
    
    ## Release notes
    
    ### 中文
    
    这是一次分享稳定性维护更新,重点修复开播、换源与画质恢复,并改善自部署站点的配置和错误说明。
    
    - Windows 自动选择编码器时,如果已验证 H.264 可用,后续软件编码对比失败或超时会保留可用的 H.264,避免因此无法开播。
    - 较低画质输出或单条音频发送连接失败时,保留仍然健康的分享和其他连接。
    - 修复停止分享、换源和媒体连接退役时,旧异步任务阻塞清理与恢复的问题。
    - 改善浏览器共享编码的首播画质与网络波动后的恢复,避免因短时码率变化反复重建编码器。
    - 自部署配置示例默认跟随站点网址;创建房间因网址未获允许而返回 403 时,页面会指出需要检查的配置。nginx 示例也修正了对本站摄像头、麦克风的权限限制。
    
    已有自部署站点若遇到 403,请检查 `PUBLIC_BASE_URL` 与 `ALLOWED_ORIGINS`。使用旧 nginx 示例的站点需更新 `Permissions-Policy`;步骤见[自部署教程](https://piik.tv/docs/zh/self-hosting)。本次更新不改变房间、信令或 App 控制协议。
    
    ### English
    
    This maintenance update improves sharing startup, source changes and video-quality recovery, with clearer configuration and error guidance for self-hosted sites.
    
    - Windows automatic codec selection retains a verified H.264 encoder if the subsequent software comparison fails or times out, instead of failing to start sharing.
    - A failed lower-quality output or individual audio sender no longer interrupts healthy sharing and other connections.
    - Fixes retired asynchronous work blocking cleanup and recovery when stopping sharing, changing sources or retiring media connections.
    - Improves initial quality and recovery after network fluctuations in Browser pooled encoding, while avoiding unnecessary encoder recreation after short bitrate changes.
    - The self-hosting sample follows the configured site address by default. Piik's Origin-related room-creation 403 now identifies the settings to check. The nginx sample also permits camera and microphone requests from the site itself.
    
    If an existing self-hosted site returns 403, check `PUBLIC_BASE_URL` and `ALLOWED_ORIGINS`. Sites using the old nginx sample must update `Permissions-Policy`; see the [self-hosting guide](https://piik.tv/docs/self-hosting). Room, signaling and App control protocols are unchanged.
    
    ## Verification / 验证
    
    - `npm run check`: 75 files / 1,106 tests, TypeScript and production Web build passed.
    - `npm run check:go`: Go formatting, tests, vet, supported core builds, Windows native compile and regressions passed. Darwin cgo packaging remains owned by its macOS CI runner.
    - Repository hygiene, documentation checks and website/documentation build passed.
    - Isolated VP8/H.264 Browser checks: constrained-child isolation and recovery, short congestion pulse, live and quiet settings, pause/resume, source replacement and ordinary fallback passed. Controlled bandwidth can still cause temporary low resolution, stalls and A/V jitter.
    - Windows native Auto/H.264/VP8 startup, window resize/fullscreen/minimize/restore, Browser-to-App fanout and embedded-SFU checks passed in the bounded local fixtures.
    - Old-code negative controls reproduce the repaired failure paths. A real Chromium policy check rejects camera/microphone with the previous nginx header and captures both fake devices with the corrected same-origin policy; geolocation remains denied.
    - Independent read-only review covered root ownership, cancellation and the producer/carrier adaptation boundary.
    
    ## Impact / 影响
    
    Compatible patch release, planned as v1.6.4. No wire, storage, routing-authority or interaction-model change. Matching Server restart interrupts current process-owned media; package cutover retains the existing bounded rollback procedure. Unknown field reports still require device/network evidence and are not claimed resolved by local fixtures. Raw diagnostics and experiment artifacts remain ignored; accepted constraints and concise evidence live in their existing documentation owners.
  • fix(media): contain connection failures and preserve stereo preferences
    An individually rejected ICE candidate could abort the App's local media bridge, an SFU publication or a Browser encoding probe. Separately, a retiring native downstream edge could propagate its closed transport into the shared source and stop capture. This phase keeps those failures at their existing resource owners, fences late bridge signaling after disposal, and corrects native Opus receive preferences.
    
    Existing candidate handling is reused across sibling paths. No route policy, retry budget, protocol version, configuration or UI is added. Browser ingress stereo normalization remains necessary for already-published Apps.
    
    Validation: `npm run check` (74 files, 1081 tests, type-check and Web build), `npm run check:go` (including Windows native compilation), documentation and repository hygiene passed. Windows Chrome H264 and VP8 gates passed candidate fault injection, resize/fullscreen/minimize transitions, live/paused settings, source replacement and re-sharing; Auto whole-display capture also passed. A real Chrome codec-probe comparison reproduces the old false H264 rejection and verifies the correction. Regression tests reproduce the downstream retirement and receive-preference defects. Linux CI owns the Go race check because the local Windows environment lacks cgo.
    
    Reported game/device failures remain unconfirmed without matched diagnostics. These fixes do not claim to resolve every share-start or game-entry failure. Interaction/voice/HDR work remains outside this release; its next steps are recorded in the existing TODO ledger.
    
    ## Release notes
    
    ### 中文
    
    这是一次分享稳定性修复更新,重点避免局部连接错误影响整场分享,并修正原生音频接收协商。
    
    - 修复单条 ICE 候选被拒绝时可能导致开播失败、SFU 发布中断,或自动编码检测误判的问题;连接会继续使用其他有效候选。
    - 修复原生下游连接关闭时可能误停整场分享的竞态,并阻止已关闭的本机媒体连接继续发送过期信令。
    - 修正原生接收端的 Opus 立体声偏好,首次连接和重新协商均会明确请求立体声。
    
    保持现有版本兼容,无需修改配置。具体游戏、显卡或网络环境中的异常仍需结合诊断记录确认。
    
    ### English
    
    This maintenance update improves sharing stability by containing local connection failures and correcting native audio receive negotiation.
    
    - Fixed cases where a rejected ICE candidate could prevent sharing, interrupt an SFU publication, or incorrectly rule out H264 during automatic codec detection. Other valid candidates remain usable.
    - Fixed a race where closing a native downstream connection could stop the entire share, and prevented disposed local media connections from sending stale signaling.
    - Corrected native Opus receive preferences to request stereo on both initial connection and renegotiation.
    
    Existing version compatibility is preserved; no configuration changes are required. Failures specific to a game, GPU or network still need matching diagnostics to establish their cause.
  • fix: improve sharing recovery and UI feedback
    ## Problem and outcome / 问题与结果
    
    Browser sharing can remain connected to a local encoding transport that never becomes usable, leaving viewers without frames. This phase bounds that startup at eight seconds and restores ordinary encoding through the existing failure path. It also keeps ready App services running after a browser-open failure, preserves user presentation/playback choices, and aligns room feedback, illustrated hints, metrics and documentation.
    
    部分环境下,本机编码连接一直无法建立会让观众收不到画面。本轮在八秒后进入现有降级流程,同时修复客户端启动移交、播放状态和前端反馈的一致性问题,并更新官网与中英文教程。
    
    Closes #399.
    
    Related: #396. The release contains relevant startup/error-handling repairs, but the reporting machine has not been retested. Keep this issue open for a current-build result. #401 (optional Windows capture-border hiding) remains deferred.
    
    Release / 发布版本:**v1.3.1**.
    
    ## Release notes
    
    ### 中文
    
    - 客户端记住上次确认的启动模式;启动移交保留已保存的语言、纯视觉模式和主题选择。
    - 系统浏览器未能自动打开时,客户端继续运行,并在终端保留页面地址、重试入口和具体错误。
    - 改善浏览器共享画面的启动兜底,避免 App 媒体因短暂信令中断被误判为失败。
    - 音轨变化保持现有视频与观众的本机暂停状态;连接恢复和暂停恢复不再重复播放电视开机动画。
    - 修复昵称编辑及长昵称查看,减少重复的角色提示,统一人物选择和连接状态的区别。
    - 完善房间准入、密码和邀请说明;复制反馈对应当前链接及当前操作,避免迟到结果覆盖新反馈。
    - 修正采集参数、统计单位与采样区间的展示,未知参数不再用配置上限代替。
    - 统一提示漫画、状态图标与动效,改善选源器还焦、键盘操作、剧场布局和触控目标尺寸。
    - 服务端默认支持 20 位观众,可在配置中设为 1–20 位,房主不占观众名额。
    - 更新官网、教程入口和中英文说明,清理过时预览及失用代码。
    
    兼容说明:使用旧版 App 连接更新后的站点时,站点会优先保留自己的显示偏好。如需更改语言或主题,请在进入后的页面调整。
    
    ### English
    
    - Remember the last confirmed App launch mode and preserve saved language, visual-mode and theme choices during launch handoff.
    - Keep the App running if the system browser fails to open, with the page address, retry action and error details available in the terminal.
    - Improve the browser sharing startup fallback and avoid treating brief signaling outages as App media failures.
    - Keep existing video and local pause state when audio tracks change. Reconnecting and resuming no longer replay the television startup animation over the picture.
    - Fix nickname editing and full-name access, remove redundant role hints, and distinguish participant selection from connection state.
    - Clarify room access, passwords and invitations. Copy feedback now belongs to the current link and operation, so late results cannot replace newer feedback.
    - Correct capture details, metric units and observation intervals. Unknown capture values are no longer replaced with configured ceilings.
    - Align illustrated hints, status icons and motion. Improve source-picker focus, keyboard operation, theater layout and touch targets.
    - Default the Server to 20 viewers, configurable from 1 to 20. The host does not count toward that limit.
    - Update the website, guide links and bilingual instructions, and remove obsolete previews and unused code.
    
    Compatibility: when an older App connects to an updated Site, the Site keeps its saved presentation preferences. Change language or theme on the destination page when using an older launcher.
    
    ## Verification / 验证
    
    Non-publishing [CI candidate run 34919320511](https://github.com/TNTcraftHIM/Piik/actions/runs/34919320511) passed Go core, race, Web checks, Server/container verification and all three native App package checks at source 188376e8. Subsequent commits only update deployment documentation, status and TODO; documentation/hygiene checks passed. Product inputs are unchanged.
    
    - `npm run check`: TypeScript, 64 test files / 854 tests, and the Web production build passed.
    - `npm run check:client-core`: final Go source passed tests, formatting, vet and core target builds. Windows capture compilation and geometry checks passed earlier in this phase; later edits did not change native capture.
    - Website build, documentation checks, repository hygiene and diff checks passed. Existing documentation-size and bundle-size warnings remain.
    - Actual browser flows covered sharing, source changes, pause/resume, late audio, brief signaling loss, invitation/copy feedback, entry preferences, source-picker focus, and narrow layouts.
    - A local three-viewer P2P relay check covered quality-report expiry, recovery and cleanup without interrupting video. A controlled browser-helper failure returning `0xc0000005` left the real App launcher and Local service available.
    - Homepage checks covered Chinese/English, light/dark preferences and inline-film open/close after removing the separate-page entry.
    
    Limits: no new reporter-machine confirmation for #396 or the Windows URL-handler crash; physical Safari/mobile, macOS/Linux capture and wider public-network/endurance coverage remain deferred. Formal release artifacts will be built from the approved squash-merge revision. Hero-loop controls and video-adjacent tooltip placement remain open design items in TODO.
    
    ## Impact / 影响
    
    Compatible patch; signaling, Native control and capture contracts are unchanged. Older App launch handoff keeps the updated Site's saved presentation preferences. The Server's default viewer limit is corrected to 20; an explicit 1–20 configuration remains valid.
    
    Service updates retain persisted room authority but restart active media sessions. Deploy the verified immutable Server artifact through the existing bounded health/recovery process. Public Demo remains open and P2P-only; deployment does not enable SFU or change infrastructure/configuration.