Skip to content

Commit

Permalink
Fix jumpy track position when playing & volume adjusted
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicholas Villarreal committed Jan 23, 2019
1 parent e9ca847 commit 7cc774d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
12 changes: 7 additions & 5 deletions client/src/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,11 @@ export default new Vuex.Store({
},
},
actions: {
updateZoneGroup({ commit, dispatch }, data) {
updateZoneGroup({ commit, getters, dispatch }, data) {
const group = getters.activeZoneGroup;
const previousPlayState = group.state;
commit('UPDATE_ZONE_GROUP', data);
dispatch('updateTrackTimer');
dispatch('updateTrackTimer', { previousPlayState });
},
setActiveZoneGroup({ commit, dispatch }, groupId) {
localStorage.setItem('activeZoneGroupId', groupId);
Expand Down Expand Up @@ -170,12 +172,12 @@ export default new Vuex.Store({
}
commit('SET_DOCUMENT_TITLE_FOR_ACTIVE_GROUP', documentTitle);
},
updateTrackTimer({ dispatch, getters, commit }) {
updateTrackTimer({ dispatch, getters, commit }, data) {
const group = getters.activeZoneGroup;
if (group) {
if (group.state === PlayState.playing) {
if (group.state === PlayState.playing && data.previousPlayState !== PlayState.playing) {
dispatch('startTrackTimer');
} else {
} else if (group.state !== PlayState.playing) {
commit('CLEAR_TRACK_TIMER');
}
}
Expand Down
3 changes: 3 additions & 0 deletions server/src/sonos/SonosNetwork.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ class SonosNetwork {
if (zoneGroup) {
// eslint-disable-next-line max-len
const updatedZone = this._updateZoneGroupRenderingInfo(zoneGroup.id, device.id, renderingInfo);
// We don't want to send this field, because it can cause a
// jumpy track position when adjust volume
delete updatedZone.track;
if (updatedZone) {
this.socketio.emit(
SonosEventDataReceived,
Expand Down

0 comments on commit 7cc774d

Please sign in to comment.