Skip to content

Commit

Permalink
Show +/- volume buttons for media players which support VOLUME_SET (#…
Browse files Browse the repository at this point in the history
…19111)

* Show +/- volume buttons for media players which support VOLUME_SET

* Fixup
  • Loading branch information
emontnemery authored Dec 27, 2023
1 parent f5d13c9 commit d7826e4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/data/media-player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export const enum MediaPlayerEntityFeature {
TURN_ON = 128,
TURN_OFF = 256,
PLAY_MEDIA = 512,
VOLUME_BUTTONS = 1024,
VOLUME_STEP = 1024,
SELECT_SOURCE = 2048,
STOP = 4096,
CLEAR_PLAYLIST = 8192,
Expand Down
7 changes: 4 additions & 3 deletions src/dialogs/more-info/controls/more-info-media_player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class MoreInfoMediaPlayer extends LitElement {
: ""}
</div>
${(supportsFeature(stateObj, MediaPlayerEntityFeature.VOLUME_SET) ||
supportsFeature(stateObj, MediaPlayerEntityFeature.VOLUME_BUTTONS)) &&
supportsFeature(stateObj, MediaPlayerEntityFeature.VOLUME_STEP)) &&
stateActive(stateObj)
? html`
<div class="volume">
Expand All @@ -104,8 +104,9 @@ class MoreInfoMediaPlayer extends LitElement {
: ""}
${supportsFeature(
stateObj,
MediaPlayerEntityFeature.VOLUME_BUTTONS
)
MediaPlayerEntityFeature.VOLUME_SET
) ||
supportsFeature(stateObj, MediaPlayerEntityFeature.VOLUME_STEP)
? html`
<ha-icon-button
action="volume_down"
Expand Down
11 changes: 4 additions & 7 deletions src/panels/lovelace/entity-rows/hui-media-player-entity-row.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,7 @@ class HuiMediaPlayerEntityRow extends LitElement implements LovelaceRow {
></ha-icon-button>
`
: !supportsFeature(stateObj, MediaPlayerEntityFeature.VOLUME_SET) &&
!supportsFeature(
stateObj,
MediaPlayerEntityFeature.VOLUME_BUTTONS
)
!supportsFeature(stateObj, MediaPlayerEntityFeature.VOLUME_STEP)
? buttons
: ""}
${supportsFeature(stateObj, MediaPlayerEntityFeature.TURN_OFF) &&
Expand All @@ -226,8 +223,8 @@ class HuiMediaPlayerEntityRow extends LitElement implements LovelaceRow {
: ""}
</div>
</hui-generic-entity-row>
${(supportsFeature(stateObj, MediaPlayerEntityFeature.VOLUME_SET) ||
supportsFeature(stateObj, MediaPlayerEntityFeature.VOLUME_BUTTONS)) &&
${(supportsFeature(stateObj, MediaPlayerEntityFeature.VOLUME_STEP) ||
supportsFeature(stateObj, MediaPlayerEntityFeature.VOLUME_SET)) &&
stateActive(stateObj)
? html`
<div class="flex">
Expand Down Expand Up @@ -266,7 +263,7 @@ class HuiMediaPlayerEntityRow extends LitElement implements LovelaceRow {
: !this._veryNarrow &&
supportsFeature(
stateObj,
MediaPlayerEntityFeature.VOLUME_BUTTONS
MediaPlayerEntityFeature.VOLUME_STEP
)
? html`
<ha-icon-button
Expand Down

0 comments on commit d7826e4

Please sign in to comment.