Skip to content

fix: silent or stuck music, partly cached songs, chunk reloads and music links - #1436

Open
A-EDev wants to merge 6 commits into
mainfrom
fix/music-offload-cache-resolve
Open

A-EDev wants to merge 6 commits into
mainfrom
fix/music-offload-cache-resolve

Conversation

@A-EDev

@A-EDev A-EDev commented Oct 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Audio offload for music is now a setting in the music player's Audio settings, off by default. On some phones offloaded songs played silently ([Bug]: canYouTube Music is playing, but I can't hear any audio #1417) or never left loading ([Bug]: Bug: Music playback stuck on loading #1422). When it is on, offload also requires gapless support, so the gapless advance is kept.
  • A song read from a cached start reached the end of the cache with its music:// uri and failed with "Malformed URL". Cache hits are now limited to the bytes actually cached, and a cache read that outlives its span resolves the stream URL.
  • Streamed songs are fetched in 512 KB chunks. Each chunk end used to stop the extractor mid-block and raise a load error before the loader reopened the song. A new ChunkStitchingDataSource opens the next chunk inside the same read. Media3 has no data source that carries a read across ranged requests.
  • Offline, an unreadable local file now fails like any other error instead of waiting up to 60 retries for the network.
  • A song started from a link while the app opens is no longer replaced by the saved queue. A play asked for before the controller connects is sent once it does, the saved-queue restore stands down when a newer queue started, and playback resumption no longer replaces a song that started while it read the saved queue.

Related issue

Closes #1417
Closes #1422

Change type

  • Bug fix
  • Feature
  • Refactor or maintenance
  • Build, packaging, or CI
  • Documentation

Validation

  • ./gradlew :app:assembleGithubDebug
  • ./gradlew :app:testGithubDebugUnitTest (4,389 tests, 0 failures)
  • I ran any additional flavor-specific build or test tasks affected by this change. ./gradlew :app:compileFossDebugKotlin and ./gradlew ktlintCheck pass.
  • I manually tested the affected behavior on an Android device or emulator.

Phone and emulator: 0 load errors over several songs (main logs one per chunk), a partly cached song plays past its cached part (main fails with "Malformed URL"), cold-start music links play the linked song, playback continues in the background and with the screen off, and auto-advance with the screen off stays gapless with no seek back.

Test device and Android version: POCO X6 Pro (HyperOS, Android 16); Android emulator (API 37)

Screenshots or recordings

Risk and compatibility

Player path: the music data source chain and session callbacks change, the player wiring does not. Offload is off by default, which may cost some battery on phones where it worked; it can be turned back on. New DataStore key music_audio_offload_enabled. No Room schema changes.

  • The change does not introduce secrets, private data, or unexpected telemetry.
  • New user-facing text uses Android string resources.
  • Dependency and lockfile changes are intentional and limited to this PR.
  • Room schema changes include the required version bump and migration, or this PR does not change the Room schema.
  • Breaking changes and upgrade steps are clearly documented.

Copilot AI balanced review requested due to automatic review settings October 24, 2026 16:00

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@github-actions github-actions Bot added documentation Improvements or additions to documentation player Video and audio playback ui Compose UI, theming, or Material 3 surfaces labels Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation player Video and audio playback ui Compose UI, theming, or Material 3 surfaces

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Bug: Music playback stuck on loading [Bug]: canYouTube Music is playing, but I can't hear any audio

2 participants