From 00f77fbd670668ec168b6814f478ec577b61774c Mon Sep 17 00:00:00 2001 From: Androz2091 Date: Fri, 22 Jan 2021 09:04:33 +0100 Subject: [PATCH] :sparkles: Add queue stream time --- src/Player.js | 4 +--- src/Queue.js | 6 ++++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Player.js b/src/Player.js index 2db6fa3..de5d3ba 100644 --- a/src/Player.js +++ b/src/Player.js @@ -668,9 +668,7 @@ class Player extends EventEmitter { if (!queue) return const timecodes = options && typeof options === 'object' ? options.timecodes : false // Stream time of the dispatcher - const currentStreamTime = queue.voiceConnection.dispatcher - ? queue.voiceConnection.dispatcher.streamTime + queue.additionalStreamTime - : 0 + const currentStreamTime = queue.currentStreamTime // Total stream time const totalTime = queue.playing.durationMS // Stream progress diff --git a/src/Queue.js b/src/Queue.js index de83314..55a230c 100644 --- a/src/Queue.js +++ b/src/Queue.js @@ -97,6 +97,12 @@ class Queue extends EventEmitter { get calculatedVolume () { return this.filters.bassboost ? this.volume + 50 : this.volume } + + get currentStreamTime () { + return this.voiceConnection.dispatcher + ? this.voiceConnection.dispatcher.streamTime + this.additionalStreamTime + : 0 + } } module.exports = Queue