From 2e289cd1524660f93a98fd8f1bd19f82548e6c81 Mon Sep 17 00:00:00 2001 From: kg333 Date: Tue, 10 Nov 2020 12:00:44 -0500 Subject: [PATCH] Add fix to more-info for media players without play/pause state (#7608) Co-authored-by: Bram Kragten --- .../more-info/controls/more-info-media_player.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/dialogs/more-info/controls/more-info-media_player.ts b/src/dialogs/more-info/controls/more-info-media_player.ts index 1e47d7f943..de427df88d 100644 --- a/src/dialogs/more-info/controls/more-info-media_player.ts +++ b/src/dialogs/more-info/controls/more-info-media_player.ts @@ -309,16 +309,21 @@ class MoreInfoMediaPlayer extends LitElement { (state === "playing" && (supportsFeature(stateObj, SUPPORT_PAUSE) || supportsFeature(stateObj, SUPPORT_STOP))) || - (state === "paused" && supportsFeature(stateObj, SUPPORTS_PLAY)) + (state === "paused" && supportsFeature(stateObj, SUPPORTS_PLAY)) || + (state === "on" && + supportsFeature(stateObj, SUPPORTS_PLAY) || + supportsFeature(stateObj, SUPPORT_PAUSE)) ) { buttons.push({ icon: - state !== "playing" + state === "on" + ? "hass:play-pause" + : state !== "playing" ? "hass:play" : supportsFeature(stateObj, SUPPORT_PAUSE) ? "hass:pause" : "hass:stop", - action: "media_play_pause", + action: state === "playing" && !supportsFeature(stateObj, SUPPORT_PAUSE) ? "media_stop" : "media_play_pause", }); }