Skip to content

feat: optional music AI beta with unified DJ playback and native daily playlists - #49

Open
QuietForge7294 wants to merge 11 commits into
henriquesebastiao:mainfrom
QuietForge7294:feat/local-music-ai-dj-beta
Open

QuietForge7294 wants to merge 11 commits into
henriquesebastiao:mainfrom
QuietForge7294:feat/local-music-ai-dj-beta

Conversation

@QuietForge7294

@QuietForge7294 QuietForge7294 commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Behavior

I keep classic playback, prepared/live server DJ and the device prototype behind the existing playback service and one MediaSession. Stale mode/account/selection work is fenced, pause is local, and renderer observations cannot restart playback. Joining a set now opens Now Playing; DJ-only media also appears in the mini player. An unjoined device offers Listen rather than a server-only resume.

Four colored daily mixes sit under favorite playlists. They open the native playlist screen and can be saved as a stable playlist with an editable name. The DJ studio, queue toggle and distinct seed actions use the same player.

The beta3 queue refreshes capabilities before deciding whether DJ can start. Unavailable controls can recheck and explain the actual gate, including an empty/short queue, disabled module, expired authentication or unavailable renderer. Preparation, a pending end-of-title relay and active playback have distinct labels and cancellation. A song-menu DJ request uses the selected engine and shows persistent progress, errors and an entry to the common player. Account changes retire the old UI and requests without stopping the new account.

Device beta and cache

  • This device · Beta is a device-only choice, initially off. Two bounded decoders share one session and audio-focus owner. The prototype uses 1.2-second sum-limited fades, keeps stable queue occurrences and the dominant original position, pauses both decks on focus/noisy events, and preserves native shuffle restoration. Shuffle/repeat-one/podcasts/HLS retain ordinary playback.
  • This does not yet execute a beat model on Android. No model is downloaded. Device audio quality, background/Bluetooth behavior, latency, battery and temperature remain unqualified.
  • Server-DJ segments have a separate app-private 64 MiB LRU disk cache, fenced by pairing and fresh manifest render identity. Manifests stay fresh; partial data and reused filenames cannot become complete cached audio from another render. GET/HEAD transient retries are bounded to three within nine seconds, with a 12-second whole-call timeout. Authorization failures are not retried. Buffered/cached audio covers short outages, not indefinite offline DJ.
  • Decoder allocator target is 64 MiB across both decks, separate from disk cache and total process memory. The beta is non-debuggable with R8/resource shrinking.
  • Optional modules and the unqualified-server trial default off. Server counterpart: feat: optional local music recommendations and DJ beta with bounded playback workloads downtify#547.

Validation and limits

On the final beta3 source, 114 player-module tests and 216 app tests pass, with three app tests explicitly skipped. The full build, beta lint, Detekt and formatting pass. Coverage includes 14 coordinator regressions, 14 queue-control tests, 11 song-mix tests, four persistent-status dialog tests, queue UI controls, seven mini-player checks and the existing simulated Android Auto integration. Delayed responses, fresh trial gates, missing capabilities, cancellation, owner/device/selection changes and precise queue prerequisites are covered. Seven real SimpleBasePlayer decoder-stall regressions include four reproduced failures before the fade correction; recovery cannot undo a manual pause. Test fixture scopes are cleaned up before resetting the main dispatcher.

The optimized 0.4.0-beta3 / versionCode 12 artifact is non-debuggable and R8-shrunk, with the same signing certificate and permissions as beta2. Its SHA256 is 457a49d8b062b01ce3634d7bbade50634f6a71be732d7a04d187072c8e0c0607. README and behavior documentation describe the corrected controls and current limits.

Previous physical Pixel 9 Pro / Android 17 and official Auto DHU checks apply to earlier betas only. The saved-playlist confirmation Robolectric test remains explicitly ignored after its reproducible idling failure; physical confirmation is still pending. No physical-device performance result or successful hour is claimed for this build.

I keep this PR in draft pending CI on this head, actual phone network/background/Bluetooth/audio checks, comparison of transitions, thermal/battery measurements and the server's uninterrupted one-hour qualification. README and docs distinguish configured budgets, measured evidence and missing model inference.

@QuietForge7294 QuietForge7294 changed the title feat: capability-gated music AI and queue DJ beta feat: optional music AI beta with unified DJ playback and native daily playlists Nov 6, 2026
QuietForge7294 and others added 8 commits November 6, 2026 22:12
- PlayOrder.startShuffled: la file aléatoire démarre au premier élément de la permutation construite par Media3. L'index tiré au hasard perdait en moyenne 17,9 titres sur 40 (jusqu'à 38).
- SessionCommand SHUFFLE_FROM_HEAD: la commande est traitée dans le service, seul endroit où la timeline est à jour de façon synchrone.
- SessionArtworkTracker: la pochette DJ vient du titre audible (extras djTrackId) et non de l'identifiant du rendu; réévaluation sur changement de métadonnées.
- LocalDjPlayer: Suivant/Précédent interceptés dans la façade qui porte la MediaSession (préparé: repère suivant; interactif: même chemin serveur que DJ_NEXT).
- Tests: ShuffleStartTest, SessionArtworkCoverTest, DjNextControlTest.
… de répétition au lancement

- Boutons aléatoire et répétition exposés via setMediaButtonPreferences, prioritaires sur le favori; leur état suit le lecteur (icônes et libellés mis à jour sur changement).
- Commandes de session TOGGLE_SHUFFLE et CYCLE_REPEAT (hors -> tout -> un -> hors).
- Un lancement explicite de l'aléatoire transforme « répéter un titre » en « répéter tout » et conserve « répéter tout ».
- Tests d'échelle: 300 et 1 000 occurrences, doublons compris, sans perte; restauration de la permutation vérifiée.
@QuietForge7294
QuietForge7294 marked this pull request as ready for review November 8, 2026 20:26
- « Ajouter à la file » et le déplacement d'un titre ne convertissent plus le lecteur de session en ExoPlayer : la session porte LocalDjPlayer, donc le transtypage échouait avant de toucher la file. Les deux commandes passent par QueueEdit sur l'interface Player, qui met aussi l'ordre mélangé à jour sur le pont audio actif.
- LocalDjPlayer.restoreShuffleOrder reconstruit son état : la façade gardait l'ancienne permutation, donc l'ordre restauré n'était pas celui qui jouait ni celui que Suivant suivait.
- Tests QueueEditTest : ajout avec et sans aléatoire, file vide, déplacement en ordre direct et mélangé, refus du titre courant, opérations via la façade, permutation restaurée.
- docs/android-auto.md : boutons Aléatoire/Répétition, règle « répéter un titre » au lancement de l'aléatoire, aléatoire complet, Suivant dans le mix.
- Version 0.4.0-beta5, versionCode 14.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant