feat(cast): comprehensive Cast improvements — sync, UI, picker, and volume - #2440
Open
Hitomatito wants to merge 5 commits into
Open
Hitomatito wants to merge 5 commits into
Hitomatito wants to merge 5 commits into
Conversation
…olume Synchronization (core submodule → Hitomatito/core#1): - Push first track immediately to receiver, resolve rest in background - Reduce INITIAL_WINDOW_SIZE from 5 to 2 - Update remoteToPlaylist on background appends - Look-ahead at lastIndex-1 instead of lastIndex - Reuse cached Stream entity in CastStreamResolver - Parallelize DB writes in getDataOfNowPlayingState - Clear songEntity on track change to prevent stale UI metadata - Singleton CastStreamResolver binding Custom Device Picker: - Liquid glass CastDevicePickerBottomSheet with Android/Google styling - Real-time device discovery with status indicators (Connecting/Ready/Playing) - Active session banner showing connected device name - Disconnect button per device - Pairing code display when receiver requests it - Empty state with guidance text - Accessible from Now Playing screen top bar and MiniPlayer Cast Button Integration: - CastIconButton appears in Now Playing top bar (Spotify, M3 Expressive, Apple Music styles) and MiniPlayer when no active session - Active sessions show device name pill instead of cast icon - Cast button hidden from bottom bar navigation Volume Controls: - Bidirectional volume sync between local and receiver - Volume slider in Now Playing screen (Android only) when casting - CastSession.getVolume/setVolume for device-level volume control - Debounced local volume change callback to avoid feedback loops Icon: - Add MusicCast Material Symbols icon for cast button UI Polish: - ForceDarkContent applied to CastDevicePickerBottomSheet - Liquid glass backdrop for picker sheet - Proper padding for now playing screens when cast button is shown
|
Thanks for the PR! Please complete the pull request template — in particular the checkbox confirming you wrote or personally reviewed every line, and the issue this change addresses. It helps us tell real contributions from the flood of auto-generated ones. Edit your PR description; no need to open a new PR. |
- Keep both Highlight and readLocalImageBytes imports in ModalBottomSheet - Keep both cast_to and crop_cover imports in ModalBottomSheet - Update core submodule to e919de9 + cast fix (760daeb)
- Core submodule: cherry-pick cast fix (760daeb) onto 182bca1 and force-push to Hitomatito/core:feat/cast-synchronization-improvements (d7407b4) - Auto-merged: AudioEffectsSection, Help icon, strings, gradle, scripts
…nt volume sync, IO dispatch, race guard, comment fix)
Owner
|
Please show me demo, screenshot and screen record of your fix, thanks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Summary
Complete overhaul of Google Cast support: fixes playback synchronization that caused 2-4s delays and stale metadata, adds a custom liquid-glass device picker, bidirectional volume control, and a new Cast button in the Now Playing screen.
What's New
Custom Cast Device Picker
A new bottom sheet replaces the default Android MediaRouter dialog with a liquid-glass styled picker that matches the app's design language:
Bidirectional Volume Control
CastSession.getVolume()/setVolume()for device-level control (not media stream volume)mayBeNormalizeVolume()overriding receiver volume on track transitionsSynchronization Fixes (core submodule)
These changes dramatically reduce the connect-to-playback latency and fix stale UI metadata:
remoteToPlaylistnot updated → UI stalledlastIndex-1StreamentitysongEntitycleared on track change, UI falls back tomediaItem.metadataOther Changes
MusicCastMaterial Symbols icon added for the Cast buttonCastStreamResolverbound as singleton for proper lifecycleGenericCastState.isActivecomputed property for cleaner state checksForceDarkContentapplied to the device picker sheetTesting
Files Changed
Root repo (14 files)
cast/src/main/java/org/simpmusic/cast/Cast.kt— Discovery, routing, filteringcast-empty/src/main/java/org/simpmusic/cast/Cast.kt— FOSS no-op stubscomposeApp/.../CastButton.android.kt— Android CastButton, DevicePicker, VolumeSlidercomposeApp/.../CastButton.kt—CastDeviceexpect declarationscomposeApp/.../CastButton.jvm.kt— Desktop stubscomposeApp/.../ModalBottomSheet.kt—CastDevicePickerBottomSheetcomposeApp/.../MusicCast.kt— New Material Symbols iconcomposeApp/.../MiniPlayer.kt— Cast button in mini playercomposeApp/.../NowPlayingContentM3Expressive.kt— Cast button in M3E playercomposeApp/.../NowPlayingContentSpotify.kt— Cast button in Spotify playercomposeApp/.../AppleMusicShared.kt— Cast button in Apple Music playercomposeApp/.../SharedViewModel.kt— Null-songEntity handling, removed stale dedup guardcomposeApp/.../strings.xml— Cast-related string resourcesCore submodule (7 files)
CastHandoffManager.kt— First-track-immediate, window=2, background append trackingCastStreamResolver.kt— Cached stream reuseCrossfadeExoPlayerAdapter.kt— Restored duplicate-index guardMediaServiceHandlerImpl.kt— Parallel DB writes, songEntity null-clearingMedia3ServiceModule.kt— Singleton CastStreamResolverGenericCastState.kt— Added isActive propertyDownloadUtils.kt— Minor cleanup