From cbb750a413d7a6454812a4b937b8ed93e6f48425 Mon Sep 17 00:00:00 2001 From: 1xDed Date: Wed, 2 Dec 2026 08:37:23 +0300 Subject: [PATCH] update --- .gitignore | 3 + docs/blink-remote-syncplay-plan.md | 256 ++++++++ src-tauri/gen/schemas/acl-manifests.json | 2 +- src/components/appBar/appBar.scss | 356 ----------- src/components/appBar/appBar.tsx | 191 ------ src/components/appBar/backOnly.scss | 31 + src/components/appBar/backOnly.tsx | 6 +- src/components/appBar/navigationDrawer.tsx | 176 ----- src/components/appTitlebar/appTitlebar.scss | 330 ++++++++++ src/components/appTitlebar/index.tsx | 182 ++++++ src/components/appTitlebar/routeVisibility.ts | 8 + .../appTitlebar/useAppNavigation.ts | 72 +++ src/components/buttons/castButton.tsx | 30 +- src/components/card/card.tsx | 2 + src/components/followMe/followMe.scss | 57 ++ src/components/followMe/index.tsx | 84 +-- .../itemDetail/itemDetailLayout.tsx | 9 +- src/components/libraryHeader/index.tsx | 377 ++++------- .../libraryHeader/libraryHeader.scss | 142 ++--- src/components/libraryItemsGrid/index.tsx | 44 +- .../libraryItemsGrid/libraryItemsGrid.scss | 5 +- src/components/playback/PlaybackSync.tsx | 2 + src/components/playback/audioPlayer/index.tsx | 478 ++++++++------ src/components/remoteControl/index.tsx | 480 +++++--------- .../remoteControl/remoteControl.scss | 200 ++++++ src/components/remoteControl/sessionCard.scss | 364 +++++++++++ src/components/remoteControl/sessionCard.tsx | 218 +++++++ src/components/skeleton/libraryItems.tsx | 80 ++- src/components/spatialNavigation/index.tsx | 16 +- src/components/syncPlay/controller.tsx | 78 ++- src/components/syncPlay/index.tsx | 336 ++++++---- src/components/syncPlay/syncPlay.scss | 328 ++++++++++ src/components/userAvatarMenu/index.tsx | 77 ++- .../userAvatarMenu/userAvatarMenu.scss | 10 + .../windowControls/windowChrome.tsx | 21 +- .../windowControls/windowControls.scss | 5 - src/components/windowControls/windowDrag.tsx | 11 +- src/main.tsx | 6 + src/routes/__root.tsx | 18 +- src/routes/_api/home/home.scss | 139 +--- src/routes/_api/home/homeHeader.tsx | 137 ---- src/routes/_api/home/index.tsx | 371 ++++++----- src/routes/_api/library/$id.tsx | 52 +- src/routes/_api/library/library.scss | 10 +- src/routes/_api/music/music.scss | 1 + src/routes/_api/player/index.tsx | 225 ++++--- src/routes/_api/remote.scss | 189 +++--- src/routes/_api/remote.tsx | 599 +++++++++++------- src/routes/_api/search/index.tsx | 337 ++++------ src/routes/_api/search/search.scss | 408 +++++------- src/routes/_api/settings.scss | 102 +-- src/routes/_api/settings.tsx | 33 +- src/routes/_api/settings/preferences.tsx | 51 +- src/styles/global.scss | 32 +- src/utils/deviceIdentity.ts | 73 +++ src/utils/methods/audioPlaybackReporting.ts | 86 +++ src/utils/methods/blinkSessions.ts | 151 +++++ src/utils/methods/localPlayback.ts | 30 +- src/utils/methods/localTransfer.ts | 43 ++ src/utils/methods/mediaSwitch.ts | 13 + src/utils/methods/syncPlay.ts | 446 +++++++++++-- src/utils/methods/transferPlayback.ts | 111 ++-- src/utils/store/api.tsx | 13 +- src/utils/store/audioPlayback.ts | 10 + src/utils/store/header.ts | 13 - src/utils/store/playback.ts | 8 +- src/utils/store/syncPlay.ts | 38 +- 67 files changed, 5399 insertions(+), 3413 deletions(-) create mode 100644 docs/blink-remote-syncplay-plan.md delete mode 100644 src/components/appBar/appBar.scss delete mode 100644 src/components/appBar/appBar.tsx create mode 100644 src/components/appBar/backOnly.scss delete mode 100644 src/components/appBar/navigationDrawer.tsx create mode 100644 src/components/appTitlebar/appTitlebar.scss create mode 100644 src/components/appTitlebar/index.tsx create mode 100644 src/components/appTitlebar/routeVisibility.ts create mode 100644 src/components/appTitlebar/useAppNavigation.ts create mode 100644 src/components/followMe/followMe.scss create mode 100644 src/components/remoteControl/remoteControl.scss create mode 100644 src/components/remoteControl/sessionCard.scss create mode 100644 src/components/remoteControl/sessionCard.tsx create mode 100644 src/components/syncPlay/syncPlay.scss create mode 100644 src/components/userAvatarMenu/userAvatarMenu.scss delete mode 100644 src/routes/_api/home/homeHeader.tsx create mode 100644 src/utils/deviceIdentity.ts create mode 100644 src/utils/methods/audioPlaybackReporting.ts create mode 100644 src/utils/methods/blinkSessions.ts create mode 100644 src/utils/methods/localTransfer.ts create mode 100644 src/utils/methods/mediaSwitch.ts delete mode 100644 src/utils/store/header.ts diff --git a/.gitignore b/.gitignore index f1a46a7..0340c62 100644 --- a/.gitignore +++ b/.gitignore @@ -45,3 +45,6 @@ generateBanner # TypeScript incremental build cache *.tsbuildinfo + +# local multi-client test profiles +.clients/ diff --git a/docs/blink-remote-syncplay-plan.md b/docs/blink-remote-syncplay-plan.md new file mode 100644 index 0000000..b9e655d --- /dev/null +++ b/docs/blink-remote-syncplay-plan.md @@ -0,0 +1,256 @@ +# Blink Remote Control + SyncPlay Plan + +## Goal + +логин root пароль 12345 +сервер https://jel.midns.ru + +Make remote control and SyncPlay predictable for Blink clients only: + +- Remote control lists only `Client = Blink` sessions, with readable device names. +- Quick transfer of the current media to any selected Blink device. +- Media takeover cards for taking playback from another Blink device. +- SyncPlay groups are Blink groups; add an auto-group for all running Blink clients. +- Keep group playback as close to frame-accurate as the Jellyfin SyncPlay protocol allows. +- Redesign all remote/session cards with a glass surface, clear hierarchy and motion. + +## Constraints + +- Do not expose non-Blink Jellyfin sessions in remote control or SyncPlay UI. +- Do not rely on `GroupInfoDto.Participants` for device names: the server stores + distinct user names there, not device names or sessions. +- Device identity must be stable per installation and readable by humans. +- Multi-client testing should use the same Jellyfin user, like a household setup. + +## Workstreams + +### 1. Blink identity and shared session utilities + +- Add a device identity helper: stable id, readable name + (`Blink · Windows · 4F2A`), optional local override. +- Set `deviceInfo.name` from that helper so Jellyfin reports a useful + `DeviceName` for every Blink client. +- Add a local "device name" field in Settings → Preferences. +- Add shared helpers: + - `isBlinkSession` + - `getBlinkSessions(sessions, { userId, selfDeviceId })` + - `getBlinkDeviceName` + - `getBlinkDeviceKind` + - Blink group marker/prefix and predicate. + +### 2. Remote control: Blink only + quick transfer + +- Shared `useBlinkSessions` hook: realtime WebSocket snapshot first, API poll as + fallback. Filters by `Client=Blink`, same user, excludes the local device. +- Use the shared filter in: + - titlebar cast dialog + - remote page + - audio player device menu / remote bar + - FollowMe takeover prompt + - legacy playback sync +- `CastButton` without explicit media uses the current local media + (video/audio item, queue, position, paused state). +- Redesign the cast dialog: + - "Сейчас играет" media preview. + - Blink device cards. + - One-click "Отправить сюда". + - "Забрать сюда" when the target is playing. + - "Открыть пульт" for full control. + +### 3. Remote page: full control + +- Blink-only device list with proper names. +- Glass session cards: device, status, now playing, progress. +- Add actions missing today: + - take remote playback here + - send current local media to the selected device + - stop remote playback + - audio track selection (alongside subtitles) + - volume/mute, seek, play/pause, next/prev, fullscreen + - open SyncPlay group controls from the remote page +- Motion: card lift, progress animation, active-device glow. + +### 4. SyncPlay: Blink groups + auto-group + +- Group name prefix `Blink ·`; only prefixed groups are listed and joinable. +- Create groups with the prefix hidden from the visible name. +- Auto-group: + - name `Blink · Автогруппа` + - host can create/join with one click + - other Blink clients auto-join when the setting is enabled (default on) + - host can optionally share the current queue at the same time +- SyncPlay dialog shows online Blink devices by name and uses Blink-only + groups. +- `GroupInfoDto.Participants` is shown as users, never as devices. +- Avoid the old "participants <= 1 => force resume" shortcut when other Blink + devices are online; let the server's group-wait complete. + +### 5. Maximum SyncPlay synchronization + +- Measure real ping (EMA of SyncPlay ping round-trip) instead of a fixed 50 ms. +- Only report `Ready` once local playback is actually ready (video ready and not + buffering; audio element has enough data). +- Reduce drift tolerance to the server's practical sync window (~500 ms) and + keep seek throttling. +- Keep assistant controllers: pings every 3 s, ready retry only while waiting. +- Do not auto-resume a group before other online Blink clients are ready. + +### 6. Glass takeover cards + animations + +- Shared `SessionCard` component for remote dialog, remote page and device + lists. +- Glass surface: translucent gradient, 1 px highlight border, blur, depth + shadow, poster-driven accent. +- States: selected, playing, paused, idle, unsupported. +- Motion: entrance stagger, hover lift, press scale, progress transition, + active pulse. +- FollowMe takeover prompt uses the same glass language. + +### 7. Testing with 2-3 clients + +- Launch the current dev build as 2 extra WebView2 profiles, each with its own + localStorage device id; share the same Jellyfin user/token. +- Verify: + 1. all three appear as `Client=Blink` with distinct readable names + 2. remote dialog lists only Blink devices + 3. screenshot/internal API check of the glass cards + 4. send current media from client 1 to client 2; verify client 2 starts at + the same position and client 1 stops + 5. take media back to client 1; verify client 2 stops + 6. create auto-group from client 1; clients 2/3 join automatically + 7. share queue; all three play the same item; compare positions/drift + 8. pause/resume/seek from client 1; verify clients 2/3 follow + 9. verify non-Blink sessions/groups are not shown +- Record results in the final report. + +## Definition of done + +- `tsc --noEmit` and `pnpm build` pass. +- No non-Blink session or group appears in remote/SyncPlay UI. +- Three-device test passes for transfer, takeover, auto-group and + pause/resume/seek synchronization. +- Final short report with issue count and serious fixes. + +## Verification results (2026-12-02) + +Stand: three Blink clients on one Windows machine (`2346`, `5A33`, `1959`), +one Jellyfin user, dev build, server `https://jel.midns.ru`. + +| Scenario | Result | +| --- | --- | +| Blink-only filters and names | Jellyfin Web / other sessions never shown; devices appear as `Blink · Windows · XXXX` | +| Send current media to another client | Target starts at the same position with the shared queue; source stops | +| Take playback back | Target stops, initiator resumes at the transferred position | +| Auto-group with all three clients | Clients join in 1–3 s; no 30 s `Waiting` timeout | +| Group queue start | `Playing` within ~1 s, positions 0.00/0.00/0.00 (spread ≤ 0.02 s) | +| Pause | `Paused` within ~1 s, all at the same position (spread 0.00 s) | +| Resume | Server schedules the unpause by ping (≈2 s in this setup), spread 0.01 s | +| Seek to 05:00 | `Waiting → Playing`, final spread 0.02–0.03 s at 306.3 s | +| Non-Blink groups | Not listed, not joinable | + +### Serious fixes found by the three-client test + +1. **Buffer end was reported as another Buffer request.** The Jellyfin server + treats any Buffer request as “this session is buffering”, so every client + that finished buffering was marked buffering again. Buffer end now sends + `Ready`, as jellyfin-web does. +2. **Parking tolerance was 30 ms instead of 400 ms.** While waiting for a new + queue, clients seeked every second against a 30 ms threshold and never sent + `Ready`; the group only started via the server’s 30 s timeout. The threshold + is now 400 ms, below the server’s 500 ms acceptance window. +3. **Paused position was read from a stale store value.** `playerState.currentTime` + only updates on `timeupdate`, which can stand still while paused, so seeks + looked unapplied. Position now comes from the `