Load artwork from URI in StyledPlayerView
See original GitHub issueHello, i would like be able to add covers for mp3 streams , i tried this:
mediaItem = new MediaItem.Builder().setUri("https:// STREAM mp3").setMediaMetadata(
new com.google.android.exoplayer2.MediaMetadata.Builder()
.setTitle(" My Stream ")
.setArtworkUri(Uri.parse("https:// COVER .jpg"))
.build())
.build();
MediaSource mediaSource = mediaSourceFactory.createMediaSource(mediaItem);
return new ProgressiveMediaSource.Factory(HttpDataSourceFactory).createMediaSource(mediaItem);
I also tried after playing the stream:
player.setPlaylistMetadata( new com.google.android.exoplayer2.MediaMetadata.Builder()
.setTitle(" My Stream ")
.setArtworkUrii(Uri.parse("https:// COVER .jpg"))
.build());
None of these work but visulation still blank
Thanks for your help
Issue Analytics
- State:
- Created a year ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
If you're using PlayerView you can set default artwork via an ...
If you're using PlayerView you can set default artwork via an attribute in your layout or programmatically (see here).
Read more >Attach artwork to mp3 Uri for ExoPlayer - Stack Overflow
You can use this function and pass mediaUri and thunbnailUri to it private fun PlayerView.loadArtWorkIfMp3(mediaUri: Uri, thumbnailUri: Uri) ...
Read more >StyledPlayerView (ExoPlayer library)
A high level view for Player media playbacks. It displays video, subtitles and album art during playback, and displays playback controls using a ......
Read more >How to show thumbnail in ExoPlayer? · Issue #7684 - GitHub
I get a json type url from the service. I couldn't find a similar example how to add it.
Read more >Media streaming with ExoPlayer - Android Developers
fromUri , which accepts the URI of a media file. Add the MediaItem to ... Start the app to play the MP3 file...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@DevinDuricka this is a different issue as it affects the
MediaSessionService
. Can you please file on the media3 tracker so we can track/handle this separately?I’ve also noticed that when using
MediaSessionService
the notification will only include the artwork if theMediaItem
sets the Artwork data, but not theplaylistMetadata
(this may be by design).It is a little problematic for me. I have an Audiobook player, and I prepare all my mediaitems at launch of the book. Adding the
ArtworkData
to each MediaItem’s metadata slows the app down considerably. Ideally I would like to apply theArtworkData
(orArtworkUri
) to the playlist since the artwork wont change betweenMediaItems
, or be able to set the artwork uri in the MediaItem’s metadata (and not load the ByteArray), and let it handle loading the artwork.