android: Implement basic media session handling for next and previous track

This starts a Media3 MediaSession when the service starts. A custom player class gets passed into that session to receive commands from other apps and the android os.

Currently we pad out some dummy items to make SimpleBasePlayer think we can do next and previous tracks.

MPD handles the threading for the native calls so we can just directly call the bridge from the player class.
This commit is contained in:
Colin Edwards
2024-01-05 18:17:54 -06:00
parent e086f09d48
commit 3711bd0d24
3 changed files with 79 additions and 3 deletions

View File

@@ -64,6 +64,8 @@ dependencies {
implementation("com.github.alorma:compose-settings-storage-preferences:1.0.3")
implementation("com.google.accompanist:accompanist-permissions:0.33.2-alpha")
implementation("androidx.media3:media3-session:1.2.0")
// Android Studio Preview support
implementation("androidx.compose.ui:ui-tooling-preview")
debugImplementation("androidx.compose.ui:ui-tooling")