Skip to content

Commit

Permalink
Fix desktop volume when change players.
Browse files Browse the repository at this point in the history
  • Loading branch information
CDrummond committed Nov 25, 2018
1 parent 4152887 commit 610a2e0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -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
-----
Expand Down
19 changes: 13 additions & 6 deletions MaterialSkin/HTML/material/html/js/toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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));
}

Expand Down

0 comments on commit 610a2e0

Please sign in to comment.