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.

Background artwork for audio in Cast

See original GitHub issue

Using com.google.android.exoplayer2.MediaMetadata it’s possible to add only one artwork with .setArtworkUri(). On a cast device with display, that artwork would display next to the title with no possibility to set a background, leaving the screen black when the playing controls disappear after a few settings. A background artwork was displayed up until version 15 when we could use ‘MediaMetadata.loadItems’. Is there a way to display a background again?

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
marcbaechingercommented, May 17, 2022

You can add it to the extras with your own key and then take it from there in the MediaItemConverter:

MediaItem.Builder builder = new MediaItem.Builder();
Bundle extras = new Bundle();
extras.putString(MY_KEY_CAST_BACKGROUND_IMAGE_URI, backgroundImageUri);
builder.setMediaMetadata(
    new MediaMetadata.Builder()
        .setExtras(extras)
        .build());
MediaItem mediaItem = builder.build();

Then in the MediaItemConverter you can get the image uri from mediaItem.mediaMetadata.extras.getString(MY_KEY_CAST_BACKGROUND_IMAGE_URI) and use it to create a cast WebImage to be added to the cast item.

1reaction
abdurahmanadiloviccommented, May 17, 2022

same issue, can’t find an alternative to addImage on MediaItem and MediaItem is needed for .setMediaItem() on the CastPlayer. Also, the Chromecast TV interface dims after a couple of seconds, I assume because there is only one image loaded.

Looking at the CastPlayer it does internally convert MediaItem to MediaQueueItem before its sends data to the cast device, I think it would make sense to open the interface and make CastPlayer accept MediaQueueItem.

@marcbaechinger The issue is I think that currently there can be only one image set on the MediaItem, even if there is a custom converter class, MediaItem builder has an option to set only setArtworkUri() and I think we are missing something like setBackgroundArtworkUri(). The way that was done before was by calling addImage() multiple times.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ambient Mode for Chromecast and Chromecast Ultra
When you select Art gallery, you can display photos in Ambient Mode from sources around the internet, such as Google Earth. You can...
Read more >
Android TV adds background Chromecast audio support
Google has quietly added support for background audio streaming for Chromecast apps on Android TV devices presumably through an update.
Read more >
Set image in media player - Home Assistant Community
Hi, Can anybody help me with how I can set the album art or image in the media player? I have added chrome...
Read more >
Sound wave background. Music sound digital equalizer wirefra
Dec 5, 2020 - Download Sound wave background. Music sound digital equalizer wirefra (788271) instantly now! Trusted by millions + EASY to use...
Read more >
Android TV can now play casted audio in the background
Android TV has added support for playing casted audio in the background while using other apps. Simply open Spotify or YouTube Music then...
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