-
-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial Support for Android Auto #76
Conversation
override fun onCreate() { | ||
super.onCreate() | ||
|
||
mediaSession = MediaLibrarySession.Builder( | ||
this, | ||
exoPlayer, | ||
MediaLibrarySessionCallback() | ||
).build() | ||
} | ||
|
||
override fun onGetSession(controllerInfo: MediaSession.ControllerInfo): MediaLibrarySession? { | ||
return mediaSession | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found here (https://developer.android.com/reference/androidx/media3/session/MediaLibraryService.MediaLibrarySession) that MediaLibrarySession
is an extension of MediaSession
and I see that it has an extra attribute MediaLibrarySession.Callback
that I imagine (as documentation is pretty much non-existent for Media3 Android Auto) will allow us to control the music from Android Auto.
Obviously it complains:
Caused by: java.lang.IllegalStateException: Session ID must be unique. ID=
at androidx.media3.session.MediaSession.<init>(MediaSession.java:732)
at androidx.media3.session.MediaLibraryService$MediaLibrarySession.<init>(MediaLibraryService.java:725)
at androidx.media3.session.MediaLibraryService$MediaLibrarySession$Builder.build(MediaLibraryService.java:703)
at org.grakovne.lissen.AutoBookPlayerService.onCreate(AutoBookPlayerService.kt:62)
The only example I have found is this:
androidx/media#204 (comment)
@GrakovNe any thoughts on how can I continue? |
let me implement this feature after NY/Christmas holidays :-) I hope i'll find a solution! Thank you for the attempt! |
Following #71 I open a PR to track my work.