mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 12:03:31 +01:00
voice: make sure speaking is false when paused
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user