feat(mobile): add video playback with native iOS controls #8919
Mergedjuliusmarmingemerged 6 commits into
main fromrefs/pull/8919/headmerged by juliusmarminge View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XXL
github-actions[bot](GitHub profile, opens in a new tab) added labels📱 Native Change
- apps/mobile/src/lib/composerImages.ts lines 216 to 216OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -206,8 +207,10 @@206207 };207208 }208209209- const { File } = await import("expo-file-system");210+ const { getDocumentAsync } = await import("expo-document-picker");210211 const endHandoff = beginForegroundHandoff();211- let result: PickMultipleFilesResult;212+ let result: DocumentPickerResult;212213 try {213- result = await File.pickFileAsync({ multipleFiles: true });214+ // Our bounded copy owns persistence. iOS already imports with asCopy;215+ // Android returns a readable content URI, so neither needs another cache copy.216+ result = await getDocumentAsync({ multiple: true, copyToCacheDirectory: false });docs/internals/mobile-navigation.md lines 92 to 93OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -50,0 +73,21 @@73+guarded `enterFullScreenAnimated:completionHandler:` selector as Expo Video;74+if that selector is unavailable, the player also falls back to a standard modal.75+Future image viewers can use the76+same source registry with `configureZoom` or the native-stack target. Images77+retain their existing viewer.78+79+Received videos open directly from their signed asset URL. AVKit handles buffering;80+the client does not download the entire file or show a separate opening overlay before81+presentation. The URL is captured once per preview so credential refresh does not82+restart playback. Saving or sharing still downloads the original file.83+84+The native presentation promise completes after dismissal. Local draft previews85+hold their file lease until that promise settles. The iOS preview component requests86+native dismissal when its source screen unmounts. Playback pauses in the background.87+The presenter restores its previous audio-session configuration on close if no88+other component changed it during playback. Android retains its React Native89+modal and Expo Video player.90+91+Use React Native's `StatusBar` API for app-owned status-bar changes. The app has92+`UIViewControllerBasedStatusBarAppearance` disabled, so native-stack93+`statusBarStyle` options raise an error.apps/mobile/modules/t3-native-controls/ios/T3NativeVideoPresentation.swift line 143OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +123,21 @@123+124+ func presentationControllerDidDismiss(_ presentationController: UIPresentationController) {125+ finish()126+ }127+128+ private func finish() {129+ guard !finished else { return }130+ finished = true131+ controller.player?.pause()132+ if embedded {133+ controller.willMove(toParent: nil)134+ controller.view.removeFromSuperview()135+ controller.removeFromParent()136+ }137+ itemObservation = nil138+ if let backgroundObserver { NotificationCenter.default.removeObserver(backgroundObserver) }139+ backgroundObserver = nil140+ let audioSession = AVAudioSession.sharedInstance()141+ if let previousAudioSession, audioSession.category == .playback,142+ audioSession.mode == .moviePlayback, audioSession.categoryOptions.isEmpty {143+ try? audioSession.setActive(false, options: .notifyOthersOnDeactivation)
- @@ -0,0 +24,21 @@24+ cancel = () => resolve(null);25+ });26+ signal.addEventListener("abort", cancel, { once: true });27+ // An unreachable environment must not hold up thumbnails for other environments.28+ timeout = setTimeout(cancel, 15_000);29+ const frame = (async () => {30+ await player.replaceAsync({ uri, contentType: "progressive" });31+ if (disposed || signal.aborted) return null;32+ const [thumbnail] = await player.generateThumbnailsAsync([0], {33+ maxWidth: 480,34+ maxHeight: 480,35+ });36+ return thumbnail ?? null;37+ })();38+ return await Promise.race([frame, canceled]);39+ } finally {40+ disposed = true;41+ clearTimeout(timeout);42+ signal.removeEventListener("abort", cancel);43+ player.release();44+ }
juliusmarminge merged this31c1c59
juliusmarminge closed this
Sign in to join this conversation.




Important
Review skipped#
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID:
f64f2a38-cc80-4a15-a218-87973bd34b11You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
Warning
Your free Security trial is over. An organization admin can activate Security or dismiss this notice.
Comment `@coderabbitai help` to get the list of available commands.