Merge branch '970-toggle-play' into 'develop'

Resolve "Player toggles play when tracks navigated in a pause state"

Closes #970

See merge request funkwhale/funkwhale!981
This commit is contained in:
Eliot Berriot 2019-12-27 10:29:05 +01:00
commit 9b23fb70fe
4 changed files with 7 additions and 12 deletions

View File

@ -0,0 +1 @@
Fixed short audio glitch when switching switching to another track with player paused (#970)

View File

@ -361,7 +361,7 @@ export default {
self.ended() self.ended()
}, },
onunlock: function () { onunlock: function () {
if (self.$store.state.player.playing) { if (self.$store.state.player.playing && self.sound) {
self.soundId = self.sound.play(self.soundId) self.soundId = self.sound.play(self.soundId)
} }
}, },
@ -581,14 +581,12 @@ export default {
} }
this.currentSound = this.getSound(trackData) this.currentSound = this.getSound(trackData)
this.$store.commit('player/isLoadingAudio', true) this.$store.commit('player/isLoadingAudio', true)
if (this.playing) {
this.soundId = this.currentSound.play() this.soundId = this.currentSound.play()
this.$store.commit('player/errored', false) this.$store.commit('player/errored', false)
this.$store.commit('player/playing', true) this.$store.commit('player/playing', true)
this.$store.dispatch('player/updateProgress', 0) this.$store.dispatch('player/updateProgress', 0)
this.observeProgress(true) this.observeProgress(true)
} }
}
}, },
toggleMobilePlayer () { toggleMobilePlayer () {
if (['queue', 'player'].indexOf(this.$store.state.ui.queueFocused) > -1) { if (['queue', 'player'].indexOf(this.$store.state.ui.queueFocused) > -1) {

View File

@ -140,7 +140,6 @@ export default {
currentIndex ({commit, state, rootState, dispatch}, index) { currentIndex ({commit, state, rootState, dispatch}, index) {
commit('ended', false) commit('ended', false)
commit('player/currentTime', 0, {root: true}) commit('player/currentTime', 0, {root: true})
commit('player/playing', true, {root: true})
commit('currentIndex', index) commit('currentIndex', index)
if (state.tracks.length - index <= 2 && rootState.radios.running) { if (state.tracks.length - index <= 2 && rootState.radios.running) {
dispatch('radios/populateQueue', null, {root: true}) dispatch('radios/populateQueue', null, {root: true})

View File

@ -226,7 +226,6 @@ describe('store/queue', () => {
expectedMutations: [ expectedMutations: [
{ type: 'ended', payload: false }, { type: 'ended', payload: false },
{ type: 'player/currentTime', payload: 0, options: {root: true} }, { type: 'player/currentTime', payload: 0, options: {root: true} },
{ type: 'player/playing', payload: true, options: {root: true} },
{ type: 'currentIndex', payload: 1 } { type: 'currentIndex', payload: 1 }
] ]
}) })
@ -239,7 +238,6 @@ describe('store/queue', () => {
expectedMutations: [ expectedMutations: [
{ type: 'ended', payload: false }, { type: 'ended', payload: false },
{ type: 'player/currentTime', payload: 0, options: {root: true} }, { type: 'player/currentTime', payload: 0, options: {root: true} },
{ type: 'player/playing', payload: true, options: {root: true} },
{ type: 'currentIndex', payload: 1 } { type: 'currentIndex', payload: 1 }
] ]
}) })
@ -252,7 +250,6 @@ describe('store/queue', () => {
expectedMutations: [ expectedMutations: [
{ type: 'ended', payload: false }, { type: 'ended', payload: false },
{ type: 'player/currentTime', payload: 0, options: {root: true} }, { type: 'player/currentTime', payload: 0, options: {root: true} },
{ type: 'player/playing', payload: true, options: {root: true} },
{ type: 'currentIndex', payload: 1 } { type: 'currentIndex', payload: 1 }
], ],
expectedActions: [ expectedActions: [