Lovelace: Mini Media Player


#389

I know I am repeating my question, but it got lost in the few unrelated replies. Back to SONOS… the nice feature with SONOS is that you can group the devices and this syncs the audio. This is key for whole home audio.
I like your development, but when I start more than one device the audio can get and does get out of sync. To resolve this I need to go to the SONOS app and group the devices which defeats the purpose.
Is there any chance that you can consider grouping the devices, use a single audio input and therefore guarantee a synced output. This is a huge take away of the current version.
Thanks!!


#390

I believe I’ve answered you regarding this already.

With that said, I understand that it would be a great feature for Sonos users.
I don’t own any Sonos myself but if anyone does and want to code this as an optional feature, feel free to make a PR and I’ll consider merging it.


#391

Thank you for your response. I understand that it will be easier if you have a SONOS, but is it a MUST? I have no idea what it takes to write this logic or whether this logic is unique for a certain device/bran, but isn’t it possible that you write the code based on the requirement and someone with a SONOS can test it for you (like me :slight_smile: )


#392

I’ll look into it, not promising anything though, but yes, I would need someone to test it for me and provide me with some additional information.

Can you please pm me the attribute list from dev-info for a few of your Sonos speakers. Preferably from some that are In a group and some that aren’t.


#393

I understand, it’s the same with Squeezebox/LMS. You sometimes need the app or the web interface to get the full range of options.

Have you tried putting the sonos web control page in a panel in home assistant? Not as good a full integration, but at least it keeps control nearby!


#394

Yeah, that’s kinda the reason why I’m hesitant to adding platform specific features.
This is primarily meant to be a universal media player card, supporting the core media player functions.


#395

New version v0.9.5

Including new media buttons & media list options plus more.

Changelog

  • Added: media_list option to display a dropdown list with items to quickly play specified media

  • Added: media_buttons option to display buttons to quickly play specified media

  • Added: full-cover-fit option parameter for the artwork option, this option does not crop/zoom the artwork like full-cover #36

  • Added: tts support for the “Alexa as Media Player” custom_component #37 (@Rocka84)

  • Changed: removed animations on initial page load

  • Fixed: less re-rendering -> better performance

  • Fixed: made card background transparent if group: true is set

  • Fixed: setting hide_info to true now make the cards content fill the entire width

  • Fixed: text labels not cutting off when no space is available

@Haavardnk @jolly


#396

Btw, I’m unable to edit the original post here for some reason, so for the latest instructions and options please go to GitHub.


#397

I think there is a time limit to editing posts.


#398

Quickly delivered, looks good! Thank you for implementing the media list and buttons, much better to have the selection implemented in the player than as separate items :slight_smile:


#399

ok, great. Here you go

Speaker 1 - NOT GROUPED and playing a radio station
Entity: media_player.bar_2

volume_level: 0.1 
is_volume_muted: false 
media_content_type: music 
media_title: NPO Radio 1 
media_artist: De nacht van de radio - BNNVARA 
source: NPO Radio 1 
source_list: José 97.5,NPO Radio 1,Queen Radio,The Bridge (XM Radio - 32),Line-in 
shuffle: false 
sonos_group: media_player.bar_2 
friendly_name: Bar 
entity_picture: /api/media_player_proxy/media_player.bar_2?token=5e4f120e02430f1aec192df6c1dc5222d8247f6216021486aa54e749cccb57c4&cache=aae2da261e521436 
supported_features: 64063

Speaker 2 - GROUPED with speaker 3 - playing playlist from NAS
Entity: media_player.office

volume_level: 0.66
is_volume_muted: false
media_content_type: music
media_duration: 202
media_position: 2
media_position_updated_at: 2018-12-01T02:42:55.430788+00:00
media_title: Ventura Highway
media_artist: America
media_album_name: History: America's Greatest Hits 
source_list: José 97.5,NPO Radio 1,Queen Radio,The Bridge (XM Radio - 32) 
shuffle: true 
sonos_group: media_player.office,media_player.whole_home_audio      
friendly_name: Whole Home Audio 
entity_picture: /api/media_player_proxy/media_player.whole_home_audio?token=af6157e32c1eaa109dfb00c1e15cfc3adc42efd8aa1d412aadc273466d729831&cache=bf812b4490d29cb7 
supported_features: 64063

Speaker 3 - GROUPED with speaker 2 - playing playlist from NAS
Entity: media_player.whole_home_audio

volume_level: 0.25
is_volume_muted: false
media_content_type: music 
media_duration: 202 
media_position: 2 
media_position_updated_at: 2018-12-01T02:42:55.430788+00:00 
media_title: Ventura Highway media_artist: America 
media_album_name: History: America's Greatest Hits 
source_list: José 97.5,NPO Radio 1,Queen Radio,The Bridge (XM Radio - 32) 
shuffle: true 
sonos_group: media_player.office,media_player.whole_home_audio 
friendly_name: Office 
entity_picture: /api/media_player_proxy/media_player.office?token=4b8a8a7930bd124c297a956a79a2adfc451118e3806963138b7dfd983ff43d80&cache=bf812b4490d29cb7 
supported_features: 64063

#400

thank you so much. now it works perfectly


#401

The media buttons are a great improvement, thanks!

Does anybody know how the syntax would work with Sonos playlists?


#402

@kalkih very nice card and I live the max volume however when I want to show just the volume slider. 1)The bubble with the number is not really readable. Could you please take a look version 0.9.5.
2) It would also be nice if the bubble could not be cutoff.

- type: custom:mini-media-player
  entity: media_player.living_room
  icon: mdi:television
  hide_icon: false
  artwork_border: true
  show_source: false
  max_volume: 35
  hide_power: true
  hide_controls: true
  hide_media_info: true 

I appreciate your help.


#403

I’ll take a look at this, thanks for reporting.


#404

Hey @kalkih
I’m using your card with my Sonos system, and think it’s great. Like others have requested I think it would be awesome if it could join/unjoin the speakers. But I understand you don’t want to start adding functionality for one system because it opens it up to adding functionality for all. I was thinking I’d play around with editing your card to see what I could come up with. I’m pretty new to javascript, so we’ll see if I get anywhere.

Anyways, first big question. Is the mini-media-player.js code the same as the mini-media-player-bundle.js code? Cause when I open the bundle.js (Notepad++) it displays all on one line so it’s basically impossible to read and edit. I can read and edit the not bundle .js just fine, but how to apply it to see if my edits are doing anything?


#405

Hey @jusdwy
mini-media-player.js is the actual source code and that’s the file you should make changes to. You can run this file directly in the frontend by referencing it in your resources in ui-lovelace.yaml instead of the bundle.

The bundle is basically the production version, the source is bundled together with the external dependencies, compiled and minified for better compatibility & speed.

There are further instructions in the GitHub repo about this (Development)

I’ve actually started playing around with Sonos join/unjoin here, Since I don’t own any Sonos myself I’ve coded this based on dummy data and documentation.
I’ll send you some information regarding my implementation including how you can test it in a pm later when I get home.


#406

I created a universal player with my Sonos MediaPlayer and put everything into a conditional card.
I show both Media player if they are not grouped. As soon they are grouped I show only the universal Player


#407

I have narrowed down the number being unreadable to the styling.

.entity__control-row–top {
line-height: 40px;
}

I went ahead and just created my own mod
to just comment that out and show the volume percent

All I need now is help figuring out how to get the z-index or maybe just adjust the height of the card so the bubble doesn’t get cut off and I’ll be good.


#408

I fixed this a couple of days ago. The fix is in the dev branch at the moment, and will be included in the next update.

Here is the commit