diff --git a/ChangeLog b/ChangeLog index 25935a2fb..4083014c5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,7 @@ 8. Use virtual library ID for A..Z grouping. 9. Add playall/addall entries to song lists. 10. Move sync control to manage players dialog. +11. Fix desktop volume when change players. 0.1.2 ----- diff --git a/MaterialSkin/HTML/material/html/js/toolbar.js b/MaterialSkin/HTML/material/html/js/toolbar.js index 0c0e21556..2da662e42 100644 --- a/MaterialSkin/HTML/material/html/js/toolbar.js +++ b/MaterialSkin/HTML/material/html/js/toolbar.js @@ -156,6 +156,16 @@ Vue.component('lms-toolbar', { this.songInfo=undefined; } } + + if (this.desktop && + (undefined==this.playerVolume.id || + this.$store.state.player.id!=this.playerVolume.id || + ((playerStatus.volume!=this.playerVolume.val && playerStatus.volume!=this.playerVolume.prev && + (!this.playerVolume.lastUpdate || ((new Date())-this.playerVolume.lastUpdate)>500))))) { + this.playerVolume.val = playerStatus.volume; + this.playerVolume.lastUpdate = new Date(); + this.playerVolume.id = this.$store.state.player.id; + } }.bind(this)); bus.$on('langChanged', function() { @@ -171,12 +181,9 @@ Vue.component('lms-toolbar', { }.bind(this)); if (this.desktop) { - bus.$on('playerStatus', function(playerStatus) { - if (playerStatus.volume!=this.playerVolume.val && playerStatus.volume!=this.playerVolume.prev && - (!this.playerVolume.lastUpdate || ((new Date())-this.playerVolume.lastUpdate)>500)) { - this.playerVolume.val = playerStatus.volume; - this.playerVolume.lastUpdate = new Date(); - } + bus.$on('playerChanged', function() { + // Ensure we update volume when player changes. + this.playerVolume.id = undefined; }.bind(this)); }