feat(android): Chromecast cast + album autoplay (spec 060 T010-T014) #1221
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/060-cast-android"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Implements the Android sender lane of the approved cast design (docs/superpowers/specs/2026-10-14-android-cast-chromecast-design.md §5.1/6/7): CAF sender + Default Media Receiver (CC1AD845), phone as remote, album autoplay slideshow. No custom receiver, no Cast queue — RemoteMediaClient.load() per item (Immich-verified pattern).
T010 deps/wiring — play-services-cast-framework 22.3.1, androidx.mediarouter 1.8.1, appcompat 1.8.0 (libs.versions.toml); CastOptionsProvider registered as manifest meta-data. CAF's AAR floors minSdk at 23 — app minSdk 25 satisfies it (verified at manifest merge). MainActivity: ComponentActivity → FragmentActivity and Theme.Memories: framework Material → Theme.AppCompat.Light — both are hard prerequisites of MediaRouteButton's chooser/controller DialogFragments (verified in mediarouter 1.8.1 sources).
T011 CastController (AppContainer singleton, main-thread CAF) — session lifecycle via SessionManagerListener; viewer pager settle → fresh POST /api/media/token → ?st= on the URL → MediaInfo(STREAM_TYPE_BUFFERED, contentType, MEDIA_TYPE_PHOTO/MOVIE).load(autoplay). Latest-wins job per settle so rapid swipes can't leave the TV behind the phone. Rendition mapping (pure, tested): photo → preview (thumbnail fallback), video → video_rendition (spec 059 field newly parsed into TimelineItemDto/Ui) with /original?purpose=view fallback. Token/load/disconnect failures emit typed events → snackbars; mint failure skips the item and self-heals on the next LOAD.
T012 UI — CastRouteButton (AndroidView over MediaRouteButton using the CAF merged selector, per-placement mediaRouteTheme overlays for white-on-black vs dark-on-light glyphs) in the viewer top bar (new optional ViewerTopBar trailing slot) and the album top bar; connected-state indicator is the button's own drawable state; no-devices stays with the system picker (design §7).
T013 album autoplay — AlbumSlideshow: interruptible state machine (photo interval default 5 s, picker 2/3/5/8/10 s; video advances on receiver terminal-idle finished/error/canceled with a generous 4 h stall cap; load failures skip; pause/resume/next/prev/stop). Overflow action → interval dialog → mini player bar (prev/play-pause/next/stop) on the album screen. Foreground-scoped by design: leaving the screen stops the run; a foreground service is a documented follow-up (code comment + ISSUE-158).
T014 tests — AlbumSlideshowTest (virtual clock: interval advance, video-complete advance, stall cap, pause/resume incl. during video, next/prev, stop, skip/finish rules), CastMediaTest (rendition mapping + st query building), HttpMediaTokenApiTest (MockWebServer: path/body/auth/response/401). FakeMemoriesApi gained mintMediaToken.
Validation (apps/android, exact CI command): ./gradlew :core:test :app:testDebugUnitTest :app:assembleDebug — BUILD SUCCESSFUL; 454 unit tests, 0 failures; app-debug.apk built. :app:assembleRelease also verified green.
Contract assumptions (backend lane built in parallel):
KNOWN_ISSUES: ISSUE-158 (device matrix unverified, foreground-only slideshow, backend dependency).