Move ExoPlayer out of the activity into a MediaSessionService so audio keeps playing when the app is backgrounded, the screen is off, or the task is swiped away. Media3 provides the media notification, lock-screen and headset controls, audio focus and noisy-headphone handling. The UI talks to the service through a MediaController-backed AudioPlayer and sends title, artist, album and artwork metadata for the notification. Add the Android 13 notification permission request, the media playback foreground service permissions, and wake mode for network streaming.
This commit is contained in:
1 parent
9cdbb3702e
commit
b8bbf8d07c
12 files changed
+232
-82
No files matched your search
@@ -28,6 +28,7 @@ The shared module contains the API client, session/cache storage, radio queue, a
|
||||
- Offline library cache: moods, songs and the last sync revision are stored locally. When the server is unreachable, downloaded tracks still play.
|
||||
- Original MP3 downloads with progress state, removal and storage usage.
|
||||
- Session persistence: the login survives app restarts until the token is revoked or expires.
|
||||
- Android background playback through a Media3 `MediaSessionService`: notification, lock-screen and headset controls, audio focus, and playback that survives the app being backgrounded or the task being swiped away.
|
||||
|
||||
## Project layout
|
||||
|
||||
@@ -127,7 +128,7 @@ The image build performs one warm-up compile (`desktopTest`, `assembleDebug`, `c
|
||||
|
||||
## Known limitations
|
||||
|
||||
- Android playback runs inside the app process; a foreground `MediaSessionService` with a notification and lock-screen controls is the next step.
|
||||
- The media notification exposes play/pause and seeking. Queue actions (skip, add to mood) stay in the app because the mood session and its events belong to the server.
|
||||
- Desktop playback cannot seek (sequential decoder); pause/resume and skipping work.
|
||||
- Web downloads are disabled because the browser owns its storage; the app still streams and caches metadata.
|
||||
- YT Music recommendations are displayed when the server provides them; discovery and downloading are server-side roadmap items.
|
||||
|
||||
Reference in new issue
Block a user