diff options
Diffstat (limited to 'backend.js')
-rw-r--r-- | backend.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/backend.js b/backend.js index 6576868..232d912 100644 --- a/backend.js +++ b/backend.js @@ -660,6 +660,12 @@ class QueuePlayer extends EventEmitter { this.emit('set loop queue at end', !!value) } + setDuration(duration) { + if (this.player.setDuration) { + setTimeout(() => this.player.setDuration(duration)) + } + } + get remainingTracks() { const index = this.queueGrouplike.items.indexOf(this.playingTrack) const length = this.queueGrouplike.items.length @@ -776,6 +782,13 @@ export default class Backend extends EventEmitter { }) } + queuePlayer.on('playing', track => { + if (track) { + const metadata = this.getMetadataFor(track) + queuePlayer.setDuration(metadata.duration) + } + }) + return queuePlayer } |