Files
piik/docs/design/visual-language.md
T
AAA 799d6efb4a 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.
2026-09-15 10:13:29 +08:00

26 KiB

Visual Language

This is the single design requirement for Piik's shared Web/App interface: illustration, semantic colour, panel grammar, motion and tooltip presentation. New UI work follows this file and the local /__tooltip-preview catalogue. Media status owns which facts justify each status; presentation lifecycle owns interaction and playback. Neither an illustration nor its colour creates product state.

Use one stroke language for single concepts, small panel comics for causes and sequences, and literal scene objects for people, rooms and media. Glyphs do not form sentences. The same meaning and visual hierarchy must work in Chinese, English and pure-visual modes, in both themes and at narrow widths.

Piik's living room uses simple silhouettes, generous space, rounded controls and a small responsive bounce. Clear hierarchy and legible interaction keep the playful details easy to use. The copy guide owns its voice. The public introduction guide owns website and film hierarchy: shared identity, current product demonstrations and promotional composition. It applies the copy guide's audience and technical-detail layers.

Keep playfulness restrained: clean silhouettes, balanced proportions, quiet expressions and brief gestures. Keep the interface approachable; avoid pushing ordinary characters toward infant proportions, exaggerated grins, dense cute decoration or children's picture-book styling.

Layout And Input

Present a small shared living room: the television is the media stage, the couch and pawns make presence spatial, and the four-digit room code stays prominent. Decoration must clarify product facts without creating another state model. Universal digits, transport symbols, URLs and measured values remain literal when the user needs the data.

Functional controls use native buttons/inputs and localized accessible names. Hover, keyboard focus and touch receive equivalent guidance. Keep information order and interaction ownership consistent across languages, themes and viewport sizes. Reflow or bounded scrolling must not hide a primary action, truncate an essential value, overlap controls or change meaning.

Keep the application language control's segmented Chinese, English and visual shortcuts. When additional catalogs exist, insert one language menu after the visual shortcut; all extra languages share that slot. Show the selected language's short label there and native names inside the menu. Reuse the sliding selection, rounded paper panels and control motion. The native popover owns visibility, outside-click dismissal and Escape; the language control owns menu navigation, focus and viewport placement. Keep touch rows large and long lists scrollable. Locale labels belong to the shared registry. Use a globe and chevron for the unselected picker, and each language's own full name in the menu, following W3C language-navigation guidance.

Help-only indicators toggle their guidance on click or tap and dismiss on a second activation, outside tap, Escape or focus leaving. Action controls keep their direct click action and offer touch guidance on long-press. Tooltip owns both interactions; pages do not add their own open state or timers.

Add a tooltip when it explains an action, a limitation or a status that needs context. Plain names, decorative participants and self-explanatory text do not need another popup. Keep participant details on their existing click action and state explanations on the dedicated status indicator.

When a nickname is clipped, the shared tooltip reveals its complete literal text in every language mode, without a comic or repeated role/status labels. Show this only after detecting actual truncation; resize and name changes must recheck it. Preserve hover, keyboard and touch-hold access, and the participant's existing click action. A complete or wrapping name needs no extra focus stop or popup. If a status tooltip already wraps the row, add the clipped name there rather than nesting another tooltip.

Tooltips, state overlays and entry/error pages reuse the same illustrative scene in every mode. Chinese and English add a concise caption beneath it; pure-visual mode keeps the scene and its playful pictograms as an explicit alternative. Literal names and addresses keep their exact text. An invitation explanation retains its link scene; simply revealing a clipped name needs only the name. Do not substitute an unrelated action just to fill a tooltip. Illustration and caption explain the same action or current fact, with one tone and motion owner. Mount scenes only while their tooltip or overlay is shown; captions remain readable throughout.

Metric icons and hints share the metric-presentation.ts definition in details and overview headings. Frames, packets, jitter and audio repair have distinct symbols; related time measurements keep a clock with a scene identifying the measured stage. Illustrations explain a metric, never invent its current value, threshold or quality verdict.

Shared buttons and chips use pill shapes, a quiet lower edge and a short lift on hover or keyboard focus, then compress on press. Inputs and option tiles share softer corners. Keep a distinct focus ring and a persistent selected state; disabled controls must not pretend to activate. Reduced motion keeps the colour, outline and selected position without decorative displacement.

Cast And Objects

The brand mascot keeps its own identity, separate from ordinary participants. Participant characters should leave room for that distinctive presence.

Meaning Representation
The person using the pictured action Green pawn (YOU / --you), in every panel
Somebody else Blue pawn (SKY), or another distinct non-green illustration colour
Host role Gold crown above the head: rounded three-point outline, dark gold edge and a quiet lower rim; the standalone absent-Host symbol uses the same outline, unfilled and dashed
Shared or watched media Small television, including antenna, body and feet
Browser application Browser chrome around content; not a second design of television
A captured window or display Window title bar or display stand, with the shared media metaphor kept distinct
Server forwarding media A server on the media path; opening a Site alone does not imply SFU

These are identity/object colours, not status. A green pawn remains green in a failed scene; a successful scene does not turn other people green. Real roster identities retain the shared UUID colour function, not the illustrative "you versus others" palette. Actor positions and identities remain stable from the first panel to the result.

Room pawns, tooltip/status comics and introduction participants use a round head, half-oval body and two restrained eyes. Reuse the shared figure and face geometry in product illustrations so expressions stay inside the head as it scales. Larger scenes can add a small lean; small status panels may omit facial detail to keep the action clear. When a gesture needs hands, use small floating round shapes. A held gamepad is a scene prop; a separate role crown identifies the host and moves with the body. Its gold is an identity colour, not a warning or achievement. The share control retains its cast icon. The cast represents friends sharing games, drawings and other screen content. Exploratory figures are not alternate participant identities. Keep the brand mascot distinct.

The couch has a back, seat, arms and feet. A full room reflows into rows of seats without hiding people or requiring horizontal scrolling. Topology preserves each participant and actual parent edge at a readable scale; reduce spare spacing, then use a vertical outline when depth exceeds the available width.

Couch upholstery uses the fixed warm orange/yellow --couch / --couch-dark palette. Never draw upholstery from the participant palette or randomize it by room. Keep automatic participant colours outside the upholstery's amber/orange range and the crown's gold; check all eight tokens against both objects in light and dark themes. The crown retains a bright gold fill with a dark gold edge. Figures and exterior upholstery use flat fills without outline strokes. Use differences in tone, spacing and name tags to keep people readable; retain only the few interior seams that clarify cushions. Apply this convention to the website and README cast as well as the product UI.

Symbol Reference

This reference applies to controls, status strips, comics, overlays, document titles, placeholders and public product demonstrations. A symbol keeps its basic meaning across those surfaces. Its nearby label identifies the affected object; it must not silently acquire a different measurement or permission. This reference describes functional meaning in context, not exclusive ownership of every shape. Decorative lettering, welcome ornaments and shared screen content do not become controls or measurements by using a familiar symbol.

Glyph owns small-icon geometry and the accepted GlyphName union. Use it for controls and embedded comic symbols; reuse MiniTv, Pawn, InviteLink and the other shared scene objects for illustrations. Select existing meanings before adding an icon. A new meaning needs a row here and a rendered example in the existing catalogue. A typo or missing icon must fail type checking rather than silently render a warning triangle.

Meaning / 含义 Symbols Use and boundary
Participants and room / 人与房间 users, couch, door People, shared room, room entry. Use the shared pawn for a person and HostMark for Host authority.
Shared screen / 共享画面 tv, MiniTv, 📺 Media or its sharing source. The TV beside the Host name identifies the source; the crown on a person identifies the role.
Start and choose a source / 分享与选源 cast, share, switchSource Start sharing, capture a screen, replace the current capture source respectively. A captured window keeps window chrome or a display stand.
Capture source / 采集来源 window, display An application window or a whole display; these nouns remain distinct from the source-switch action.
Invitation URL / 邀请链接 link, InviteLink, linkOff A URL and its disabled/revoked form. Keep the chain when copying or rejecting it. Copying is local; a send-to-chat scene is a separate action.
Credential / 凭证 key, password dots Site passphrase or room password, identified by the field label. Room-code admission with a password shows both fields.
Restriction / 受限 lock Restricted entry, concealed password or a setting fixed by availability; show the affected object. A lock never promises anonymity or secure media.
Site and public entry / 站点与公开入口 globe Browser/Site entry or code-based public entry. It does not claim internet reachability.
Connections / 连接 network, branch, signal, wifiOff, server Topology, branching, signaling, disconnected signaling and the named server. A server on a media path means forwarding; a Site backend or control-link server alone does not imply SFU. An invitation chain does not represent signaling.
Playback / 播放 play, pause, stop Play/resume, pause, end. The control label states whether it affects local viewing or the Host's share. Stop is distinct from a paused or idle room.
Audio / 声音 speaker, speakerOff Audio and mute/no audio, qualified by the source or local playback label. A source track's presence does not establish delivered sound.
Size and viewing mode / 尺寸与观看模式 expand, contract, pip, pipExit, theater, theaterExit Expand/restore, enter/leave picture in picture, enter/leave theatre mode. The same size symbol can accompany a resolution measurement.
Local actions / 本地操作 copy, save, pencil, eye, eyeOff Copy, save, edit, reveal and conceal the named object. An action icon does not prove completion.
Repeat and disclosure / 重试与展开 refresh, chevron, arrowRight Repeat/refresh, expand/collapse, proceed/enter. Direction follows the control's action; no arrow alone establishes delivery.
Transfer and upgrade / 传输与更新 arrowUp, arrowDown Outbound/inbound or upload/download, qualified by the adjacent label. An explicit update label may use the upward arrow for upgrade; neither arrow is a connection-quality rating.
Diagnostics / 诊断 cpu Technical diagnostics in the labelled diagnostic control; in metrics the same processor identifies encoding work. The surrounding control or measured field states the scope.
Settings / 设置 sliders, mountain, balance, frames Settings, preserve image detail, balanced preference, preserve frame rate. The frame-rate preference uses the same frames as the measured value.
Progress and result / 进度与结果 loader, alert, check, x In progress, a problem, confirmation/positive result, cancellation/negative result. The status owner supplies severity; the shape alone cannot set it.
Theme / 主题 sun, moon Light/dark appearance in theme controls. A moon in an idle-room scene means rest, with the idle scene providing that context.
Welcome decoration / 开场装饰 gamepad, popcorn, clapperboard, trophy, gift, flag, heart, bulb, zap Games, snacks, film, achievement, gift, next stop, affection, discovery and energy. These may decorate the welcome line, never a measured speed, failure or connection verdict.

Metrics use METRIC_PRESENTATION in both summaries and details. Labels, units and stage-specific comics distinguish related values; views do not choose their own symbols.

Topology hover and keyboard focus use neutral outlines; selection adds a heavier outline and text weight. Connection colours remain owned by route/readiness facts, so interacting with a node cannot look like a connection-state change.

Measurement / 指标 Symbol Boundary
Frame rate / 帧率 frames Video frames per second, including capture/input frame rate.
Packet loss / 丢包 packetLoss Missing network packets, including audio packets.
Dropped frames / 丢帧 frameDrop Discarded video frames in the stated observation interval; never substitute packet loss or a cumulative total under the same interval label.
Jitter / 抖动 jitter Variation in arrival timing, including audio jitter.
Audio concealment / 音频补偿 audioRepair Missing audio concealed by the decoder.
Rate / 速率 gauge, speaker for audio rate Bitrate or outgoing rate; the unit remains visible.
Duration / 耗时 clock RTT, encode/decode time, freeze duration, playout or buffer time. The label and comic identify the measured stage.
Freeze count / 卡顿次数 pause Count of interrupted video progress, distinguished by its metric label from intentional pause.
Encoder and codec / 编码器与编码格式 cpu, puzzle Processing implementation and encoded format respectively.

Text-only surfaces retain the same meanings:

Surface Standard and owner
Activity in document titles Title catalogs: 📺 sharing/viewing, 🛋️ ready room, 💤 idle, ⏳ waiting/starting, ⏸️ paused, ▶️ waiting for playback, ⏹️ ended, ❗ unavailable. Secondary decorations cannot replace this leading meaning or imply new progress.
A problem beside an activity Media status supplies ⚠️ from actual facts; document-title only composes and rotates titles.
Default names display-name owns 📺 for the sharing source and 👤 for a Viewer in visual mode. Preserve user-entered emoji names as data; never infer role from their characters. viewer-presence owns duplicate-name suffixes.
Visual-mode shortcut ✦ in the language control and its documentation; not a success or quality mark.
Input placeholders Four slots represent the four-digit room code. Password dots mask a field; their illustrated count imposes no password length. Numeric samples reuse the actual field's --mono typeface and weight. Real inputs retain localized labels.
Unknown values — means unavailable/unknown, never zero or a healthy result. Keep exact values and units whenever known.
Capability values ✓ / ✗ answer the adjacent boolean capability, not whether an entire route or share succeeded.
Shortened text … means truncation. Preserve the full nickname/URL for reading and copying; never turn an exact value into a decorative code.
Welcome cipher WelcomeLine owns the paired symbols and pixel words, tied to the same selected line. They are decoration, not hidden connection state.

Semantic Colour And Shape

Use the existing theme tokens in src/client/styles.css. The shared comic-presentation.ts maps meanings to those tokens for tooltip outlines, carets, result panels and verdict marks. Do not choose independent hex colours or animation rules inside an individual scene.

Meaning Token / code tone Panel and symbol
Explanation, preference, ordinary action, intentional closure or unknown state Neutral ink / off Neutral panels; illustrate the action/object without a success stamp
Confirmed completion or delivered media Green --live / live Neutral before, green result; check or completed object
Still usable with a limitation, unavailable optional capability, or intentional media pause Amber --warn / warn Neutral before, amber result; limit, pause, lock or unavailable mark on the affected part
Confirmed failed or blocked action Red --danger / bad Neutral before, red result; cross, broken path or other explicit failure mark
Work in progress or awaiting an action/frame Blue --action / busy Neutral before, blue current/result panel; connection, progress or play symbol

Recovery retains amber because service is interrupted while work continues. Waiting for a Host and unknown observations remain neutral. A control's prospective action is not proof of success: opening details, switching theme, adjusting volume or offering P2P stays neutral. Actual copy feedback can change that same hint to green or red, using the existing operation result.

Review meaning at the call site. A current admission badge shows the credential accepted by room access, not the act of switching privacy. Password input is not proof of admission; copying writes to the local clipboard and does not send to a friend. An audio track's presence does not establish a locked control or delivery to another device.

Two-panel comics always read before/context on the left and result/current condition on the right. Only the result carries the semantic accent; a single panel carries the current condition. Tooltip outline and caret use that same tone in Chinese, English and visual modes. Neutral uses theme ink, not literal white. Keep paper fills quiet; do not tint the whole scene green/yellow/red. Meaning must also survive without colour through objects, symbols and accessible localized names. Never show celebration or a completed live path as the verdict of a failed or unavailable operation.

A missing optional feature is not a failed media path. For example, unavailable NAT prediction marks only extra candidate paths; ordinary P2P remains a neutral possibility. A rejected PiP request is failure; lack of PiP support is a limitation.

Motion Grammar

Presentation Rule
Action demonstration (demo) Play one meaningful transition when shown, then hold its result
Work actually continuing (progress) Repeat a gentle connection/recovery beat while that state exists
Settled success, failure, limitation, pause or idle (still) Keep the result readable while a related subject moves briefly, then holds; do not repeat the operation, retry or celebrate

Demonstrations and progress share the existing 3.2-second comic beat. The main action belongs in its first half, followed by a readable hold; small internal staggering is allowed. At most two independent movers per panel. An explanatory slider describes purpose and available range, not its live numeric value. Decorative sparkle must support the pictured action, never fake current success.

Reduced motion and settled states reuse each scene's same explicit final pose. Disabling animation alone is insufficient if the base SVG hides the result or shows a misleading starting pose. Static styling is scoped to its SVG; one still tooltip must not freeze another progress scene. New keyframes must end in the documented result rather than reset for an obsolete loop.

Every comic surface, including overlays and error pages, needs visible motion in its subject: a paused scene's steam rises, a loose cable sways, or packets advance toward a bottleneck. Whole-scene entrance, blinking or sparkle alone does not satisfy this. Settled result marks stay readable during that movement. Changing the comic's meaning starts its animation afresh; changing a caption, language or numeric value alone does not. The preview's reduced-motion setting uses the same explicit final poses as the system setting. Check scenes in isolation, including settled overrides and quick re-entry while a tooltip is exiting, so another mounted scene cannot hide missing CSS or a finished animation. Reduced-motion rules must outrank settled-motion overrides. Also check the actual controls together, in every relevant property combination. Judge motion at its displayed size: a changing transform on a tiny figure can still look frozen. The default scene catalogue does not cover a Pill's settled override or missing preview states by itself.

The tooltip panel itself uses the same restrained entrance/exit for every tone. Replay belongs to opening/hovering/focusing the whole control, not just its SVG. Ordinary controls keep their icons visible during hover and keyboard focus; surface colour, lift, focus and press feedback carry the interaction. Reserve icon drawing/replay for primary actions such as starting a share or joining a room, and for explicit state-entry feedback. The whole control owns the trigger. Stroke and solid drawings share one total duration and easing; stroke count must not lengthen the animation. Disabled controls and passive status icons retain their informative pose; busy indicators retain their progress beat. Do not add a per-scene timer or another interaction/state owner. Outside status comics, the brand mascot and participant figures may blink or glance occasionally; a pictured screen can guide the Host's gaze. Keep eye gestures and small body leans brief, separated by long pauses and offset between people. A participant's UUID seeds the cadence; align its phase to wall time in every view, including later mounts and return from background. Names, roster order and the observer's role do not reseed it. Device clock skew bounds cross-device precision; cosmetic motion adds no signaling or media state. They express personality independently of connection feedback. Follow the system's reduced-motion preference, keeping a natural, open-eyed pose when enabled; participant gestures have no separate product playback control. Status comics still follow the table above.

Introduction artwork is separate from product status. Website/README scenes may repeat a short action with a generous pause. Keep broad movement to one or two focal elements; small participant gestures follow the quiet cadence above. Provide a pause or hide control for automatic loops, and a useful static pose for reduced motion. Product-state comics still follow the table above.

Entry screens may carry one quiet, original welcome line in Chinese or English text mode. Pure-visual mode pairs familiar pictograms with static pixel pseudo-lettering tied to the same line. Hide that visual cipher from assistive technology; the ordinary text sentence remains readable. The selected line stays stable during that visit, including mode changes, and never replaces an action, error, loading message or connection progress. Keep it on one line, apart from the actions; primary controls take precedence when space is tight.

Ownership And Incremental Review

  • Existing status/operation facts outrank the scene default. Reused warning artwork can represent a warning or a confirmed failure; pass the actual tone.
  • comic-presentation.ts owns defaults and semantic tokens; Frame, RedX, rmBlock, Comic and HintComic apply the shared grammar. Scenes own only their cast, causal illustration and final pose. Tooltip owns interaction and placement. Do not duplicate these rules in each scene or page.
  • Keep the semantic kind and tone in all languages; localized text changes expression, not severity. Symbol-only controls retain accessible names.
  • For each changed scene inspect its start, transition and settled pose in both themes, reduced motion and narrow layouts. Compare success, failure, limitation and neutral neighbours in the catalogue. Code-level tests do not establish visual clarity.
  • Update this owner when accepting a new convention. Product documents link here instead of copying the palette, cast or animation table.

Interaction References

Carbon status indicators supports combining semantic colour with shape and symbols; Carbon motion distinguishes functional feedback from occasional expressive movement.

Web Animations start time provides the native timeline alignment used by participant gestures.

Carbon tooltip guidance supports concise, contextual help where it adds information; required instructions stay visible beside the action.