Repository navigation
refactor(media): unify file and media previews across clients - #9253
Merged
Merged
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
client-runtimeso web and mobile use the same rules.Native long-press menus on markdown file chips are in #9258.
Why
The web and mobile clients had separate path parsers, media resolvers, URL lifecycle code, and viewer paths. The copies had already drifted. Some videos downloaded before playback, expired URLs left expanded viewers stuck, and iOS media sometimes opened in React Native viewers instead of AVKit or Quick Look.
This puts the shared decisions in one package and leaves each client responsible only for presentation. On iOS, native viewers own media playback and document preview.
UI changes
Pre-fix tap and long-press race reproduced on device: screen recording
Testing
Checklist
Created with gpt-5.6-sol using the Codex harness in T3 Code.
Note
Unify file and media preview parsing and playback across web and mobile
client-runtime(parseMarkdownFileLink,resolveMediaSource) and replaces local parsing implementations in web, mobile, and the t3-markdown module with these shared helpersMediaVideoPlayer; mobile removes the Expo-basedVideoPlaybackandMediaVideoPreviewModal, and web replaces raw<video>rendering inExpandedImageDialog,MessagesTimeline, andChatMarkdownwith the shared playerAssetUrlStateandassetUrlStateFromResultintoclient-runtime; web and mobile asset URL hooks now derive loading/failure/success through the shared mapper instead of local inline checksMediaActionIdunion andMediaActionsMenu/useMediaActions; both platforms now expose save/share/open-file actions through the same identifiers and long-press surfacesresolveViewedImageAssetandViewedImageAssetnow only return media-file resources, removing the attachment-resource variant — callers expectingattachmentresources from viewed workspace images will break; iOSFilePreviewalways usesNativeFilePreviewand no longer rendersMediaImagePreviewfor actionable images;MediaVideoPlayerno longer renders an expand/maximize control or accepts anonExpandcallbackMacroscope summarized 452f18a.
Note
Medium Risk
Broad cross-platform media and preview behavior changes (iOS native viewers, inline vs modal video, shared URL lifecycle) touch high-traffic chat and file flows, though logic is consolidated and covered by focused tests.
Overview
Centralizes markdown file-link parsing, media-source classification, signed asset URL state, and media action IDs in
client-runtime, then rewires web and mobile to call those helpers instead of duplicated local heuristics.Mobile drops bespoke link/path code in favor of
parseMarkdownFileLinkandresolveMediaSource. Video and attachment UX converges onuseMediaActions/MediaActionsMenu(long-press on thumbnails);VideoAttachmentMenu,MediaVideoPreviewModal, and the workspace image prefetch atom are removed. iOS routes all full-screen file previews through Quick Look and full-screen videos through AVKit (with URL re-mint on failure); inline/workspace video stays on Expo Video. Composer and thread attachments shareattachmentVideoPreviewSourceand attachment-scoped asset resources.Web plays timeline and markdown videos inline via the shared
MediaVideoPlayer(no separate “open video” flow or expand control); expanded dialogs stream through the same player with asset refresh. File attachment clicks no longer auto-open a modal for videos. Context menus align action IDs (save,copy-full-path, etc.) and expose save for videos as well as images.Docs are updated to describe streaming, long-press save/share, and platform-specific players.
Reviewed by Cursor Bugbot for commit 452f18a. Bugbot is set up for automated code reviews on this repo. Configure here.