Skip to content

Commit

Permalink
fix: volume and mute not changing for single player setup
Browse files Browse the repository at this point in the history
  • Loading branch information
punxaphil committed Apr 16, 2024
1 parent eb1e6ad commit 3664fcc
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/model/media-player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,15 @@ export class MediaPlayer {
}

private createGroupMembers(mainHassEntity: HassEntity, mediaPlayerHassEntities: HassEntity[]): MediaPlayer[] {
return getGroupPlayerIds(mainHassEntity).reduce((players: MediaPlayer[], id) => {
const hassEntity = mediaPlayerHassEntities.find((hassEntity) => hassEntity.entity_id === id);
return hassEntity ? [...players, new MediaPlayer(hassEntity, this.config)] : players;
}, []);
const players: MediaPlayer[] = [];
for (const groupPlayerId of getGroupPlayerIds(mainHassEntity)) {
for (const mediaPlayerHassEntity of mediaPlayerHassEntities) {
if (mediaPlayerHassEntity.entity_id === groupPlayerId) {
players.push(new MediaPlayer(mediaPlayerHassEntity, this.config));
}
}
}
return players ?? [this];
}

private determineVolumePlayer() {
Expand Down

0 comments on commit 3664fcc

Please sign in to comment.