@@ -19,6 +19,7 @@ import { MediaPlayer } from '../model/media-player';
1919import { until } from 'lit-html/directives/until.js' ;
2020import { findPlayer } from '../utils/utils' ;
2121import MediaBrowseService from '../services/media-browse-service' ;
22+ import { when } from 'lit/directives/when.js' ;
2223
2324class PlayerControls extends LitElement {
2425 @property ( { attribute : false } ) store ! : Store ;
@@ -48,31 +49,34 @@ class PlayerControls extends LitElement {
4849 const playing = this . activePlayer . isPlaying ( ) ;
4950 return html `
5051 <div class= "main" id = "mediaControls" >
51- <div class= "icons" >
52- <div class= "flex-1" > </ div>
53- <ha- icon- butto n hide= ${ noUpDown } @click = ${ this . volDown } .path = ${ mdiVolumeMinus } > </ ha- icon- butto n>
54- <sonos- shuffle hide= ${ noShuffle } .store = ${ this . store } > </ sonos- shuffle>
55- <ha- icon- butto n hide= ${ noPrev } @click = ${ this . prev } .path = ${ mdiSkipPrevious } > </ ha- icon- butto n>
56- <ha- icon- butto n hide= ${ noFastForwardAndRewind } @click = ${ this . rewind } .path = ${ mdiRewind } > </ ha- icon- butto n>
57- <ha- icon- butto n @click = ${ playing ? this . pauseOrStop : this . play } . path = ${ playing ? pauseOrStop : mdiPlayCircle } class = "big-icon" > < / ha - icon - but to n >
58- <ha - icon - but to n hide = ${ noFastForwardAndRewind } @click = ${ this . fastForward } .path = ${ mdiFastForward } > </ ha- icon- butto n>
59- <ha- icon- butto n hide= ${ noNext } @click = ${ this . next } . path = ${ mdiSkipNext } > < / ha - icon - but to n >
60- <sonos - repeat hide = ${ noRepeat } . store = ${ this . store } > </ sonos - repeat >
61-
62- <ha - icon - but to n hide= ${ noUpDown } @click = ${ this . volUp } . path = ${ mdiVolumePlus } > </ ha - icon - but to n >
63- <div class = "audio-input-format" >
64- ${ this . config . showAudioInputFormat && until ( this . getAudioInputFormat ( ) ) }
65- < / div>
66- <ha - icon - but to n hide = ${ noBrowse } @click = ${ this . browseMedia } . path = ${ mdiPlayBoxMultiple } > < / ha - icon - but to n >
52+ <div class= "icons" >
53+ <div class= "flex-1" > </ div>
54+ <ha- icon- butto n hide= ${ noUpDown } @click = ${ this . volDown } .path = ${ mdiVolumeMinus } > </ ha- icon- butto n>
55+ <sonos- shuffle hide= ${ noShuffle } .store = ${ this . store } > </ sonos- shuffle>
56+ <ha- icon- butto n hide= ${ noPrev } @click = ${ this . prev } .path = ${ mdiSkipPrevious } > </ ha- icon- butto n>
57+ <ha- icon- butto n hide= ${ noFastForwardAndRewind } @click = ${ this . rewind } .path = ${ mdiRewind } > </ ha- icon- butto n>
58+ <ha- icon- butto n @click = ${ playing ? this . pauseOrStop : this . play }
59+ .path = ${ playing ? pauseOrStop : mdiPlayCircle } class = "big-icon" > </ ha- icon- butto n>
60+ <ha- icon- butto n hide= ${ noFastForwardAndRewind } @click = ${ this . fastForward }
61+ . path = ${ mdiFastForward } > </ ha - icon - but to n >
62+ <ha - icon - but to n hide = ${ noNext } @click = ${ this . next } . path = ${ mdiSkipNext } > < / ha - icon - but to n >
63+ <sonos - repeat hide= ${ noRepeat } . store = ${ this . store } > </ sonos - repeat >
64+
65+ <ha - icon - but to n hide = ${ noUpDown } @click = ${ this . volUp } . path = ${ mdiVolumePlus } > < / ha - icon - but to n >
66+ < div class = "audio-input-format" >
67+ ${ when ( this . config . showAudioInputFormat , ( ) => until ( this . getAudioInputFormat ( ) ) ) }
6768 </ div>
68- <sonos- volume .store = ${ this . store } .player = ${ this . volumePlayer }
69- .updateMembers = ${ this . updateMemberVolumes } > </ sonos- volume>
70- <div class= "icons" >
71- <ha- icon- butto n hide= ${ this . store . hidePower ( true ) } @click = ${ this . togglePower } > </ ha- icon- butto n>
72- </ div">
69+ <ha- icon- butto n hide= ${ noBrowse } @click = ${ this . browseMedia } .path = ${ mdiPlayBoxMultiple } > </ ha- icon- butto n>
70+ </ div>
71+ <sonos- volume .store = ${ this . store } .player = ${ this . volumePlayer }
72+ .updateMembers = ${ this . updateMemberVolumes } > </ sonos- volume>
73+ <div class= "icons" >
74+ <ha- icon- butto n hide= ${ this . store . hidePower ( true ) } @click = ${ this . togglePower } > </ ha- icon- butto n>
75+ </ div">
7376 </div>
74- ` ;
77+ ` ;
7578 }
79+
7680 private prev = async ( ) => await this . mediaControlService . prev ( this . activePlayer ) ;
7781 private play = async ( ) => await this . mediaControlService . play ( this . activePlayer ) ;
7882 private pauseOrStop = async ( ) => {
@@ -139,19 +143,12 @@ class PlayerControls extends LitElement {
139143 flex: 1 0 0;
140144 margin-bottom: 10px;
141145 text-align: center;
142- align-self: stretch;
143- position: relative;
146+ align-self: end;
144147 }
145148 .audio-input-format > div {
146149 color: var(--card-background-color);
147150 background: var(--disabled-text-color);
148- text-overflow: ellipsis;
149- overflow: hidden;
150151 white-space: nowrap;
151- position: absolute;
152- bottom: 0;
153- right: 0;
154- max-width: 100%;
155152 font-size: smaller;
156153 line-height: normal;
157154 padding: 3px;
0 commit comments