Lovelace: Mini Media Player

I think the background only shows if there is no available artwork.

Have you tried it, or should someone come over and do it for you?

I think that even with a background image set, the card returns to its default mini size when the player is powered off or the queue is empty. This makes it smaller than when artwork is set to full-cover and the player is on.

To keep the card a consistent size, I 've found I have to play around with card-mod to set the height of the card. You might need to experiment to find the right height - this value keeps the player square in the app on my Pixel 4.

- type: custom:mini-media-player
  card_mod:
    style:
      .: |
        ha-card {
          height: 385px;
        }
  artwork: full-cover-fit

3 Likes

Thanks, @nickrout . Perhaps Iā€™m missing a setting, but this is what background: like for me with no artwork. My goal is to maintain the 1:1 aspect ratio and size when there is no album art.

entity: media_player.dining_room
group: false
hide:
  controls: false
  icon: true
  info: true
  mute: true
  name: true
  power: true
  progress: true
  source: false
  volume: true
info: 'no'
progress: false
tap_action:
  action: url
  url: app://com.sonos.acr2
type: custom:mini-media-player
volume_stateless: true
artwork: full-cover
background: /local/images/idle_art_1.png

EDIT: Slight revision here Lovelace: Mini Media Player - #2771 by ronschaeffer

@reste_narquois , thanks so much. Thatā€™s it.

Hereā€™s what I ended up with as a test card:

type: custom:mini-media-player
entity: media_player.dining_room
card_mod:
  style: |
    ha-card {
      height: 385px;
    }
artwork: full-cover-fit
background: /local/images/idle_art_1.png
1 Like

What are the dimensions of the jpg?

640x640

But, @reste_narquois 's suggestion worked. Would be nice to be able to do it without card_mod. Iā€™ll raise a feature request.

Thanks!

No, thanks.

It will size to the size of the background image, so make the background image the size of the typical album art. It really is as simple as that. The question was: I want an image displayed when thereā€™s no art, keeping the sizing in tact.

You donā€™t need card mod. See above.

Source: Iā€™m doing it all, which is why I suggested it in the first place. Just an image, sized correctly.

If youā€™ve got that working, please post your YAML.

For whatever reason, without card_mod, the card always collapses when there is no cover art to what I showed here using either full-cover or full-cover-fit, and with the image sized to 385x385, 640x640 or 1600x1600.

1600x1600 is whatā€™s recommended for Spotify cover art, so I assume thatā€™s what you mean by typical.

Well, there seems to be at least 2 of us whose experience is different from yours - would be helpful if you posted your code as requested.

1 Like

Iā€™m doing it for the cover artwork option. It only transpired later that thereā€™s a requirement for the full-cover and full-cover-fit options, and in that case, I donā€™t see another option. Itā€™s ironic (to me) to make something that was designed to be mini not-so-mini, but to each their own.

Re: Mantaining card aspect ratio when using artwork: full-cover if no cover art is available or when the target player is idle.

Currently, if there is no cover art available or when the target payer is idle, the card will collapse from the 1:1 ratio of cover art to the minimum size needed to fit any configured control and information elements of the card. For better control over the position of cards on a dashboard, it can be desireable to maintain the same size and shape of the card

If youā€™re looking to do this, the most consistent way appears to be setting the overall card aspect_ratio with the custom component card_mod. At least, this has worked for @reste_narquois and me in testing.

Hereā€™s a comparison using a square background image:

And here is the configuration for the rightmost card:

type: custom:mini-media-player
entity: media_player.dining_room
card_mod:
  style: |
    ha-card {
      aspect-ratio: 1 / 1;
    }
artwork: full-cover-fit
background: /local/images/idle_grid_dark.png

Note that artwork: full-cover and artwork: full-cover-fit have the same result in this case.

4 Likes

Is it possible to get a volume slider for each Sonos speaker in my group?

2022-12-20_00h58_22

If I use the volume slider in the top of the card, it only changes the volume for the master speaker (The first speaker I used as entity when the card was created).
I would like to be able to change the volume for each speakerā€¦ :slight_smile:

Code for the card:

type: custom:mini-media-player
entity: media_player.koekken
hide:
  power: true
speaker_group:
  platform: sonos
  show_group_count: true
  entities:
    - entity_id: media_player.koekken
      name: Sonos KĆøkken
    - entity_id: media_player.stue
      name: Sonos Beam Stue
    - entity_id: media_player.badevaerelse
      name: Sonos BadevƦrelse
entities:
  - type: custom:mini-media-player
    entity: media_player.multiroom_player
    group: true
    source: icon
    artwork: cover
    info: short
    hide:
      volume: false
      power: true
  - type: custom:mini-media-player
    entity: media_player.koekken
    group: true
    hide:
      controls: false
  - type: custom:mini-media-player
    entity: media_player.stue
    group: true
    hide:
      controls: false
  - type: custom:mini-media-player
    entity: media_player.badevaerelse
    group: true
    hide:
      controls: false
artwork: cover
source: full
sound_mode: full

Quick Question.
How would I change the name of the dropdown list?Screenshot 2022-12-20 113955

> > type: custom:mini-media-player
> > entity: media_player.kitchen_2
> > name: Kitchen Speaker
> > artwork: cover
> > source: full
> > sound_mode: full
> > background: /local/radio/radiobackround.jpg
> > show_tts: true
> > shortcuts:
> >   name: Radio
> >   columns: 2
> >   list:
> >     - type: script
> >       name: Wild Country Radio
> >       id: script.wild_953
> >     - type: script
> >       name: Amp Hits Radio
> >       id: script.amp_radio
> > group: false
> > info: scroll
> > speaker_group:
> >   platform: sonos
> >   show_group_count: true
> >   entities:
> >     - entity_id: media_player.kitchen_3
> >       name: Sonos Kitchen
> >     - entity_id: media_player.sonos_roam_3
> >       name: Sonos Bedroom

Iā€™m not sure if you can configure individual volume controls, however you are able to make the main slider control all speakers in the group using sync_volume:. I know its not what you asked for, but maybe could help your use case?

speaker_group:
   platform: sonos
   show_group_count: true
   sync_volume: true
   ....

Thanks for the reply!

Itā€™s way better then before, I will implement this and give it a try.

Iā€™m kinda new til HA/YAML, so not that strong with this yet.
Could I make it so the speakers volume slider is always available, and not just under the ā€œgroupingā€ menu? That way I could have a card that I could expand or something, and then change it individual.

Another question regarding this also:

I have tried to create some buttons to start spotify playlists from, but I canā€™t start the stream to my speakers. I get the same results, when I test in the ā€˜Developer Toolsā€™ under ā€˜Servicesā€™.

I have tried to stream to both the ā€˜KĆøkkenā€™ and ā€˜Stueā€™ speakers with no luck.

I use the information in the ā€˜Nameā€™ field, as I understand i shouldā€™n be the ā€˜Entity IDā€™.?

type: custom:mini-media-player
entity: media_player.koekken
max_volume: '35'
hide:
  power: true
speaker_group:
  platform: sonos
  show_group_count: true
  sync_volume: true
  entities:
    - entity_id: media_player.koekken
      name: Sonos KĆøkken
    - entity_id: media_player.stue
      name: Sonos Beam Stue
    - entity_id: media_player.badevaerelse
      name: Sonos BadevƦrelse
entities:
  - type: custom:mini-media-player
    entity: media_player.multiroom_player
    group: true
    source: icon
    artwork: cover
    info: short
    hide:
      volume: false
      power: true
  - type: custom:mini-media-player
    entity: media_player.koekken
    group: true
    hide:
      controls: false
  - type: custom:mini-media-player
    entity: media_player.stue
    group: true
    hide:
      controls: false
  - type: custom:mini-media-player
    entity: media_player.badevaerelse
    group: true
    hide:
      controls: false
artwork: cover
source: full
sound_mode: full
icon: mdi:music
background: /local/spotify/radiobackground.jpg
shortcuts:
  columns: 3
  buttons:
    - name: Tessa
      type: service
      id: spotcast.start
      data:
        device_name: KĆøkken
        uri: spotify:playlist:3pJK3CUpbnyX7ogDfAwa9J
        random_song: true
        shuffle: true

Nevermind, for some reason it started working when I created a new dashboard and view, however, artwork isnā€™t showing, I saw someone hade the same issue on Github.

Hi everyone!

Iā€™m trying to cast the MMP to my Nest Hub, Iā€™ve read and triedā€¦for some it seems to work and for some not.

I get the ā€œCustom element doesnā€™t existā€ on the Nest Hub when casting, casting other stuff works.

Can anyone please help or point me in the right direction?

Is it possible to edit the player so that the round artwork is on top of the title of the song thats playing?

Currently this is my sidebar: