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

Will now play appended track automatically if end of queue was previously reached

parent 084dc8a4
No related branches found
No related tags found
No related merge requests found
......@@ -11,6 +11,7 @@ class Queue {
this.tracks = []
this.currentIndex = -1
this.currentTrack = null
this.ended = true
this.state = {
volume: cache.get('volume', 0.5)
}
......@@ -98,8 +99,8 @@ class Queue {
// we insert the track at given position
this.tracks.splice(index, 0, track)
}
if (this.currentIndex < 0) {
this.play(0)
if (this.ended) {
this.play(this.currentIndex + 1)
}
this.cache()
}
......@@ -154,6 +155,7 @@ class Queue {
}
this.currentIndex = index
this.currentTrack = this.tracks[index]
this.ended = false
let file = this.currentTrack.files[0]
if (!file) {
return this.next()
......@@ -178,6 +180,7 @@ class Queue {
this.next()
} else {
logger.default.info('We reached the end of the queue')
this.ended = true
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment