Skip to content
Snippets Groups Projects
Commit f6582876 authored by Eliot Berriot's avatar Eliot Berriot
Browse files

Merge branch 'reset-queue-same-track' into 'develop'

Fixed position not being reseted properly when playing the same track multiple times in a row

See merge request funkwhale/funkwhale!90
parents cec0dcfc 59445b61
No related branches found
No related tags found
No related merge requests found
Fixed position not being reseted properly when playing the same track multiple times in a row
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<div class="player"> <div class="player">
<audio-track <audio-track
ref="currentAudio" ref="currentAudio"
v-if="currentTrack" v-if="renderAudio && currentTrack"
:key="(currentIndex, currentTrack.id)" :key="(currentIndex, currentTrack.id)"
:is-current="true" :is-current="true"
:start-time="$store.state.player.currentTime" :start-time="$store.state.player.currentTime"
...@@ -151,6 +151,7 @@ export default { ...@@ -151,6 +151,7 @@ export default {
data () { data () {
let defaultAmbiantColors = [[46, 46, 46], [46, 46, 46], [46, 46, 46], [46, 46, 46]] let defaultAmbiantColors = [[46, 46, 46], [46, 46, 46], [46, 46, 46], [46, 46, 46]]
return { return {
renderAudio: true,
sliderVolume: this.volume, sliderVolume: this.volume,
Track: Track, Track: Track,
defaultAmbiantColors: defaultAmbiantColors, defaultAmbiantColors: defaultAmbiantColors,
...@@ -163,7 +164,6 @@ export default { ...@@ -163,7 +164,6 @@ export default {
}, },
methods: { methods: {
...mapActions({ ...mapActions({
pause: 'player/pause',
togglePlay: 'player/togglePlay', togglePlay: 'player/togglePlay',
clean: 'queue/clean', clean: 'queue/clean',
next: 'queue/next', next: 'queue/next',
...@@ -230,6 +230,17 @@ export default { ...@@ -230,6 +230,17 @@ export default {
this.ambiantColors = this.defaultAmbiantColors this.ambiantColors = this.defaultAmbiantColors
} }
}, },
currentIndex (newValue, oldValue) {
if (newValue !== oldValue) {
// why this? to ensure the audio tag is deleted and fully
// rerendered, so we don't have any issues with cached position
// or whatever
this.renderAudio = false
this.$nextTick(() => {
this.renderAudio = true
})
}
},
volume (newValue) { volume (newValue) {
this.sliderVolume = newValue this.sliderVolume = newValue
}, },
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment