Lovelace: Mini Media Player

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:

Just adding this for future tinkerers looking for a complete script. I adapted this to work while playing or paused (at least on an Apple TV):

- seek_interval:
    alias: Seek Interval
    fields:
      media_player:
        description: Media Player to be positioned.
        example: media_player.apple_tv_theater
      interval:
        description: Time in seconds from current position to be seeked. (+) Fast Forward. (-) Rewind.
        example: -10
    sequence:
      service: media_player.media_seek
      target:
        entity_id: "{{ media_player }}"
      data:
        seek_position:  >-
                        {% if (states('media_player.apple_tv_living_room') == 'playing')%}
                        {{(as_timestamp(now())-as_timestamp(state_attr(media_player, 'media_position_updated_at'))+state_attr(media_player, 'media_position'))|float+interval}}
                        {% else %}
                        {{state_attr(media_player, 'media_position')|float+interval}}
                        {% endif %}

Thanks for the running start!

Hi,

i think that’s quite easy.
I Did it like that:

SCR-20221227-eg8

    shortcuts:
      label: Radiosender
      list:
        - type: source
          name: 1LIVE
          id: 1LIVE
          icon: mdi:radio

Kind regards

Hey! Thanks for the great card!!! Its possible to show the speaker group everytime without push on the speaker icon? thank you :smile:

Wow thanks so much! why did I knot think the use label:

Hi there,
is there a way to present both volume change methods? i mean - the slider and the buttons?
Sometimes there is a need to change a value 1 and with slider it is difficult to do.

hi Guys,

can you help me change the size of the player? I would like the mini media player to be the same size as the media control card.
what is the best way to go about it?

Hi there,

A question, I made a web radio with 6 buttons to select/play the radio station,
Is it possible to set the text of the “Info”, it says ow “Streaming with…” but I would like to set the inf to the name of the radio station. Any help appreciated

image