mirror of
https://github.com/danbulant/discord.js
synced 2026-06-08 17:21:31 +00:00
voice: make sure speaking is false when paused
This commit is contained in:
parent
841b9de918
commit
685814aa61
1 changed files with 4 additions and 2 deletions
|
|
@ -118,8 +118,8 @@ class StreamDispatcher extends Writable {
|
||||||
* Pauses playback
|
* Pauses playback
|
||||||
*/
|
*/
|
||||||
pause() {
|
pause() {
|
||||||
if (!this.paused) this.pausedSince = Date.now();
|
|
||||||
this._setSpeaking(false);
|
this._setSpeaking(false);
|
||||||
|
if (!this.paused) this.pausedSince = Date.now();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -200,7 +200,9 @@ class StreamDispatcher extends Writable {
|
||||||
if (this.pausedSince) return;
|
if (this.pausedSince) return;
|
||||||
if (!this.streams.broadcast) {
|
if (!this.streams.broadcast) {
|
||||||
const next = FRAME_LENGTH + (this.count * FRAME_LENGTH) - (Date.now() - this.startTime - this.pausedTime);
|
const next = FRAME_LENGTH + (this.count * FRAME_LENGTH) - (Date.now() - this.startTime - this.pausedTime);
|
||||||
setTimeout(this._writeCallback.bind(this), next);
|
setTimeout(() => {
|
||||||
|
if (!this.pausedSince && this._writeCallback) this._writeCallback();
|
||||||
|
}, next);
|
||||||
}
|
}
|
||||||
this._sdata.sequence++;
|
this._sdata.sequence++;
|
||||||
this._sdata.timestamp += TIMESTAMP_INC;
|
this._sdata.timestamp += TIMESTAMP_INC;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue