Skip to main content

Media player

When enabled, this configuration displays a media player widget above or alongside the navbar. You can configure one or multiple players; with multiple players, a carousel appears with dot indicators and swipe/drag to switch between them. The widget is shown when any configured player is playing or paused (or when a custom show template evaluates to true).

Media player imageMedia player image

Widget-level options

OptionTypeDefaultDescription
playersarray-List of media player configurations. Each player has its own entity and optional overrides.
showboolean | JSTemplate-Widget-level visibility. When set, overrides per-player visibility for the whole widget.
album_cover_backgroundbooleanfalseDisplay the album cover as blurred background for all players
desktop_positiontop-left | top-center | top-right | bottom-left | bottom-center | bottom-rightbottom-centerPosition of the media player widget on desktop. On mobile, the widget is always displayed at the bottom of the view.

Per-player options

Each item in players supports:

OptionTypeDefaultDescription
entitystring | JSTemplate-Entity ID of the media_player (required)
showboolean | JSTemplatetrue when playing or pausedPer-player visibility. When configured, this player is shown when the template evaluates to true.
iconstring | JSTemplatemdi:music (or album cover)Icon to display. If configured, overrides the album cover image.
titlestring | JSTemplatemedia_title attributeTitle text displayed in the media player.
subtitlestring | JSTemplatemedia_artist attributeSubtitle text displayed in the media player.
tap_actionHA Actionmore-info for entityTap action for this player.
hold_actionHA Action-Hold action for this player.
double_tap_actionHA Action-Double tap action for this player.


Examples

Single player

type: custom:navbar-card
# ...
media_player:
album_cover_background: true
players:
- entity: media_player.living_room
tap_action:
action: navigate
navigation_path: /lovelace/media
media_player:
album_cover_background: true
players:
- entity: media_player.spotify
- entity: media_player.sonos
icon: mdi:speaker
- entity: media_player.kitchen

Dynamic entity with template

media_player:
album_cover_background: true
players:
- entity: |
[[[
const state = states['sensor.area_select'].state;
switch (state) {
case 'Office': return 'media_player.office';
case 'Kitchen': return 'media_player.kitchen';
case 'Main bedroom': return 'media_player.main_bedroom';
case 'Living room': return 'media_player.living_room';
default: return 'media_player.whole_home';
}
]]]
tap_action:
action: navigate
navigation_path: /lovelace/media
hold_action:
action: more-info

Widget-level show (hide entire widget)

media_player:
players:
- entity: media_player.test_media_player
show: "[[[ return !navbar.isDesktop ]]]" # Only on mobile
desktop_position: bottom-right

Per-player show (filter which players appear)

media_player:
players:
- entity: media_player.spotify
show: "[[[ return states['media_player.spotify'].state == 'playing' ]]]"
- entity: media_player.sonos
show: "[[[ return states['media_player.sonos'].state == 'playing' ]]]"