Add fix to more-info for media players without play/pause state (#7608)

Co-authored-by: Bram Kragten <mail@bramkragten.nl>
This commit is contained in:
kg333 2020-11-10 12:00:44 -05:00 committed by GitHub
parent 21a3dcf06c
commit 2e289cd152
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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",
});
}