Set image in media player


Can anybody help me with how I can set the album art or image in the media player? I have added chrome cast to my home assistant and when I cast from spotify or a internet radio app its automatically shows the correct image or album art. However I have made an automation that send an internet address to the chrome cast and starts playing, in this case I do not get any image in the player. So how can I update the image?

This is how my automation looks now. I tried with setting the entity_picture but no sucess.

  • action:

the service play_media for media_players only accepts 3 keywords; entity_id, media_content_id, and media_content_type.

Changing the image may only be possible with specific media players and it may only come from the media device itself, meaning you cannot set it.

Which media player are you using?

Thanks for the reply.

The media players are chrome cast devices and if I cast directly to them from spotify on my phone I can see the following in the entity list:

The player does also get a image in the home assistant UI.

supported_features: 21437
friendly_name: Kjøkken
media_content_id: spotify:track:5qN0ZSv80PlNuAxrhhnjjQ
media_title: Looking For You
media_artist: Wolfgang Wee
media_duration: 192.024
is_volume_muted: false
app_id: CC32E753
media_position_updated_at: 2018-05-08T12:26:54.938698+00:00
media_position: 106.365
media_content_type: music
app_name: Spotify
entity_picture: /api/media_player_proxy/media_player.kjkken? 
volume_level: 0.08999998867511749preformatted text by 4 spaces

Just because it has an attribute does not mean it can be set in the configuration. The documents don’t spell it out. The media_player base class only contains the property and it cannot be set unless the component chooses to. The cast component only sets it from the URL provided:

    def media_image_url(self):
        """Image url of current playing media."""
        if self.media_status is None:
            return None

        images = self.media_status.images

        return images[0].url if images and images[0].url else None

Ok, I see. Thanks for the info

Does this mean, that there’s no way at all to accomplish this?

Not without changing the component and adding a service. You’d need to make it into a custom component and override the built in component. Would be quite a bit of work.

For anybody using NodeRED, this node that can do it…

Sounds like it yeah. What about communicating directly with the chromecast instead?

That’s what it does currently. It pulls the images from the media.

I’m trying to solve the same problem, and using the node-red-contrib-cast node. It’s no problem to send an image when I start the stream, but is it possible to change the image, withour interupting the audio-stream?

I’m trying to mimic the behaviour of my radio-app in my phone where the image changes when a new program starts. And it changes the image in HA as well, but would like to be able to start it automatically from HA as well.

I don’t think it’s possible to change the image without also re-casting the media URL, which would stop and re-start playback.

But you can cast a list of songs with related images as an array instead of a one continuous stream (assuming you’re building the stream on your end).

no, I’m streaming live radio…

trying some workarounds, but right now not much success… The absolute best would be the possibility to change directly to media-player, but, but…

OK, then the images are also being streamed from the radio station. If the station is using fairly simple code you may just need to find their image URL. The easiest way is probably to just cast the station directly to your configured cast device then check the entity_picture attribute in HA. In the example above you can see that a token is required, but you might be luckier, or the token may match one provided in the media URL.


Did you had further developments ?
I’m having exactly the same issue. Radio streaming to google hub, and I would like to change the background every time the music changes.