Commit 2358a551 authored by Agate's avatar Agate 💬

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

parent 084dc8a4
......@@ -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
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment