Skip to content

feat(attachments): preview and play video attachments - #658

Merged
nixuuu merged 1 commit into
devfrom
feat/preview-play-videos
Nov 13, 2026
Merged

nixuuu merged 1 commit into
devfrom
feat/preview-play-videos

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

Videos attached to threads now open in the shared media viewer instead of downloading as generic files. MP4/MOV and WebM are identified from container bytes, show a video icon and known duration, and retain their original bytes for workers.

The BFF serves owner-scoped HTTP byte ranges from bounded PostgreSQL reads (256 KiB per RPC), including linked-computer attachments, 206/Content-Range, 416, HEAD and If-Range. The shared web/desktop lightbox has native video controls, download, Space/arrow shortcuts and pause on close, hidden tab or offscreen. Playback starts muted and requires a user action. Mobile gets a raster poster, duration and Share/Save with “Play on a computer”; native playback follows in the next stack layer.

Decisions: retain the existing 20 MiB default / 30 MiB ceiling because uploads and worker delivery still buffer originals. Use a neutral WebP through existing sharp rather than adding a native video decoder. Keep playback in the viewer so the timeline does not retain decoders. Existing stored MP4/MOV MIME metadata also enables playback; legacy homes require a whole-file fallback within the upload cap.

Validation: focused gateway/BFF integration passes (sniffing including disguised HTML/SVG, ownership, limits, ranges and linked-home routing, worker delivery); frozen-lockfile install, full monorepo typecheck, lint, formatting, generation check and web production build pass on the rebased head. Current-head CI passes all four test shards, static checks and builds. The ask_user cancellation test failed on the first CI attempt and passed on the failed-job retry; it also passed in the local sharded run.

Local suite results: the final four shards executed all 518 test files exactly once, with 2,766 passing tests, 166 skips and 7 failures in configuration-sync recovery and mirror recovery. Both complete files then passed (19 tests, 147 assertions). An earlier full local run also hit linked-computer moves/relay, diagnostics and GitHub PR deduplication; all four complete files passed on rerun (48 tests, 860 assertions). Every full shard and complete-file rerun left no owned temporary files. These local failures are disclosed separately from the green current-head CI gate.

Browser review on an isolated remote production stack passed in light/dark, desktop/phone widths, with 2-second and 2-minute clips, long filenames, hover poster, muted playback, seeking to 90 seconds, keyboard handlers, download availability, and pause/removal on close. A browser Range request returned 206 and the exact requested bytes. Real linked-computer browser review was unavailable in the isolated fixture; linked routing is integration-tested. No UI tests added. Mobile device check pending: reported MacStudio device host error. No native dependencies changed in this layer.

Expo fingerprints unchanged: iOS 6ddec9ef559ee0095ac33e94ff9418a942053b17; Android 5f6eae3ab278f1cd543e9ed763f923a319b65ec9.

Copy audit (§8): generic file actions → “Play video”, “Share video” / “Save video”, and “Play on a computer” describe the available action; playback failure → “Could not play this video. Download it to open it in another app.” states the problem and next action. Sentence case, verb-led actions, existing glossary, no new terms or decorative copy. Short and long filename truncation/wrapping checked at desktop and phone widths in light/dark.

Stack #660: native mobile playback follows in #659. Merge the stack together.

@nixuuu
nixuuu force-pushed the feat/preview-play-videos branch from c9ed0c6 to d79ec85 Compare November 13, 2026 17:42
@nixuuu
nixuuu added this pull request to stack #660 November 13, 2026 17:42
@nixuuu
nixuuu force-pushed the feat/preview-play-videos branch from d79ec85 to 29aed2f Compare November 13, 2026 17:43
@nixuuu
nixuuu force-pushed the feat/preview-play-videos branch from 29aed2f to 073828c Compare November 13, 2026 17:51
@nixuuu
nixuuu force-pushed the feat/preview-play-videos branch from 073828c to 24a1198 Compare November 13, 2026 18:53
@nixuuu
nixuuu marked this pull request as ready for review November 13, 2026 19:25
@nixuuu
nixuuu merged commit 24bbcc7 into dev Nov 13, 2026
17 of 19 checks passed
@nixuuu
nixuuu deleted the feat/preview-play-videos branch November 13, 2026 19:34
nixuuu added a commit that referenced this pull request Nov 14, 2026
Video attachments now play inside the mobile viewer with expo-video
(~58.0.14): poster, play/pause, native seeking and fullscreen controls.
Playback requires a tap, starts muted, and pauses when the viewer
closes, its route loses focus, or the app backgrounds. The viewer keeps
the existing reduced-motion behavior. Share/Save remains available.
Composer tiles adopt the gateway's detected kind after upload, including
videos renamed with a non-video extension.

Authenticated streaming retains the existing pinned, routed gateway
client. AVPlayer/ExoPlayer cannot use Canopy's self-signed certificate
pin directly, so a small local Expo module serves bounded reads over an
ephemeral loopback listener. It binds only 127.0.0.1, uses an
unguessable path, expires with the viewer or after 15 idle minutes,
permits four connections, and never receives device credentials or a
remote gateway URL. Active reads renew the idle deadline so long videos
remain seekable. Every metadata/chunk RPC remains owner-scoped,
including linked computers; 256 KiB writes provide backpressure and
cancellation. Production Android permits cleartext only for loopback;
the existing development HTTP opt-in is preserved. No signed remote
URLs, TLS bypass or model transcoding.

Native runtime change: `runtimeVersion: { policy: "fingerprint" }`
remains in effect. Production profile fingerprints change:

| Platform | Before | After |
| --- | --- | --- |
| iOS | `6ddec9ef559ee0095ac33e94ff9418a942053b17` |
`f05d9756d267ff22288f59b90575c27b0038c9ab` |
| Android | `5f6eae3ab278f1cd543e9ed763f923a319b65ec9` |
`c0977af96d22d12c9c7d16dc8055d4c4ffdca1cc` |

A new native build is required for expo-video and the media bridge. No
EAS builds or OTA publication were run. Native compilation and device
playback are unverified; the device check is pending because of the
reported MacStudio device-host error. The maintainer handles native
builds.

Validation: frozen-lockfile install, generation check, full monorepo
typecheck, lint, formatting, web production build, and iOS/Android
exports pass on the rebased head. Current-head CI passes all four test
shards, static checks and builds. Focused gateway tests pass (7 tests,
98 assertions), including native-read ranges, multi-chunk streaming,
invalid ranges, owner denial, cancellation, and disguised HTML. The
attachment and domain checks also pass through check:tmp (17 tests, 143
assertions, no temporary files left). Expo autolinking resolves the
local module on both platforms. Android prebuild verifies production
loopback-only HTTP and the existing dev opt-in. The local config plugin
is explicitly present in fingerprint inputs. No UI tests added.

Local suite results: the final four shards executed all 518 test files
exactly once, with 2,766 passing tests, 166 skips and 7 failures in
configuration-sync recovery and mirror recovery. Both complete files
then passed (19 tests, 147 assertions). An earlier full local run also
hit linked-computer moves/relay, diagnostics and GitHub PR
deduplication; all four complete files passed on rerun (48 tests, 860
assertions). Every full shard and complete-file rerun left no owned
temporary files. These local failures are disclosed separately from the
green current-head CI gate.

Copy audit (§8): “Play on a computer” → “Play video” because playback is
now available on the device. New “Loading video…” describes ongoing
work; playback failure → “Could not play this video. Retry or save the
file to open it in another app.” gives a concrete recovery action.
Verb-led actions, sentence case, no new glossary terms, no decorative
copy or duplicated status. Shared viewer/chip filenames checked at
desktop and phone widths; native device text/layout check remains
pending.

Stack #660: this PR depends on #658. Merge the stack together.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant