Skip to content
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

Music Notification Artwork Not Showing #9

Closed
re-ovo opened this issue Nov 25, 2021 · 6 comments
Closed

Music Notification Artwork Not Showing #9

re-ovo opened this issue Nov 25, 2021 · 6 comments
Assignees
Labels

Comments

@re-ovo
Copy link

re-ovo commented Nov 25, 2021

image
I set the artworkUrl, but it doesn't show anything. Did I set it wrong?

My MediaItemBuilder:

               addMediaItem(
                            MediaItem.Builder()
                                .setMediaId(track.id.toString())
                                .setMediaMetadata(
                                    MediaMetadata.Builder()
                                        .setTitle(track.name)
                                        .setArtist(track.ar.joinToString(", ") { ar -> ar.name })
                                        .setMediaUri(Uri.parse("$RainMusicProtocol://music?id=${track.id}"))
                                        .setArtworkUri(Uri.parse(track.al.picUrl))
                                        .build()
                                )
                                .build()
               )
@ojw28
Copy link
Contributor

ojw28 commented Dec 2, 2021

None of the UI components load from the artworkUri field currently, so you have to use setArtworkData. That's obviously bad for playlists though, since there will be a large amount of associated memory usage.

This is something we should address for 1.0.0 stable, so I'll mark it as a bug. We'll need to make sure our approach is compatible with image caching libraries (e.g., Glide), without mandating use of one. For internal devs, see [Internal ref: cr/383239306] for some previous discussion about this.

@ojw28 ojw28 removed the needs triage label Dec 2, 2021
@re-ovo
Copy link
Author

re-ovo commented May 10, 2022

Is there any progress?

@marcbaechinger
Copy link
Contributor

marcbaechinger commented May 10, 2022

We added a Bitmap loader with this commit. It is already part of the released alpha version.

Did you try after updating and it did not work? Please let us know if this is the case.

@re-ovo
Copy link
Author

re-ovo commented May 11, 2022

It's not in release branch...It only exists in main branch currently 🤔 @marcbaechinger

@marcbaechinger
Copy link
Contributor

Closing as this will be in the next release that is coming soon.

@DevinDuricka
Copy link

I'm having a similar issue as the original bug, but local artwork seems to not show.

Here is my MediaMetadata

val mediaMetaData = MediaMetadata.Builder().apply {
                        setAlbumTitle(audiobook.audiobookTitle)
                        setAlbumArtist(audiobook.audiobookAuthor)
                        setGenre(audiobook.audiobookGenre)
                        setArtworkUri(audiobook.imgThumbnail) //Doesn't work -> content://com.android.externalstorage.documents/tree/primary%3AAudiobooks/document/primary%3AAudiobooks%2FCreativity%2C%20Inc%2FCreativity%2C%20Inc-Cover.jpg
                        //setArtworkUri(Uri.parse("https://m.media-amazon.com/images/I/51vXKxIu6xL._SL500_.jpg")) //Works
                        setTitle(track.chapters.getOrNull(index)?.chapterName?.trim() ?: track.track.trackTitle ?: audiobook.audiobookTitle)
                    }.build()

When I try to set the artwork via a content:// Uri, the notification artwork is missing. (I use the same Uri in other areas of the app)

setArtworkUri(audiobook.imgThumbnail) //Doesn't work -> content://com.android.externalstorage.documents/tree/primary%3AAudiobooks/document/primary%3AAudiobooks%2FCreativity%2C%20Inc%2FCreativity%2C%20Inc-Cover.jpg

When I use a https:// reference, it shows the artwork in the notification. I'm not storing a url to the artwork though, so it's not really a viable solution. The above example was just for testing purposes.

Am I doing something wrong? (Or does this necessitate a separate bug?)

@androidx androidx locked and limited conversation to collaborators Mar 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants