From 74e299d1dbb2478fce66d2f2cb54febb939610a6 Mon Sep 17 00:00:00 2001 From: Androz2091 Date: Sat, 20 Feb 2021 15:32:04 +0100 Subject: [PATCH] :bug: Fix create progress bar with queue Closes #285 --- src/Player.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Player.js b/src/Player.js index 87530b6..20bc6c5 100644 --- a/src/Player.js +++ b/src/Player.js @@ -982,11 +982,11 @@ class Player extends EventEmitter { if (!queue) return const timecodes = options && typeof options === 'object' ? options.timecodes : false // Stream time of the dispatcher - const previousTracksTime = queue.previousTracks.length > 0 ? queue.previousTracks.map((t) => t.durationMS) : 0 + const previousTracksTime = queue.previousTracks.length > 0 ? queue.previousTracks.map((t) => t.durationMS).reduce((p, c) => p + c) : 0 const currentStreamTime = options && options.queue ? previousTracksTime + queue.currentStreamTime : queue.currentStreamTime // Total stream time const totalTracksTime = queue.tracks.length > 0 ? queue.tracks.map((t) => t.durationMS).reduce((p, c) => p + c) : 0 - const totalTime = options && options.queue ? totalTracksTime : queue.playing.durationMS + const totalTime = options && options.queue ? previousTracksTime + totalTracksTime : queue.playing.durationMS // Stream progress const index = Math.round((currentStreamTime / totalTime) * 15) // conditions