-
Notifications
You must be signed in to change notification settings - Fork 490
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
MediaMetadata: Support using a XML drawable as artwork #262
Comments
Thanks for your request! I wouldn't recommend using Short answer/quickest and available solution: Store that bitmap image on an http server on the internet and reference it by URI. Long answer/(probably) best solution: Better would IMO be to only use Personally I think the best and most efficient solution would be to store the bitmap in your app and create a content provider and serve the image with the content provider. UAMP does this for album artwork. The the From this I think the enhancement for the Media3 library would probably be to make sure that Without thinking more about it than since starting writing this comment, I think there are these AIs around this enhancement for us (or the rest of the world that wants that): 1 - Modify the session demo app or UAMP to use If you depend on the source of the main branch you can use the |
Thank you for your answer!!! 🙂
I think that already works for PNG images. I tried that a couple of days ago. But it does not work for vector drawables. Why not use PNGs? With vector drawables the fallback default icon can adapt to the app's theme. In my case a themed fallback icon is already used in the phone UI. It would be great if this icon could be used in the notification, too. I know that this might be out of scope for media3, but I does not hurt to ask. In any case it is great to read that you consider to officially support |
Ah, I see! Sorry I misunderstood. :D Yeah, that would require a platform change. As a library we'd still need to support the API levels before this new feature with bitmaps. |
Just a quick addition:
(*) actually sometimes the artwork embedded in the actual source is displayed and the artwork set via |
Yes, that makes sense. I guess I can close this feature request then. While working with |
Use case description
I develop maintain an audio app that lets users add their own media. Not all user provided media come with an artwork. In that case my app uses a default vector drawable to represent the media in the UI. The app's default drawable makes use of dynamic colors to better fit in with the theme. The default icon should not only be used in the app's user interface, but also in the notification and in other clients, that connect to the playback service. I think there is a whole class of apps that need to provide a default fallback icon for media artwork.
Proposed solution
setArtworkUri
inMediaMetadata.Builder
could accept Uris that point to android XML resources.Alternatives considered
The app could grab the XML default drawable, create a
Bitmap
, convert it to aByteArray
and feed that tosetArtworkData
to build theMediaMetadata
for media that has no artwork.The text was updated successfully, but these errors were encountered: