🐛 Fix createProgressBar progress time
This commit is contained in:
parent
a3ce8c66f6
commit
1215364e51
1 changed files with 5 additions and 5 deletions
|
@ -750,7 +750,7 @@ class Player {
|
||||||
const queue = this.queues.find((g) => g.guildID === guildID)
|
const queue = this.queues.find((g) => g.guildID === guildID)
|
||||||
if (!queue) return
|
if (!queue) return
|
||||||
// Stream time of the dispatcher
|
// Stream time of the dispatcher
|
||||||
const currentStreamTime = queue.calculatedStreamTime
|
const currentStreamTime = queue.voiceConnection.dispatcher.streamTime + queue.additionalStreamTime
|
||||||
// Total stream time
|
// Total stream time
|
||||||
const totalTime = queue.playing.durationMS
|
const totalTime = queue.playing.durationMS
|
||||||
// Stream progress
|
// Stream progress
|
||||||
|
@ -800,7 +800,7 @@ class Player {
|
||||||
*/
|
*/
|
||||||
_playYTDLStream (queue, updateFilter) {
|
_playYTDLStream (queue, updateFilter) {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
const currentStreamTime = updateFilter ? queue.voiceConnection.dispatcher.streamTime / 1000 : undefined
|
const seekTime = updateFilter ? queue.voiceConnection.dispatcher.streamTime + queue.additionalStreamTime : undefined
|
||||||
const encoderArgsFilters = []
|
const encoderArgsFilters = []
|
||||||
Object.keys(queue.filters).forEach((filterName) => {
|
Object.keys(queue.filters).forEach((filterName) => {
|
||||||
if (queue.filters[filterName]) {
|
if (queue.filters[filterName]) {
|
||||||
|
@ -817,7 +817,7 @@ class Player {
|
||||||
filter: 'audioonly',
|
filter: 'audioonly',
|
||||||
opusEncoded: true,
|
opusEncoded: true,
|
||||||
encoderArgs,
|
encoderArgs,
|
||||||
seek: currentStreamTime + queue.additionalStreamTime
|
seek: seekTime / 1000
|
||||||
})
|
})
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (queue.stream) queue.stream.destroy()
|
if (queue.stream) queue.stream.destroy()
|
||||||
|
@ -826,8 +826,8 @@ class Player {
|
||||||
type: 'opus',
|
type: 'opus',
|
||||||
bitrate: 'auto'
|
bitrate: 'auto'
|
||||||
})
|
})
|
||||||
if (currentStreamTime) {
|
if (seekTime) {
|
||||||
queue.additionalStreamTime += currentStreamTime
|
queue.additionalStreamTime = seekTime
|
||||||
}
|
}
|
||||||
queue.voiceConnection.dispatcher.setVolumeLogarithmic(queue.calculatedVolume / 200)
|
queue.voiceConnection.dispatcher.setVolumeLogarithmic(queue.calculatedVolume / 200)
|
||||||
// When the track starts
|
// When the track starts
|
||||||
|
|
Loading…
Reference in a new issue