Skip to content

Commit

Permalink
✨ Add queue stream time
Browse files Browse the repository at this point in the history
  • Loading branch information
Androz2091 committed Jan 22, 2021
1 parent 3374835 commit 00f77fb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 1 addition & 3 deletions src/Player.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions src/Queue.js
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 00f77fb

Please sign in to comment.