question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Load artwork from URI in StyledPlayerView

See original GitHub issue

Hello, 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:open
  • Created a year ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
christostscommented, Oct 19, 2022

@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?

0reactions
DevinDurickacommented, Oct 19, 2022

I’ve also noticed that when using MediaSessionService the notification will only include the artwork if the MediaItem sets the Artwork data, but not the playlistMetadata (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 the ArtworkData (or ArtworkUri) to the playlist since the artwork wont change between MediaItems, 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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found