File tree Expand file tree Collapse file tree 6 files changed +19
-6
lines changed
Expand file tree Collapse file tree 6 files changed +19
-6
lines changed Original file line number Diff line number Diff line change @@ -210,6 +210,7 @@ showChannelInPlayer: true # default is false. Will show the channel (if availabl
210210hidePlaylistInPlayer : true # default is false. Will hide the playlist name in the player section.
211211stopInsteadOfPause : true # default is false. Will show the stop button instead of the pause button when media is playing.
212212storePlayerInSessionStorage : true # default is false. If set to true, the active player will be stored in the session storage instead of URL hash.
213+ doNotRememberSelectedPlayer : true # default is false. If set to true, the selected player will not be remembered in URL hash or session storage.
213214
214215# media browser specific
215216favoritesItemsPerRow : 1 # default is 4. Use this to show items as list.
@@ -344,6 +345,8 @@ You can change this behavior to use the browser's session storage by setting `st
344345
345346If `entityId` is configured for the card, both the URL hash and session storage will be ignored on initial load. See more in the Usage section above.
346347
348+ If you never want to remember the selected player, you can set `doNotRememberSelectedPlayer : true` to an empty string.
349+
347350# # Sort order of entities
348351
349352If you want to have a custom sorting for your entities in the groups section you can use the `entities` configuration.
Original file line number Diff line number Diff line change @@ -124,7 +124,7 @@ export class Card extends LitElement {
124124 }
125125 window . addEventListener ( CALL_MEDIA_STARTED , this . callMediaStartedListener ) ;
126126 window . addEventListener ( CALL_MEDIA_DONE , this . callMediaDoneListener ) ;
127- if ( ! this . config . storePlayerInSessionStorage ) {
127+ if ( ! this . config . storePlayerInSessionStorage && ! this . config . doNotRememberSelectedPlayer ) {
128128 window . addEventListener ( 'hashchange' , this . hashChangeListener ) ;
129129 }
130130 }
Original file line number Diff line number Diff line change @@ -73,11 +73,13 @@ class Group extends LitElement {
7373 private handleGroupClicked ( ) {
7474 if ( ! this . selected ) {
7575 this . selected = true ;
76- if ( this . store . config . storePlayerInSessionStorage ) {
77- window . sessionStorage . setItem ( SESSION_STORAGE_PLAYER_ID , this . player . id ) ;
78- } else {
79- const newUrl = window . location . href . replace ( / # .* / g, '' ) ;
80- window . location . replace ( `${ newUrl } #${ this . player . id } ` ) ;
76+ if ( ! this . store . config . doNotRememberSelectedPlayer ) {
77+ if ( this . store . config . storePlayerInSessionStorage ) {
78+ window . sessionStorage . setItem ( SESSION_STORAGE_PLAYER_ID , this . player . id ) ;
79+ } else {
80+ const newUrl = window . location . href . replace ( / # .* / g, '' ) ;
81+ window . location . replace ( `${ newUrl } #${ this . player . id } ` ) ;
82+ }
8183 }
8284 this . dispatchEntityIdEvent ( ) ;
8385 }
Original file line number Diff line number Diff line change @@ -169,6 +169,10 @@ export const ADVANCED_SCHEMA = [
169169 name : 'storePlayerInSessionStorage' ,
170170 selector : { boolean : { } } ,
171171 } ,
172+ {
173+ name : 'doNotRememberSelectedPlayer' ,
174+ selector : { boolean : { } } ,
175+ } ,
172176] ;
173177
174178class AdvancedEditor extends BaseEditor {
Original file line number Diff line number Diff line change @@ -182,6 +182,9 @@ export default class Store {
182182 }
183183
184184 private getActivePlayer ( ) {
185+ if ( this . config . doNotRememberSelectedPlayer ) {
186+ return '' ;
187+ }
185188 if ( this . config . storePlayerInSessionStorage ) {
186189 return this . getActivePlayerFromStorage ( ) ;
187190 }
Original file line number Diff line number Diff line change @@ -103,6 +103,7 @@ export interface CardConfig extends LovelaceCardConfig {
103103 inverseGroupMuteState ?: boolean ;
104104 storePlayerInSessionStorage ?: boolean ;
105105 sortFavoritesByType ?: boolean ;
106+ doNotRememberSelectedPlayer ?: boolean ;
106107}
107108
108109export interface MediaArtworkOverride {
You can’t perform that action at this time.
0 commit comments