mirror of
https://github.com/danbulant/discord.js
synced 2026-06-07 16:52:16 +00:00
Add VoiceBroadcast.pause and VoiceBroadcast.resume
This commit is contained in:
parent
ad18b05d66
commit
12605575fb
2 changed files with 15 additions and 0 deletions
|
|
@ -77,6 +77,20 @@ class VoiceBroadcast extends EventEmitter {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pause() {
|
||||||
|
for (const dispatcher of this.dispatchers) {
|
||||||
|
dispatcher.pause();
|
||||||
|
}
|
||||||
|
clearInterval(this.tickInterval);
|
||||||
|
}
|
||||||
|
|
||||||
|
resume() {
|
||||||
|
for (const dispatcher of this.dispatchers) {
|
||||||
|
dispatcher.resume();
|
||||||
|
}
|
||||||
|
this._startPlaying();
|
||||||
|
}
|
||||||
|
|
||||||
_startPlaying() {
|
_startPlaying() {
|
||||||
if (this.tickInterval) clearInterval(this.tickInterval);
|
if (this.tickInterval) clearInterval(this.tickInterval);
|
||||||
this.tickInterval = this.client.setInterval(this.tick.bind(this), 20);
|
this.tickInterval = this.client.setInterval(this.tick.bind(this), 20);
|
||||||
|
|
|
||||||
|
|
@ -183,6 +183,7 @@ class StreamDispatcher extends EventEmitter {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.paused) {
|
if (this.paused) {
|
||||||
|
this.setSpeaking(false);
|
||||||
// data.timestamp = data.timestamp + 4294967295 ? data.timestamp + 960 : 0;
|
// data.timestamp = data.timestamp + 4294967295 ? data.timestamp + 960 : 0;
|
||||||
data.pausedTime += data.length * 10;
|
data.pausedTime += data.length * 10;
|
||||||
// if buffer is provided we are assuming a master process is controlling the dispatcher
|
// if buffer is provided we are assuming a master process is controlling the dispatcher
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue