Lovelace: Mini Media Player

Hi Kalkih

I was wondering, is there a maximum number of letters for sources in the source picker? Not all my sources are showing after being selected, and I then reload the page. Music is still playing, but the source is empty. I still see them all in the list, when I press the source picker. I have noticed, that the sources with short names are visible even after reloading the page, but longer sources seem to disappear.

Alright, I need a bit more info to try to re-create this.
Roughly, how many characters are the sources that doesn’t show?
Which browser are you having this issue in?

I see it both on pc (chrome, edge) and from the Ios app.

I have a source with 10 letters, which is not visible

1 Like

Hmm, I can’t reproduce this issue.

Are you on the latest version v0.8.2?
Does it show up in the regular source select (more info dialog)?
Is it just this particular source that doesn’t show up?

Is it still saying “Afslapning” if you refresh the site?
Yes, I have tried with the newest, same result.

It is only Skala FM and DR P3 that works. The rest results in not being visible, if I refresh the site, eventhough the source is correctly playing. And no, they do not show up in the regular source select either :confused:

1 Like

Oooh wait! It seems that only the sources connected to a tunein station works. The rest are playlists marked as Sonos Favourites. I think that could be the issue. Just tried adding a new radio station, and that one workes just as the other stations DR P3 and Skala FM.

1 Like

Ok, it’s possible that this is a bug in the sonos component where the source attribute is not reported to the entities state properly. That’s probably also why it’s gone after a refresh since I use the entities source attribute to display the current source.

New version v0.8.3

2 Likes

I have this in my lovelace:

  - title: Media Mini
    icon: mdi:boombox
    cards:
      - type: entities
        title: Google Devices
        entities:
        - entity: media_player.all_speakers
          type: "custom:mini-media-player"
          group: true
          show_tts: google
          artwork: cover
          power_color: true
          scroll_info: true
        - entity: media_player.living_areas
          type: "custom:mini-media-player"
          group: true
          show_tts: google
          artwork: cover
          power_color: true
          scroll_info: true
        - entity: media_player.bedroom_speaker
          type: "custom:mini-media-player"
          group: true
          show_tts: google
          artwork: cover
          power_color: true
          scroll_info: true
        - entity: media_player.office_speaker
          type: "custom:mini-media-player"
          group: true
          show_tts: google
          artwork: cover
          power_color: true
          scroll_info: true
        - entity: media_player.lounge_speaker
          type: "custom:mini-media-player"
          group: true
          show_tts: google
          artwork: cover
          power_color: true
          scroll_info: true
        - entity: media_player.lounge_room_tv
          type: "custom:mini-media-player"
          group: true
          artwork: cover
          power_color: true
      - type: entities
        title: Other Media Players
        entities:
        - entity: media_player.roku_5x46aj056306
          type: "custom:mini-media-player"
          group: true
          artwork: cover
          power_color: true
          scroll_info: true
        - entity: media_player.foxtel_7587
          type: "custom:mini-media-player"
          group: true
          artwork: cover
          power_color: true
          scroll_info: true
        - entity: media_player.kodi
          type: "custom:mini-media-player"
          group: true
          artwork: cover
          power_color: true
          scroll_info: true
        - entity: media_player.osmc_vero4
          type: "custom:mini-media-player"
          group: true
          artwork: cover
          power_color: true
          scroll_info: true
        - entity: media_player.txnr1009
          type: "custom:mini-media-player"
          group: true
          artwork: cover
          power_color: true
          scroll_info: true
          show_source: true
        - entity: media_player.samsung_tv
          type: "custom:mini-media-player"
          group: true
          artwork: cover
          power_color: true
          show_source: true

Which seems to work fine. But I am getting this error:

2018-10-02 10:23:57 ERROR (MainThread) [frontend.js.latest.201809270] https://domain.duckdns.org:30443/local/mini-media-player.js?ver=0.8.3:680:22 NotSupportedError: Cannot define multiple custom elements with the same tag name

Maybe it’s the colons in your JS include “mini-media-player.js?0.8.3:680:22”
Replace the colons with something else, dashes maybe?

the colons are not in the JS include. Only in the error.

Yes, you are probably right about that :slight_smile:

I actually saw this error in my log once as well, but it didn’t make sense so I ignored it and it has not showed up again.
My first thought was that it were a caching issue, where the old version would still be loaded in parallel with the new one.
The error message indicates that the custom-element tag name mini-media-player (I suppose) is already defined.

The card still works as expected right?
You don’t import the mini-media-player twice under resources: in ui-lovelace.yaml?
Would you mind posting everything from your resources: in your ui-lovelace.yaml?

Hi,

i have some problems with the mini-media-player

http://hassio.local:8123/local/mini-media-player.js?v=0.8.3:9:1 Uncaught SyntaxError: Unexpected token <

In my config.yaml it looks like this:

frontend:
  javascript_version: latest

and my ui-lovelace.yaml:

title: My Awesome Home
# Include external resources
resources:
  - url: /local/mini-media-player.js?v=0.8.3
    type: module

views:
  - title: Home
    id: Home
    cards:
        # The filter card will filter entities for their state
      - type: picture-glance
        image: /local/schlafzimmer.png
        title: Schlafzimmer
        entities:
          - light.schlafzimmerlampe
          - light.bettlampen
          - light.schlafband
          - sensor.temp_schlafzimmer
          - binary_sensor.bewegung_schlafzimmer
          - binary_sensor.fenster_schlafzimmer
          - sensor.helligkeit_schlafzimmer
      - type: vertical-stack
        cards:
          - type: picture-entity
            image: /local/wohnzimmer.png
            entity: light.sofa
          - type: glance
            entities:
              - light.sofa
              - light.wohnzimmerlampe
              - sensor.temp_wohnzimmer
  - title: Test
    id: Test
    cards:
      - type: custom:mini-media-player
        entity: media_player.wohnzimmer
        icon: 'mdi:cast'
        artwork_border: true
        power_color: true
        show_source: true

I’ve searched the hole thread but didn’t find any solution. Maybe somebody here, has an idea where my failure is.

thx

Hey!

Error indicates that there is a &lt; (<) token in the mini media-player.js file at row 9.
This seems strange, that shouldn’t be there.
I would suggest checking your mini-media-player.js file to make sure everything is fine there, compare it with this.

Found it. Thx :+1::tada:

1 Like

I have only seen it a few times
 not all the time and yes the card is working fine. I am only importing it once. Resources:

title: Home
resources:
  - url: /local/tracker-card.js?v=0.1.5
    type: js
  - url: /local/custom-lovelace/upcoming-media-card/upcoming-media-card.js?v=0.1.9
    type: js
  - url: /local/custom_ui/dark-sky-weather-card.js?v=1
    type: js
  - url: /local/mini-media-player.js?ver=0.8.3
    type: module
  - url: /local/column-card.js?ver=7221e1
    type: js
views:

Alright, that looks fine. But yeah, might be a caching issue after updates.

1 Like

Loving this card, however I’m also getting the “mini-media-player” doesn’t exist error.

The annoying thing is that it is happening on my FireHD tablet, running fully kiosk browser. The mini media player card works ok in Chrome on Desktop. I’ve set the type: module correctly.

1 Like

I installed Fully Kiosk on my Google Pixel 2XL just to test and the card works fine.
But I suspect the web engine might be different on your Fire tablet and might not support some ES5/ES6 features that are used in this card.

Make sure you have javascript_version: latest in your configuration.yaml under frontend:.