You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Our media application is available on both Android mobile (with support of Android Auto) and on Android Automotive. We already migrated to Media3, so we're using MediaLibraryService, however there's this one case we're not sure how to cover in Media3.
We have some custom actions that are not always available, like adding content to favorites, which requires user to be logged in. We're providing an alternative variant of action's icon to indicate that it's not available at the moment, but user can of course still click on it. What we previously did in this case is setting a non-fatal error in the media session like this:
mediaSession.setPlaybackState(
// We would take the current playback state rather than setting STATE_ERROR
// as the error we surface is non-fatal, playback can continue normally, we're only
// interested in providing an error message
PlaybackStateCompat.Builder(controller.playbackState)
.setErrorMessage(errorCode, errorMessage)
.build()
)
This was especially important on Android Automotive as this allowed us to surface meaningful error message to the user in form of a toast. However, due to automatic state handling in Media3, this no longer seems to be possible. I noticed that this issue is being mentioned in the docs: https://developer.android.com/guide/topics/media/session/mediasession#automatic-state.
I was wondering if there's already any solution that I could go for to cover this case in Media3?
The text was updated successfully, but these errors were encountered:
That's a known issue and there is currently no good way to do this with Media3 I'm afraid.
We agree it's useful to have this for the use cases you explained.
We already have #543 so I mark this as a duplicate. We hope to have this ready for the next release.
A question around your actual implementation with the legacy library: once you have sent the error code and message as above, how long do you keep that error in the PlaybackStateCompat? Are you simply clearing this message with the next update of the playback state or do you keep it until a certain event in your app happens?
Our media application is available on both Android mobile (with support of Android Auto) and on Android Automotive. We already migrated to Media3, so we're using
MediaLibraryService
, however there's this one case we're not sure how to cover in Media3.We have some custom actions that are not always available, like adding content to favorites, which requires user to be logged in. We're providing an alternative variant of action's icon to indicate that it's not available at the moment, but user can of course still click on it. What we previously did in this case is setting a non-fatal error in the media session like this:
This was especially important on Android Automotive as this allowed us to surface meaningful error message to the user in form of a toast. However, due to automatic state handling in Media3, this no longer seems to be possible. I noticed that this issue is being mentioned in the docs: https://developer.android.com/guide/topics/media/session/mediasession#automatic-state.
I was wondering if there's already any solution that I could go for to cover this case in Media3?
The text was updated successfully, but these errors were encountered: